From 750d6b65d6fb4feb80af06ba53f38cf892ba7d08 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 30 Jul 2024 11:27:53 -0300 Subject: [PATCH] show equipo on mobile --- docs/index.js | 4 ++-- docs/index.js.map | 4 ++-- src/Routing.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/index.js b/docs/index.js index afac89f..637ac1b 100644 --- a/docs/index.js +++ b/docs/index.js @@ -37616,7 +37616,7 @@ function AppFrame({ children: children2 }) { src: "assets/icons/isotipo.png", alt: "Your Company" } - )), /* @__PURE__ */ h("div", { class: "hidden md:block" }, /* @__PURE__ */ h("div", { class: "ml-10 flex items-baseline space-x-4" }, /* @__PURE__ */ h( + )), /* @__PURE__ */ h("div", { class: "md:block" }, /* @__PURE__ */ h("div", { class: "ml-10 flex items-baseline space-x-4" }, /* @__PURE__ */ h( "a", { href: "#", @@ -37631,7 +37631,7 @@ function AppFrame({ children: children2 }) { class: "text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium" }, "Equipo" - )))), /* @__PURE__ */ h("div", { class: "hidden md:block" }, /* @__PURE__ */ h("div", { class: "ml-4 flex items-center md:ml-6" }, /* @__PURE__ */ h( + )))), /* @__PURE__ */ h("div", { class: "md:block" }, /* @__PURE__ */ h("div", { class: "ml-4 flex items-center md:ml-6" }, /* @__PURE__ */ h( "button", { type: "button", diff --git a/docs/index.js.map b/docs/index.js.map index af95d5e..6559071 100644 --- a/docs/index.js.map +++ b/docs/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../node_modules/.pnpm/big-integer@1.6.52/node_modules/big-integer/BigInteger.js", "../node_modules/.pnpm/jed@1.1.1/node_modules/jed/jed.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/util.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/options.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/create-element.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/component.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/create-context.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/constants.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/diff/children.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/diff/props.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/diff/index.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/render.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/clone-element.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/src/diff/catch-error.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/hooks/src/index.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/util.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/PureComponent.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/memo.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/forwardRef.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/Children.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/suspense.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/suspense-list.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/portals.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/render.js", "../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/src/index.js", "../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js", "../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/nacl-fast.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/prng-browser.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/taler-error-codes.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/CancellationToken.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/amounts.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/punycode.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/whatwg-url.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/url.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/helpers.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/logging.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/codec.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-status-codes.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-impl.missing.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/time.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-common.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/libtool-version.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/operation.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-common.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-merchant.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/MerchantApiClient.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/RequestThrottler.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/ReserveTransaction.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/TaskThrottler.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/bank-api-client.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/taler-crypto.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/sha256.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/kdf.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-exchange.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/contract-terms.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/errors.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/fnutils.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/utils.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/payto.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-wallet-transactions.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-wallet.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/bank-conversion.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-corebank.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/bank-core.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/types-taler-bank-integration.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/bank-integration.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/challenger.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/exchange.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/http-client/merchant.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/i18n.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/iban.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/notifications.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/taleruri.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/timer.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/transaction-test-data.ts", "../node_modules/.pnpm/@gnu-taler+taler-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3f_4pvlut4qzkiz5o6nqpyvszyqcu/node_modules/@gnu-taler/taler-util/src/index.browser.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/hooks/useLocalStorage.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/observable.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/hooks/useLang.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/hooks/useMemoryStorage.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/hooks/useNotifications.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/hooks/useAsyncAsHook.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/base64.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/request.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/http-impl.browser.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/http-impl.sw.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/utils/route.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/api.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/translation.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/toInteger/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/requiredArgs/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/toDate/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addDays/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMonths/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/add/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMilliseconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultOptions/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/startOfWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/startOfDay/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarDays/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/compareAsc/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/constants/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isSameDay/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isDate/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isValid/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarMonths/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarYears/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInDays/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMilliseconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/roundingMethods/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInHours/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMinutes/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfDay/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfMonth/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isLastDayOfMonth/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMonths/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInSeconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInYears/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/eachDayOfInterval/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/startOfMonth/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subMilliseconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/formatters/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/longFormatters/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/protectedTokens/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultLocale/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/format/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/assign/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/formatDuration/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/formatISO/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/getHours/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/getMinutes/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/getMonth/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/getSeconds/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/getYear/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/intervalToDuration/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/Setter.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/Parser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/constants.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/utils.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/setUTCWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/setUTCDay/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/setUTCISODay/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/_lib/parsers/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parse/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isSameMonth/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subDays/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/setHours/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subMonths/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/sub/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/_lib/formatDistance/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/_lib/formatLong/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/_lib/formatRelative/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/_lib/localize/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/_lib/match/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/de/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-GB/_lib/formatLong/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-GB/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/_lib/formatDistance/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/_lib/formatLong/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/_lib/formatRelative/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/_lib/localize/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/_lib/match/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/es/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/_lib/formatDistance/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/_lib/formatLong/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/_lib/formatRelative/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/_lib/localize/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/_lib/match/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/fr/index.js", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/bank-api.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/activity.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/challenger-api.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/merchant-api.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/exchange-api.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/navigation.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/context/wallet-integration.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/utils.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Attention.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/CopyButton.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/ErrorLoading.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/LangSelector.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Loading.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Header.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Footer.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Button.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/ShowInputErrorLabel.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/NotificationBanner.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/ToastBanner.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/components/Time.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/Calendar.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/Caption.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputLine.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputArray.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/FormProvider.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/forms.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/Group.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputAbsoluteTime.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/Dialog.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/useField.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputAmount.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputChoiceHorizontal.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputChoiceStacked.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputFile.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputInteger.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputSelectMultiple.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputSelectOne.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputText.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputTextArea.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/InputToggle.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/DefaultForm.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/TimePicker.tsx", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/ui-form.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/forms/converter.ts", "../node_modules/.pnpm/@gnu-taler+web-util@git+git+++git.taler.net+wallet-core.git+#fc03476a5f129b59006e74bb1afa3fae_pwiiokuw34goucrhclyok6qneu/node_modules/@gnu-taler/web-util/src/stories.tsx", "../src/app.tsx", "../node_modules/.pnpm/swr@2.0.3_react@18.2.0/node_modules/swr/core/dist/index.mjs", "../node_modules/.pnpm/swr@2.0.3_react@18.2.0/node_modules/swr/_internal/dist/index.mjs", "../src/Routing.tsx", "../src/Home.tsx", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisect.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/count.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/cross.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/cumsum.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/variance.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/deviation.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/extent.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/fsum.js", "../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/identity.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/group.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/permute.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/sort.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/groupSort.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/threshold/sturges.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/maxIndex.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/minIndex.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/quickselect.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/greatest.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/quantile.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/threshold/freedmanDiaconis.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/threshold/scott.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/mean.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/median.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/merge.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/mode.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/pairs.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/sum.js", "../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/reverse.js", "../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js", "../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js", "../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/sourceEvent.js", "../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/pointer.js", "../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js", "../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js", "../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/math.js", "../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/lab.js", "../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/cubehelix.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hsl.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/lab.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/cubehelix.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/piecewise.js", "../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/quantize.js", "../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js", "../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js", "../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js", "../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js", "../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/brush.js", "../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js", "../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/dsv.js", "../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/csv.js", "../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/tsv.js", "../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/autoType.js", "../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/text.js", "../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/dsv.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatDecimal.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/exponent.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatGroup.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatNumerals.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatSpecifier.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTrim.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatPrefixAuto.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatRounded.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTypes.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/locale.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/defaultLocale.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionFixed.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionPrefix.js", "../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionRound.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/math.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/noop.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/stream.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/cartesian.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/compose.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/rotation.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/circle.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/buffer.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/pointEqual.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rejoin.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/polygonContains.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/index.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/antimeridian.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/circle.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/line.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rectangle.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/identity.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/area.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/bounds.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/centroid.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/context.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/measure.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/string.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/index.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/transform.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/fit.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/resample.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/index.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/conic.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/cylindricalEqualArea.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/conicEqualArea.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/albers.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/albersUsa.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/azimuthal.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/azimuthalEqualArea.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/azimuthalEquidistant.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/mercator.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/conicConformal.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/equirectangular.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/conicEquidistant.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/equalEarth.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/gnomonic.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/orthographic.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/stereographic.js", "../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/transverseMercator.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/identity.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/nice.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/log.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/symlog.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/pow.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/quantile.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/threshold.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js", "../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js", "../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js", "../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/time.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/utcTime.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/sequential.js", "../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/diverging.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/category10.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Accent.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Dark2.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/observable10.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Pastel1.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Pastel2.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Set1.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Set2.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Set3.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/ramp.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/BrBG.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/PRGn.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/PiYG.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/PuOr.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/RdBu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/RdGy.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/RdYlBu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/RdYlGn.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/diverging/Spectral.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/BuGn.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/BuPu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/GnBu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/OrRd.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/PuBuGn.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/PuBu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/PuRd.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/RdPu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/YlGnBu.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/YlGn.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/YlOrBr.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/YlOrRd.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Blues.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Greens.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Greys.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Purples.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Reds.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-single/Oranges.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/cividis.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/cubehelix.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/rainbow.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/sinebow.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/turbo.js", "../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/sequential-multi/viridis.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/math.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/area.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bump.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/asterisk.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/circle.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/cross.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/diamond.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/diamond2.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/plus.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/square.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/square2.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/star.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/triangle.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/triangle2.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/wye.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol/times.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/symbol.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/noop.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basis.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisClosed.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisOpen.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bundle.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinal.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalClosed.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalOpen.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRom.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomClosed.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomOpen.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linearClosed.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/natural.js", "../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/step.js", "../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/defined.js", "../node_modules/.pnpm/isoformat@0.2.1/node_modules/isoformat/src/format.js", "../node_modules/.pnpm/isoformat@0.2.1/node_modules/isoformat/src/parse.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/order.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/time.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/options.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/index.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/symbol.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/basic.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/group.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/channel.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/context.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/warnings.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/projection.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/schemes.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/quantitative.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/diverging.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/temporal.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales/ordinal.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/scales.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/memoize.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/format.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/style.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/dimensions.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/facet.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/mark.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/interactions/pointer.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/axes.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/legends/ramp.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/math.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marker.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/inset.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/interval.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/rule.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/template.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/text.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/vector.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/axis.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/legends/swatches.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/legends.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/frame.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/tip.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/plot.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/curve.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/bin.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/identity.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/exclusiveFacets.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/transforms/stack.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/area.js", "../node_modules/.pnpm/@observablehq+plot@0.6.14/node_modules/@observablehq/plot/src/marks/line.js", "../src/Histogram.tsx", "../src/utils.ts", "../src/codec.ts", "../src/time.ts", "../src/context/settings.ts", "../src/i18n/strings.ts", "../src/settings.ts", "../src/index.tsx"], - "sourcesContent": ["var bigInt = (function (undefined) {\r\n \"use strict\";\r\n\r\n var BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_INT = 9007199254740992,\r\n MAX_INT_ARR = smallToArray(MAX_INT),\r\n DEFAULT_ALPHABET = \"0123456789abcdefghijklmnopqrstuvwxyz\";\r\n\r\n var supportsNativeBigInt = typeof BigInt === \"function\";\r\n\r\n function Integer(v, radix, alphabet, caseSensitive) {\r\n if (typeof v === \"undefined\") return Integer[0];\r\n if (typeof radix !== \"undefined\") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);\r\n return parseValue(v);\r\n }\r\n\r\n function BigInteger(value, sign) {\r\n this.value = value;\r\n this.sign = sign;\r\n this.isSmall = false;\r\n }\r\n BigInteger.prototype = Object.create(Integer.prototype);\r\n\r\n function SmallInteger(value) {\r\n this.value = value;\r\n this.sign = value < 0;\r\n this.isSmall = true;\r\n }\r\n SmallInteger.prototype = Object.create(Integer.prototype);\r\n\r\n function NativeBigInt(value) {\r\n this.value = value;\r\n }\r\n NativeBigInt.prototype = Object.create(Integer.prototype);\r\n\r\n function isPrecise(n) {\r\n return -MAX_INT < n && n < MAX_INT;\r\n }\r\n\r\n function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes\r\n if (n < 1e7)\r\n return [n];\r\n if (n < 1e14)\r\n return [n % 1e7, Math.floor(n / 1e7)];\r\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\r\n }\r\n\r\n function arrayToSmall(arr) { // If BASE changes this function may need to change\r\n trim(arr);\r\n var length = arr.length;\r\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\r\n switch (length) {\r\n case 0: return 0;\r\n case 1: return arr[0];\r\n case 2: return arr[0] + arr[1] * BASE;\r\n default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n function trim(v) {\r\n var i = v.length;\r\n while (v[--i] === 0);\r\n v.length = i + 1;\r\n }\r\n\r\n function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger\r\n var x = new Array(length);\r\n var i = -1;\r\n while (++i < length) {\r\n x[i] = 0;\r\n }\r\n return x;\r\n }\r\n\r\n function truncate(n) {\r\n if (n > 0) return Math.floor(n);\r\n return Math.ceil(n);\r\n }\r\n\r\n function add(a, b) { // assumes a and b are arrays with a.length >= b.length\r\n var l_a = a.length,\r\n l_b = b.length,\r\n r = new Array(l_a),\r\n carry = 0,\r\n base = BASE,\r\n sum, i;\r\n for (i = 0; i < l_b; i++) {\r\n sum = a[i] + b[i] + carry;\r\n carry = sum >= base ? 1 : 0;\r\n r[i] = sum - carry * base;\r\n }\r\n while (i < l_a) {\r\n sum = a[i] + carry;\r\n carry = sum === base ? 1 : 0;\r\n r[i++] = sum - carry * base;\r\n }\r\n if (carry > 0) r.push(carry);\r\n return r;\r\n }\r\n\r\n function addAny(a, b) {\r\n if (a.length >= b.length) return add(a, b);\r\n return add(b, a);\r\n }\r\n\r\n function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT\r\n var l = a.length,\r\n r = new Array(l),\r\n base = BASE,\r\n sum, i;\r\n for (i = 0; i < l; i++) {\r\n sum = a[i] - base + carry;\r\n carry = Math.floor(sum / base);\r\n r[i] = sum - carry * base;\r\n carry += 1;\r\n }\r\n while (carry > 0) {\r\n r[i++] = carry % base;\r\n carry = Math.floor(carry / base);\r\n }\r\n return r;\r\n }\r\n\r\n BigInteger.prototype.add = function (v) {\r\n var n = parseValue(v);\r\n if (this.sign !== n.sign) {\r\n return this.subtract(n.negate());\r\n }\r\n var a = this.value, b = n.value;\r\n if (n.isSmall) {\r\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\r\n }\r\n return new BigInteger(addAny(a, b), this.sign);\r\n };\r\n BigInteger.prototype.plus = BigInteger.prototype.add;\r\n\r\n SmallInteger.prototype.add = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value;\r\n if (a < 0 !== n.sign) {\r\n return this.subtract(n.negate());\r\n }\r\n var b = n.value;\r\n if (n.isSmall) {\r\n if (isPrecise(a + b)) return new SmallInteger(a + b);\r\n b = smallToArray(Math.abs(b));\r\n }\r\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\r\n };\r\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\r\n\r\n NativeBigInt.prototype.add = function (v) {\r\n return new NativeBigInt(this.value + parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.plus = NativeBigInt.prototype.add;\r\n\r\n function subtract(a, b) { // assumes a and b are arrays with a >= b\r\n var a_l = a.length,\r\n b_l = b.length,\r\n r = new Array(a_l),\r\n borrow = 0,\r\n base = BASE,\r\n i, difference;\r\n for (i = 0; i < b_l; i++) {\r\n difference = a[i] - borrow - b[i];\r\n if (difference < 0) {\r\n difference += base;\r\n borrow = 1;\r\n } else borrow = 0;\r\n r[i] = difference;\r\n }\r\n for (i = b_l; i < a_l; i++) {\r\n difference = a[i] - borrow;\r\n if (difference < 0) difference += base;\r\n else {\r\n r[i++] = difference;\r\n break;\r\n }\r\n r[i] = difference;\r\n }\r\n for (; i < a_l; i++) {\r\n r[i] = a[i];\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n function subtractAny(a, b, sign) {\r\n var value;\r\n if (compareAbs(a, b) >= 0) {\r\n value = subtract(a, b);\r\n } else {\r\n value = subtract(b, a);\r\n sign = !sign;\r\n }\r\n value = arrayToSmall(value);\r\n if (typeof value === \"number\") {\r\n if (sign) value = -value;\r\n return new SmallInteger(value);\r\n }\r\n return new BigInteger(value, sign);\r\n }\r\n\r\n function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT\r\n var l = a.length,\r\n r = new Array(l),\r\n carry = -b,\r\n base = BASE,\r\n i, difference;\r\n for (i = 0; i < l; i++) {\r\n difference = a[i] + carry;\r\n carry = Math.floor(difference / base);\r\n difference %= base;\r\n r[i] = difference < 0 ? difference + base : difference;\r\n }\r\n r = arrayToSmall(r);\r\n if (typeof r === \"number\") {\r\n if (sign) r = -r;\r\n return new SmallInteger(r);\r\n } return new BigInteger(r, sign);\r\n }\r\n\r\n BigInteger.prototype.subtract = function (v) {\r\n var n = parseValue(v);\r\n if (this.sign !== n.sign) {\r\n return this.add(n.negate());\r\n }\r\n var a = this.value, b = n.value;\r\n if (n.isSmall)\r\n return subtractSmall(a, Math.abs(b), this.sign);\r\n return subtractAny(a, b, this.sign);\r\n };\r\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\r\n\r\n SmallInteger.prototype.subtract = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value;\r\n if (a < 0 !== n.sign) {\r\n return this.add(n.negate());\r\n }\r\n var b = n.value;\r\n if (n.isSmall) {\r\n return new SmallInteger(a - b);\r\n }\r\n return subtractSmall(b, Math.abs(a), a >= 0);\r\n };\r\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\r\n\r\n NativeBigInt.prototype.subtract = function (v) {\r\n return new NativeBigInt(this.value - parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;\r\n\r\n BigInteger.prototype.negate = function () {\r\n return new BigInteger(this.value, !this.sign);\r\n };\r\n SmallInteger.prototype.negate = function () {\r\n var sign = this.sign;\r\n var small = new SmallInteger(-this.value);\r\n small.sign = !sign;\r\n return small;\r\n };\r\n NativeBigInt.prototype.negate = function () {\r\n return new NativeBigInt(-this.value);\r\n }\r\n\r\n BigInteger.prototype.abs = function () {\r\n return new BigInteger(this.value, false);\r\n };\r\n SmallInteger.prototype.abs = function () {\r\n return new SmallInteger(Math.abs(this.value));\r\n };\r\n NativeBigInt.prototype.abs = function () {\r\n return new NativeBigInt(this.value >= 0 ? this.value : -this.value);\r\n }\r\n\r\n\r\n function multiplyLong(a, b) {\r\n var a_l = a.length,\r\n b_l = b.length,\r\n l = a_l + b_l,\r\n r = createArray(l),\r\n base = BASE,\r\n product, carry, i, a_i, b_j;\r\n for (i = 0; i < a_l; ++i) {\r\n a_i = a[i];\r\n for (var j = 0; j < b_l; ++j) {\r\n b_j = b[j];\r\n product = a_i * b_j + r[i + j];\r\n carry = Math.floor(product / base);\r\n r[i + j] = product - carry * base;\r\n r[i + j + 1] += carry;\r\n }\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE\r\n var l = a.length,\r\n r = new Array(l),\r\n base = BASE,\r\n carry = 0,\r\n product, i;\r\n for (i = 0; i < l; i++) {\r\n product = a[i] * b + carry;\r\n carry = Math.floor(product / base);\r\n r[i] = product - carry * base;\r\n }\r\n while (carry > 0) {\r\n r[i++] = carry % base;\r\n carry = Math.floor(carry / base);\r\n }\r\n return r;\r\n }\r\n\r\n function shiftLeft(x, n) {\r\n var r = [];\r\n while (n-- > 0) r.push(0);\r\n return r.concat(x);\r\n }\r\n\r\n function multiplyKaratsuba(x, y) {\r\n var n = Math.max(x.length, y.length);\r\n\r\n if (n <= 30) return multiplyLong(x, y);\r\n n = Math.ceil(n / 2);\r\n\r\n var b = x.slice(n),\r\n a = x.slice(0, n),\r\n d = y.slice(n),\r\n c = y.slice(0, n);\r\n\r\n var ac = multiplyKaratsuba(a, c),\r\n bd = multiplyKaratsuba(b, d),\r\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\r\n\r\n var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));\r\n trim(product);\r\n return product;\r\n }\r\n\r\n // The following function is derived from a surface fit of a graph plotting the performance difference\r\n // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.\r\n function useKaratsuba(l1, l2) {\r\n return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;\r\n }\r\n\r\n BigInteger.prototype.multiply = function (v) {\r\n var n = parseValue(v),\r\n a = this.value, b = n.value,\r\n sign = this.sign !== n.sign,\r\n abs;\r\n if (n.isSmall) {\r\n if (b === 0) return Integer[0];\r\n if (b === 1) return this;\r\n if (b === -1) return this.negate();\r\n abs = Math.abs(b);\r\n if (abs < BASE) {\r\n return new BigInteger(multiplySmall(a, abs), sign);\r\n }\r\n b = smallToArray(abs);\r\n }\r\n if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes\r\n return new BigInteger(multiplyKaratsuba(a, b), sign);\r\n return new BigInteger(multiplyLong(a, b), sign);\r\n };\r\n\r\n BigInteger.prototype.times = BigInteger.prototype.multiply;\r\n\r\n function multiplySmallAndArray(a, b, sign) { // a >= 0\r\n if (a < BASE) {\r\n return new BigInteger(multiplySmall(b, a), sign);\r\n }\r\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\r\n }\r\n SmallInteger.prototype._multiplyBySmall = function (a) {\r\n if (isPrecise(a.value * this.value)) {\r\n return new SmallInteger(a.value * this.value);\r\n }\r\n return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);\r\n };\r\n BigInteger.prototype._multiplyBySmall = function (a) {\r\n if (a.value === 0) return Integer[0];\r\n if (a.value === 1) return this;\r\n if (a.value === -1) return this.negate();\r\n return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);\r\n };\r\n SmallInteger.prototype.multiply = function (v) {\r\n return parseValue(v)._multiplyBySmall(this);\r\n };\r\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\r\n\r\n NativeBigInt.prototype.multiply = function (v) {\r\n return new NativeBigInt(this.value * parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;\r\n\r\n function square(a) {\r\n //console.assert(2 * BASE * BASE < MAX_INT);\r\n var l = a.length,\r\n r = createArray(l + l),\r\n base = BASE,\r\n product, carry, i, a_i, a_j;\r\n for (i = 0; i < l; i++) {\r\n a_i = a[i];\r\n carry = 0 - a_i * a_i;\r\n for (var j = i; j < l; j++) {\r\n a_j = a[j];\r\n product = 2 * (a_i * a_j) + r[i + j] + carry;\r\n carry = Math.floor(product / base);\r\n r[i + j] = product - carry * base;\r\n }\r\n r[i + l] = carry;\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n BigInteger.prototype.square = function () {\r\n return new BigInteger(square(this.value), false);\r\n };\r\n\r\n SmallInteger.prototype.square = function () {\r\n var value = this.value * this.value;\r\n if (isPrecise(value)) return new SmallInteger(value);\r\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\r\n };\r\n\r\n NativeBigInt.prototype.square = function (v) {\r\n return new NativeBigInt(this.value * this.value);\r\n }\r\n\r\n function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.\r\n var a_l = a.length,\r\n b_l = b.length,\r\n base = BASE,\r\n result = createArray(b.length),\r\n divisorMostSignificantDigit = b[b_l - 1],\r\n // normalization\r\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\r\n remainder = multiplySmall(a, lambda),\r\n divisor = multiplySmall(b, lambda),\r\n quotientDigit, shift, carry, borrow, i, l, q;\r\n if (remainder.length <= a_l) remainder.push(0);\r\n divisor.push(0);\r\n divisorMostSignificantDigit = divisor[b_l - 1];\r\n for (shift = a_l - b_l; shift >= 0; shift--) {\r\n quotientDigit = base - 1;\r\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\r\n quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);\r\n }\r\n // quotientDigit <= base - 1\r\n carry = 0;\r\n borrow = 0;\r\n l = divisor.length;\r\n for (i = 0; i < l; i++) {\r\n carry += quotientDigit * divisor[i];\r\n q = Math.floor(carry / base);\r\n borrow += remainder[shift + i] - (carry - q * base);\r\n carry = q;\r\n if (borrow < 0) {\r\n remainder[shift + i] = borrow + base;\r\n borrow = -1;\r\n } else {\r\n remainder[shift + i] = borrow;\r\n borrow = 0;\r\n }\r\n }\r\n while (borrow !== 0) {\r\n quotientDigit -= 1;\r\n carry = 0;\r\n for (i = 0; i < l; i++) {\r\n carry += remainder[shift + i] - base + divisor[i];\r\n if (carry < 0) {\r\n remainder[shift + i] = carry + base;\r\n carry = 0;\r\n } else {\r\n remainder[shift + i] = carry;\r\n carry = 1;\r\n }\r\n }\r\n borrow += carry;\r\n }\r\n result[shift] = quotientDigit;\r\n }\r\n // denormalization\r\n remainder = divModSmall(remainder, lambda)[0];\r\n return [arrayToSmall(result), arrayToSmall(remainder)];\r\n }\r\n\r\n function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/\r\n // Performs faster than divMod1 on larger input sizes.\r\n var a_l = a.length,\r\n b_l = b.length,\r\n result = [],\r\n part = [],\r\n base = BASE,\r\n guess, xlen, highx, highy, check;\r\n while (a_l) {\r\n part.unshift(a[--a_l]);\r\n trim(part);\r\n if (compareAbs(part, b) < 0) {\r\n result.push(0);\r\n continue;\r\n }\r\n xlen = part.length;\r\n highx = part[xlen - 1] * base + part[xlen - 2];\r\n highy = b[b_l - 1] * base + b[b_l - 2];\r\n if (xlen > b_l) {\r\n highx = (highx + 1) * base;\r\n }\r\n guess = Math.ceil(highx / highy);\r\n do {\r\n check = multiplySmall(b, guess);\r\n if (compareAbs(check, part) <= 0) break;\r\n guess--;\r\n } while (guess);\r\n result.push(guess);\r\n part = subtract(part, check);\r\n }\r\n result.reverse();\r\n return [arrayToSmall(result), arrayToSmall(part)];\r\n }\r\n\r\n function divModSmall(value, lambda) {\r\n var length = value.length,\r\n quotient = createArray(length),\r\n base = BASE,\r\n i, q, remainder, divisor;\r\n remainder = 0;\r\n for (i = length - 1; i >= 0; --i) {\r\n divisor = remainder * base + value[i];\r\n q = truncate(divisor / lambda);\r\n remainder = divisor - q * lambda;\r\n quotient[i] = q | 0;\r\n }\r\n return [quotient, remainder | 0];\r\n }\r\n\r\n function divModAny(self, v) {\r\n var value, n = parseValue(v);\r\n if (supportsNativeBigInt) {\r\n return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];\r\n }\r\n var a = self.value, b = n.value;\r\n var quotient;\r\n if (b === 0) throw new Error(\"Cannot divide by zero\");\r\n if (self.isSmall) {\r\n if (n.isSmall) {\r\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\r\n }\r\n return [Integer[0], self];\r\n }\r\n if (n.isSmall) {\r\n if (b === 1) return [self, Integer[0]];\r\n if (b == -1) return [self.negate(), Integer[0]];\r\n var abs = Math.abs(b);\r\n if (abs < BASE) {\r\n value = divModSmall(a, abs);\r\n quotient = arrayToSmall(value[0]);\r\n var remainder = value[1];\r\n if (self.sign) remainder = -remainder;\r\n if (typeof quotient === \"number\") {\r\n if (self.sign !== n.sign) quotient = -quotient;\r\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\r\n }\r\n return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];\r\n }\r\n b = smallToArray(abs);\r\n }\r\n var comparison = compareAbs(a, b);\r\n if (comparison === -1) return [Integer[0], self];\r\n if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\r\n\r\n // divMod1 is faster on smaller input sizes\r\n if (a.length + b.length <= 200)\r\n value = divMod1(a, b);\r\n else value = divMod2(a, b);\r\n\r\n quotient = value[0];\r\n var qSign = self.sign !== n.sign,\r\n mod = value[1],\r\n mSign = self.sign;\r\n if (typeof quotient === \"number\") {\r\n if (qSign) quotient = -quotient;\r\n quotient = new SmallInteger(quotient);\r\n } else quotient = new BigInteger(quotient, qSign);\r\n if (typeof mod === \"number\") {\r\n if (mSign) mod = -mod;\r\n mod = new SmallInteger(mod);\r\n } else mod = new BigInteger(mod, mSign);\r\n return [quotient, mod];\r\n }\r\n\r\n BigInteger.prototype.divmod = function (v) {\r\n var result = divModAny(this, v);\r\n return {\r\n quotient: result[0],\r\n remainder: result[1]\r\n };\r\n };\r\n NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\r\n\r\n\r\n BigInteger.prototype.divide = function (v) {\r\n return divModAny(this, v)[0];\r\n };\r\n NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {\r\n return new NativeBigInt(this.value / parseValue(v).value);\r\n };\r\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;\r\n\r\n BigInteger.prototype.mod = function (v) {\r\n return divModAny(this, v)[1];\r\n };\r\n NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {\r\n return new NativeBigInt(this.value % parseValue(v).value);\r\n };\r\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;\r\n\r\n BigInteger.prototype.pow = function (v) {\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value,\r\n value, x, y;\r\n if (b === 0) return Integer[1];\r\n if (a === 0) return Integer[0];\r\n if (a === 1) return Integer[1];\r\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\r\n if (n.sign) {\r\n return Integer[0];\r\n }\r\n if (!n.isSmall) throw new Error(\"The exponent \" + n.toString() + \" is too large.\");\r\n if (this.isSmall) {\r\n if (isPrecise(value = Math.pow(a, b)))\r\n return new SmallInteger(truncate(value));\r\n }\r\n x = this;\r\n y = Integer[1];\r\n while (true) {\r\n if (b & 1 === 1) {\r\n y = y.times(x);\r\n --b;\r\n }\r\n if (b === 0) break;\r\n b /= 2;\r\n x = x.square();\r\n }\r\n return y;\r\n };\r\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\r\n\r\n NativeBigInt.prototype.pow = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value, b = n.value;\r\n var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);\r\n if (b === _0) return Integer[1];\r\n if (a === _0) return Integer[0];\r\n if (a === _1) return Integer[1];\r\n if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];\r\n if (n.isNegative()) return new NativeBigInt(_0);\r\n var x = this;\r\n var y = Integer[1];\r\n while (true) {\r\n if ((b & _1) === _1) {\r\n y = y.times(x);\r\n --b;\r\n }\r\n if (b === _0) break;\r\n b /= _2;\r\n x = x.square();\r\n }\r\n return y;\r\n }\r\n\r\n BigInteger.prototype.modPow = function (exp, mod) {\r\n exp = parseValue(exp);\r\n mod = parseValue(mod);\r\n if (mod.isZero()) throw new Error(\"Cannot take modPow with modulus 0\");\r\n var r = Integer[1],\r\n base = this.mod(mod);\r\n if (exp.isNegative()) {\r\n exp = exp.multiply(Integer[-1]);\r\n base = base.modInv(mod);\r\n }\r\n while (exp.isPositive()) {\r\n if (base.isZero()) return Integer[0];\r\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\r\n exp = exp.divide(2);\r\n base = base.square().mod(mod);\r\n }\r\n return r;\r\n };\r\n NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\r\n\r\n function compareAbs(a, b) {\r\n if (a.length !== b.length) {\r\n return a.length > b.length ? 1 : -1;\r\n }\r\n for (var i = a.length - 1; i >= 0; i--) {\r\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\r\n }\r\n return 0;\r\n }\r\n\r\n BigInteger.prototype.compareAbs = function (v) {\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (n.isSmall) return 1;\r\n return compareAbs(a, b);\r\n };\r\n SmallInteger.prototype.compareAbs = function (v) {\r\n var n = parseValue(v),\r\n a = Math.abs(this.value),\r\n b = n.value;\r\n if (n.isSmall) {\r\n b = Math.abs(b);\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n return -1;\r\n };\r\n NativeBigInt.prototype.compareAbs = function (v) {\r\n var a = this.value;\r\n var b = parseValue(v).value;\r\n a = a >= 0 ? a : -a;\r\n b = b >= 0 ? b : -b;\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n\r\n BigInteger.prototype.compare = function (v) {\r\n // See discussion about comparison with Infinity:\r\n // https://github.com/peterolson/BigInteger.js/issues/61\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (this.sign !== n.sign) {\r\n return n.sign ? 1 : -1;\r\n }\r\n if (n.isSmall) {\r\n return this.sign ? -1 : 1;\r\n }\r\n return compareAbs(a, b) * (this.sign ? -1 : 1);\r\n };\r\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\r\n\r\n SmallInteger.prototype.compare = function (v) {\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (n.isSmall) {\r\n return a == b ? 0 : a > b ? 1 : -1;\r\n }\r\n if (a < 0 !== n.sign) {\r\n return a < 0 ? -1 : 1;\r\n }\r\n return a < 0 ? 1 : -1;\r\n };\r\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\r\n\r\n NativeBigInt.prototype.compare = function (v) {\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n var a = this.value;\r\n var b = parseValue(v).value;\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;\r\n\r\n BigInteger.prototype.equals = function (v) {\r\n return this.compare(v) === 0;\r\n };\r\n NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;\r\n\r\n BigInteger.prototype.notEquals = function (v) {\r\n return this.compare(v) !== 0;\r\n };\r\n NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;\r\n\r\n BigInteger.prototype.greater = function (v) {\r\n return this.compare(v) > 0;\r\n };\r\n NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;\r\n\r\n BigInteger.prototype.lesser = function (v) {\r\n return this.compare(v) < 0;\r\n };\r\n NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;\r\n\r\n BigInteger.prototype.greaterOrEquals = function (v) {\r\n return this.compare(v) >= 0;\r\n };\r\n NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;\r\n\r\n BigInteger.prototype.lesserOrEquals = function (v) {\r\n return this.compare(v) <= 0;\r\n };\r\n NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;\r\n\r\n BigInteger.prototype.isEven = function () {\r\n return (this.value[0] & 1) === 0;\r\n };\r\n SmallInteger.prototype.isEven = function () {\r\n return (this.value & 1) === 0;\r\n };\r\n NativeBigInt.prototype.isEven = function () {\r\n return (this.value & BigInt(1)) === BigInt(0);\r\n }\r\n\r\n BigInteger.prototype.isOdd = function () {\r\n return (this.value[0] & 1) === 1;\r\n };\r\n SmallInteger.prototype.isOdd = function () {\r\n return (this.value & 1) === 1;\r\n };\r\n NativeBigInt.prototype.isOdd = function () {\r\n return (this.value & BigInt(1)) === BigInt(1);\r\n }\r\n\r\n BigInteger.prototype.isPositive = function () {\r\n return !this.sign;\r\n };\r\n SmallInteger.prototype.isPositive = function () {\r\n return this.value > 0;\r\n };\r\n NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;\r\n\r\n BigInteger.prototype.isNegative = function () {\r\n return this.sign;\r\n };\r\n SmallInteger.prototype.isNegative = function () {\r\n return this.value < 0;\r\n };\r\n NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;\r\n\r\n BigInteger.prototype.isUnit = function () {\r\n return false;\r\n };\r\n SmallInteger.prototype.isUnit = function () {\r\n return Math.abs(this.value) === 1;\r\n };\r\n NativeBigInt.prototype.isUnit = function () {\r\n return this.abs().value === BigInt(1);\r\n }\r\n\r\n BigInteger.prototype.isZero = function () {\r\n return false;\r\n };\r\n SmallInteger.prototype.isZero = function () {\r\n return this.value === 0;\r\n };\r\n NativeBigInt.prototype.isZero = function () {\r\n return this.value === BigInt(0);\r\n }\r\n\r\n BigInteger.prototype.isDivisibleBy = function (v) {\r\n var n = parseValue(v);\r\n if (n.isZero()) return false;\r\n if (n.isUnit()) return true;\r\n if (n.compareAbs(2) === 0) return this.isEven();\r\n return this.mod(n).isZero();\r\n };\r\n NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\r\n\r\n function isBasicPrime(v) {\r\n var n = v.abs();\r\n if (n.isUnit()) return false;\r\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\r\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\r\n if (n.lesser(49)) return true;\r\n // we don't know if it's prime: let the other functions figure it out\r\n }\r\n\r\n function millerRabinTest(n, a) {\r\n var nPrev = n.prev(),\r\n b = nPrev,\r\n r = 0,\r\n d, t, i, x;\r\n while (b.isEven()) b = b.divide(2), r++;\r\n next: for (i = 0; i < a.length; i++) {\r\n if (n.lesser(a[i])) continue;\r\n x = bigInt(a[i]).modPow(b, n);\r\n if (x.isUnit() || x.equals(nPrev)) continue;\r\n for (d = r - 1; d != 0; d--) {\r\n x = x.square().mod(n);\r\n if (x.isUnit()) return false;\r\n if (x.equals(nPrev)) continue next;\r\n }\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n // Set \"strict\" to true to force GRH-supported lower bound of 2*log(N)^2\r\n BigInteger.prototype.isPrime = function (strict) {\r\n var isPrime = isBasicPrime(this);\r\n if (isPrime !== undefined) return isPrime;\r\n var n = this.abs();\r\n var bits = n.bitLength();\r\n if (bits <= 64)\r\n return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);\r\n var logN = Math.log(2) * bits.toJSNumber();\r\n var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);\r\n for (var a = [], i = 0; i < t; i++) {\r\n a.push(bigInt(i + 2));\r\n }\r\n return millerRabinTest(n, a);\r\n };\r\n NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\r\n\r\n BigInteger.prototype.isProbablePrime = function (iterations, rng) {\r\n var isPrime = isBasicPrime(this);\r\n if (isPrime !== undefined) return isPrime;\r\n var n = this.abs();\r\n var t = iterations === undefined ? 5 : iterations;\r\n for (var a = [], i = 0; i < t; i++) {\r\n a.push(bigInt.randBetween(2, n.minus(2), rng));\r\n }\r\n return millerRabinTest(n, a);\r\n };\r\n NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\r\n\r\n BigInteger.prototype.modInv = function (n) {\r\n var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;\r\n while (!newR.isZero()) {\r\n q = r.divide(newR);\r\n lastT = t;\r\n lastR = r;\r\n t = newT;\r\n r = newR;\r\n newT = lastT.subtract(q.multiply(newT));\r\n newR = lastR.subtract(q.multiply(newR));\r\n }\r\n if (!r.isUnit()) throw new Error(this.toString() + \" and \" + n.toString() + \" are not co-prime\");\r\n if (t.compare(0) === -1) {\r\n t = t.add(n);\r\n }\r\n if (this.isNegative()) {\r\n return t.negate();\r\n }\r\n return t;\r\n };\r\n\r\n NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\r\n\r\n BigInteger.prototype.next = function () {\r\n var value = this.value;\r\n if (this.sign) {\r\n return subtractSmall(value, 1, this.sign);\r\n }\r\n return new BigInteger(addSmall(value, 1), this.sign);\r\n };\r\n SmallInteger.prototype.next = function () {\r\n var value = this.value;\r\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\r\n return new BigInteger(MAX_INT_ARR, false);\r\n };\r\n NativeBigInt.prototype.next = function () {\r\n return new NativeBigInt(this.value + BigInt(1));\r\n }\r\n\r\n BigInteger.prototype.prev = function () {\r\n var value = this.value;\r\n if (this.sign) {\r\n return new BigInteger(addSmall(value, 1), true);\r\n }\r\n return subtractSmall(value, 1, this.sign);\r\n };\r\n SmallInteger.prototype.prev = function () {\r\n var value = this.value;\r\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\r\n return new BigInteger(MAX_INT_ARR, true);\r\n };\r\n NativeBigInt.prototype.prev = function () {\r\n return new NativeBigInt(this.value - BigInt(1));\r\n }\r\n\r\n var powersOfTwo = [1];\r\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\r\n var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];\r\n\r\n function shift_isSmall(n) {\r\n return Math.abs(n) <= BASE;\r\n }\r\n\r\n BigInteger.prototype.shiftLeft = function (v) {\r\n var n = parseValue(v).toJSNumber();\r\n if (!shift_isSmall(n)) {\r\n throw new Error(String(n) + \" is too large for shifting.\");\r\n }\r\n if (n < 0) return this.shiftRight(-n);\r\n var result = this;\r\n if (result.isZero()) return result;\r\n while (n >= powers2Length) {\r\n result = result.multiply(highestPower2);\r\n n -= powers2Length - 1;\r\n }\r\n return result.multiply(powersOfTwo[n]);\r\n };\r\n NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\r\n\r\n BigInteger.prototype.shiftRight = function (v) {\r\n var remQuo;\r\n var n = parseValue(v).toJSNumber();\r\n if (!shift_isSmall(n)) {\r\n throw new Error(String(n) + \" is too large for shifting.\");\r\n }\r\n if (n < 0) return this.shiftLeft(-n);\r\n var result = this;\r\n while (n >= powers2Length) {\r\n if (result.isZero() || (result.isNegative() && result.isUnit())) return result;\r\n remQuo = divModAny(result, highestPower2);\r\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r\n n -= powers2Length - 1;\r\n }\r\n remQuo = divModAny(result, powersOfTwo[n]);\r\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r\n };\r\n NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\r\n\r\n function bitwise(x, y, fn) {\r\n y = parseValue(y);\r\n var xSign = x.isNegative(), ySign = y.isNegative();\r\n var xRem = xSign ? x.not() : x,\r\n yRem = ySign ? y.not() : y;\r\n var xDigit = 0, yDigit = 0;\r\n var xDivMod = null, yDivMod = null;\r\n var result = [];\r\n while (!xRem.isZero() || !yRem.isZero()) {\r\n xDivMod = divModAny(xRem, highestPower2);\r\n xDigit = xDivMod[1].toJSNumber();\r\n if (xSign) {\r\n xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers\r\n }\r\n\r\n yDivMod = divModAny(yRem, highestPower2);\r\n yDigit = yDivMod[1].toJSNumber();\r\n if (ySign) {\r\n yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers\r\n }\r\n\r\n xRem = xDivMod[0];\r\n yRem = yDivMod[0];\r\n result.push(fn(xDigit, yDigit));\r\n }\r\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\r\n for (var i = result.length - 1; i >= 0; i -= 1) {\r\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\r\n }\r\n return sum;\r\n }\r\n\r\n BigInteger.prototype.not = function () {\r\n return this.negate().prev();\r\n };\r\n NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;\r\n\r\n BigInteger.prototype.and = function (n) {\r\n return bitwise(this, n, function (a, b) { return a & b; });\r\n };\r\n NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;\r\n\r\n BigInteger.prototype.or = function (n) {\r\n return bitwise(this, n, function (a, b) { return a | b; });\r\n };\r\n NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;\r\n\r\n BigInteger.prototype.xor = function (n) {\r\n return bitwise(this, n, function (a, b) { return a ^ b; });\r\n };\r\n NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;\r\n\r\n var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;\r\n function roughLOB(n) { // get lowestOneBit (rough)\r\n // SmallInteger: return Min(lowestOneBit(n), 1 << 30)\r\n // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]\r\n var v = n.value,\r\n x = typeof v === \"number\" ? v | LOBMASK_I :\r\n typeof v === \"bigint\" ? v | BigInt(LOBMASK_I) :\r\n v[0] + v[1] * BASE | LOBMASK_BI;\r\n return x & -x;\r\n }\r\n\r\n function integerLogarithm(value, base) {\r\n if (base.compareTo(value) <= 0) {\r\n var tmp = integerLogarithm(value, base.square(base));\r\n var p = tmp.p;\r\n var e = tmp.e;\r\n var t = p.multiply(base);\r\n return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };\r\n }\r\n return { p: bigInt(1), e: 0 };\r\n }\r\n\r\n BigInteger.prototype.bitLength = function () {\r\n var n = this;\r\n if (n.compareTo(bigInt(0)) < 0) {\r\n n = n.negate().subtract(bigInt(1));\r\n }\r\n if (n.compareTo(bigInt(0)) === 0) {\r\n return bigInt(0);\r\n }\r\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\r\n }\r\n NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\r\n\r\n function max(a, b) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n return a.greater(b) ? a : b;\r\n }\r\n function min(a, b) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n return a.lesser(b) ? a : b;\r\n }\r\n function gcd(a, b) {\r\n a = parseValue(a).abs();\r\n b = parseValue(b).abs();\r\n if (a.equals(b)) return a;\r\n if (a.isZero()) return b;\r\n if (b.isZero()) return a;\r\n var c = Integer[1], d, t;\r\n while (a.isEven() && b.isEven()) {\r\n d = min(roughLOB(a), roughLOB(b));\r\n a = a.divide(d);\r\n b = b.divide(d);\r\n c = c.multiply(d);\r\n }\r\n while (a.isEven()) {\r\n a = a.divide(roughLOB(a));\r\n }\r\n do {\r\n while (b.isEven()) {\r\n b = b.divide(roughLOB(b));\r\n }\r\n if (a.greater(b)) {\r\n t = b; b = a; a = t;\r\n }\r\n b = b.subtract(a);\r\n } while (!b.isZero());\r\n return c.isUnit() ? a : a.multiply(c);\r\n }\r\n function lcm(a, b) {\r\n a = parseValue(a).abs();\r\n b = parseValue(b).abs();\r\n return a.divide(gcd(a, b)).multiply(b);\r\n }\r\n function randBetween(a, b, rng) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n var usedRNG = rng || Math.random;\r\n var low = min(a, b), high = max(a, b);\r\n var range = high.subtract(low).add(1);\r\n if (range.isSmall) return low.add(Math.floor(usedRNG() * range));\r\n var digits = toBase(range, BASE).value;\r\n var result = [], restricted = true;\r\n for (var i = 0; i < digits.length; i++) {\r\n var top = restricted ? digits[i] + (i + 1 < digits.length ? digits[i + 1] / BASE : 0) : BASE;\r\n var digit = truncate(usedRNG() * top);\r\n result.push(digit);\r\n if (digit < digits[i]) restricted = false;\r\n }\r\n return low.add(Integer.fromArray(result, BASE, false));\r\n }\r\n\r\n var parseBase = function (text, base, alphabet, caseSensitive) {\r\n alphabet = alphabet || DEFAULT_ALPHABET;\r\n text = String(text);\r\n if (!caseSensitive) {\r\n text = text.toLowerCase();\r\n alphabet = alphabet.toLowerCase();\r\n }\r\n var length = text.length;\r\n var i;\r\n var absBase = Math.abs(base);\r\n var alphabetValues = {};\r\n for (i = 0; i < alphabet.length; i++) {\r\n alphabetValues[alphabet[i]] = i;\r\n }\r\n for (i = 0; i < length; i++) {\r\n var c = text[i];\r\n if (c === \"-\") continue;\r\n if (c in alphabetValues) {\r\n if (alphabetValues[c] >= absBase) {\r\n if (c === \"1\" && absBase === 1) continue;\r\n throw new Error(c + \" is not a valid digit in base \" + base + \".\");\r\n }\r\n }\r\n }\r\n base = parseValue(base);\r\n var digits = [];\r\n var isNegative = text[0] === \"-\";\r\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\r\n var c = text[i];\r\n if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));\r\n else if (c === \"<\") {\r\n var start = i;\r\n do { i++; } while (text[i] !== \">\" && i < text.length);\r\n digits.push(parseValue(text.slice(start + 1, i)));\r\n }\r\n else throw new Error(c + \" is not a valid character\");\r\n }\r\n return parseBaseFromArray(digits, base, isNegative);\r\n };\r\n\r\n function parseBaseFromArray(digits, base, isNegative) {\r\n var val = Integer[0], pow = Integer[1], i;\r\n for (i = digits.length - 1; i >= 0; i--) {\r\n val = val.add(digits[i].times(pow));\r\n pow = pow.times(base);\r\n }\r\n return isNegative ? val.negate() : val;\r\n }\r\n\r\n function stringify(digit, alphabet) {\r\n alphabet = alphabet || DEFAULT_ALPHABET;\r\n if (digit < alphabet.length) {\r\n return alphabet[digit];\r\n }\r\n return \"<\" + digit + \">\";\r\n }\r\n\r\n function toBase(n, base) {\r\n base = bigInt(base);\r\n if (base.isZero()) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n throw new Error(\"Cannot convert nonzero numbers to base 0.\");\r\n }\r\n if (base.equals(-1)) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n if (n.isNegative())\r\n return {\r\n value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))\r\n .map(Array.prototype.valueOf, [1, 0])\r\n ),\r\n isNegative: false\r\n };\r\n\r\n var arr = Array.apply(null, Array(n.toJSNumber() - 1))\r\n .map(Array.prototype.valueOf, [0, 1]);\r\n arr.unshift([1]);\r\n return {\r\n value: [].concat.apply([], arr),\r\n isNegative: false\r\n };\r\n }\r\n\r\n var neg = false;\r\n if (n.isNegative() && base.isPositive()) {\r\n neg = true;\r\n n = n.abs();\r\n }\r\n if (base.isUnit()) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n\r\n return {\r\n value: Array.apply(null, Array(n.toJSNumber()))\r\n .map(Number.prototype.valueOf, 1),\r\n isNegative: neg\r\n };\r\n }\r\n var out = [];\r\n var left = n, divmod;\r\n while (left.isNegative() || left.compareAbs(base) >= 0) {\r\n divmod = left.divmod(base);\r\n left = divmod.quotient;\r\n var digit = divmod.remainder;\r\n if (digit.isNegative()) {\r\n digit = base.minus(digit).abs();\r\n left = left.next();\r\n }\r\n out.push(digit.toJSNumber());\r\n }\r\n out.push(left.toJSNumber());\r\n return { value: out.reverse(), isNegative: neg };\r\n }\r\n\r\n function toBaseString(n, base, alphabet) {\r\n var arr = toBase(n, base);\r\n return (arr.isNegative ? \"-\" : \"\") + arr.value.map(function (x) {\r\n return stringify(x, alphabet);\r\n }).join('');\r\n }\r\n\r\n BigInteger.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n SmallInteger.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n NativeBigInt.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n BigInteger.prototype.toString = function (radix, alphabet) {\r\n if (radix === undefined) radix = 10;\r\n if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet);\r\n var v = this.value, l = v.length, str = String(v[--l]), zeros = \"0000000\", digit;\r\n while (--l >= 0) {\r\n digit = String(v[l]);\r\n str += zeros.slice(digit.length) + digit;\r\n }\r\n var sign = this.sign ? \"-\" : \"\";\r\n return sign + str;\r\n };\r\n\r\n SmallInteger.prototype.toString = function (radix, alphabet) {\r\n if (radix === undefined) radix = 10;\r\n if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet);\r\n return String(this.value);\r\n };\r\n\r\n NativeBigInt.prototype.toString = SmallInteger.prototype.toString;\r\n\r\n NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }\r\n\r\n BigInteger.prototype.valueOf = function () {\r\n return parseInt(this.toString(), 10);\r\n };\r\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\r\n\r\n SmallInteger.prototype.valueOf = function () {\r\n return this.value;\r\n };\r\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\r\n NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {\r\n return parseInt(this.toString(), 10);\r\n }\r\n\r\n function parseStringValue(v) {\r\n if (isPrecise(+v)) {\r\n var x = +v;\r\n if (x === truncate(x))\r\n return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);\r\n throw new Error(\"Invalid integer: \" + v);\r\n }\r\n var sign = v[0] === \"-\";\r\n if (sign) v = v.slice(1);\r\n var split = v.split(/e/i);\r\n if (split.length > 2) throw new Error(\"Invalid integer: \" + split.join(\"e\"));\r\n if (split.length === 2) {\r\n var exp = split[1];\r\n if (exp[0] === \"+\") exp = exp.slice(1);\r\n exp = +exp;\r\n if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error(\"Invalid integer: \" + exp + \" is not a valid exponent.\");\r\n var text = split[0];\r\n var decimalPlace = text.indexOf(\".\");\r\n if (decimalPlace >= 0) {\r\n exp -= text.length - decimalPlace - 1;\r\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\r\n }\r\n if (exp < 0) throw new Error(\"Cannot include negative exponent part for integers\");\r\n text += (new Array(exp + 1)).join(\"0\");\r\n v = text;\r\n }\r\n var isValid = /^([0-9][0-9]*)$/.test(v);\r\n if (!isValid) throw new Error(\"Invalid integer: \" + v);\r\n if (supportsNativeBigInt) {\r\n return new NativeBigInt(BigInt(sign ? \"-\" + v : v));\r\n }\r\n var r = [], max = v.length, l = LOG_BASE, min = max - l;\r\n while (max > 0) {\r\n r.push(+v.slice(min, max));\r\n min -= l;\r\n if (min < 0) min = 0;\r\n max -= l;\r\n }\r\n trim(r);\r\n return new BigInteger(r, sign);\r\n }\r\n\r\n function parseNumberValue(v) {\r\n if (supportsNativeBigInt) {\r\n return new NativeBigInt(BigInt(v));\r\n }\r\n if (isPrecise(v)) {\r\n if (v !== truncate(v)) throw new Error(v + \" is not an integer.\");\r\n return new SmallInteger(v);\r\n }\r\n return parseStringValue(v.toString());\r\n }\r\n\r\n function parseValue(v) {\r\n if (typeof v === \"number\") {\r\n return parseNumberValue(v);\r\n }\r\n if (typeof v === \"string\") {\r\n return parseStringValue(v);\r\n }\r\n if (typeof v === \"bigint\") {\r\n return new NativeBigInt(v);\r\n }\r\n return v;\r\n }\r\n // Pre-define numbers in range [-999,999]\r\n for (var i = 0; i < 1000; i++) {\r\n Integer[i] = parseValue(i);\r\n if (i > 0) Integer[-i] = parseValue(-i);\r\n }\r\n // Backwards compatibility\r\n Integer.one = Integer[1];\r\n Integer.zero = Integer[0];\r\n Integer.minusOne = Integer[-1];\r\n Integer.max = max;\r\n Integer.min = min;\r\n Integer.gcd = gcd;\r\n Integer.lcm = lcm;\r\n Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };\r\n Integer.randBetween = randBetween;\r\n\r\n Integer.fromArray = function (digits, base, isNegative) {\r\n return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);\r\n };\r\n\r\n return Integer;\r\n})();\r\n\r\n// Node.js check\r\nif (typeof module !== \"undefined\" && module.hasOwnProperty(\"exports\")) {\r\n module.exports = bigInt;\r\n}\r\n\r\n//amd check\r\nif (typeof define === \"function\" && define.amd) {\r\n define( function () {\r\n return bigInt;\r\n });\r\n}\r\n", "/**\n * @preserve jed.js https://github.com/SlexAxton/Jed\n */\n/*\n-----------\nA gettext compatible i18n library for modern JavaScript Applications\n\nby Alex Sexton - AlexSexton [at] gmail - @SlexAxton\n\nMIT License\n\nA jQuery Foundation project - requires CLA to contribute -\nhttps://contribute.jquery.org/CLA/\n\n\n\nJed offers the entire applicable GNU gettext spec'd set of\nfunctions, but also offers some nicer wrappers around them.\nThe api for gettext was written for a language with no function\noverloading, so Jed allows a little more of that.\n\nMany thanks to Joshua I. Miller - unrtst@cpan.org - who wrote\ngettext.js back in 2008. I was able to vet a lot of my ideas\nagainst his. I also made sure Jed passed against his tests\nin order to offer easy upgrades -- jsgettext.berlios.de\n*/\n(function (root, undef) {\n\n // Set up some underscore-style functions, if you already have\n // underscore, feel free to delete this section, and use it\n // directly, however, the amount of functions used doesn't\n // warrant having underscore as a full dependency.\n // Underscore 1.3.0 was used to port and is licensed\n // under the MIT License by Jeremy Ashkenas.\n var ArrayProto = Array.prototype,\n ObjProto = Object.prototype,\n slice = ArrayProto.slice,\n hasOwnProp = ObjProto.hasOwnProperty,\n nativeForEach = ArrayProto.forEach,\n breaker = {};\n\n // We're not using the OOP style _ so we don't need the\n // extra level of indirection. This still means that you\n // sub out for real `_` though.\n var _ = {\n forEach : function( obj, iterator, context ) {\n var i, l, key;\n if ( obj === null ) {\n return;\n }\n\n if ( nativeForEach && obj.forEach === nativeForEach ) {\n obj.forEach( iterator, context );\n }\n else if ( obj.length === +obj.length ) {\n for ( i = 0, l = obj.length; i < l; i++ ) {\n if ( i in obj && iterator.call( context, obj[i], i, obj ) === breaker ) {\n return;\n }\n }\n }\n else {\n for ( key in obj) {\n if ( hasOwnProp.call( obj, key ) ) {\n if ( iterator.call (context, obj[key], key, obj ) === breaker ) {\n return;\n }\n }\n }\n }\n },\n extend : function( obj ) {\n this.forEach( slice.call( arguments, 1 ), function ( source ) {\n for ( var prop in source ) {\n obj[prop] = source[prop];\n }\n });\n return obj;\n }\n };\n // END Miniature underscore impl\n\n // Jed is a constructor function\n var Jed = function ( options ) {\n // Some minimal defaults\n this.defaults = {\n \"locale_data\" : {\n \"messages\" : {\n \"\" : {\n \"domain\" : \"messages\",\n \"lang\" : \"en\",\n \"plural_forms\" : \"nplurals=2; plural=(n != 1);\"\n }\n // There are no default keys, though\n }\n },\n // The default domain if one is missing\n \"domain\" : \"messages\",\n // enable debug mode to log untranslated strings to the console\n \"debug\" : false\n };\n\n // Mix in the sent options with the default options\n this.options = _.extend( {}, this.defaults, options );\n this.textdomain( this.options.domain );\n\n if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {\n throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');\n }\n };\n\n // The gettext spec sets this character as the default\n // delimiter for context lookups.\n // e.g.: context\\u0004key\n // If your translation company uses something different,\n // just change this at any time and it will use that instead.\n Jed.context_delimiter = String.fromCharCode( 4 );\n\n function getPluralFormFunc ( plural_form_string ) {\n return Jed.PF.compile( plural_form_string || \"nplurals=2; plural=(n != 1);\");\n }\n\n function Chain( key, i18n ){\n this._key = key;\n this._i18n = i18n;\n }\n\n // Create a chainable api for adding args prettily\n _.extend( Chain.prototype, {\n onDomain : function ( domain ) {\n this._domain = domain;\n return this;\n },\n withContext : function ( context ) {\n this._context = context;\n return this;\n },\n ifPlural : function ( num, pkey ) {\n this._val = num;\n this._pkey = pkey;\n return this;\n },\n fetch : function ( sArr ) {\n if ( {}.toString.call( sArr ) != '[object Array]' ) {\n sArr = [].slice.call(arguments, 0);\n }\n return ( sArr && sArr.length ? Jed.sprintf : function(x){ return x; } )(\n this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),\n sArr\n );\n }\n });\n\n // Add functions to the Jed prototype.\n // These will be the functions on the object that's returned\n // from creating a `new Jed()`\n // These seem redundant, but they gzip pretty well.\n _.extend( Jed.prototype, {\n // The sexier api start point\n translate : function ( key ) {\n return new Chain( key, this );\n },\n\n textdomain : function ( domain ) {\n if ( ! domain ) {\n return this._textdomain;\n }\n this._textdomain = domain;\n },\n\n gettext : function ( key ) {\n return this.dcnpgettext.call( this, undef, undef, key );\n },\n\n dgettext : function ( domain, key ) {\n return this.dcnpgettext.call( this, domain, undef, key );\n },\n\n dcgettext : function ( domain , key /*, category */ ) {\n // Ignores the category anyways\n return this.dcnpgettext.call( this, domain, undef, key );\n },\n\n ngettext : function ( skey, pkey, val ) {\n return this.dcnpgettext.call( this, undef, undef, skey, pkey, val );\n },\n\n dngettext : function ( domain, skey, pkey, val ) {\n return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );\n },\n\n dcngettext : function ( domain, skey, pkey, val/*, category */) {\n return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );\n },\n\n pgettext : function ( context, key ) {\n return this.dcnpgettext.call( this, undef, context, key );\n },\n\n dpgettext : function ( domain, context, key ) {\n return this.dcnpgettext.call( this, domain, context, key );\n },\n\n dcpgettext : function ( domain, context, key/*, category */) {\n return this.dcnpgettext.call( this, domain, context, key );\n },\n\n npgettext : function ( context, skey, pkey, val ) {\n return this.dcnpgettext.call( this, undef, context, skey, pkey, val );\n },\n\n dnpgettext : function ( domain, context, skey, pkey, val ) {\n return this.dcnpgettext.call( this, domain, context, skey, pkey, val );\n },\n\n // The most fully qualified gettext function. It has every option.\n // Since it has every option, we can use it from every other method.\n // This is the bread and butter.\n // Technically there should be one more argument in this function for 'Category',\n // but since we never use it, we might as well not waste the bytes to define it.\n dcnpgettext : function ( domain, context, singular_key, plural_key, val ) {\n // Set some defaults\n\n plural_key = plural_key || singular_key;\n\n // Use the global domain default if one\n // isn't explicitly passed in\n domain = domain || this._textdomain;\n\n var fallback;\n\n // Handle special cases\n\n // No options found\n if ( ! this.options ) {\n // There's likely something wrong, but we'll return the correct key for english\n // We do this by instantiating a brand new Jed instance with the default set\n // for everything that could be broken.\n fallback = new Jed();\n return fallback.dcnpgettext.call( fallback, undefined, undefined, singular_key, plural_key, val );\n }\n\n // No translation data provided\n if ( ! this.options.locale_data ) {\n throw new Error('No locale data provided.');\n }\n\n if ( ! this.options.locale_data[ domain ] ) {\n throw new Error('Domain `' + domain + '` was not found.');\n }\n\n if ( ! this.options.locale_data[ domain ][ \"\" ] ) {\n throw new Error('No locale meta information provided.');\n }\n\n // Make sure we have a truthy key. Otherwise we might start looking\n // into the empty string key, which is the options for the locale\n // data.\n if ( ! singular_key ) {\n throw new Error('No translation key found.');\n }\n\n var key = context ? context + Jed.context_delimiter + singular_key : singular_key,\n locale_data = this.options.locale_data,\n dict = locale_data[ domain ],\n defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[\"\"],\n pluralForms = dict[\"\"].plural_forms || dict[\"\"][\"Plural-Forms\"] || dict[\"\"][\"plural-forms\"] || defaultConf.plural_forms || defaultConf[\"Plural-Forms\"] || defaultConf[\"plural-forms\"],\n val_list,\n res;\n\n var val_idx;\n if (val === undefined) {\n // No value passed in; assume singular key lookup.\n val_idx = 0;\n\n } else {\n // Value has been passed in; use plural-forms calculations.\n\n // Handle invalid numbers, but try casting strings for good measure\n if ( typeof val != 'number' ) {\n val = parseInt( val, 10 );\n\n if ( isNaN( val ) ) {\n throw new Error('The number that was passed in is not a number.');\n }\n }\n\n val_idx = getPluralFormFunc(pluralForms)(val);\n }\n\n // Throw an error if a domain isn't found\n if ( ! dict ) {\n throw new Error('No domain named `' + domain + '` could be found.');\n }\n\n val_list = dict[ key ];\n\n // If there is no match, then revert back to\n // english style singular/plural with the keys passed in.\n if ( ! val_list || val_idx > val_list.length ) {\n if (this.options.missing_key_callback) {\n this.options.missing_key_callback(key, domain);\n }\n res = [ singular_key, plural_key ];\n\n // collect untranslated strings\n if (this.options.debug===true) {\n console.log(res[ getPluralFormFunc(pluralForms)( val ) ]);\n }\n return res[ getPluralFormFunc()( val ) ];\n }\n\n res = val_list[ val_idx ];\n\n // This includes empty strings on purpose\n if ( ! res ) {\n res = [ singular_key, plural_key ];\n return res[ getPluralFormFunc()( val ) ];\n }\n return res;\n }\n });\n\n\n // We add in sprintf capabilities for post translation value interolation\n // This is not internally used, so you can remove it if you have this\n // available somewhere else, or want to use a different system.\n\n // We _slightly_ modify the normal sprintf behavior to more gracefully handle\n // undefined values.\n\n /**\n sprintf() for JavaScript 0.7-beta1\n http://www.diveintojavascript.com/projects/javascript-sprintf\n\n Copyright (c) Alexandru Marasteanu \n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of sprintf() for JavaScript nor the\n names of its contributors may be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n var sprintf = (function() {\n function get_type(variable) {\n return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();\n }\n function str_repeat(input, multiplier) {\n for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}\n return output.join('');\n }\n\n var str_format = function() {\n if (!str_format.cache.hasOwnProperty(arguments[0])) {\n str_format.cache[arguments[0]] = str_format.parse(arguments[0]);\n }\n return str_format.format.call(null, str_format.cache[arguments[0]], arguments);\n };\n\n str_format.format = function(parse_tree, argv) {\n var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;\n for (i = 0; i < tree_length; i++) {\n node_type = get_type(parse_tree[i]);\n if (node_type === 'string') {\n output.push(parse_tree[i]);\n }\n else if (node_type === 'array') {\n match = parse_tree[i]; // convenience purposes only\n if (match[2]) { // keyword argument\n arg = argv[cursor];\n for (k = 0; k < match[2].length; k++) {\n if (!arg.hasOwnProperty(match[2][k])) {\n throw(sprintf('[sprintf] property \"%s\" does not exist', match[2][k]));\n }\n arg = arg[match[2][k]];\n }\n }\n else if (match[1]) { // positional argument (explicit)\n arg = argv[match[1]];\n }\n else { // positional argument (implicit)\n arg = argv[cursor++];\n }\n\n if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {\n throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));\n }\n\n // Jed EDIT\n if ( typeof arg == 'undefined' || arg === null ) {\n arg = '';\n }\n // Jed EDIT\n\n switch (match[8]) {\n case 'b': arg = arg.toString(2); break;\n case 'c': arg = String.fromCharCode(arg); break;\n case 'd': arg = parseInt(arg, 10); break;\n case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;\n case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;\n case 'o': arg = arg.toString(8); break;\n case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;\n case 'u': arg = Math.abs(arg); break;\n case 'x': arg = arg.toString(16); break;\n case 'X': arg = arg.toString(16).toUpperCase(); break;\n }\n arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);\n pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';\n pad_length = match[6] - String(arg).length;\n pad = match[6] ? str_repeat(pad_character, pad_length) : '';\n output.push(match[5] ? arg + pad : pad + arg);\n }\n }\n return output.join('');\n };\n\n str_format.cache = {};\n\n str_format.parse = function(fmt) {\n var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;\n while (_fmt) {\n if ((match = /^[^\\x25]+/.exec(_fmt)) !== null) {\n parse_tree.push(match[0]);\n }\n else if ((match = /^\\x25{2}/.exec(_fmt)) !== null) {\n parse_tree.push('%');\n }\n else if ((match = /^\\x25(?:([1-9]\\d*)\\$|\\(([^\\)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {\n if (match[2]) {\n arg_names |= 1;\n var field_list = [], replacement_field = match[2], field_match = [];\n if ((field_match = /^([a-z_][a-z_\\d]*)/i.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n if ((field_match = /^\\.([a-z_][a-z_\\d]*)/i.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else if ((field_match = /^\\[(\\d+)\\]/.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else {\n throw('[sprintf] huh?');\n }\n }\n }\n else {\n throw('[sprintf] huh?');\n }\n match[2] = field_list;\n }\n else {\n arg_names |= 2;\n }\n if (arg_names === 3) {\n throw('[sprintf] mixing positional and named placeholders is not (yet) supported');\n }\n parse_tree.push(match);\n }\n else {\n throw('[sprintf] huh?');\n }\n _fmt = _fmt.substring(match[0].length);\n }\n return parse_tree;\n };\n\n return str_format;\n })();\n\n var vsprintf = function(fmt, argv) {\n argv.unshift(fmt);\n return sprintf.apply(null, argv);\n };\n\n Jed.parse_plural = function ( plural_forms, n ) {\n plural_forms = plural_forms.replace(/n/g, n);\n return Jed.parse_expression(plural_forms);\n };\n\n Jed.sprintf = function ( fmt, args ) {\n if ( {}.toString.call( args ) == '[object Array]' ) {\n return vsprintf( fmt, [].slice.call(args) );\n }\n return sprintf.apply(this, [].slice.call(arguments) );\n };\n\n Jed.prototype.sprintf = function () {\n return Jed.sprintf.apply(this, arguments);\n };\n // END sprintf Implementation\n\n // Start the Plural forms section\n // This is a full plural form expression parser. It is used to avoid\n // running 'eval' or 'new Function' directly against the plural\n // forms.\n //\n // This can be important if you get translations done through a 3rd\n // party vendor. I encourage you to use this instead, however, I\n // also will provide a 'precompiler' that you can use at build time\n // to output valid/safe function representations of the plural form\n // expressions. This means you can build this code out for the most\n // part.\n Jed.PF = {};\n\n Jed.PF.parse = function ( p ) {\n var plural_str = Jed.PF.extractPluralExpr( p );\n return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);\n };\n\n Jed.PF.compile = function ( p ) {\n // Handle trues and falses as 0 and 1\n function imply( val ) {\n return (val === true ? 1 : val ? val : 0);\n }\n\n var ast = Jed.PF.parse( p );\n return function ( n ) {\n return imply( Jed.PF.interpreter( ast )( n ) );\n };\n };\n\n Jed.PF.interpreter = function ( ast ) {\n return function ( n ) {\n var res;\n switch ( ast.type ) {\n case 'GROUP':\n return Jed.PF.interpreter( ast.expr )( n );\n case 'TERNARY':\n if ( Jed.PF.interpreter( ast.expr )( n ) ) {\n return Jed.PF.interpreter( ast.truthy )( n );\n }\n return Jed.PF.interpreter( ast.falsey )( n );\n case 'OR':\n return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );\n case 'AND':\n return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );\n case 'LT':\n return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );\n case 'GT':\n return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );\n case 'LTE':\n return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );\n case 'GTE':\n return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );\n case 'EQ':\n return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );\n case 'NEQ':\n return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );\n case 'MOD':\n return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );\n case 'VAR':\n return n;\n case 'NUM':\n return ast.val;\n default:\n throw new Error(\"Invalid Token found.\");\n }\n };\n };\n\n Jed.PF.extractPluralExpr = function ( p ) {\n // trim first\n p = p.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\n if (! /;\\s*$/.test(p)) {\n p = p.concat(';');\n }\n\n var nplurals_re = /nplurals\\=(\\d+);/,\n plural_re = /plural\\=(.*);/,\n nplurals_matches = p.match( nplurals_re ),\n res = {},\n plural_matches;\n\n // Find the nplurals number\n if ( nplurals_matches.length > 1 ) {\n res.nplurals = nplurals_matches[1];\n }\n else {\n throw new Error('nplurals not found in plural_forms string: ' + p );\n }\n\n // remove that data to get to the formula\n p = p.replace( nplurals_re, \"\" );\n plural_matches = p.match( plural_re );\n\n if (!( plural_matches && plural_matches.length > 1 ) ) {\n throw new Error('`plural` expression not found: ' + p);\n }\n return plural_matches[ 1 ];\n };\n\n /* Jison generated parser */\n Jed.PF.parser = (function(){\n\nvar parser = {trace: function trace() { },\nyy: {},\nsymbols_: {\"error\":2,\"expressions\":3,\"e\":4,\"EOF\":5,\"?\":6,\":\":7,\"||\":8,\"&&\":9,\"<\":10,\"<=\":11,\">\":12,\">=\":13,\"!=\":14,\"==\":15,\"%\":16,\"(\":17,\")\":18,\"n\":19,\"NUMBER\":20,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",5:\"EOF\",6:\"?\",7:\":\",8:\"||\",9:\"&&\",10:\"<\",11:\"<=\",12:\">\",13:\">=\",14:\"!=\",15:\"==\",16:\"%\",17:\"(\",18:\")\",19:\"n\",20:\"NUMBER\"},\nproductions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],\nperformAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 1: return { type : 'GROUP', expr: $$[$0-1] };\nbreak;\ncase 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };\nbreak;\ncase 3:this.$ = { type: \"OR\", left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 4:this.$ = { type: \"AND\", left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };\nbreak;\ncase 13:this.$ = { type: 'VAR' };\nbreak;\ncase 14:this.$ = { type: 'NUM', val: Number(yytext) };\nbreak;\n}\n},\ntable: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],\ndefaultActions: {6:[2,1]},\nparseError: function parseError(str, hash) {\n throw new Error(str);\n},\nparse: function parse(input) {\n var self = this,\n stack = [0],\n vstack = [null], // semantic value stack\n lstack = [], // location stack\n table = this.table,\n yytext = '',\n yylineno = 0,\n yyleng = 0,\n recovering = 0,\n TERROR = 2,\n EOF = 1;\n\n //this.reductionCount = this.shiftCount = 0;\n\n this.lexer.setInput(input);\n this.lexer.yy = this.yy;\n this.yy.lexer = this.lexer;\n if (typeof this.lexer.yylloc == 'undefined')\n this.lexer.yylloc = {};\n var yyloc = this.lexer.yylloc;\n lstack.push(yyloc);\n\n if (typeof this.yy.parseError === 'function')\n this.parseError = this.yy.parseError;\n\n function popStack (n) {\n stack.length = stack.length - 2*n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n\n function lex() {\n var token;\n token = self.lexer.lex() || 1; // $end = 1\n // if token isn't its numeric value, convert\n if (typeof token !== 'number') {\n token = self.symbols_[token] || token;\n }\n return token;\n }\n\n var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;\n while (true) {\n // retreive state number from top of stack\n state = stack[stack.length-1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol == null)\n symbol = lex();\n // read action for current state and first input\n action = table[state] && table[state][symbol];\n }\n\n // handle parse error\n _handle_error:\n if (typeof action === 'undefined' || !action.length || !action[0]) {\n\n if (!recovering) {\n // Report error\n expected = [];\n for (p in table[state]) if (this.terminals_[p] && p > 2) {\n expected.push(\"'\"+this.terminals_[p]+\"'\");\n }\n var errStr = '';\n if (this.lexer.showPosition) {\n errStr = 'Parse error on line '+(yylineno+1)+\":\\n\"+this.lexer.showPosition()+\"\\nExpecting \"+expected.join(', ') + \", got '\" + this.terminals_[symbol]+ \"'\";\n } else {\n errStr = 'Parse error on line '+(yylineno+1)+\": Unexpected \" +\n (symbol == 1 /*EOF*/ ? \"end of input\" :\n (\"'\"+(this.terminals_[symbol] || symbol)+\"'\"));\n }\n this.parseError(errStr,\n {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});\n }\n\n // just recovered from another error\n if (recovering == 3) {\n if (symbol == EOF) {\n throw new Error(errStr || 'Parsing halted.');\n }\n\n // discard current lookahead and grab another\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n symbol = lex();\n }\n\n // try to recover from error\n while (1) {\n // check for error recovery rule in this state\n if ((TERROR.toString()) in table[state]) {\n break;\n }\n if (state == 0) {\n throw new Error(errStr || 'Parsing halted.');\n }\n popStack(1);\n state = stack[stack.length-1];\n }\n\n preErrorSymbol = symbol; // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n state = stack[stack.length-1];\n action = table[state] && table[state][TERROR];\n recovering = 3; // allow 3 real symbols to be shifted before reporting a new error\n }\n\n // this shouldn't happen, unless resolve defaults are off\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);\n }\n\n switch (action[0]) {\n\n case 1: // shift\n //this.shiftCount++;\n\n stack.push(symbol);\n vstack.push(this.lexer.yytext);\n lstack.push(this.lexer.yylloc);\n stack.push(action[1]); // push state\n symbol = null;\n if (!preErrorSymbol) { // normal execution/no error\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n if (recovering > 0)\n recovering--;\n } else { // error just occurred, resume old lookahead f/ before error\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n\n case 2: // reduce\n //this.reductionCount++;\n\n len = this.productions_[action[1]][1];\n\n // perform semantic action\n yyval.$ = vstack[vstack.length-len]; // default to $$ = $1\n // default location, uses first token for firsts, last for lasts\n yyval._$ = {\n first_line: lstack[lstack.length-(len||1)].first_line,\n last_line: lstack[lstack.length-1].last_line,\n first_column: lstack[lstack.length-(len||1)].first_column,\n last_column: lstack[lstack.length-1].last_column\n };\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);\n\n if (typeof r !== 'undefined') {\n return r;\n }\n\n // pop off stack\n if (len) {\n stack = stack.slice(0,-1*len*2);\n vstack = vstack.slice(0, -1*len);\n lstack = lstack.slice(0, -1*len);\n }\n\n stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[stack[stack.length-2]][stack[stack.length-1]];\n stack.push(newState);\n break;\n\n case 3: // accept\n return true;\n }\n\n }\n\n return true;\n}};/* Jison generated lexer */\nvar lexer = (function(){\n\nvar lexer = ({EOF:1,\nparseError:function parseError(str, hash) {\n if (this.yy.parseError) {\n this.yy.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\nsetInput:function (input) {\n this._input = input;\n this._more = this._less = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};\n return this;\n },\ninput:function () {\n var ch = this._input[0];\n this.yytext+=ch;\n this.yyleng++;\n this.match+=ch;\n this.matched+=ch;\n var lines = ch.match(/\\n/);\n if (lines) this.yylineno++;\n this._input = this._input.slice(1);\n return ch;\n },\nunput:function (ch) {\n this._input = ch + this._input;\n return this;\n },\nmore:function () {\n this._more = true;\n return this;\n },\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\\n/g, \"\");\n },\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c+\"^\";\n },\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) this.done = true;\n\n var token,\n match,\n col,\n lines;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i=0;i < rules.length; i++) {\n match = this._input.match(this.rules[rules[i]]);\n if (match) {\n lines = match[0].match(/\\n.*/g);\n if (lines) this.yylineno += lines.length;\n this.yylloc = {first_line: this.yylloc.last_line,\n last_line: this.yylineno+1,\n first_column: this.yylloc.last_column,\n last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n this._more = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);\n if (token) return token;\n else return;\n }\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\\n'+this.showPosition(),\n {text: \"\", token: null, line: this.yylineno});\n }\n },\nlex:function lex() {\n var r = this.next();\n if (typeof r !== 'undefined') {\n return r;\n } else {\n return this.lex();\n }\n },\nbegin:function begin(condition) {\n this.conditionStack.push(condition);\n },\npopState:function popState() {\n return this.conditionStack.pop();\n },\n_currentRules:function _currentRules() {\n return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;\n },\ntopState:function () {\n return this.conditionStack[this.conditionStack.length-2];\n },\npushState:function begin(condition) {\n this.begin(condition);\n }});\nlexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\n\nvar YYSTATE=YY_START;\nswitch($avoiding_name_collisions) {\ncase 0:/* skip whitespace */\nbreak;\ncase 1:return 20\nbreak;\ncase 2:return 19\nbreak;\ncase 3:return 8\nbreak;\ncase 4:return 9\nbreak;\ncase 5:return 6\nbreak;\ncase 6:return 7\nbreak;\ncase 7:return 11\nbreak;\ncase 8:return 13\nbreak;\ncase 9:return 10\nbreak;\ncase 10:return 12\nbreak;\ncase 11:return 14\nbreak;\ncase 12:return 15\nbreak;\ncase 13:return 16\nbreak;\ncase 14:return 17\nbreak;\ncase 15:return 18\nbreak;\ncase 16:return 5\nbreak;\ncase 17:return 'INVALID'\nbreak;\n}\n};\nlexer.rules = [/^\\s+/,/^[0-9]+(\\.[0-9]+)?\\b/,/^n\\b/,/^\\|\\|/,/^&&/,/^\\?/,/^:/,/^<=/,/^>=/,/^/,/^!=/,/^==/,/^%/,/^\\(/,/^\\)/,/^$/,/^./];\nlexer.conditions = {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],\"inclusive\":true}};return lexer;})()\nparser.lexer = lexer;\nreturn parser;\n})();\n// End parser\n\n // Handle node, amd, and global systems\n if (typeof exports !== 'undefined') {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = Jed;\n }\n exports.Jed = Jed;\n }\n else {\n if (typeof define === 'function' && define.amd) {\n define(function() {\n return Jed;\n });\n }\n // Leak a global regardless of module system\n root['Jed'] = Jed;\n }\n\n})(this);\n", "import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n", "import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n", "import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n", "import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\n\nprocess._rerenderCount = 0;\n", "import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n", "export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g.
{reuse}{reuse}
) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse =
\n\t\t\t//
{reuse}{reuse}
\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : null,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(parentDom, vnode, vnode, c, vnode._dom, oldDom);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != null && (value !== false || name.indexOf('-') != -1)) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n", "import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the -element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix \n\t\tif (\n\t\t\ttype == 'select' &&\n\t\t\tnormalizedProps.multiple &&\n\t\t\tArray.isArray(normalizedProps.value)\n\t\t) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (type == 'select' && normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvnode.props = normalizedProps;\n\n\t\tif (props.class != props.className) {\n\t\t\tclassNameDescriptor.enumerable = 'className' in props;\n\t\t\tif (props.className != null) normalizedProps.class = props.className;\n\t\t\tObject.defineProperty(normalizedProps, 'className', classNameDescriptor);\n\t\t}\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function(vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection. So far\n// only `react-relay` makes use of it. It uses it to read the\n// context value.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t}\n\t\t}\n\t}\n};\n", "import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport { is } from './util';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '17.0.2'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender. It's\n * implmented here as a no-op.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional arugment that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => callback(arg);\n\n/**\n * Strict Mode is not implemented in Preact, so we provide a stand-in for it\n * that just renders its children without imposing any restrictions.\n */\nconst StrictMode = Fragment;\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (!is(_instance._value, getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n", "/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n", "// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\n// TypeScript port in 2019 by Florian Dold.\n// Public domain.\n//\n// Implementation derived from TweetNaCl version 20140427.\n// See for details: http://tweetnacl.cr.yp.to/\n\nconst gf = function (init: number[] = []): Float64Array {\n const r = new Float64Array(16);\n if (init) for (let i = 0; i < init.length; i++) r[i] = init[i];\n return r;\n};\n\n// Pluggable, initialized in high-level API below.\nlet randombytes = function (x: Uint8Array, n: number): void {\n throw new Error(\"no PRNG\");\n};\n\nconst _9 = new Uint8Array(32);\n_9[0] = 9;\n\n// prettier-ignore\nconst gf0 = gf();\nconst gf1 = gf([1]);\nconst _121665 = gf([0xdb41, 1]);\nconst D = gf([\n 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898,\n 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203,\n]);\nconst D2 = gf([\n 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130,\n 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406,\n]);\nconst X = gf([\n 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c,\n 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169,\n]);\nconst Y = gf([\n 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,\n 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,\n]);\nconst I = gf([\n 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7,\n 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83,\n]);\n\nfunction ts64(x: Uint8Array, i: number, h: number, l: number): void {\n x[i] = (h >> 24) & 0xff;\n x[i + 1] = (h >> 16) & 0xff;\n x[i + 2] = (h >> 8) & 0xff;\n x[i + 3] = h & 0xff;\n x[i + 4] = (l >> 24) & 0xff;\n x[i + 5] = (l >> 16) & 0xff;\n x[i + 6] = (l >> 8) & 0xff;\n x[i + 7] = l & 0xff;\n}\n\nfunction vn(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n n: number,\n): number {\n let i,\n d = 0;\n for (i = 0; i < n; i++) d |= x[xi + i] ^ y[yi + i];\n return (1 & ((d - 1) >>> 8)) - 1;\n}\n\nfunction crypto_verify_16(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n) {\n return vn(x, xi, y, yi, 16);\n}\n\nfunction crypto_verify_32(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n): number {\n return vn(x, xi, y, yi, 32);\n}\n\nfunction core_salsa20(\n o: Uint8Array,\n p: Uint8Array,\n k: Uint8Array,\n c: Uint8Array,\n) {\n var j0 =\n (c[0] & 0xff) |\n ((c[1] & 0xff) << 8) |\n ((c[2] & 0xff) << 16) |\n ((c[3] & 0xff) << 24),\n j1 =\n (k[0] & 0xff) |\n ((k[1] & 0xff) << 8) |\n ((k[2] & 0xff) << 16) |\n ((k[3] & 0xff) << 24),\n j2 =\n (k[4] & 0xff) |\n ((k[5] & 0xff) << 8) |\n ((k[6] & 0xff) << 16) |\n ((k[7] & 0xff) << 24),\n j3 =\n (k[8] & 0xff) |\n ((k[9] & 0xff) << 8) |\n ((k[10] & 0xff) << 16) |\n ((k[11] & 0xff) << 24),\n j4 =\n (k[12] & 0xff) |\n ((k[13] & 0xff) << 8) |\n ((k[14] & 0xff) << 16) |\n ((k[15] & 0xff) << 24),\n j5 =\n (c[4] & 0xff) |\n ((c[5] & 0xff) << 8) |\n ((c[6] & 0xff) << 16) |\n ((c[7] & 0xff) << 24),\n j6 =\n (p[0] & 0xff) |\n ((p[1] & 0xff) << 8) |\n ((p[2] & 0xff) << 16) |\n ((p[3] & 0xff) << 24),\n j7 =\n (p[4] & 0xff) |\n ((p[5] & 0xff) << 8) |\n ((p[6] & 0xff) << 16) |\n ((p[7] & 0xff) << 24),\n j8 =\n (p[8] & 0xff) |\n ((p[9] & 0xff) << 8) |\n ((p[10] & 0xff) << 16) |\n ((p[11] & 0xff) << 24),\n j9 =\n (p[12] & 0xff) |\n ((p[13] & 0xff) << 8) |\n ((p[14] & 0xff) << 16) |\n ((p[15] & 0xff) << 24),\n j10 =\n (c[8] & 0xff) |\n ((c[9] & 0xff) << 8) |\n ((c[10] & 0xff) << 16) |\n ((c[11] & 0xff) << 24),\n j11 =\n (k[16] & 0xff) |\n ((k[17] & 0xff) << 8) |\n ((k[18] & 0xff) << 16) |\n ((k[19] & 0xff) << 24),\n j12 =\n (k[20] & 0xff) |\n ((k[21] & 0xff) << 8) |\n ((k[22] & 0xff) << 16) |\n ((k[23] & 0xff) << 24),\n j13 =\n (k[24] & 0xff) |\n ((k[25] & 0xff) << 8) |\n ((k[26] & 0xff) << 16) |\n ((k[27] & 0xff) << 24),\n j14 =\n (k[28] & 0xff) |\n ((k[29] & 0xff) << 8) |\n ((k[30] & 0xff) << 16) |\n ((k[31] & 0xff) << 24),\n j15 =\n (c[12] & 0xff) |\n ((c[13] & 0xff) << 8) |\n ((c[14] & 0xff) << 16) |\n ((c[15] & 0xff) << 24);\n\n var x0 = j0,\n x1 = j1,\n x2 = j2,\n x3 = j3,\n x4 = j4,\n x5 = j5,\n x6 = j6,\n x7 = j7,\n x8 = j8,\n x9 = j9,\n x10 = j10,\n x11 = j11,\n x12 = j12,\n x13 = j13,\n x14 = j14,\n x15 = j15,\n u;\n\n for (var i = 0; i < 20; i += 2) {\n u = (x0 + x12) | 0;\n x4 ^= (u << 7) | (u >>> (32 - 7));\n u = (x4 + x0) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x4) | 0;\n x12 ^= (u << 13) | (u >>> (32 - 13));\n u = (x12 + x8) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x1) | 0;\n x9 ^= (u << 7) | (u >>> (32 - 7));\n u = (x9 + x5) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x9) | 0;\n x1 ^= (u << 13) | (u >>> (32 - 13));\n u = (x1 + x13) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x6) | 0;\n x14 ^= (u << 7) | (u >>> (32 - 7));\n u = (x14 + x10) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x14) | 0;\n x6 ^= (u << 13) | (u >>> (32 - 13));\n u = (x6 + x2) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x11) | 0;\n x3 ^= (u << 7) | (u >>> (32 - 7));\n u = (x3 + x15) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x3) | 0;\n x11 ^= (u << 13) | (u >>> (32 - 13));\n u = (x11 + x7) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x0 + x3) | 0;\n x1 ^= (u << 7) | (u >>> (32 - 7));\n u = (x1 + x0) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x1) | 0;\n x3 ^= (u << 13) | (u >>> (32 - 13));\n u = (x3 + x2) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x4) | 0;\n x6 ^= (u << 7) | (u >>> (32 - 7));\n u = (x6 + x5) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x6) | 0;\n x4 ^= (u << 13) | (u >>> (32 - 13));\n u = (x4 + x7) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x9) | 0;\n x11 ^= (u << 7) | (u >>> (32 - 7));\n u = (x11 + x10) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x11) | 0;\n x9 ^= (u << 13) | (u >>> (32 - 13));\n u = (x9 + x8) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x14) | 0;\n x12 ^= (u << 7) | (u >>> (32 - 7));\n u = (x12 + x15) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x12) | 0;\n x14 ^= (u << 13) | (u >>> (32 - 13));\n u = (x14 + x13) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n }\n x0 = (x0 + j0) | 0;\n x1 = (x1 + j1) | 0;\n x2 = (x2 + j2) | 0;\n x3 = (x3 + j3) | 0;\n x4 = (x4 + j4) | 0;\n x5 = (x5 + j5) | 0;\n x6 = (x6 + j6) | 0;\n x7 = (x7 + j7) | 0;\n x8 = (x8 + j8) | 0;\n x9 = (x9 + j9) | 0;\n x10 = (x10 + j10) | 0;\n x11 = (x11 + j11) | 0;\n x12 = (x12 + j12) | 0;\n x13 = (x13 + j13) | 0;\n x14 = (x14 + j14) | 0;\n x15 = (x15 + j15) | 0;\n\n o[0] = (x0 >>> 0) & 0xff;\n o[1] = (x0 >>> 8) & 0xff;\n o[2] = (x0 >>> 16) & 0xff;\n o[3] = (x0 >>> 24) & 0xff;\n\n o[4] = (x1 >>> 0) & 0xff;\n o[5] = (x1 >>> 8) & 0xff;\n o[6] = (x1 >>> 16) & 0xff;\n o[7] = (x1 >>> 24) & 0xff;\n\n o[8] = (x2 >>> 0) & 0xff;\n o[9] = (x2 >>> 8) & 0xff;\n o[10] = (x2 >>> 16) & 0xff;\n o[11] = (x2 >>> 24) & 0xff;\n\n o[12] = (x3 >>> 0) & 0xff;\n o[13] = (x3 >>> 8) & 0xff;\n o[14] = (x3 >>> 16) & 0xff;\n o[15] = (x3 >>> 24) & 0xff;\n\n o[16] = (x4 >>> 0) & 0xff;\n o[17] = (x4 >>> 8) & 0xff;\n o[18] = (x4 >>> 16) & 0xff;\n o[19] = (x4 >>> 24) & 0xff;\n\n o[20] = (x5 >>> 0) & 0xff;\n o[21] = (x5 >>> 8) & 0xff;\n o[22] = (x5 >>> 16) & 0xff;\n o[23] = (x5 >>> 24) & 0xff;\n\n o[24] = (x6 >>> 0) & 0xff;\n o[25] = (x6 >>> 8) & 0xff;\n o[26] = (x6 >>> 16) & 0xff;\n o[27] = (x6 >>> 24) & 0xff;\n\n o[28] = (x7 >>> 0) & 0xff;\n o[29] = (x7 >>> 8) & 0xff;\n o[30] = (x7 >>> 16) & 0xff;\n o[31] = (x7 >>> 24) & 0xff;\n\n o[32] = (x8 >>> 0) & 0xff;\n o[33] = (x8 >>> 8) & 0xff;\n o[34] = (x8 >>> 16) & 0xff;\n o[35] = (x8 >>> 24) & 0xff;\n\n o[36] = (x9 >>> 0) & 0xff;\n o[37] = (x9 >>> 8) & 0xff;\n o[38] = (x9 >>> 16) & 0xff;\n o[39] = (x9 >>> 24) & 0xff;\n\n o[40] = (x10 >>> 0) & 0xff;\n o[41] = (x10 >>> 8) & 0xff;\n o[42] = (x10 >>> 16) & 0xff;\n o[43] = (x10 >>> 24) & 0xff;\n\n o[44] = (x11 >>> 0) & 0xff;\n o[45] = (x11 >>> 8) & 0xff;\n o[46] = (x11 >>> 16) & 0xff;\n o[47] = (x11 >>> 24) & 0xff;\n\n o[48] = (x12 >>> 0) & 0xff;\n o[49] = (x12 >>> 8) & 0xff;\n o[50] = (x12 >>> 16) & 0xff;\n o[51] = (x12 >>> 24) & 0xff;\n\n o[52] = (x13 >>> 0) & 0xff;\n o[53] = (x13 >>> 8) & 0xff;\n o[54] = (x13 >>> 16) & 0xff;\n o[55] = (x13 >>> 24) & 0xff;\n\n o[56] = (x14 >>> 0) & 0xff;\n o[57] = (x14 >>> 8) & 0xff;\n o[58] = (x14 >>> 16) & 0xff;\n o[59] = (x14 >>> 24) & 0xff;\n\n o[60] = (x15 >>> 0) & 0xff;\n o[61] = (x15 >>> 8) & 0xff;\n o[62] = (x15 >>> 16) & 0xff;\n o[63] = (x15 >>> 24) & 0xff;\n}\n\nfunction core_hsalsa20(\n o: Uint8Array,\n p: Uint8Array,\n k: Uint8Array,\n c: Uint8Array,\n) {\n var j0 =\n (c[0] & 0xff) |\n ((c[1] & 0xff) << 8) |\n ((c[2] & 0xff) << 16) |\n ((c[3] & 0xff) << 24),\n j1 =\n (k[0] & 0xff) |\n ((k[1] & 0xff) << 8) |\n ((k[2] & 0xff) << 16) |\n ((k[3] & 0xff) << 24),\n j2 =\n (k[4] & 0xff) |\n ((k[5] & 0xff) << 8) |\n ((k[6] & 0xff) << 16) |\n ((k[7] & 0xff) << 24),\n j3 =\n (k[8] & 0xff) |\n ((k[9] & 0xff) << 8) |\n ((k[10] & 0xff) << 16) |\n ((k[11] & 0xff) << 24),\n j4 =\n (k[12] & 0xff) |\n ((k[13] & 0xff) << 8) |\n ((k[14] & 0xff) << 16) |\n ((k[15] & 0xff) << 24),\n j5 =\n (c[4] & 0xff) |\n ((c[5] & 0xff) << 8) |\n ((c[6] & 0xff) << 16) |\n ((c[7] & 0xff) << 24),\n j6 =\n (p[0] & 0xff) |\n ((p[1] & 0xff) << 8) |\n ((p[2] & 0xff) << 16) |\n ((p[3] & 0xff) << 24),\n j7 =\n (p[4] & 0xff) |\n ((p[5] & 0xff) << 8) |\n ((p[6] & 0xff) << 16) |\n ((p[7] & 0xff) << 24),\n j8 =\n (p[8] & 0xff) |\n ((p[9] & 0xff) << 8) |\n ((p[10] & 0xff) << 16) |\n ((p[11] & 0xff) << 24),\n j9 =\n (p[12] & 0xff) |\n ((p[13] & 0xff) << 8) |\n ((p[14] & 0xff) << 16) |\n ((p[15] & 0xff) << 24),\n j10 =\n (c[8] & 0xff) |\n ((c[9] & 0xff) << 8) |\n ((c[10] & 0xff) << 16) |\n ((c[11] & 0xff) << 24),\n j11 =\n (k[16] & 0xff) |\n ((k[17] & 0xff) << 8) |\n ((k[18] & 0xff) << 16) |\n ((k[19] & 0xff) << 24),\n j12 =\n (k[20] & 0xff) |\n ((k[21] & 0xff) << 8) |\n ((k[22] & 0xff) << 16) |\n ((k[23] & 0xff) << 24),\n j13 =\n (k[24] & 0xff) |\n ((k[25] & 0xff) << 8) |\n ((k[26] & 0xff) << 16) |\n ((k[27] & 0xff) << 24),\n j14 =\n (k[28] & 0xff) |\n ((k[29] & 0xff) << 8) |\n ((k[30] & 0xff) << 16) |\n ((k[31] & 0xff) << 24),\n j15 =\n (c[12] & 0xff) |\n ((c[13] & 0xff) << 8) |\n ((c[14] & 0xff) << 16) |\n ((c[15] & 0xff) << 24);\n\n var x0 = j0,\n x1 = j1,\n x2 = j2,\n x3 = j3,\n x4 = j4,\n x5 = j5,\n x6 = j6,\n x7 = j7,\n x8 = j8,\n x9 = j9,\n x10 = j10,\n x11 = j11,\n x12 = j12,\n x13 = j13,\n x14 = j14,\n x15 = j15,\n u;\n\n for (var i = 0; i < 20; i += 2) {\n u = (x0 + x12) | 0;\n x4 ^= (u << 7) | (u >>> (32 - 7));\n u = (x4 + x0) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x4) | 0;\n x12 ^= (u << 13) | (u >>> (32 - 13));\n u = (x12 + x8) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x1) | 0;\n x9 ^= (u << 7) | (u >>> (32 - 7));\n u = (x9 + x5) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x9) | 0;\n x1 ^= (u << 13) | (u >>> (32 - 13));\n u = (x1 + x13) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x6) | 0;\n x14 ^= (u << 7) | (u >>> (32 - 7));\n u = (x14 + x10) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x14) | 0;\n x6 ^= (u << 13) | (u >>> (32 - 13));\n u = (x6 + x2) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x11) | 0;\n x3 ^= (u << 7) | (u >>> (32 - 7));\n u = (x3 + x15) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x3) | 0;\n x11 ^= (u << 13) | (u >>> (32 - 13));\n u = (x11 + x7) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x0 + x3) | 0;\n x1 ^= (u << 7) | (u >>> (32 - 7));\n u = (x1 + x0) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x1) | 0;\n x3 ^= (u << 13) | (u >>> (32 - 13));\n u = (x3 + x2) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x4) | 0;\n x6 ^= (u << 7) | (u >>> (32 - 7));\n u = (x6 + x5) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x6) | 0;\n x4 ^= (u << 13) | (u >>> (32 - 13));\n u = (x4 + x7) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x9) | 0;\n x11 ^= (u << 7) | (u >>> (32 - 7));\n u = (x11 + x10) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x11) | 0;\n x9 ^= (u << 13) | (u >>> (32 - 13));\n u = (x9 + x8) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x14) | 0;\n x12 ^= (u << 7) | (u >>> (32 - 7));\n u = (x12 + x15) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x12) | 0;\n x14 ^= (u << 13) | (u >>> (32 - 13));\n u = (x14 + x13) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n }\n\n o[0] = (x0 >>> 0) & 0xff;\n o[1] = (x0 >>> 8) & 0xff;\n o[2] = (x0 >>> 16) & 0xff;\n o[3] = (x0 >>> 24) & 0xff;\n\n o[4] = (x5 >>> 0) & 0xff;\n o[5] = (x5 >>> 8) & 0xff;\n o[6] = (x5 >>> 16) & 0xff;\n o[7] = (x5 >>> 24) & 0xff;\n\n o[8] = (x10 >>> 0) & 0xff;\n o[9] = (x10 >>> 8) & 0xff;\n o[10] = (x10 >>> 16) & 0xff;\n o[11] = (x10 >>> 24) & 0xff;\n\n o[12] = (x15 >>> 0) & 0xff;\n o[13] = (x15 >>> 8) & 0xff;\n o[14] = (x15 >>> 16) & 0xff;\n o[15] = (x15 >>> 24) & 0xff;\n\n o[16] = (x6 >>> 0) & 0xff;\n o[17] = (x6 >>> 8) & 0xff;\n o[18] = (x6 >>> 16) & 0xff;\n o[19] = (x6 >>> 24) & 0xff;\n\n o[20] = (x7 >>> 0) & 0xff;\n o[21] = (x7 >>> 8) & 0xff;\n o[22] = (x7 >>> 16) & 0xff;\n o[23] = (x7 >>> 24) & 0xff;\n\n o[24] = (x8 >>> 0) & 0xff;\n o[25] = (x8 >>> 8) & 0xff;\n o[26] = (x8 >>> 16) & 0xff;\n o[27] = (x8 >>> 24) & 0xff;\n\n o[28] = (x9 >>> 0) & 0xff;\n o[29] = (x9 >>> 8) & 0xff;\n o[30] = (x9 >>> 16) & 0xff;\n o[31] = (x9 >>> 24) & 0xff;\n}\n\nvar sigma = new Uint8Array([\n 101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107,\n]);\n// \"expand 32-byte k\"\n\nfunction crypto_stream_salsa20_xor(\n c: Uint8Array,\n cpos: number,\n m: Uint8Array,\n mpos: number,\n b: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var z = new Uint8Array(16),\n x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < 64; i++) c[cpos + i] = m[mpos + i] ^ x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = (u + (z[i] & 0xff)) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n mpos += 64;\n }\n if (b > 0) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < b; i++) c[cpos + i] = m[mpos + i] ^ x[i];\n }\n return 0;\n}\n\nfunction crypto_stream_salsa20(\n c: Uint8Array,\n cpos: number,\n b: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var z = new Uint8Array(16),\n x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < 64; i++) c[cpos + i] = x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = (u + (z[i] & 0xff)) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n }\n if (b > 0) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < b; i++) c[cpos + i] = x[i];\n }\n return 0;\n}\n\nfunction crypto_stream(\n c: Uint8Array,\n cpos: number,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var s = new Uint8Array(32);\n core_hsalsa20(s, n, k, sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i + 16];\n return crypto_stream_salsa20(c, cpos, d, sn, s);\n}\n\nfunction crypto_stream_xor(\n c: Uint8Array,\n cpos: number,\n m: Uint8Array,\n mpos: number,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var s = new Uint8Array(32);\n core_hsalsa20(s, n, k, sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i + 16];\n return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, sn, s);\n}\n\n/*\n * Port of Andrew Moon's Poly1305-donna-16. Public domain.\n * https://github.com/floodyberry/poly1305-donna\n */\n\nclass poly1305 {\n buffer = new Uint8Array(16);\n r = new Uint16Array(10);\n h = new Uint16Array(10);\n pad = new Uint16Array(8);\n leftover = 0;\n fin = 0;\n\n constructor(key: Uint8Array) {\n var t0, t1, t2, t3, t4, t5, t6, t7;\n\n t0 = (key[0] & 0xff) | ((key[1] & 0xff) << 8);\n this.r[0] = t0 & 0x1fff;\n t1 = (key[2] & 0xff) | ((key[3] & 0xff) << 8);\n this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = (key[4] & 0xff) | ((key[5] & 0xff) << 8);\n this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n t3 = (key[6] & 0xff) | ((key[7] & 0xff) << 8);\n this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = (key[8] & 0xff) | ((key[9] & 0xff) << 8);\n this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this.r[5] = (t4 >>> 1) & 0x1ffe;\n t5 = (key[10] & 0xff) | ((key[11] & 0xff) << 8);\n this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = (key[12] & 0xff) | ((key[13] & 0xff) << 8);\n this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n t7 = (key[14] & 0xff) | ((key[15] & 0xff) << 8);\n this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this.r[9] = (t7 >>> 5) & 0x007f;\n\n this.pad[0] = (key[16] & 0xff) | ((key[17] & 0xff) << 8);\n this.pad[1] = (key[18] & 0xff) | ((key[19] & 0xff) << 8);\n this.pad[2] = (key[20] & 0xff) | ((key[21] & 0xff) << 8);\n this.pad[3] = (key[22] & 0xff) | ((key[23] & 0xff) << 8);\n this.pad[4] = (key[24] & 0xff) | ((key[25] & 0xff) << 8);\n this.pad[5] = (key[26] & 0xff) | ((key[27] & 0xff) << 8);\n this.pad[6] = (key[28] & 0xff) | ((key[29] & 0xff) << 8);\n this.pad[7] = (key[30] & 0xff) | ((key[31] & 0xff) << 8);\n }\n\n blocks(m: Uint8Array, mpos: number, bytes: number) {\n var hibit = this.fin ? 0 : 1 << 11;\n var t0, t1, t2, t3, t4, t5, t6, t7, c;\n var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;\n\n var h0 = this.h[0],\n h1 = this.h[1],\n h2 = this.h[2],\n h3 = this.h[3],\n h4 = this.h[4],\n h5 = this.h[5],\n h6 = this.h[6],\n h7 = this.h[7],\n h8 = this.h[8],\n h9 = this.h[9];\n\n var r0 = this.r[0],\n r1 = this.r[1],\n r2 = this.r[2],\n r3 = this.r[3],\n r4 = this.r[4],\n r5 = this.r[5],\n r6 = this.r[6],\n r7 = this.r[7],\n r8 = this.r[8],\n r9 = this.r[9];\n\n while (bytes >= 16) {\n t0 = (m[mpos + 0] & 0xff) | ((m[mpos + 1] & 0xff) << 8);\n h0 += t0 & 0x1fff;\n t1 = (m[mpos + 2] & 0xff) | ((m[mpos + 3] & 0xff) << 8);\n h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = (m[mpos + 4] & 0xff) | ((m[mpos + 5] & 0xff) << 8);\n h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;\n t3 = (m[mpos + 6] & 0xff) | ((m[mpos + 7] & 0xff) << 8);\n h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = (m[mpos + 8] & 0xff) | ((m[mpos + 9] & 0xff) << 8);\n h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;\n h5 += (t4 >>> 1) & 0x1fff;\n t5 = (m[mpos + 10] & 0xff) | ((m[mpos + 11] & 0xff) << 8);\n h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = (m[mpos + 12] & 0xff) | ((m[mpos + 13] & 0xff) << 8);\n h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;\n t7 = (m[mpos + 14] & 0xff) | ((m[mpos + 15] & 0xff) << 8);\n h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n h9 += (t7 >>> 5) | hibit;\n\n c = 0;\n\n d0 = c;\n d0 += h0 * r0;\n d0 += h1 * (5 * r9);\n d0 += h2 * (5 * r8);\n d0 += h3 * (5 * r7);\n d0 += h4 * (5 * r6);\n c = d0 >>> 13;\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5);\n d0 += h6 * (5 * r4);\n d0 += h7 * (5 * r3);\n d0 += h8 * (5 * r2);\n d0 += h9 * (5 * r1);\n c += d0 >>> 13;\n d0 &= 0x1fff;\n\n d1 = c;\n d1 += h0 * r1;\n d1 += h1 * r0;\n d1 += h2 * (5 * r9);\n d1 += h3 * (5 * r8);\n d1 += h4 * (5 * r7);\n c = d1 >>> 13;\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6);\n d1 += h6 * (5 * r5);\n d1 += h7 * (5 * r4);\n d1 += h8 * (5 * r3);\n d1 += h9 * (5 * r2);\n c += d1 >>> 13;\n d1 &= 0x1fff;\n\n d2 = c;\n d2 += h0 * r2;\n d2 += h1 * r1;\n d2 += h2 * r0;\n d2 += h3 * (5 * r9);\n d2 += h4 * (5 * r8);\n c = d2 >>> 13;\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7);\n d2 += h6 * (5 * r6);\n d2 += h7 * (5 * r5);\n d2 += h8 * (5 * r4);\n d2 += h9 * (5 * r3);\n c += d2 >>> 13;\n d2 &= 0x1fff;\n\n d3 = c;\n d3 += h0 * r3;\n d3 += h1 * r2;\n d3 += h2 * r1;\n d3 += h3 * r0;\n d3 += h4 * (5 * r9);\n c = d3 >>> 13;\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8);\n d3 += h6 * (5 * r7);\n d3 += h7 * (5 * r6);\n d3 += h8 * (5 * r5);\n d3 += h9 * (5 * r4);\n c += d3 >>> 13;\n d3 &= 0x1fff;\n\n d4 = c;\n d4 += h0 * r4;\n d4 += h1 * r3;\n d4 += h2 * r2;\n d4 += h3 * r1;\n d4 += h4 * r0;\n c = d4 >>> 13;\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9);\n d4 += h6 * (5 * r8);\n d4 += h7 * (5 * r7);\n d4 += h8 * (5 * r6);\n d4 += h9 * (5 * r5);\n c += d4 >>> 13;\n d4 &= 0x1fff;\n\n d5 = c;\n d5 += h0 * r5;\n d5 += h1 * r4;\n d5 += h2 * r3;\n d5 += h3 * r2;\n d5 += h4 * r1;\n c = d5 >>> 13;\n d5 &= 0x1fff;\n d5 += h5 * r0;\n d5 += h6 * (5 * r9);\n d5 += h7 * (5 * r8);\n d5 += h8 * (5 * r7);\n d5 += h9 * (5 * r6);\n c += d5 >>> 13;\n d5 &= 0x1fff;\n\n d6 = c;\n d6 += h0 * r6;\n d6 += h1 * r5;\n d6 += h2 * r4;\n d6 += h3 * r3;\n d6 += h4 * r2;\n c = d6 >>> 13;\n d6 &= 0x1fff;\n d6 += h5 * r1;\n d6 += h6 * r0;\n d6 += h7 * (5 * r9);\n d6 += h8 * (5 * r8);\n d6 += h9 * (5 * r7);\n c += d6 >>> 13;\n d6 &= 0x1fff;\n\n d7 = c;\n d7 += h0 * r7;\n d7 += h1 * r6;\n d7 += h2 * r5;\n d7 += h3 * r4;\n d7 += h4 * r3;\n c = d7 >>> 13;\n d7 &= 0x1fff;\n d7 += h5 * r2;\n d7 += h6 * r1;\n d7 += h7 * r0;\n d7 += h8 * (5 * r9);\n d7 += h9 * (5 * r8);\n c += d7 >>> 13;\n d7 &= 0x1fff;\n\n d8 = c;\n d8 += h0 * r8;\n d8 += h1 * r7;\n d8 += h2 * r6;\n d8 += h3 * r5;\n d8 += h4 * r4;\n c = d8 >>> 13;\n d8 &= 0x1fff;\n d8 += h5 * r3;\n d8 += h6 * r2;\n d8 += h7 * r1;\n d8 += h8 * r0;\n d8 += h9 * (5 * r9);\n c += d8 >>> 13;\n d8 &= 0x1fff;\n\n d9 = c;\n d9 += h0 * r9;\n d9 += h1 * r8;\n d9 += h2 * r7;\n d9 += h3 * r6;\n d9 += h4 * r5;\n c = d9 >>> 13;\n d9 &= 0x1fff;\n d9 += h5 * r4;\n d9 += h6 * r3;\n d9 += h7 * r2;\n d9 += h8 * r1;\n d9 += h9 * r0;\n c += d9 >>> 13;\n d9 &= 0x1fff;\n\n c = ((c << 2) + c) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = c >>> 13;\n d1 += c;\n\n h0 = d0;\n h1 = d1;\n h2 = d2;\n h3 = d3;\n h4 = d4;\n h5 = d5;\n h6 = d6;\n h7 = d7;\n h8 = d8;\n h9 = d9;\n\n mpos += 16;\n bytes -= 16;\n }\n this.h[0] = h0;\n this.h[1] = h1;\n this.h[2] = h2;\n this.h[3] = h3;\n this.h[4] = h4;\n this.h[5] = h5;\n this.h[6] = h6;\n this.h[7] = h7;\n this.h[8] = h8;\n this.h[9] = h9;\n }\n\n finish(mac: Uint8Array, macpos: number) {\n var g = new Uint16Array(10);\n var c, mask, f, i;\n\n if (this.leftover) {\n i = this.leftover;\n this.buffer[i++] = 1;\n for (; i < 16; i++) this.buffer[i] = 0;\n this.fin = 1;\n this.blocks(this.buffer, 0, 16);\n }\n\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n for (i = 2; i < 10; i++) {\n this.h[i] += c;\n c = this.h[i] >>> 13;\n this.h[i] &= 0x1fff;\n }\n this.h[0] += c * 5;\n c = this.h[0] >>> 13;\n this.h[0] &= 0x1fff;\n this.h[1] += c;\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n this.h[2] += c;\n\n g[0] = this.h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (i = 1; i < 10; i++) {\n g[i] = this.h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= 1 << 13;\n\n mask = (c ^ 1) - 1;\n for (i = 0; i < 10; i++) g[i] &= mask;\n mask = ~mask;\n for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];\n\n this.h[0] = (this.h[0] | (this.h[1] << 13)) & 0xffff;\n this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10)) & 0xffff;\n this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7)) & 0xffff;\n this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4)) & 0xffff;\n this.h[4] =\n ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;\n this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11)) & 0xffff;\n this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8)) & 0xffff;\n this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5)) & 0xffff;\n\n f = this.h[0] + this.pad[0];\n this.h[0] = f & 0xffff;\n for (i = 1; i < 8; i++) {\n f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;\n this.h[i] = f & 0xffff;\n }\n\n mac[macpos + 0] = (this.h[0] >>> 0) & 0xff;\n mac[macpos + 1] = (this.h[0] >>> 8) & 0xff;\n mac[macpos + 2] = (this.h[1] >>> 0) & 0xff;\n mac[macpos + 3] = (this.h[1] >>> 8) & 0xff;\n mac[macpos + 4] = (this.h[2] >>> 0) & 0xff;\n mac[macpos + 5] = (this.h[2] >>> 8) & 0xff;\n mac[macpos + 6] = (this.h[3] >>> 0) & 0xff;\n mac[macpos + 7] = (this.h[3] >>> 8) & 0xff;\n mac[macpos + 8] = (this.h[4] >>> 0) & 0xff;\n mac[macpos + 9] = (this.h[4] >>> 8) & 0xff;\n mac[macpos + 10] = (this.h[5] >>> 0) & 0xff;\n mac[macpos + 11] = (this.h[5] >>> 8) & 0xff;\n mac[macpos + 12] = (this.h[6] >>> 0) & 0xff;\n mac[macpos + 13] = (this.h[6] >>> 8) & 0xff;\n mac[macpos + 14] = (this.h[7] >>> 0) & 0xff;\n mac[macpos + 15] = (this.h[7] >>> 8) & 0xff;\n }\n\n update(m: Uint8Array, mpos: number, bytes: number) {\n let i: number;\n let want: number;\n if (this.leftover) {\n want = 16 - this.leftover;\n if (want > bytes) want = bytes;\n for (i = 0; i < want; i++) this.buffer[this.leftover + i] = m[mpos + i];\n bytes -= want;\n mpos += want;\n this.leftover += want;\n if (this.leftover < 16) return;\n this.blocks(this.buffer, 0, 16);\n this.leftover = 0;\n }\n\n if (bytes >= 16) {\n want = bytes - (bytes % 16);\n this.blocks(m, mpos, want);\n mpos += want;\n bytes -= want;\n }\n\n if (bytes) {\n for (i = 0; i < bytes; i++) this.buffer[this.leftover + i] = m[mpos + i];\n this.leftover += bytes;\n }\n }\n}\n\nfunction crypto_onetimeauth(\n out: Uint8Array,\n outpos: number,\n m: any,\n mpos: number,\n n: number,\n k: Uint8Array,\n) {\n var s = new poly1305(k);\n s.update(m, mpos, n);\n s.finish(out, outpos);\n return 0;\n}\n\nfunction crypto_onetimeauth_verify(\n h: Uint8Array,\n hpos: number,\n m: any,\n mpos: number,\n n: number,\n k: Uint8Array,\n) {\n var x = new Uint8Array(16);\n crypto_onetimeauth(x, 0, m, mpos, n, k);\n return crypto_verify_16(h, hpos, x, 0);\n}\n\nfunction crypto_secretbox(\n c: Uint8Array,\n m: Uint8Array,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n): number {\n var i;\n if (d < 32) return -1;\n crypto_stream_xor(c, 0, m, 0, d, n, k);\n crypto_onetimeauth(c, 16, c, 32, d - 32, c);\n for (i = 0; i < 16; i++) c[i] = 0;\n return 0;\n}\n\nfunction crypto_secretbox_open(\n m: Uint8Array,\n c: Uint8Array,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n): number {\n var i;\n var x = new Uint8Array(32);\n if (d < 32) return -1;\n crypto_stream(x, 0, 32, n, k);\n if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) return -1;\n crypto_stream_xor(m, 0, c, 0, d, n, k);\n for (i = 0; i < 32; i++) m[i] = 0;\n return 0;\n}\n\nfunction set25519(r: Float64Array, a: Float64Array): void {\n let i;\n for (i = 0; i < 16; i++) r[i] = a[i] | 0;\n}\n\nfunction car25519(o: Float64Array): void {\n let i,\n v,\n c = 1;\n for (i = 0; i < 16; i++) {\n v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c - 1 + 37 * (c - 1);\n}\n\nfunction sel25519(p: Float64Array, q: Float64Array, b: number): void {\n let t;\n const c = ~(b - 1);\n for (let i = 0; i < 16; i++) {\n t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\n\nfunction pack25519(o: Uint8Array, n: Float64Array): void {\n let i, j, b;\n const m = gf(),\n t = gf();\n for (i = 0; i < 16; i++) t[i] = n[i];\n car25519(t);\n car25519(t);\n car25519(t);\n for (j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);\n m[i - 1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);\n b = (m[15] >> 16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1 - b);\n }\n for (i = 0; i < 16; i++) {\n o[2 * i] = t[i] & 0xff;\n o[2 * i + 1] = t[i] >> 8;\n }\n}\n\nfunction neq25519(a: Float64Array, b: Float64Array): number {\n const c = new Uint8Array(32),\n d = new Uint8Array(32);\n pack25519(c, a);\n pack25519(d, b);\n return crypto_verify_32(c, 0, d, 0);\n}\n\nfunction par25519(a: Float64Array): number {\n const d = new Uint8Array(32);\n pack25519(d, a);\n return d[0] & 1;\n}\n\nfunction unpack25519(o: Float64Array, n: Uint8Array): void {\n let i;\n for (i = 0; i < 16; i++) o[i] = n[2 * i] + (n[2 * i + 1] << 8);\n o[15] &= 0x7fff;\n}\n\nfunction A(o: Float64Array, a: Float64Array, b: Float64Array): void {\n for (let i = 0; i < 16; i++) o[i] = a[i] + b[i];\n}\n\nfunction Z(o: Float64Array, a: Float64Array, b: Float64Array): void {\n for (let i = 0; i < 16; i++) o[i] = a[i] - b[i];\n}\n\nfunction M(o: Float64Array, a: Float64Array, b: Float64Array): void {\n let v,\n c,\n t0 = 0,\n t1 = 0,\n t2 = 0,\n t3 = 0,\n t4 = 0,\n t5 = 0,\n t6 = 0,\n t7 = 0,\n t8 = 0,\n t9 = 0,\n t10 = 0,\n t11 = 0,\n t12 = 0,\n t13 = 0,\n t14 = 0,\n t15 = 0,\n t16 = 0,\n t17 = 0,\n t18 = 0,\n t19 = 0,\n t20 = 0,\n t21 = 0,\n t22 = 0,\n t23 = 0,\n t24 = 0,\n t25 = 0,\n t26 = 0,\n t27 = 0,\n t28 = 0,\n t29 = 0,\n t30 = 0;\n const b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11],\n b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n\n // first car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n\n // second car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n\n o[0] = t0;\n o[1] = t1;\n o[2] = t2;\n o[3] = t3;\n o[4] = t4;\n o[5] = t5;\n o[6] = t6;\n o[7] = t7;\n o[8] = t8;\n o[9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\n\nfunction S(o: Float64Array, a: Float64Array): void {\n M(o, a, a);\n}\n\nfunction inv25519(o: Float64Array, i: Float64Array): void {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 253; a >= 0; a--) {\n S(c, c);\n if (a !== 2 && a !== 4) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction pow2523(o: Float64Array, i: Float64Array): void {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 250; a >= 0; a--) {\n S(c, c);\n if (a !== 1) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction crypto_scalarmult(\n q: Uint8Array,\n n: Uint8Array,\n p: Uint8Array,\n): number {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n let r;\n let i;\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n z[31] = (n[31] & 127) | 64;\n z[0] &= 248;\n unpack25519(x, p);\n for (i = 0; i < 16; i++) {\n b[i] = x[i];\n d[i] = a[i] = c[i] = 0;\n }\n a[0] = d[0] = 1;\n for (i = 254; i >= 0; --i) {\n r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n A(e, a, c);\n Z(a, a, c);\n A(c, b, d);\n Z(b, b, d);\n S(d, e);\n S(f, a);\n M(a, c, a);\n M(c, b, e);\n A(e, a, c);\n Z(a, a, c);\n S(b, a);\n Z(c, d, f);\n M(a, c, _121665);\n A(a, a, d);\n M(c, c, a);\n M(a, d, f);\n M(d, b, x);\n S(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n M(x16, x16, x32);\n pack25519(q, x16);\n return 0;\n}\n\nfunction crypto_scalarmult_base(q: Uint8Array, n: Uint8Array): number {\n return crypto_scalarmult(q, n, _9);\n}\n\nexport function crypto_scalarmult_noclamp(\n q: Uint8Array,\n n: Uint8Array,\n p: Uint8Array,\n): number {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n let r;\n let i;\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n unpack25519(x, p);\n for (i = 0; i < 16; i++) {\n b[i] = x[i];\n d[i] = a[i] = c[i] = 0;\n }\n a[0] = d[0] = 1;\n for (i = 254; i >= 0; --i) {\n r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n A(e, a, c);\n Z(a, a, c);\n A(c, b, d);\n Z(b, b, d);\n S(d, e);\n S(f, a);\n M(a, c, a);\n M(c, b, e);\n A(e, a, c);\n Z(a, a, c);\n S(b, a);\n Z(c, d, f);\n M(a, c, _121665);\n A(a, a, d);\n M(c, c, a);\n M(a, d, f);\n M(d, b, x);\n S(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n M(x16, x16, x32);\n pack25519(q, x16);\n return 0;\n}\n\nexport function crypto_scalarmult_base_noclamp(\n q: Uint8Array,\n n: Uint8Array,\n): number {\n return crypto_scalarmult_noclamp(q, n, _9);\n}\n\n// prettier-ignore\nconst K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction crypto_hashblocks_hl(\n hh: Int32Array,\n hl: Int32Array,\n m: Uint8Array,\n n: number,\n): number {\n const wh = new Int32Array(16),\n wl = new Int32Array(16);\n let bh0,\n bh1,\n bh2,\n bh3,\n bh4,\n bh5,\n bh6,\n bh7,\n bl0,\n bl1,\n bl2,\n bl3,\n bl4,\n bl5,\n bl6,\n bl7,\n th,\n tl,\n i,\n j,\n h,\n l,\n a,\n b,\n c,\n d;\n\n let ah0 = hh[0],\n ah1 = hh[1],\n ah2 = hh[2],\n ah3 = hh[3],\n ah4 = hh[4],\n ah5 = hh[5],\n ah6 = hh[6],\n ah7 = hh[7],\n al0 = hl[0],\n al1 = hl[1],\n al2 = hl[2],\n al3 = hl[3],\n al4 = hl[4],\n al5 = hl[5],\n al6 = hl[6],\n al7 = hl[7];\n\n let pos = 0;\n while (n >= 128) {\n for (i = 0; i < 16; i++) {\n j = 8 * i + pos;\n wh[i] = (m[j + 0] << 24) | (m[j + 1] << 16) | (m[j + 2] << 8) | m[j + 3];\n wl[i] = (m[j + 4] << 24) | (m[j + 5] << 16) | (m[j + 6] << 8) | m[j + 7];\n }\n for (i = 0; i < 80; i++) {\n bh0 = ah0;\n bh1 = ah1;\n bh2 = ah2;\n bh3 = ah3;\n bh4 = ah4;\n bh5 = ah5;\n bh6 = ah6;\n bh7 = ah7;\n\n bl0 = al0;\n bl1 = al1;\n bl2 = al2;\n bl3 = al3;\n bl4 = al4;\n bl5 = al5;\n bl6 = al6;\n bl7 = al7;\n\n // add\n h = ah7;\n l = al7;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n // Sigma1\n h =\n ((ah4 >>> 14) | (al4 << (32 - 14))) ^\n ((ah4 >>> 18) | (al4 << (32 - 18))) ^\n ((al4 >>> (41 - 32)) | (ah4 << (32 - (41 - 32))));\n l =\n ((al4 >>> 14) | (ah4 << (32 - 14))) ^\n ((al4 >>> 18) | (ah4 << (32 - 18))) ^\n ((ah4 >>> (41 - 32)) | (al4 << (32 - (41 - 32))));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // Ch\n h = (ah4 & ah5) ^ (~ah4 & ah6);\n l = (al4 & al5) ^ (~al4 & al6);\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // K\n h = K[i * 2];\n l = K[i * 2 + 1];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // w\n h = wh[i % 16];\n l = wl[i % 16];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n th = (c & 0xffff) | (d << 16);\n tl = (a & 0xffff) | (b << 16);\n\n // add\n h = th;\n l = tl;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n // Sigma0\n h =\n ((ah0 >>> 28) | (al0 << (32 - 28))) ^\n ((al0 >>> (34 - 32)) | (ah0 << (32 - (34 - 32)))) ^\n ((al0 >>> (39 - 32)) | (ah0 << (32 - (39 - 32))));\n l =\n ((al0 >>> 28) | (ah0 << (32 - 28))) ^\n ((ah0 >>> (34 - 32)) | (al0 << (32 - (34 - 32)))) ^\n ((ah0 >>> (39 - 32)) | (al0 << (32 - (39 - 32))));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // Maj\n h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);\n l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh7 = (c & 0xffff) | (d << 16);\n bl7 = (a & 0xffff) | (b << 16);\n\n // add\n h = bh3;\n l = bl3;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = th;\n l = tl;\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh3 = (c & 0xffff) | (d << 16);\n bl3 = (a & 0xffff) | (b << 16);\n\n ah1 = bh0;\n ah2 = bh1;\n ah3 = bh2;\n ah4 = bh3;\n ah5 = bh4;\n ah6 = bh5;\n ah7 = bh6;\n ah0 = bh7;\n\n al1 = bl0;\n al2 = bl1;\n al3 = bl2;\n al4 = bl3;\n al5 = bl4;\n al6 = bl5;\n al7 = bl6;\n al0 = bl7;\n\n if (i % 16 === 15) {\n for (j = 0; j < 16; j++) {\n // add\n h = wh[j];\n l = wl[j];\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = wh[(j + 9) % 16];\n l = wl[(j + 9) % 16];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // sigma0\n th = wh[(j + 1) % 16];\n tl = wl[(j + 1) % 16];\n h =\n ((th >>> 1) | (tl << (32 - 1))) ^\n ((th >>> 8) | (tl << (32 - 8))) ^\n (th >>> 7);\n l =\n ((tl >>> 1) | (th << (32 - 1))) ^\n ((tl >>> 8) | (th << (32 - 8))) ^\n ((tl >>> 7) | (th << (32 - 7)));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // sigma1\n th = wh[(j + 14) % 16];\n tl = wl[(j + 14) % 16];\n h =\n ((th >>> 19) | (tl << (32 - 19))) ^\n ((tl >>> (61 - 32)) | (th << (32 - (61 - 32)))) ^\n (th >>> 6);\n l =\n ((tl >>> 19) | (th << (32 - 19))) ^\n ((th >>> (61 - 32)) | (tl << (32 - (61 - 32)))) ^\n ((tl >>> 6) | (th << (32 - 6)));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n wh[j] = (c & 0xffff) | (d << 16);\n wl[j] = (a & 0xffff) | (b << 16);\n }\n }\n }\n\n // add\n h = ah0;\n l = al0;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[0];\n l = hl[0];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[0] = ah0 = (c & 0xffff) | (d << 16);\n hl[0] = al0 = (a & 0xffff) | (b << 16);\n\n h = ah1;\n l = al1;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[1];\n l = hl[1];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[1] = ah1 = (c & 0xffff) | (d << 16);\n hl[1] = al1 = (a & 0xffff) | (b << 16);\n\n h = ah2;\n l = al2;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[2];\n l = hl[2];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[2] = ah2 = (c & 0xffff) | (d << 16);\n hl[2] = al2 = (a & 0xffff) | (b << 16);\n\n h = ah3;\n l = al3;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[3];\n l = hl[3];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[3] = ah3 = (c & 0xffff) | (d << 16);\n hl[3] = al3 = (a & 0xffff) | (b << 16);\n\n h = ah4;\n l = al4;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[4];\n l = hl[4];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[4] = ah4 = (c & 0xffff) | (d << 16);\n hl[4] = al4 = (a & 0xffff) | (b << 16);\n\n h = ah5;\n l = al5;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[5];\n l = hl[5];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[5] = ah5 = (c & 0xffff) | (d << 16);\n hl[5] = al5 = (a & 0xffff) | (b << 16);\n\n h = ah6;\n l = al6;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[6];\n l = hl[6];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[6] = ah6 = (c & 0xffff) | (d << 16);\n hl[6] = al6 = (a & 0xffff) | (b << 16);\n\n h = ah7;\n l = al7;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[7];\n l = hl[7];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[7] = ah7 = (c & 0xffff) | (d << 16);\n hl[7] = al7 = (a & 0xffff) | (b << 16);\n\n pos += 128;\n n -= 128;\n }\n\n return n;\n}\n\nfunction crypto_hash(out: Uint8Array, m: Uint8Array, n: number): number {\n const hh = new Int32Array(8);\n const hl = new Int32Array(8);\n const x = new Uint8Array(256);\n const b = n;\n\n hh[0] = 0x6a09e667;\n hh[1] = 0xbb67ae85;\n hh[2] = 0x3c6ef372;\n hh[3] = 0xa54ff53a;\n hh[4] = 0x510e527f;\n hh[5] = 0x9b05688c;\n hh[6] = 0x1f83d9ab;\n hh[7] = 0x5be0cd19;\n\n hl[0] = 0xf3bcc908;\n hl[1] = 0x84caa73b;\n hl[2] = 0xfe94f82b;\n hl[3] = 0x5f1d36f1;\n hl[4] = 0xade682d1;\n hl[5] = 0x2b3e6c1f;\n hl[6] = 0xfb41bd6b;\n hl[7] = 0x137e2179;\n\n crypto_hashblocks_hl(hh, hl, m, n);\n n %= 128;\n\n for (let i = 0; i < n; i++) x[i] = m[b - n + i];\n x[n] = 128;\n\n n = 256 - 128 * (n < 112 ? 1 : 0);\n x[n - 9] = 0;\n ts64(x, n - 8, (b / 0x20000000) | 0, b << 3);\n crypto_hashblocks_hl(hh, hl, x, n);\n\n for (let i = 0; i < 8; i++) ts64(out, 8 * i, hh[i], hl[i]);\n\n return 0;\n}\n\n/**\n * Incremental version of crypto_hash.\n */\nexport class HashState {\n private hh = new Int32Array(8);\n private hl = new Int32Array(8);\n\n private next = new Uint8Array(128);\n private p = 0;\n private total = 0;\n\n constructor() {\n this.hh[0] = 0x6a09e667;\n this.hh[1] = 0xbb67ae85;\n this.hh[2] = 0x3c6ef372;\n this.hh[3] = 0xa54ff53a;\n this.hh[4] = 0x510e527f;\n this.hh[5] = 0x9b05688c;\n this.hh[6] = 0x1f83d9ab;\n this.hh[7] = 0x5be0cd19;\n\n this.hl[0] = 0xf3bcc908;\n this.hl[1] = 0x84caa73b;\n this.hl[2] = 0xfe94f82b;\n this.hl[3] = 0x5f1d36f1;\n this.hl[4] = 0xade682d1;\n this.hl[5] = 0x2b3e6c1f;\n this.hl[6] = 0xfb41bd6b;\n this.hl[7] = 0x137e2179;\n }\n\n update(data: Uint8Array): HashState {\n this.total += data.length;\n let i = 0;\n while (i < data.length) {\n const r = 128 - this.p;\n if (r > data.length - i) {\n for (let j = 0; i + j < data.length; j++) {\n this.next[this.p + j] = data[i + j];\n }\n this.p += data.length - i;\n break;\n } else {\n for (let j = 0; this.p + j < 128; j++) {\n this.next[this.p + j] = data[i + j];\n }\n crypto_hashblocks_hl(this.hh, this.hl, this.next, 128);\n i += 128 - this.p;\n this.p = 0;\n }\n }\n return this;\n }\n\n finish(): Uint8Array {\n const out = new Uint8Array(64);\n let n = this.p;\n const x = new Uint8Array(256);\n const b = this.total;\n for (let i = 0; i < n; i++) x[i] = this.next[i];\n x[n] = 128;\n\n n = 256 - 128 * (n < 112 ? 1 : 0);\n x[n - 9] = 0;\n ts64(x, n - 8, (b / 0x20000000) | 0, b << 3);\n crypto_hashblocks_hl(this.hh, this.hl, x, n);\n\n for (let i = 0; i < 8; i++) ts64(out, 8 * i, this.hh[i], this.hl[i]);\n return out;\n }\n}\n\nfunction add(p: Float64Array[], q: Float64Array[]): void {\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf(),\n g = gf(),\n h = gf(),\n t = gf();\n\n Z(a, p[1], p[0]);\n Z(t, q[1], q[0]);\n M(a, a, t);\n A(b, p[0], p[1]);\n A(t, q[0], q[1]);\n M(b, b, t);\n M(c, p[3], q[3]);\n M(c, c, D2);\n M(d, p[2], q[2]);\n A(d, d, d);\n Z(e, b, a);\n Z(f, d, c);\n A(g, d, c);\n A(h, b, a);\n\n M(p[0], e, f);\n M(p[1], h, g);\n M(p[2], g, f);\n M(p[3], e, h);\n}\n\nfunction cswap(p: Float64Array[], q: Float64Array[], b: number): void {\n let i;\n for (i = 0; i < 4; i++) {\n sel25519(p[i], q[i], b);\n }\n}\n\nfunction pack(r: Uint8Array, p: Float64Array[]): void {\n const tx = gf(),\n ty = gf(),\n zi = gf();\n inv25519(zi, p[2]);\n M(tx, p[0], zi);\n M(ty, p[1], zi);\n pack25519(r, ty);\n r[31] ^= par25519(tx) << 7;\n}\n\n/**\n * Ed25519 scalar multiplication\n */\nfunction scalarmult(p: Float64Array[], q: Float64Array[], s: Uint8Array): void {\n let b, i;\n set25519(p[0], gf0);\n set25519(p[1], gf1);\n set25519(p[2], gf1);\n set25519(p[3], gf0);\n for (i = 255; i >= 0; --i) {\n b = (s[(i / 8) | 0] >> (i & 7)) & 1;\n cswap(p, q, b);\n add(q, p);\n add(p, p);\n cswap(p, q, b);\n }\n}\n\nfunction scalarbase(p: Float64Array[], s: Uint8Array): void {\n const q = [gf(), gf(), gf(), gf()];\n set25519(q[0], X);\n set25519(q[1], Y);\n set25519(q[2], gf1);\n M(q[3], X, Y);\n scalarmult(p, q, s);\n}\n\nfunction crypto_sign_keypair(\n pk: Uint8Array,\n sk: Uint8Array,\n seeded: boolean,\n): number {\n const d = new Uint8Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n if (!seeded) randombytes(sk, 32);\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n for (let i = 0; i < 32; i++) sk[i + 32] = pk[i];\n return 0;\n}\n\nexport const L = new Float64Array([\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde,\n 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,\n]);\n\nfunction modL(r: Uint8Array, x: Float64Array): void {\n let carry, i, j, k;\n for (i = 63; i >= 32; --i) {\n carry = 0;\n for (j = i - 32, k = i - 12; j < k; ++j) {\n x[j] += carry - 16 * x[i] * L[j - (i - 32)];\n carry = Math.floor((x[j] + 128) / 256);\n x[j] -= carry * 256;\n }\n x[j] += carry;\n x[i] = 0;\n }\n carry = 0;\n for (j = 0; j < 32; j++) {\n x[j] += carry - (x[31] >> 4) * L[j];\n carry = x[j] >> 8;\n x[j] &= 255;\n }\n for (j = 0; j < 32; j++) x[j] -= carry * L[j];\n for (i = 0; i < 32; i++) {\n x[i + 1] += x[i] >> 8;\n r[i] = x[i] & 255;\n }\n}\n\nfunction reduce(r: Uint8Array): void {\n const x = new Float64Array(64);\n for (let i = 0; i < 64; i++) x[i] = r[i];\n for (let i = 0; i < 64; i++) r[i] = 0;\n modL(r, x);\n}\n\n// Note: difference from C - smlen returned, not passed as argument.\nfunction crypto_sign(\n sm: Uint8Array,\n m: Uint8Array,\n n: number,\n sk: Uint8Array,\n): number {\n const d = new Uint8Array(64),\n h = new Uint8Array(64),\n r = new Uint8Array(64);\n let i, j;\n const x = new Float64Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n const smlen = n + 64;\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];\n\n crypto_hash(r, sm.subarray(32), n + 32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = sk[i];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i + j] += h[i] * d[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return smlen;\n}\n\nfunction unpackpos(r: Float64Array[], p: Uint8Array): number {\n // FIXME: implement directly\n const q = [gf(), gf(), gf(), gf()];\n if (unpackneg(q, p)) return -1;\n const scalar0 = new Uint8Array(32);\n const scalar1 = new Uint8Array(32);\n scalar1[0] = 1;\n const scalarNeg1 = crypto_core_ed25519_scalar_sub(scalar0, scalar1);\n scalarmult(r, q, scalarNeg1);\n return 0;\n}\n\nfunction unpackneg(r: Float64Array[], p: Uint8Array): number {\n const t = gf();\n const chk = gf();\n const num = gf();\n const den = gf();\n const den2 = gf();\n const den4 = gf();\n const den6 = gf();\n\n set25519(r[2], gf1);\n unpack25519(r[1], p);\n S(num, r[1]);\n M(den, num, D);\n Z(num, num, r[2]);\n A(den, r[2], den);\n\n S(den2, den);\n S(den4, den2);\n M(den6, den4, den2);\n M(t, den6, num);\n M(t, t, den);\n\n pow2523(t, t);\n M(t, t, num);\n M(t, t, den);\n M(t, t, den);\n M(r[0], t, den);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) M(r[0], r[0], I);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) return -1;\n\n if (par25519(r[0]) === p[31] >> 7) Z(r[0], gf0, r[0]);\n\n M(r[3], r[0], r[1]);\n return 0;\n}\n\nexport function crypto_scalarmult_ed25519_base_noclamp(\n s: Uint8Array,\n): Uint8Array {\n const r = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n\n scalarbase(p, s);\n pack(r, p);\n return r;\n}\n\nexport function crypto_scalarmult_ed25519_noclamp(\n s: Uint8Array,\n q: Uint8Array,\n): Uint8Array {\n const r = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n const ql = [gf(), gf(), gf(), gf()];\n\n if (unpackpos(ql, q)) throw new Error();\n scalarmult(p, ql, s);\n pack(r, p);\n return r;\n}\n\nexport function crypto_core_ed25519_add(\n p1: Uint8Array,\n p2: Uint8Array,\n): Uint8Array {\n const q1 = [gf(), gf(), gf(), gf()];\n const q2 = [gf(), gf(), gf(), gf()];\n const res = new Uint8Array(32);\n if (unpackpos(q1, p1)) throw new Error();\n if (unpackpos(q2, p2)) throw new Error();\n add(q1, q2);\n pack(res, q1);\n return res;\n}\n\nfunction crypto_sign_open(\n m: Uint8Array,\n sm: Uint8Array,\n n: number,\n pk: Uint8Array,\n): number {\n let i, mlen;\n const t = new Uint8Array(32),\n h = new Uint8Array(64);\n const p = [gf(), gf(), gf(), gf()],\n q = [gf(), gf(), gf(), gf()];\n\n mlen = -1;\n if (n < 64) return -1;\n\n if (unpackneg(q, pk)) return -1;\n\n for (i = 0; i < n; i++) m[i] = sm[i];\n for (i = 0; i < 32; i++) m[i + 32] = pk[i];\n crypto_hash(h, m, n);\n reduce(h);\n scalarmult(p, q, h);\n\n scalarbase(q, sm.subarray(32));\n add(p, q);\n pack(t, p);\n\n n -= 64;\n if (crypto_verify_32(sm, 0, t, 0)) {\n for (i = 0; i < n; i++) m[i] = 0;\n return -1;\n }\n\n for (i = 0; i < n; i++) m[i] = sm[i + 64];\n mlen = n;\n return mlen;\n}\n\nconst crypto_secretbox_KEYBYTES = 32;\nconst crypto_secretbox_NONCEBYTES = 24;\nconst crypto_secretbox_ZEROBYTES = 32;\nconst crypto_secretbox_BOXZEROBYTES = 16;\nconst crypto_scalarmult_BYTES = 32;\nconst crypto_scalarmult_SCALARBYTES = 32;\nconst crypto_sign_BYTES = 64;\nconst crypto_sign_PUBLICKEYBYTES = 32;\nconst crypto_sign_SECRETKEYBYTES = 64;\nconst crypto_sign_SEEDBYTES = 32;\nconst crypto_hash_BYTES = 64;\n\n/* High-level API */\n\nfunction checkLengths(k: Uint8Array, n: Uint8Array) {\n if (k.length !== crypto_secretbox_KEYBYTES) throw new Error(\"bad key size\");\n if (n.length !== crypto_secretbox_NONCEBYTES)\n throw new Error(\"bad nonce size\");\n}\n\nfunction checkArrayTypes(...args: Uint8Array[]): void {\n for (let i = 0; i < args.length; i++) {\n if (!(args[i] instanceof Uint8Array))\n throw new TypeError(\"unexpected type, use Uint8Array\");\n }\n}\n\nexport function randomBytes(n: number): Uint8Array {\n const b = new Uint8Array(n);\n randombytes(b, n);\n return b;\n}\n\nexport function scalarMult(n: Uint8Array, p: Uint8Array): Uint8Array {\n checkArrayTypes(n, p);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\"bad n size\");\n if (p.length !== crypto_scalarmult_BYTES) throw new Error(\"bad p size\");\n const q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult(q, n, p);\n return q;\n}\n\nexport function scalarMult_base(n: Uint8Array): Uint8Array {\n checkArrayTypes(n);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\"bad n size\");\n const q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult_base(q, n);\n return q;\n}\n\nexport const scalarMult_scalarLength = crypto_scalarmult_SCALARBYTES;\nexport const scalarMult_groupElementLength = crypto_scalarmult_BYTES;\n\nexport function sign(msg: Uint8Array, secretKey: Uint8Array): Uint8Array {\n checkArrayTypes(msg, secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\"bad secret key size\");\n const signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length);\n crypto_sign(signedMsg, msg, msg.length, secretKey);\n return signedMsg;\n}\n\nexport function sign_open(\n signedMsg: Uint8Array,\n publicKey: Uint8Array,\n): Uint8Array | null {\n checkArrayTypes(signedMsg, publicKey);\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const tmp = new Uint8Array(signedMsg.length);\n const mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);\n if (mlen < 0) return null;\n const m = new Uint8Array(mlen);\n for (let i = 0; i < m.length; i++) m[i] = tmp[i];\n return m;\n}\n\nexport function sign_detached(\n msg: Uint8Array,\n secretKey: Uint8Array,\n): Uint8Array {\n const signedMsg = sign(msg, secretKey);\n const sig = new Uint8Array(crypto_sign_BYTES);\n for (let i = 0; i < sig.length; i++) sig[i] = signedMsg[i];\n return sig;\n}\n\nexport function sign_detached_verify(\n msg: Uint8Array,\n sig: Uint8Array,\n publicKey: Uint8Array,\n): boolean {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES) throw new Error(\"bad signature size\");\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n const m = new Uint8Array(crypto_sign_BYTES + msg.length);\n let i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i];\n return crypto_sign_open(m, sm, sm.length, publicKey) >= 0;\n}\n\nexport function sign_keyPair(): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n const sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n crypto_sign_keypair(pk, sk, false);\n return { publicKey: pk, secretKey: sk };\n}\n\nexport function x25519_edwards_keyPair_fromSecretKey(\n secretKey: Uint8Array,\n): Uint8Array {\n const p = [gf(), gf(), gf(), gf()];\n const pk = new Uint8Array(32);\n\n const d = new Uint8Array(64);\n if (secretKey.length != 32) {\n throw new Error(\"bad secret key size\");\n }\n d.set(secretKey, 0);\n\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n return pk;\n}\n\nexport function crypto_sign_keyPair_fromSecretKey(secretKey: Uint8Array): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\"bad secret key size\");\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n for (let i = 0; i < pk.length; i++) pk[i] = secretKey[32 + i];\n return { publicKey: pk, secretKey: new Uint8Array(secretKey) };\n}\n\nexport function crypto_sign_keyPair_fromSeed(seed: Uint8Array): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n checkArrayTypes(seed);\n if (seed.length !== crypto_sign_SEEDBYTES)\n throw new Error(`bad seed size: ${seed.length}`);\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n const sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n for (let i = 0; i < 32; i++) sk[i] = seed[i];\n crypto_sign_keypair(pk, sk, true);\n return { publicKey: pk, secretKey: sk };\n}\n\nexport const sign_publicKeyLength = crypto_sign_PUBLICKEYBYTES;\nexport const sign_secretKeyLength = crypto_sign_SECRETKEYBYTES;\nexport const sign_seedLength = crypto_sign_SEEDBYTES;\nexport const sign_signatureLength = crypto_sign_BYTES;\n\nexport function hash(msg: Uint8Array): Uint8Array {\n checkArrayTypes(msg);\n const h = new Uint8Array(crypto_hash_BYTES);\n crypto_hash(h, msg, msg.length);\n return h;\n}\n\nexport const hash_hashLength = crypto_hash_BYTES;\n\nexport function verify(x: Uint8Array, y: Uint8Array): boolean {\n checkArrayTypes(x, y);\n // Zero length arguments are considered not equal.\n if (x.length === 0 || y.length === 0) return false;\n if (x.length !== y.length) return false;\n return vn(x, 0, y, 0, x.length) === 0 ? true : false;\n}\n\nexport function setPRNG(fn: (x: Uint8Array, n: number) => void): void {\n randombytes = fn;\n}\n\nexport function sign_ed25519_pk_to_curve25519(\n ed25519_pk: Uint8Array,\n): Uint8Array {\n const ge_a = [gf(), gf(), gf(), gf()];\n const x = gf();\n const one_minus_y = gf();\n const x25519_pk = new Uint8Array(32);\n\n if (unpackneg(ge_a, ed25519_pk)) {\n throw Error(\"invalid public key\");\n }\n\n set25519(one_minus_y, gf1);\n Z(one_minus_y, one_minus_y, ge_a[1]);\n\n set25519(x, gf1);\n A(x, x, ge_a[1]);\n\n inv25519(one_minus_y, one_minus_y);\n M(x, x, one_minus_y);\n pack25519(x25519_pk, x);\n\n return x25519_pk;\n}\n\nexport function secretbox(\n msg: Uint8Array,\n nonce: Uint8Array,\n key: Uint8Array,\n): Uint8Array {\n checkArrayTypes(msg, nonce, key);\n checkLengths(key, nonce);\n var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);\n var c = new Uint8Array(m.length);\n for (var i = 0; i < msg.length; i++)\n m[i + crypto_secretbox_ZEROBYTES] = msg[i];\n crypto_secretbox(c, m, m.length, nonce, key);\n return c.subarray(crypto_secretbox_BOXZEROBYTES);\n}\n\nexport function secretbox_open(\n box: Uint8Array,\n nonce: Uint8Array,\n key: Uint8Array,\n): Uint8Array | undefined {\n checkArrayTypes(box, nonce, key);\n checkLengths(key, nonce);\n var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);\n var m = new Uint8Array(c.length);\n for (var i = 0; i < box.length; i++)\n c[i + crypto_secretbox_BOXZEROBYTES] = box[i];\n if (c.length < 32) return undefined;\n if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return undefined;\n return m.subarray(crypto_secretbox_ZEROBYTES);\n}\n\nexport function crypto_core_ed25519_scalar_add(\n x: Uint8Array,\n y: Uint8Array,\n): Uint8Array {\n const z = new Float64Array(64);\n for (let i = 0; i < 32; i++) {\n z[i] = x[i] + y[i];\n }\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\n/**\n * Reduce a scalar \"s\" to \"s mod L\". The input can be up to 64 bytes long.\n */\nexport function crypto_core_ed25519_scalar_reduce(x: Uint8Array): Uint8Array {\n const len = x.length;\n const z = new Float64Array(64);\n for (let i = 0; i < len; i++) z[i] = x[i];\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\nexport function crypto_core_ed25519_scalar_sub(\n x: Uint8Array,\n y: Uint8Array,\n): Uint8Array {\n const z = new Float64Array(64);\n for (let i = 0; i < 32; i++) {\n z[i] = x[i] - y[i];\n }\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\nexport function crypto_edx25519_private_key_create(): Uint8Array {\n const seed = new Uint8Array(32);\n randombytes(seed, 32);\n return crypto_edx25519_private_key_create_from_seed(seed);\n}\n\nexport function crypto_edx25519_private_key_create_from_seed(\n seed: Uint8Array,\n): Uint8Array {\n const pk = hash(seed);\n pk[0] &= 248;\n pk[31] &= 127;\n pk[31] |= 64;\n return pk;\n}\n\nexport function crypto_edx25519_get_public(priv: Uint8Array): Uint8Array {\n return crypto_scalarmult_ed25519_base_noclamp(priv.subarray(0, 32));\n}\n\nexport function crypto_edx25519_sign_detached(\n m: Uint8Array,\n skx: Uint8Array,\n pkx: Uint8Array,\n): Uint8Array {\n const n: number = m.length;\n const h = new Uint8Array(64);\n const r = new Uint8Array(64);\n let i, j;\n const x = new Float64Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n const sm = new Uint8Array(n + 64);\n\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = skx[32 + i];\n\n crypto_hash(r, sm.subarray(32), n + 32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = pkx[i - 32];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i + j] += h[i] * skx[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return sm.subarray(0, 64);\n}\n\nexport function crypto_edx25519_sign_detached_verify(\n msg: Uint8Array,\n sig: Uint8Array,\n publicKey: Uint8Array,\n): boolean {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES) throw new Error(\"bad signature size\");\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n const m = new Uint8Array(crypto_sign_BYTES + msg.length);\n let i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i];\n return crypto_sign_open(m, sm, sm.length, publicKey) >= 0;\n}\n", "import { setPRNG } from \"./nacl-fast.js\";\n\nexport function loadBrowserPrng() {\n // Initialize PRNG if environment provides CSPRNG.\n // If not, methods calling randombytes will throw.\n // @ts-ignore-error\n const cr = typeof self !== \"undefined\" ? self.crypto || self.msCrypto : null;\n\n const QUOTA = 65536;\n setPRNG(function (x: Uint8Array, n: number) {\n let i;\n const v = new Uint8Array(n);\n for (i = 0; i < n; i += QUOTA) {\n cr.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));\n }\n for (i = 0; i < n; i++) x[i] = v[i];\n for (i = 0; i < v.length; i++) v[i] = 0;\n });\n}\n", "/*\n This file is part of GNU Taler\n Copyright (C) 2012-2020 Taler Systems SA\n\n GNU Taler is free software: you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as published\n by the Free Software Foundation, either version 3 of the License,\n or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see .\n\n SPDX-License-Identifier: LGPL3.0-or-later\n\n Note: the LGPL does not apply to all components of GNU Taler,\n but it does apply to this file.\n */\n\nexport enum TalerErrorCode {\n\n\n /**\n * Special code to indicate success (no error).\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n NONE = 0,\n\n\n /**\n * An error response did not include an error code in the format expected by the client. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n INVALID = 1,\n\n\n /**\n * An internal failure happened on the client side. Details should be in the local logs. Check if you are using the latest available version or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CLIENT_INTERNAL_ERROR = 2,\n\n\n /**\n * The client does not support the protocol version advertised by the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION = 3,\n\n\n /**\n * The response we got from the server was not in the expected format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_INVALID_RESPONSE = 10,\n\n\n /**\n * The operation timed out. Trying again might help. Check the network connection.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TIMEOUT = 11,\n\n\n /**\n * The protocol version given by the server does not follow the required format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_VERSION_MALFORMED = 12,\n\n\n /**\n * The service responded with a reply that was in the right data format, but the content did not satisfy the protocol. Please file a bug report.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_REPLY_MALFORMED = 13,\n\n\n /**\n * There is an error in the client-side configuration, for example an option is set to an invalid value. Check the logs and fix the local configuration.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CONFIGURATION_INVALID = 14,\n\n\n /**\n * The client made a request to a service, but received an error response it does not know how to handle. Please file a bug report.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UNEXPECTED_REQUEST_ERROR = 15,\n\n\n /**\n * The token used by the client to authorize the request does not grant the required permissions for the request. Check the requirements and obtain a suitable authorization token to proceed.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_PERMISSION_INSUFFICIENT = 16,\n\n\n /**\n * The HTTP method used is invalid for this endpoint. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_METHOD_INVALID = 20,\n\n\n /**\n * There is no endpoint defined for the URL provided by the client. Check if you used the correct URL and/or file a report with the developers of the client software.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_ENDPOINT_UNKNOWN = 21,\n\n\n /**\n * The JSON in the client's request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_JSON_INVALID = 22,\n\n\n /**\n * Some of the HTTP headers provided by the client were malformed and caused the server to not be able to handle the request. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_HTTP_HEADERS_MALFORMED = 23,\n\n\n /**\n * The payto:// URI provided by the client is malformed. Check that you are using the correct syntax as of RFC 8905 and/or that you entered the bank account number correctly.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PAYTO_URI_MALFORMED = 24,\n\n\n /**\n * A required parameter in the request was missing. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARAMETER_MISSING = 25,\n\n\n /**\n * A parameter in the request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARAMETER_MALFORMED = 26,\n\n\n /**\n * The reserve public key was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_RESERVE_PUB_MALFORMED = 27,\n\n\n /**\n * The body in the request could not be decompressed by the server. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_COMPRESSION_INVALID = 28,\n\n\n /**\n * A segment in the path of the URL provided by the client is malformed. Check that you are using the correct encoding for the URL.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PATH_SEGMENT_MALFORMED = 29,\n\n\n /**\n * The currency involved in the operation is not acceptable for this server. Check your configuration and make sure the currency specified for a given service provider is one of the currencies supported by that provider.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CURRENCY_MISMATCH = 30,\n\n\n /**\n * The URI is longer than the longest URI the HTTP server is willing to parse. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit.\n * Returned with an HTTP status code of #MHD_HTTP_URI_TOO_LONG (414).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_URI_TOO_LONG = 31,\n\n\n /**\n * The body is too large to be permissible for the endpoint. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UPLOAD_EXCEEDS_LIMIT = 32,\n\n\n /**\n * The service refused the request due to lack of proper authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UNAUTHORIZED = 40,\n\n\n /**\n * The service refused the request as the given authorization token is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_UNKNOWN = 41,\n\n\n /**\n * The service refused the request as the given authorization token expired.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_EXPIRED = 42,\n\n\n /**\n * The service refused the request as the given authorization token is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_MALFORMED = 43,\n\n\n /**\n * The service refused the request due to lack of proper rights on the resource.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FORBIDDEN = 44,\n\n\n /**\n * The service failed initialize its connection to the database. The system administrator should check that the service has permissions to access the database and that the database is running.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_SETUP_FAILED = 50,\n\n\n /**\n * The service encountered an error event to just start the database transaction. The system administrator should check that the database is running.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_START_FAILED = 51,\n\n\n /**\n * The service failed to store information in its database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_STORE_FAILED = 52,\n\n\n /**\n * The service failed to fetch information from its database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_FETCH_FAILED = 53,\n\n\n /**\n * The service encountered an unrecoverable error trying to commit a transaction to the database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_COMMIT_FAILED = 54,\n\n\n /**\n * The service encountered an error event to commit the database transaction, even after repeatedly retrying it there was always a conflicting transaction. This indicates a repeated serialization error; it should only happen if some client maliciously tries to create conflicting concurrent transactions. It could also be a sign of a missing index. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_SOFT_FAILURE = 55,\n\n\n /**\n * The service's database is inconsistent and violates service-internal invariants. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_INVARIANT_FAILURE = 56,\n\n\n /**\n * The HTTP server experienced an internal invariant failure (bug). Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_INTERNAL_INVARIANT_FAILURE = 60,\n\n\n /**\n * The service could not compute a cryptographic hash over some JSON value. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_COMPUTE_JSON_HASH = 61,\n\n\n /**\n * The service could not compute an amount. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_COMPUTE_AMOUNT = 62,\n\n\n /**\n * The HTTP server had insufficient memory to parse the request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARSER_OUT_OF_MEMORY = 70,\n\n\n /**\n * The HTTP server failed to allocate memory. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_ALLOCATION_FAILURE = 71,\n\n\n /**\n * The HTTP server failed to allocate memory for building JSON reply. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_JSON_ALLOCATION_FAILURE = 72,\n\n\n /**\n * The HTTP server failed to allocate memory for making a CURL request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CURL_ALLOCATION_FAILURE = 73,\n\n\n /**\n * The backend could not locate a required template to generate an HTML reply. The system administrator should check if the resource files are installed in the correct location and are readable to the service.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_ACCEPTABLE (406).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_TO_LOAD_TEMPLATE = 74,\n\n\n /**\n * The backend could not expand the template to generate an HTML reply. The system administrator should investigate the logs and check if the templates are well-formed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_TO_EXPAND_TEMPLATE = 75,\n\n\n /**\n * Exchange is badly configured and thus cannot operate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_BAD_CONFIGURATION = 1000,\n\n\n /**\n * Operation specified unknown for this endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_OPERATION_UNKNOWN = 1001,\n\n\n /**\n * The number of segments included in the URI does not match the number of segments expected by the endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 1002,\n\n\n /**\n * The same coin was already used with a different denomination previously.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY = 1003,\n\n\n /**\n * The public key of given to a \"/coins/\" endpoint of the exchange was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB = 1004,\n\n\n /**\n * The exchange is not aware of the denomination key the wallet requested for the operation.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN = 1005,\n\n\n /**\n * The signature of the denomination key over the coin is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_SIGNATURE_INVALID = 1006,\n\n\n /**\n * The exchange failed to perform the operation as it could not find the private keys. This is a problem with the exchange setup, not with the client's request.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KEYS_MISSING = 1007,\n\n\n /**\n * Validity period of the denomination lies in the future.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE = 1008,\n\n\n /**\n * Denomination key of the coin is past its expiration time for the requested operation.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_EXPIRED = 1009,\n\n\n /**\n * Denomination key of the coin has been revoked.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_REVOKED = 1010,\n\n\n /**\n * An operation where the exchange interacted with a security module timed out.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_SECMOD_TIMEOUT = 1011,\n\n\n /**\n * The respective coin did not have sufficient residual value for the operation. The \"history\" in this response provides the \"residual_value\" of the coin, which may be less than its \"original_value\".\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_INSUFFICIENT_FUNDS = 1012,\n\n\n /**\n * The exchange had an internal error reconstructing the transaction history of the coin that was being processed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_HISTORY_COMPUTATION_FAILED = 1013,\n\n\n /**\n * The exchange failed to obtain the transaction history of the given coin from the database while generating an insufficient funds errors.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1014,\n\n\n /**\n * The same coin was already used with a different age hash previously.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH = 1015,\n\n\n /**\n * The requested operation is not valid for the cipher used by the selected denomination.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_INVALID_DENOMINATION_CIPHER_FOR_OPERATION = 1016,\n\n\n /**\n * The provided arguments for the operation use inconsistent ciphers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_CIPHER_MISMATCH = 1017,\n\n\n /**\n * The number of denominations specified in the request exceeds the limit of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE = 1018,\n\n\n /**\n * The coin is not known to the exchange (yet).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_UNKNOWN = 1019,\n\n\n /**\n * The time at the server is too far off from the time specified in the request. Most likely the client system time is wrong.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_CLOCK_SKEW = 1020,\n\n\n /**\n * The specified amount for the coin is higher than the value of the denomination of the coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AMOUNT_EXCEEDS_DENOMINATION_VALUE = 1021,\n\n\n /**\n * The exchange was not properly configured with global fees.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_GLOBAL_FEES_MISSING = 1022,\n\n\n /**\n * The exchange was not properly configured with wire fees.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_WIRE_FEES_MISSING = 1023,\n\n\n /**\n * The purse public key was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_PUB_MALFORMED = 1024,\n\n\n /**\n * The purse is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_UNKNOWN = 1025,\n\n\n /**\n * The purse has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_EXPIRED = 1026,\n\n\n /**\n * The exchange has no information about the \"reserve_pub\" that was given.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_RESERVE_UNKNOWN = 1027,\n\n\n /**\n * The exchange is not allowed to proceed with the operation until the client has satisfied a KYC check.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KYC_REQUIRED = 1028,\n\n\n /**\n * Inconsistency between provided age commitment and attest: either none or both must be provided\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_CONFLICTING_ATTEST_VS_AGE_COMMITMENT = 1029,\n\n\n /**\n * The provided attestation for the minimum age couldn't be verified by the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_AGE_ATTESTATION_FAILURE = 1030,\n\n\n /**\n * The purse was deleted.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_DELETED = 1031,\n\n\n /**\n * The public key of the AML officer in the URL was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_PUB_MALFORMED = 1032,\n\n\n /**\n * The signature affirming the GET request of the AML officer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID = 1033,\n\n\n /**\n * The specified AML officer does not have access at this time.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_ACCESS_DENIED = 1034,\n\n\n /**\n * The requested operation is denied pending the resolution of an anti-money laundering investigation by the exchange operator. This is a manual process, please wait and retry later.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_PENDING = 1035,\n\n\n /**\n * The requested operation is denied as the account was frozen on suspicion of money laundering. Please contact the exchange operator.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_FROZEN = 1036,\n\n\n /**\n * The exchange failed to start a KYC attribute conversion helper process. It is likely configured incorrectly.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KYC_CONVERTER_FAILED = 1037,\n\n\n /**\n * The exchange did not find information about the specified transaction in the database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_NOT_FOUND = 1100,\n\n\n /**\n * The wire hash of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE = 1101,\n\n\n /**\n * The merchant key of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB = 1102,\n\n\n /**\n * The hash of the contract terms given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS = 1103,\n\n\n /**\n * The coin public key of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB = 1104,\n\n\n /**\n * The signature returned by the exchange in a /deposits/ request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1105,\n\n\n /**\n * The signature of the merchant is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID = 1106,\n\n\n /**\n * The provided policy data was not accepted\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED = 1107,\n\n\n /**\n * The given reserve does not have sufficient funds to admit the requested withdraw operation at this time. The response includes the current \"balance\" of the reserve as well as the transaction \"history\" that lead to this balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS = 1150,\n\n\n /**\n * The given reserve does not have sufficient funds to admit the requested age-withdraw operation at this time. The response includes the current \"balance\" of the reserve as well as the transaction \"history\" that lead to this balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS = 1151,\n\n\n /**\n * The amount to withdraw together with the fee exceeds the numeric range for Taler amounts. This is not a client failure, as the coin value and fees come from the exchange's configuration.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW = 1152,\n\n\n /**\n * The exchange failed to create the signature using the denomination key.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_SIGNATURE_FAILED = 1153,\n\n\n /**\n * The signature of the reserve is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID = 1154,\n\n\n /**\n * When computing the reserve history, we ended up with a negative overall balance, which should be impossible.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS = 1155,\n\n\n /**\n * The reserve did not have sufficient funds in it to pay for a full reserve history statement.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE = 1156,\n\n\n /**\n * Withdraw period of the coin to be withdrawn is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST = 1158,\n\n\n /**\n * The client failed to unblind the blind signature.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_UNBLIND_FAILURE = 1159,\n\n\n /**\n * The client re-used a withdraw nonce, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_NONCE_REUSE = 1160,\n\n\n /**\n * The client provided an unknown commitment for an age-withdraw request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN = 1161,\n\n\n /**\n * The total sum of amounts from the denominations did overflow.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_AMOUNT_OVERFLOW = 1162,\n\n\n /**\n * The total sum of value and fees from the denominations differs from the committed amount with fees.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_AMOUNT_INCORRECT = 1163,\n\n\n /**\n * The original commitment differs from the calculated hash\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH = 1164,\n\n\n /**\n * The maximum age in the commitment is too large for the reserve\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE = 1165,\n\n\n /**\n * The batch withdraw included a planchet that was already withdrawn. This is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_BATCH_IDEMPOTENT_PLANCHET = 1175,\n\n\n /**\n * The signature made by the coin over the deposit permission is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID = 1205,\n\n\n /**\n * The same coin was already deposited for the same merchant and contract with other details.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT = 1206,\n\n\n /**\n * The stated value of the coin after the deposit fee is subtracted would be negative.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE = 1207,\n\n\n /**\n * The stated refund deadline is after the wire deadline.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE = 1208,\n\n\n /**\n * The stated wire deadline is \"never\", which makes no sense.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER = 1209,\n\n\n /**\n * The exchange failed to canonicalize and hash the given wire format. For example, the merchant failed to provide the \"salt\" or a valid payto:// URI in the wire details. Note that while the exchange will do some basic sanity checking on the wire details, it cannot warrant that the banking system will ultimately be able to route to the specified address, even if this check passed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON = 1210,\n\n\n /**\n * The hash of the given wire address does not match the wire hash specified in the proposal data.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT = 1211,\n\n\n /**\n * The signature provided by the exchange is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE = 1221,\n\n\n /**\n * The deposited amount is smaller than the deposit fee, which would result in a negative contribution.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_FEE_ABOVE_AMOUNT = 1222,\n\n\n /**\n * The proof of policy fulfillment was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_EXTENSIONS_INVALID_FULFILLMENT = 1240,\n\n\n /**\n * The coin history was requested with a bad signature.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_COIN_HISTORY_BAD_SIGNATURE = 1251,\n\n\n /**\n * The reserve history was requested with a bad signature.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE = 1252,\n\n\n /**\n * The exchange encountered melt fees exceeding the melted coin's contribution.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION = 1302,\n\n\n /**\n * The signature made with the coin to be melted is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_COIN_SIGNATURE_INVALID = 1303,\n\n\n /**\n * The denomination of the given coin has past its expiration date and it is also not a valid zombie (that is, was not refreshed with the fresh coin being subjected to recoup).\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE = 1305,\n\n\n /**\n * The signature returned by the exchange in a melt request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE = 1306,\n\n\n /**\n * The provided transfer keys do not match up with the original commitment. Information about the original commitment is included in the response.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION = 1353,\n\n\n /**\n * Failed to produce the blinded signatures over the coins to be returned.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR = 1354,\n\n\n /**\n * The exchange is unaware of the refresh session specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN = 1355,\n\n\n /**\n * The size of the cut-and-choose dimension of the private transfer keys request does not match #TALER_CNC_KAPPA - 1.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1356,\n\n\n /**\n * The number of envelopes given does not match the number of denomination keys given.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH = 1358,\n\n\n /**\n * The exchange encountered a numeric overflow totaling up the cost for the refresh operation.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW = 1359,\n\n\n /**\n * The exchange's cost calculation shows that the melt amount is below the costs of the transaction.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT = 1360,\n\n\n /**\n * The signature made with the coin over the link data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID = 1361,\n\n\n /**\n * The refresh session hash given to a /refreshes/ handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_INVALID_RCH = 1362,\n\n\n /**\n * Operation specified invalid for this endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID = 1363,\n\n\n /**\n * The client provided age commitment data, but age restriction is not supported on this server.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_NOT_SUPPORTED = 1364,\n\n\n /**\n * The client provided invalid age commitment data: missing, not an array, or array of invalid size.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID = 1365,\n\n\n /**\n * The coin specified in the link request is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_LINK_COIN_UNKNOWN = 1400,\n\n\n /**\n * The public key of given to a /transfers/ handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WTID_MALFORMED = 1450,\n\n\n /**\n * The exchange did not find information about the specified wire transfer identifier in the database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND = 1451,\n\n\n /**\n * The exchange did not find information about the wire transfer fees it charged.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND = 1452,\n\n\n /**\n * The exchange found a wire fee that was above the total transfer value (and thus could not have been charged).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT = 1453,\n\n\n /**\n * The wait target of the URL was not in the set of expected values.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSES_INVALID_WAIT_TARGET = 1475,\n\n\n /**\n * The signature on the purse status returned by the exchange was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSES_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1476,\n\n\n /**\n * The exchange knows literally nothing about the coin we were asked to refund. But without a transaction history, we cannot issue a refund. This is kind-of OK, the owner should just refresh it directly without executing the refund.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_COIN_NOT_FOUND = 1500,\n\n\n /**\n * We could not process the refund request as the coin's transaction history does not permit the requested refund because then refunds would exceed the deposit amount. The \"history\" in the response proves this.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT = 1501,\n\n\n /**\n * The exchange knows about the coin we were asked to refund, but not about the specific /deposit operation. Hence, we cannot issue a refund (as we do not know if this merchant public key is authorized to do a refund).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_DEPOSIT_NOT_FOUND = 1502,\n\n\n /**\n * The exchange can no longer refund the customer/coin as the money was already transferred (paid out) to the merchant. (It should be past the refund deadline.)\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_ALREADY_PAID = 1503,\n\n\n /**\n * The refund fee specified for the request is lower than the refund fee charged by the exchange for the given denomination key of the refunded coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_FEE_TOO_LOW = 1504,\n\n\n /**\n * The refunded amount is smaller than the refund fee, which would result in a negative refund.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_FEE_ABOVE_AMOUNT = 1505,\n\n\n /**\n * The signature of the merchant is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID = 1506,\n\n\n /**\n * Merchant backend failed to create the refund confirmation signature.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_SIGNING_FAILED = 1507,\n\n\n /**\n * The signature returned by the exchange in a refund request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE = 1508,\n\n\n /**\n * The failure proof returned by the exchange is incorrect.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE = 1509,\n\n\n /**\n * Conflicting refund granted before with different amount but same refund transaction ID.\n * Returned with an HTTP status code of #MHD_HTTP_FAILED_DEPENDENCY (424).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INCONSISTENT_AMOUNT = 1510,\n\n\n /**\n * The given coin signature is invalid for the request.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_SIGNATURE_INVALID = 1550,\n\n\n /**\n * The exchange could not find the corresponding withdraw operation. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND = 1551,\n\n\n /**\n * The coin's remaining balance is zero. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_COIN_BALANCE_ZERO = 1552,\n\n\n /**\n * The exchange failed to reproduce the coin's blinding.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_BLINDING_FAILED = 1553,\n\n\n /**\n * The coin's remaining balance is zero. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE = 1554,\n\n\n /**\n * The coin's denomination has not been revoked yet.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_NOT_ELIGIBLE = 1555,\n\n\n /**\n * The given coin signature is invalid for the request.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_SIGNATURE_INVALID = 1575,\n\n\n /**\n * The exchange could not find the corresponding melt operation. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_MELT_NOT_FOUND = 1576,\n\n\n /**\n * The exchange failed to reproduce the coin's blinding.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED = 1578,\n\n\n /**\n * The coin's denomination has not been revoked yet.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_NOT_ELIGIBLE = 1580,\n\n\n /**\n * This exchange does not allow clients to request /keys for times other than the current (exchange) time.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN = 1600,\n\n\n /**\n * A signature in the server's response was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_SIGNATURE_INVALID = 1650,\n\n\n /**\n * No bank accounts are enabled for the exchange. The administrator should enable-account using the taler-exchange-offline tool.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_NO_ACCOUNTS_CONFIGURED = 1651,\n\n\n /**\n * The payto:// URI stored in the exchange database for its bank account is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_INVALID_PAYTO_CONFIGURED = 1652,\n\n\n /**\n * No wire fees are configured for an enabled wire method of the exchange. The administrator must set the wire-fee using the taler-exchange-offline tool.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_FEES_NOT_CONFIGURED = 1653,\n\n\n /**\n * This purse was previously created with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA = 1675,\n\n\n /**\n * This purse was previously merged with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_MERGE_CONFLICTING_META_DATA = 1676,\n\n\n /**\n * The reserve has insufficient funds to create another purse.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS = 1677,\n\n\n /**\n * The purse fee specified for the request is lower than the purse fee charged by the exchange at this time.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW = 1678,\n\n\n /**\n * The payment request cannot be deleted anymore, as it either already completed or timed out.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DELETE_ALREADY_DECIDED = 1679,\n\n\n /**\n * The signature affirming the purse deletion is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID = 1680,\n\n\n /**\n * Withdrawal from the reserve requires age restriction to be set.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED = 1681,\n\n\n /**\n * The exchange failed to talk to the process responsible for its private denomination keys or the helpers had no denominations (properly) configured.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE = 1700,\n\n\n /**\n * The response from the denomination key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_BUG = 1701,\n\n\n /**\n * The helper refuses to sign with the key, because it is too early: the validity period has not yet started.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_TOO_EARLY = 1702,\n\n\n /**\n * The signature of the exchange on the reply was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_EXCHANGE_SIGNATURE_INVALID = 1725,\n\n\n /**\n * The exchange failed to talk to the process responsible for its private signing keys.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE = 1750,\n\n\n /**\n * The response from the online signing key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_BUG = 1751,\n\n\n /**\n * The helper refuses to sign with the key, because it is too early: the validity period has not yet started.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_TOO_EARLY = 1752,\n\n\n /**\n * The purse expiration time is in the past at the time of its creation.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW = 1775,\n\n\n /**\n * The purse expiration time is set to never, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER = 1776,\n\n\n /**\n * The signature affirming the merge of the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID = 1777,\n\n\n /**\n * The signature by the reserve affirming the merge is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID = 1778,\n\n\n /**\n * The signature by the reserve affirming the open operation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE = 1785,\n\n\n /**\n * The signature by the reserve affirming the close operation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE = 1786,\n\n\n /**\n * The signature by the reserve affirming the attestion request is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE = 1787,\n\n\n /**\n * The exchange does not know an origin account to which the remaining reserve balance could be wired to, and the wallet failed to provide one.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT = 1788,\n\n\n /**\n * The reserve balance is insufficient to pay for the open operation.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS = 1789,\n\n\n /**\n * The auditor that was supposed to be disabled is unknown to this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND = 1800,\n\n\n /**\n * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT = 1801,\n\n\n /**\n * The signature to add or enable the auditor does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID = 1802,\n\n\n /**\n * The signature to disable the auditor does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID = 1803,\n\n\n /**\n * The signature to revoke the denomination does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID = 1804,\n\n\n /**\n * The signature to revoke the online signing key does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID = 1805,\n\n\n /**\n * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT = 1806,\n\n\n /**\n * The signingkey specified is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN = 1807,\n\n\n /**\n * The signature to publish wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID = 1808,\n\n\n /**\n * The signature to add the wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID = 1809,\n\n\n /**\n * The signature to disable the wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID = 1810,\n\n\n /**\n * The wire account to be disabled is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND = 1811,\n\n\n /**\n * The signature to affirm wire fees does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID = 1812,\n\n\n /**\n * The signature conflicts with a previous signature affirming different fees.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH = 1813,\n\n\n /**\n * The signature affirming the denomination key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID = 1814,\n\n\n /**\n * The signature affirming the signing key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID = 1815,\n\n\n /**\n * The signature conflicts with a previous signature affirming different fees.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_GLOBAL_FEE_MISMATCH = 1816,\n\n\n /**\n * The signature affirming the fee structure is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_GLOBAL_FEE_SIGNATURE_INVALID = 1817,\n\n\n /**\n * The signature affirming the profit drain is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_DRAIN_PROFITS_SIGNATURE_INVALID = 1818,\n\n\n /**\n * The signature affirming the AML decision is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_ADD_SIGNATURE_INVALID = 1825,\n\n\n /**\n * The AML officer specified is not allowed to make AML decisions right now.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_INVALID_OFFICER = 1826,\n\n\n /**\n * There is a more recent AML decision on file. The decision was rejected as timestamps of AML decisions must be monotonically increasing.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT = 1827,\n\n\n /**\n * There AML decision would impose an AML check of a type that is not provided by any KYC provider known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_UNKNOWN_CHECK = 1828,\n\n\n /**\n * The signature affirming the change in the AML officer status is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_UPDATE_AML_OFFICER_SIGNATURE_INVALID = 1830,\n\n\n /**\n * A more recent decision about the AML officer status is known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AML_OFFICERS_MORE_RECENT_PRESENT = 1831,\n\n\n /**\n * The purse was previously created with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA = 1850,\n\n\n /**\n * The purse was previously created with a different contract.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_CONFLICTING_CONTRACT_STORED = 1851,\n\n\n /**\n * A coin signature for a deposit into the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_COIN_SIGNATURE_INVALID = 1852,\n\n\n /**\n * The purse expiration time is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW = 1853,\n\n\n /**\n * The purse expiration time is \"never\".\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER = 1854,\n\n\n /**\n * The purse signature over the purse meta data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID = 1855,\n\n\n /**\n * The signature over the encrypted contract is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID = 1856,\n\n\n /**\n * The signature from the exchange over the confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXCHANGE_SIGNATURE_INVALID = 1857,\n\n\n /**\n * The coin was previously deposited with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA = 1858,\n\n\n /**\n * The encrypted contract was previously uploaded with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA = 1859,\n\n\n /**\n * The deposited amount is less than the purse fee.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CREATE_PURSE_NEGATIVE_VALUE_AFTER_FEE = 1860,\n\n\n /**\n * The signature using the merge key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE = 1876,\n\n\n /**\n * The signature using the reserve key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE = 1877,\n\n\n /**\n * The targeted purse is not yet full and thus cannot be merged. Retrying the request later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_NOT_FULL = 1878,\n\n\n /**\n * The signature from the exchange over the confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_EXCHANGE_SIGNATURE_INVALID = 1879,\n\n\n /**\n * The exchange of the target account is not a partner of this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN = 1880,\n\n\n /**\n * The signature affirming the new partner is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_ADD_PARTNER_SIGNATURE_INVALID = 1890,\n\n\n /**\n * Conflicting data for the partner already exists with the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_ADD_PARTNER_DATA_CONFLICT = 1891,\n\n\n /**\n * The auditor signature over the denomination meta data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID = 1900,\n\n\n /**\n * The auditor that was specified is unknown to this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_UNKNOWN = 1901,\n\n\n /**\n * The auditor that was specified is no longer used by this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_INACTIVE = 1902,\n\n\n /**\n * The signature affirming the wallet's KYC request was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_WALLET_SIGNATURE_INVALID = 1925,\n\n\n /**\n * The exchange received an unexpected malformed response from its KYC backend.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE = 1926,\n\n\n /**\n * The backend signaled an unexpected failure.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_ERROR = 1927,\n\n\n /**\n * The backend signaled an authorization failure.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_AUTHORIZATION_FAILED = 1928,\n\n\n /**\n * The exchange is unaware of having made an the authorization request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN = 1929,\n\n\n /**\n * The KYC authorization signature was invalid. Hence the request was denied.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED = 1930,\n\n\n /**\n * The request used a logic specifier that is not known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN = 1931,\n\n\n /**\n * The request requires a logic which is no longer configured at the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_GONE = 1932,\n\n\n /**\n * The logic plugin had a bug in its interaction with the KYC provider.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_BUG = 1933,\n\n\n /**\n * The exchange could not process the request with its KYC provider because the provider refused access to the service. This indicates some configuration issue at the Taler exchange operator.\n * Returned with an HTTP status code of #MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED (511).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_ACCESS_REFUSED = 1934,\n\n\n /**\n * There was a timeout in the interaction between the exchange and the KYC provider. The most likely cause is some networking problem. Trying again later might succeed.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_TIMEOUT = 1935,\n\n\n /**\n * The KYC provider responded with a status that was completely unexpected by the KYC logic of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY = 1936,\n\n\n /**\n * The rate limit of the exchange at the KYC provider has been exceeded. Trying much later might work.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_RATE_LIMIT_EXCEEDED = 1937,\n\n\n /**\n * The request to the webhook lacked proper authorization or authentication data.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_WEBHOOK_UNAUTHORIZED = 1938,\n\n\n /**\n * The exchange is unaware of the given requirement row.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN = 1939,\n\n\n /**\n * The exchange has no account public key to check the KYC authorization signature against. Hence the request was denied. The user should do a wire transfer to the exchange with the KYC authorization key in the subject.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN = 1940,\n\n\n /**\n * The form has been previously uploaded, and may only be filed once. The user should be redirected to their main KYC page and see if any other steps need to be taken.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_FORM_ALREADY_UPLOADED = 1941,\n\n\n /**\n * The internal state of the exchange specifying KYC measures is malformed. Please contact technical support.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_MEASURES_MALFORMED = 1942,\n\n\n /**\n * The specified index does not refer to a valid KYC measure. Please check the URL.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_MEASURE_INDEX_INVALID = 1943,\n\n\n /**\n * The operation is not supported by the selected KYC logic. This is either caused by a configuration change or some invalid use of the API. Please contact technical support.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_INVALID_LOGIC_TO_CHECK = 1944,\n\n\n /**\n * The exchange does not know a contract under the given contract public key.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_UNKNOWN = 1950,\n\n\n /**\n * The URL does not encode a valid exchange public key in its path.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_INVALID_CONTRACT_PUB = 1951,\n\n\n /**\n * The returned encrypted contract did not decrypt.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_DECRYPTION_FAILED = 1952,\n\n\n /**\n * The signature on the encrypted contract did not validate.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_SIGNATURE_INVALID = 1953,\n\n\n /**\n * The decrypted contract was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_DECODING_FAILED = 1954,\n\n\n /**\n * A coin signature for a deposit into the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_SIGNATURE_INVALID = 1975,\n\n\n /**\n * It is too late to deposit coins into the purse.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY = 1976,\n\n\n /**\n * TOTP key is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TOTP_KEY_INVALID = 1980,\n\n\n /**\n * The backend could not find the merchant instance specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_INSTANCE_UNKNOWN = 2000,\n\n\n /**\n * The start and end-times in the wire fee structure leave a hole. This is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE = 2001,\n\n\n /**\n * The merchant was unable to obtain a valid answer to /wire from the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED = 2002,\n\n\n /**\n * The product category is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CATEGORY_UNKNOWN = 2003,\n\n\n /**\n * The proposal is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_ORDER_UNKNOWN = 2005,\n\n\n /**\n * The order provided to the backend could not be completed, because a product to be completed via inventory data is not actually in our inventory.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_PRODUCT_UNKNOWN = 2006,\n\n\n /**\n * The reward ID is unknown. This could happen if the reward has expired.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_REWARD_ID_UNKNOWN = 2007,\n\n\n /**\n * The contract obtained from the merchant backend was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID = 2008,\n\n\n /**\n * The order we found does not match the provided contract hash.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER = 2009,\n\n\n /**\n * The exchange failed to provide a valid response to the merchant's /keys request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE = 2010,\n\n\n /**\n * The exchange failed to respond to the merchant on time.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_TIMEOUT = 2011,\n\n\n /**\n * The merchant failed to talk to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE = 2012,\n\n\n /**\n * The exchange returned a maformed response.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_REPLY_MALFORMED = 2013,\n\n\n /**\n * The exchange returned an unexpected response status.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_UNEXPECTED_STATUS = 2014,\n\n\n /**\n * The merchant refused the request due to lack of authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_UNAUTHORIZED = 2015,\n\n\n /**\n * The merchant instance specified in the request was deleted.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_INSTANCE_DELETED = 2016,\n\n\n /**\n * The backend could not find the inbound wire transfer specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_TRANSFER_UNKNOWN = 2017,\n\n\n /**\n * The backend could not find the template(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_TEMPLATE_UNKNOWN = 2018,\n\n\n /**\n * The backend could not find the webhook(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_WEBHOOK_UNKNOWN = 2019,\n\n\n /**\n * The backend could not find the webhook(serial) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_PENDING_WEBHOOK_UNKNOWN = 2020,\n\n\n /**\n * The backend could not find the OTP device(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_OTP_DEVICE_UNKNOWN = 2021,\n\n\n /**\n * The account is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_ACCOUNT_UNKNOWN = 2022,\n\n\n /**\n * The wire hash was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_H_WIRE_MALFORMED = 2023,\n\n\n /**\n * The currency specified in the operation does not work with the current state of the given resource.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CURRENCY_MISMATCH = 2024,\n\n\n /**\n * The exchange failed to provide a valid answer to the tracking request, thus those details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE = 2100,\n\n\n /**\n * The merchant backend failed to construct the request for tracking to the exchange, thus tracking details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE = 2103,\n\n\n /**\n * The merchant backend failed trying to contact the exchange for tracking details, thus those details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE = 2104,\n\n\n /**\n * The claim token used to authenticate the client is invalid for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_INVALID_TOKEN = 2105,\n\n\n /**\n * The contract terms hash used to authenticate the client is invalid for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_HASH = 2106,\n\n\n /**\n * The exchange responded saying that funds were insufficient (for example, due to double-spending).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS = 2150,\n\n\n /**\n * The denomination key used for payment is not listed among the denomination keys of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND = 2151,\n\n\n /**\n * The denomination key used for payment is not audited by an auditor approved by the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_AUDITOR_FAILURE = 2152,\n\n\n /**\n * There was an integer overflow totaling up the amounts or deposit fees in the payment.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AMOUNT_OVERFLOW = 2153,\n\n\n /**\n * The deposit fees exceed the total value of the payment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_FEES_EXCEED_PAYMENT = 2154,\n\n\n /**\n * After considering deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract. The client should revisit the logic used to calculate fees it must cover.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_DUE_TO_FEES = 2155,\n\n\n /**\n * Even if we do not consider deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_PAYMENT_INSUFFICIENT = 2156,\n\n\n /**\n * The signature over the contract of one of the coins was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_COIN_SIGNATURE_INVALID = 2157,\n\n\n /**\n * When we tried to find information about the exchange to issue the deposit, we failed. This usually only happens if the merchant backend is somehow unable to get its own HTTP client logic to work.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_LOOKUP_FAILED = 2158,\n\n\n /**\n * The refund deadline in the contract is after the transfer deadline.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUND_DEADLINE_PAST_WIRE_TRANSFER_DEADLINE = 2159,\n\n\n /**\n * The order was already paid (maybe by another wallet).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_ALREADY_PAID = 2160,\n\n\n /**\n * The payment is too late, the offer has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_OFFER_EXPIRED = 2161,\n\n\n /**\n * The \"merchant\" field is missing in the proposal data. This is an internal error as the proposal is from the merchant's own database at this point.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_MERCHANT_FIELD_MISSING = 2162,\n\n\n /**\n * Failed to locate merchant's account information matching the wire hash given in the proposal.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_WIRE_HASH_UNKNOWN = 2163,\n\n\n /**\n * The deposit time for the denomination has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_DEPOSIT_EXPIRED = 2165,\n\n\n /**\n * The exchange of the deposited coin charges a wire fee that could not be added to the total (total amount too high).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_WIRE_FEE_ADDITION_FAILED = 2166,\n\n\n /**\n * The contract was not fully paid because of refunds. Note that clients MAY treat this as paid if, for example, contracts must be executed despite of refunds.\n * Returned with an HTTP status code of #MHD_HTTP_PAYMENT_REQUIRED (402).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUNDED = 2167,\n\n\n /**\n * According to our database, we have refunded more than we were paid (which should not be possible).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUNDS_EXCEED_PAYMENTS = 2168,\n\n\n /**\n * Legacy stuff. Remove me with protocol v1.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DEAD_QQQ_PAY_MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2169,\n\n\n /**\n * The payment failed at the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_FAILED = 2170,\n\n\n /**\n * The payment required a minimum age but one of the coins (of a denomination with support for age restriction) did not provide any age_commitment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_MISSING = 2171,\n\n\n /**\n * The payment required a minimum age but one of the coins provided an age_commitment that contained a wrong number of public keys compared to the number of age groups defined in the denomination of the coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_SIZE_MISMATCH = 2172,\n\n\n /**\n * The payment required a minimum age but one of the coins provided a minimum_age_sig that couldn't be verified with the given age_commitment for that particular minimum age.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_VERIFICATION_FAILED = 2173,\n\n\n /**\n * The payment required no minimum age but one of the coins (of a denomination with support for age restriction) did not provide the required h_age_commitment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_HASH_MISSING = 2174,\n\n\n /**\n * The exchange does not support the selected bank account of the merchant. Likely the merchant had stale data on the bank accounts of the exchange and thus selected an inappropriate exchange when making the offer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_WIRE_METHOD_UNSUPPORTED = 2175,\n\n\n /**\n * The payment requires the wallet to select a choice from the choices array and pass it in the 'choice_index' field of the request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING = 2176,\n\n\n /**\n * The 'choice_index' field is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS = 2177,\n\n\n /**\n * The provided 'tokens' array does not match with the required input tokens of the order.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INPUT_TOKENS_MISMATCH = 2178,\n\n\n /**\n * Invalid token issue signature (blindly signed by merchant) for provided token.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID = 2179,\n\n\n /**\n * Invalid token use signature (EdDSA, signed by wallet) for provided token.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID = 2180,\n\n\n /**\n * The provided number of tokens does not match the required number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH = 2181,\n\n\n /**\n * The provided number of token envelopes does not match the specified number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH = 2182,\n\n\n /**\n * Invalid token because it was already used, is expired or not yet valid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_INVALID = 2183,\n\n\n /**\n * The contract hash does not match the given order ID.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAID_CONTRACT_HASH_MISMATCH = 2200,\n\n\n /**\n * The signature of the merchant is not valid for the given contract hash.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAID_COIN_SIGNATURE_INVALID = 2201,\n\n\n /**\n * A token family with this ID but conflicting data exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_TOKEN_FAMILY_CONFLICT = 2225,\n\n\n /**\n * The backend is unaware of a token family with the given ID.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PATCH_TOKEN_FAMILY_NOT_FOUND = 2226,\n\n\n /**\n * The merchant failed to send the exchange the refund request.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_REFUND_FAILED = 2251,\n\n\n /**\n * The merchant failed to find the exchange to process the lookup.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_LOOKUP_FAILED = 2252,\n\n\n /**\n * The merchant could not find the contract.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_NOT_FOUND = 2253,\n\n\n /**\n * The payment was already completed and thus cannot be aborted anymore.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2254,\n\n\n /**\n * The hash provided by the wallet does not match the order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_HASH_MISSMATCH = 2255,\n\n\n /**\n * The array of coins cannot be empty.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_COINS_ARRAY_EMPTY = 2256,\n\n\n /**\n * We are waiting for the exchange to provide us with key material before checking the wire transfer.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_AWAITING_KEYS = 2258,\n\n\n /**\n * We are waiting for the exchange to provide us with the list of aggregated transactions.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_AWAITING_LIST = 2259,\n\n\n /**\n * The endpoint indicated in the wire transfer does not belong to a GNU Taler exchange.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_FATAL_NO_EXCHANGE = 2260,\n\n\n /**\n * The exchange indicated in the wire transfer claims to know nothing about the wire transfer.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_FATAL_NOT_FOUND = 2261,\n\n\n /**\n * The interaction with the exchange is delayed due to rate limiting.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_RATE_LIMITED = 2262,\n\n\n /**\n * We experienced a transient failure in our interaction with the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_TRANSIENT_FAILURE = 2263,\n\n\n /**\n * The response from the exchange was unacceptable and should be reviewed with an auditor.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_HARD_FAILURE = 2264,\n\n\n /**\n * We could not claim the order because the backend is unaware of it.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_NOT_FOUND = 2300,\n\n\n /**\n * We could not claim the order because someone else claimed it first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_ALREADY_CLAIMED = 2301,\n\n\n /**\n * The client-side experienced an internal failure.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE = 2302,\n\n\n /**\n * The backend failed to sign the refund request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_REFUND_SIGNATURE_FAILED = 2350,\n\n\n /**\n * The client failed to unblind the signature returned by the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_UNBLIND_FAILURE = 2400,\n\n\n /**\n * The exchange returned a failure code for the withdraw operation.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_EXCHANGE_ERROR = 2403,\n\n\n /**\n * The merchant failed to add up the amounts to compute the pick up value.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_SUMMATION_FAILED = 2404,\n\n\n /**\n * The reward expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_HAS_EXPIRED = 2405,\n\n\n /**\n * The requested withdraw amount exceeds the amount remaining to be picked up.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING = 2406,\n\n\n /**\n * The merchant did not find the specified denomination key in the exchange's key set.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_DENOMINATION_UNKNOWN = 2407,\n\n\n /**\n * The merchant instance has no active bank accounts configured. However, at least one bank account must be available to create new orders.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE = 2500,\n\n\n /**\n * The proposal had no timestamp and the merchant backend failed to obtain the current local time.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME = 2501,\n\n\n /**\n * The order provided to the backend could not be parsed; likely some required fields were missing or ill-formed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR = 2502,\n\n\n /**\n * A conflicting order (sharing the same order identifier) already exists at this merchant backend instance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS = 2503,\n\n\n /**\n * The order creation request is invalid because the given wire deadline is before the refund deadline.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE = 2504,\n\n\n /**\n * The order creation request is invalid because the delivery date given is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_DELIVERY_DATE_IN_PAST = 2505,\n\n\n /**\n * The order creation request is invalid because a wire deadline of \"never\" is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_WIRE_DEADLINE_IS_NEVER = 2506,\n\n\n /**\n * The order creation request is invalid because the given payment deadline is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_PAY_DEADLINE_IN_PAST = 2507,\n\n\n /**\n * The order creation request is invalid because the given refund deadline is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_REFUND_DEADLINE_IN_PAST = 2508,\n\n\n /**\n * The backend does not trust any exchange that would allow funds to be wired to any bank account of this instance using the wire method specified with the order. Note that right now, we do not support the use of exchange bank accounts with mandatory currency conversion.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_NO_EXCHANGES_FOR_WIRE_METHOD = 2509,\n\n\n /**\n * One of the paths to forget is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_SYNTAX_INCORRECT = 2510,\n\n\n /**\n * One of the paths to forget was not marked as forgettable.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE = 2511,\n\n\n /**\n * The order provided to the backend could not be deleted, our offer is still valid and awaiting payment. Deletion may work later after the offer has expired if it remains unpaid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_ORDERS_AWAITING_PAYMENT = 2520,\n\n\n /**\n * The order provided to the backend could not be deleted as the order was already paid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_ORDERS_ALREADY_PAID = 2521,\n\n\n /**\n * The amount to be refunded is inconsistent: either is lower than the previous amount being awarded, or it exceeds the original price paid by the customer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_INCONSISTENT_AMOUNT = 2530,\n\n\n /**\n * Only paid orders can be refunded, and the frontend specified an unpaid order to issue a refund for.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID = 2531,\n\n\n /**\n * The refund delay was set to 0 and thus no refunds are ever allowed for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT = 2532,\n\n\n /**\n * The token family slug provided in this order could not be found in the merchant database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_SLUG_UNKNOWN = 2533,\n\n\n /**\n * A token family referenced in this order is either expired or not valid yet.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID = 2534,\n\n\n /**\n * The exchange says it does not know this transfer.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_EXCHANGE_UNKNOWN = 2550,\n\n\n /**\n * We internally failed to execute the /track/transfer request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_REQUEST_ERROR = 2551,\n\n\n /**\n * The amount transferred differs between what was submitted and what the exchange claimed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_TRANSFERS = 2552,\n\n\n /**\n * The exchange gave conflicting information about a coin which has been wire transferred.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS = 2553,\n\n\n /**\n * The exchange charged a different wire fee than what it originally advertised, and it is higher.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE = 2554,\n\n\n /**\n * We did not find the account that the transfer was made to.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_ACCOUNT_NOT_FOUND = 2555,\n\n\n /**\n * The backend could not delete the transfer as the echange already replied to our inquiry about it and we have integrated the result.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_TRANSFERS_ALREADY_CONFIRMED = 2556,\n\n\n /**\n * The backend was previously informed about a wire transfer with the same ID but a different amount. Multiple wire transfers with the same ID are not allowed. If the new amount is correct, the old transfer should first be deleted.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_SUBMISSION = 2557,\n\n\n /**\n * The amount transferred differs between what was submitted and what the exchange claimed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_CONFLICTING_TRANSFERS = 2563,\n\n\n /**\n * The merchant backend cannot create an instance under the given identifier as one already exists. Use PATCH to modify the existing entry.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS = 2600,\n\n\n /**\n * The merchant backend cannot create an instance because the authentication configuration field is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_BAD_AUTH = 2601,\n\n\n /**\n * The merchant backend cannot update an instance's authentication settings because the provided authentication settings are malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCE_AUTH_BAD_AUTH = 2602,\n\n\n /**\n * The merchant backend cannot create an instance under the given identifier, the previous one was deleted but must be purged first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED = 2603,\n\n\n /**\n * The merchant backend cannot update an instance under the given identifier, the previous one was deleted but must be purged first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_INSTANCES_PURGE_REQUIRED = 2625,\n\n\n /**\n * The bank account referenced in the requested operation was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_ACCOUNT_DELETE_UNKNOWN_ACCOUNT = 2626,\n\n\n /**\n * The bank account specified in the request already exists at the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_ACCOUNT_EXISTS = 2627,\n\n\n /**\n * The product ID exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PRODUCTS_CONFLICT_PRODUCT_EXISTS = 2650,\n\n\n /**\n * A category with the same name exists already.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS = 2651,\n\n\n /**\n * The update would have reduced the total amount of product lost, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_REDUCED = 2660,\n\n\n /**\n * The update would have mean that more stocks were lost than what remains from total inventory after sales, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_EXCEEDS_STOCKS = 2661,\n\n\n /**\n * The update would have reduced the total amount of product in stock, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_STOCKED_REDUCED = 2662,\n\n\n /**\n * The update would have reduced the total amount of product sold, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_SOLD_REDUCED = 2663,\n\n\n /**\n * The lock request is for more products than we have left (unlocked) in stock.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS = 2670,\n\n\n /**\n * The deletion request is for a product that is locked.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_PRODUCTS_CONFLICTING_LOCK = 2680,\n\n\n /**\n * The requested wire method is not supported by the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD = 2700,\n\n\n /**\n * The requested exchange does not allow rewards.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_RESERVES_REWARDS_NOT_ALLOWED = 2701,\n\n\n /**\n * The reserve could not be deleted because it is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE = 2710,\n\n\n /**\n * The reserve that was used to fund the rewards has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED = 2750,\n\n\n /**\n * The reserve that was used to fund the rewards was not found in the DB.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_UNKNOWN = 2751,\n\n\n /**\n * The backend knows the instance that was supposed to support the reward, and it was configured for rewardping. However, the funds remaining are insufficient to cover the reward, and the merchant should top up the reserve.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS = 2752,\n\n\n /**\n * The backend failed to find a reserve needed to authorize the reward.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND = 2753,\n\n\n /**\n * The merchant backend encountered a failure in computing the deposit total.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE = 2800,\n\n\n /**\n * The template ID already exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS = 2850,\n\n\n /**\n * The OTP device ID already exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_OTP_DEVICES_CONFLICT_OTP_DEVICE_EXISTS = 2851,\n\n\n /**\n * Amount given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT = 2860,\n\n\n /**\n * Subject given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT = 2861,\n\n\n /**\n * Amount not given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT = 2862,\n\n\n /**\n * Subject not given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY = 2863,\n\n\n /**\n * The webhook ID elready exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS = 2900,\n\n\n /**\n * The webhook serial elready exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PENDING_WEBHOOKS_CONFLICT_PENDING_WEBHOOK_EXISTS = 2910,\n\n\n /**\n * The auditor refused the connection due to a lack of authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_GENERIC_UNAUTHORIZED = 3001,\n\n\n /**\n * This method is not allowed here.\n * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_GENERIC_METHOD_NOT_ALLOWED = 3002,\n\n\n /**\n * The signature from the exchange on the deposit confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID = 3100,\n\n\n /**\n * The exchange key used for the signature on the deposit confirmation was revoked.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED = 3101,\n\n\n /**\n * The requested resource could not be found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_RESOURCE_NOT_FOUND = 3102,\n\n\n /**\n * The URI is missing a path component.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_URI_MISSING_PATH_COMPONENT = 3103,\n\n\n /**\n * Wire transfer attempted with credit and debit party being the same bank account.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_SAME_ACCOUNT = 5101,\n\n\n /**\n * Wire transfer impossible, due to financial limitation of the party that attempted the payment.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNALLOWED_DEBIT = 5102,\n\n\n /**\n * Negative numbers are not allowed (as value and/or fraction) to instantiate an amount object.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NEGATIVE_NUMBER_AMOUNT = 5103,\n\n\n /**\n * A too big number was used (as value and/or fraction) to instantiate an amount object.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NUMBER_TOO_BIG = 5104,\n\n\n /**\n * The bank account referenced in the requested operation was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_ACCOUNT = 5106,\n\n\n /**\n * The transaction referenced in the requested operation (typically a reject operation), was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TRANSACTION_NOT_FOUND = 5107,\n\n\n /**\n * Bank received a malformed amount string.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_BAD_FORMAT_AMOUNT = 5108,\n\n\n /**\n * The client does not own the account credited by the transaction which is to be rejected, so it has no rights do reject it.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REJECT_NO_RIGHTS = 5109,\n\n\n /**\n * This error code is returned when no known exception types captured the exception.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNMANAGED_EXCEPTION = 5110,\n\n\n /**\n * This error code is used for all those exceptions that do not really need a specific error code to return to the client. Used for example when a client is trying to register with a unavailable username.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_SOFT_EXCEPTION = 5111,\n\n\n /**\n * The request UID for a request to transfer funds has already been used, but with different details for the transfer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TRANSFER_REQUEST_UID_REUSED = 5112,\n\n\n /**\n * The withdrawal operation already has a reserve selected. The current request conflicts with the existing selection.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT = 5113,\n\n\n /**\n * The wire transfer subject duplicates an existing reserve public key. But wire transfer subjects must be unique.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_DUPLICATE_RESERVE_PUB_SUBJECT = 5114,\n\n\n /**\n * The client requested a transaction that is so far in the past, that it has been forgotten by the bank.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ANCIENT_TRANSACTION_GONE = 5115,\n\n\n /**\n * The client attempted to abort a transaction that was already confirmed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ABORT_CONFIRM_CONFLICT = 5116,\n\n\n /**\n * The client attempted to confirm a transaction that was already aborted.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONFIRM_ABORT_CONFLICT = 5117,\n\n\n /**\n * The client attempted to register an account with the same name.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_CONFLICT = 5118,\n\n\n /**\n * The client attempted to confirm a withdrawal operation before the wallet posted the required details.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_POST_WITHDRAWAL_OPERATION_REQUIRED = 5119,\n\n\n /**\n * The client tried to register a new account under a reserved username (like 'admin' for example).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_RESERVED_USERNAME_CONFLICT = 5120,\n\n\n /**\n * The client tried to register a new account with an username already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_USERNAME_REUSE = 5121,\n\n\n /**\n * The client tried to register a new account with a payto:// URI already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_PAYTO_URI_REUSE = 5122,\n\n\n /**\n * The client tried to delete an account with a non null balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_BALANCE_NOT_ZERO = 5123,\n\n\n /**\n * The client tried to create a transaction or an operation that credit an unknown account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_CREDITOR = 5124,\n\n\n /**\n * The client tried to create a transaction or an operation that debit an unknown account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_DEBTOR = 5125,\n\n\n /**\n * The client tried to perform an action prohibited for exchange accounts.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_IS_EXCHANGE = 5126,\n\n\n /**\n * The client tried to perform an action reserved for exchange accounts.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_IS_NOT_EXCHANGE = 5127,\n\n\n /**\n * Received currency conversion is wrong.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_BAD_CONVERSION = 5128,\n\n\n /**\n * The account referenced in this operation is missing tan info for the chosen channel.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_MISSING_TAN_INFO = 5129,\n\n\n /**\n * The client attempted to confirm a transaction with incomplete info.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONFIRM_INCOMPLETE = 5130,\n\n\n /**\n * The request rate is too high. The server is refusing requests to guard against brute-force attacks.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_RATE_LIMITED = 5131,\n\n\n /**\n * This TAN channel is not supported.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHANNEL_NOT_SUPPORTED = 5132,\n\n\n /**\n * Failed to send TAN using the helper script. Either script is not found, or script timeout, or script terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHANNEL_SCRIPT_FAILED = 5133,\n\n\n /**\n * The client's response to the challenge was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHALLENGE_FAILED = 5134,\n\n\n /**\n * A non-admin user has tried to change their legal name.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_LEGAL_NAME = 5135,\n\n\n /**\n * A non-admin user has tried to change their debt limit.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_DEBT_LIMIT = 5136,\n\n\n /**\n * A non-admin user has tried to change their password whihout providing the current one.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD = 5137,\n\n\n /**\n * Provided old password does not match current password.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_PATCH_BAD_OLD_PASSWORD = 5138,\n\n\n /**\n * An admin user has tried to become an exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_PATCH_ADMIN_EXCHANGE = 5139,\n\n\n /**\n * A non-admin user has tried to change their cashout account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_CASHOUT = 5140,\n\n\n /**\n * A non-admin user has tried to change their contact info.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_CONTACT = 5141,\n\n\n /**\n * The client tried to create a transaction that credit the admin account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ADMIN_CREDITOR = 5142,\n\n\n /**\n * The referenced challenge was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CHALLENGE_NOT_FOUND = 5143,\n\n\n /**\n * The referenced challenge has expired.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHALLENGE_EXPIRED = 5144,\n\n\n /**\n * A non-admin user has tried to create an account with 2fa.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_SET_TAN_CHANNEL = 5145,\n\n\n /**\n * A non-admin user has tried to set their minimum cashout amount.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_SET_MIN_CASHOUT = 5146,\n\n\n /**\n * Amount of currency conversion it less than the minimum allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONVERSION_AMOUNT_TO_SMALL = 5147,\n\n\n /**\n * Specified amount will not work for this withdrawal.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_AMOUNT_DIFFERS = 5148,\n\n\n /**\n * The backend requires an amount to be specified.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_AMOUNT_REQUIRED = 5149,\n\n\n /**\n * The sync service failed find the account in its database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_ACCOUNT_UNKNOWN = 6100,\n\n\n /**\n * The SHA-512 hash provided in the If-None-Match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_IF_NONE_MATCH = 6101,\n\n\n /**\n * The SHA-512 hash provided in the If-Match header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_IF_MATCH = 6102,\n\n\n /**\n * The signature provided in the \"Sync-Signature\" header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_SYNC_SIGNATURE = 6103,\n\n\n /**\n * The signature provided in the \"Sync-Signature\" header does not match the account, old or new Etags.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_INVALID_SIGNATURE = 6104,\n\n\n /**\n * The \"Content-length\" field for the upload is not a number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_MALFORMED_CONTENT_LENGTH = 6105,\n\n\n /**\n * The \"Content-length\" field for the upload is too big based on the server's terms of service.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_EXCESSIVE_CONTENT_LENGTH = 6106,\n\n\n /**\n * The server is out of memory to handle the upload. Trying again later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 6107,\n\n\n /**\n * The uploaded data does not match the Etag.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_INVALID_UPLOAD = 6108,\n\n\n /**\n * HTTP server experienced a timeout while awaiting promised payment.\n * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PAYMENT_GENERIC_TIMEOUT = 6109,\n\n\n /**\n * Sync could not setup the payment request with its own backend.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PAYMENT_CREATE_BACKEND_ERROR = 6110,\n\n\n /**\n * The sync service failed find the backup to be updated in its database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PREVIOUS_BACKUP_UNKNOWN = 6111,\n\n\n /**\n * The \"Content-length\" field for the upload is missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_MISSING_CONTENT_LENGTH = 6112,\n\n\n /**\n * Sync had problems communicating with its payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_GENERIC_BACKEND_ERROR = 6113,\n\n\n /**\n * Sync experienced a timeout communicating with its payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_GENERIC_BACKEND_TIMEOUT = 6114,\n\n\n /**\n * The wallet does not implement a version of the exchange protocol that is compatible with the protocol version of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE = 7000,\n\n\n /**\n * The wallet encountered an unexpected exception. This is likely a bug in the wallet implementation.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_UNEXPECTED_EXCEPTION = 7001,\n\n\n /**\n * The wallet received a response from a server, but the response can't be parsed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_RECEIVED_MALFORMED_RESPONSE = 7002,\n\n\n /**\n * The wallet tried to make a network request, but it received no response.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_NETWORK_ERROR = 7003,\n\n\n /**\n * The wallet tried to make a network request, but it was throttled.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_HTTP_REQUEST_THROTTLED = 7004,\n\n\n /**\n * The wallet made a request to a service, but received an error response it does not know how to handle.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_UNEXPECTED_REQUEST_ERROR = 7005,\n\n\n /**\n * The denominations offered by the exchange are insufficient. Likely the exchange is badly configured or not maintained.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT = 7006,\n\n\n /**\n * The wallet does not support the operation requested by a client.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_API_OPERATION_UNKNOWN = 7007,\n\n\n /**\n * The given taler://pay URI is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_INVALID_TALER_PAY_URI = 7008,\n\n\n /**\n * The signature on a coin by the exchange's denomination key is invalid after unblinding it.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_COIN_SIGNATURE_INVALID = 7009,\n\n\n /**\n * The exchange does not know about the reserve (yet), and thus withdrawal can't progress.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN_AT_EXCHANGE = 7010,\n\n\n /**\n * The wallet core service is not available.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_NOT_AVAILABLE = 7011,\n\n\n /**\n * The bank has aborted a withdrawal operation, and thus a withdrawal can't complete.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK = 7012,\n\n\n /**\n * An HTTP request made by the wallet timed out.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_HTTP_REQUEST_GENERIC_TIMEOUT = 7013,\n\n\n /**\n * The order has already been claimed by another wallet.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_ORDER_ALREADY_CLAIMED = 7014,\n\n\n /**\n * A group of withdrawal operations (typically for the same reserve at the same exchange) has errors and will be tried again later.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_GROUP_INCOMPLETE = 7015,\n\n\n /**\n * The signature on a coin by the exchange's denomination key (obtained through the merchant via a reward) is invalid after unblinding it.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_REWARD_COIN_SIGNATURE_INVALID = 7016,\n\n\n /**\n * The wallet does not implement a version of the bank integration API that is compatible with the version offered by the bank.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE = 7017,\n\n\n /**\n * The wallet processed a taler://pay URI, but the merchant base URL in the downloaded contract terms does not match the merchant base URL derived from the URI.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH = 7018,\n\n\n /**\n * The merchant's signature on the contract terms is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_SIGNATURE_INVALID = 7019,\n\n\n /**\n * The contract terms given by the merchant are malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_MALFORMED = 7020,\n\n\n /**\n * A pending operation failed, and thus the request can't be completed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PENDING_OPERATION_FAILED = 7021,\n\n\n /**\n * A payment was attempted, but the merchant had an internal server error (5xx).\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PAY_MERCHANT_SERVER_ERROR = 7022,\n\n\n /**\n * The crypto worker failed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CRYPTO_WORKER_ERROR = 7023,\n\n\n /**\n * The crypto worker received a bad request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CRYPTO_WORKER_BAD_REQUEST = 7024,\n\n\n /**\n * A KYC step is required before withdrawal can proceed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_KYC_REQUIRED = 7025,\n\n\n /**\n * The wallet does not have sufficient balance to create a deposit group.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE = 7026,\n\n\n /**\n * The wallet does not have sufficient balance to create a peer push payment.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE = 7027,\n\n\n /**\n * The wallet does not have sufficient balance to pay for an invoice.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE = 7028,\n\n\n /**\n * A group of refresh operations has errors and will be tried again later.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_REFRESH_GROUP_INCOMPLETE = 7029,\n\n\n /**\n * The exchange's self-reported base URL does not match the one that the wallet is using.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_BASE_URL_MISMATCH = 7030,\n\n\n /**\n * The order has already been paid by another wallet.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_ORDER_ALREADY_PAID = 7031,\n\n\n /**\n * An exchange that is required for some request is currently not available.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_UNAVAILABLE = 7032,\n\n\n /**\n * An exchange entry is still used by the exchange, thus it can't be deleted without purging.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_USED = 7033,\n\n\n /**\n * The wallet database is unavailable and the wallet thus is not operational.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_DB_UNAVAILABLE = 7034,\n\n\n /**\n * A taler:// URI is malformed and can't be parsed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_TALER_URI_MALFORMED = 7035,\n\n\n /**\n * A wallet-core request was cancelled and thus can't provide a response.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_REQUEST_CANCELLED = 7036,\n\n\n /**\n * A wallet-core request failed because the user needs to first accept the exchange's terms of service.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_TOS_NOT_ACCEPTED = 7037,\n\n\n /**\n * An exchange entry could not be updated, as the exchange's new details conflict with the new details.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT = 7038,\n\n\n /**\n * The wallet's information about the exchange is outdated.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_OUTDATED = 7039,\n\n\n /**\n * We encountered a timeout with our payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_BACKEND_TIMEOUT = 8000,\n\n\n /**\n * The backend requested payment, but the request is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_INVALID_PAYMENT_REQUEST = 8001,\n\n\n /**\n * The backend got an unexpected reply from the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_BACKEND_ERROR = 8002,\n\n\n /**\n * The \"Content-length\" field for the upload is missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_MISSING_CONTENT_LENGTH = 8003,\n\n\n /**\n * The \"Content-length\" field for the upload is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_MALFORMED_CONTENT_LENGTH = 8004,\n\n\n /**\n * The backend failed to setup an order with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_ORDER_CREATE_BACKEND_ERROR = 8005,\n\n\n /**\n * The backend was not authorized to check for payment with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED = 8006,\n\n\n /**\n * The backend could not check payment status with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PAYMENT_CHECK_START_FAILED = 8007,\n\n\n /**\n * The Anastasis provider could not be reached.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PROVIDER_UNREACHABLE = 8008,\n\n\n /**\n * HTTP server experienced a timeout while awaiting promised payment.\n * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_PAYMENT_GENERIC_TIMEOUT = 8009,\n\n\n /**\n * The key share is unknown to the provider.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UNKNOWN = 8108,\n\n\n /**\n * The authorization method used for the key share is no longer supported by the provider.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_AUTHORIZATION_METHOD_NO_LONGER_SUPPORTED = 8109,\n\n\n /**\n * The client needs to respond to the challenge.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED = 8110,\n\n\n /**\n * The client's response to the challenge was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_FAILED = 8111,\n\n\n /**\n * The backend is not aware of having issued the provided challenge code. Either this is the wrong code, or it has expired.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_UNKNOWN = 8112,\n\n\n /**\n * The backend failed to initiate the authorization process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_AUTHORIZATION_START_FAILED = 8114,\n\n\n /**\n * The authorization succeeded, but the key share is no longer available.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_KEY_SHARE_GONE = 8115,\n\n\n /**\n * The backend forgot the order we asked the client to pay for\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_ORDER_DISAPPEARED = 8116,\n\n\n /**\n * The backend itself reported a bad exchange interaction.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_BACKEND_EXCHANGE_BAD = 8117,\n\n\n /**\n * The backend reported a payment status we did not expect.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UNEXPECTED_PAYMENT_STATUS = 8118,\n\n\n /**\n * The backend failed to setup the order for payment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR = 8119,\n\n\n /**\n * The decryption of the key share failed with the provided key.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_DECRYPTION_FAILED = 8120,\n\n\n /**\n * The request rate is too high. The server is refusing requests to guard against brute-force attacks.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_RATE_LIMITED = 8121,\n\n\n /**\n * A request to issue a challenge is not valid for this authentication method.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_WRONG_METHOD = 8123,\n\n\n /**\n * The backend failed to store the key share because the UUID is already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS = 8150,\n\n\n /**\n * The backend failed to store the key share because the authorization method is not supported.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED = 8151,\n\n\n /**\n * The provided phone number is not an acceptable number.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_PHONE_INVALID = 8200,\n\n\n /**\n * Failed to run the SMS transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_HELPER_EXEC_FAILED = 8201,\n\n\n /**\n * Provider failed to send SMS. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_HELPER_COMMAND_FAILED = 8202,\n\n\n /**\n * The provided email address is not an acceptable address.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_INVALID = 8210,\n\n\n /**\n * Failed to run the E-mail transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_HELPER_EXEC_FAILED = 8211,\n\n\n /**\n * Provider failed to send E-mail. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_HELPER_COMMAND_FAILED = 8212,\n\n\n /**\n * The provided postal address is not an acceptable address.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_INVALID = 8220,\n\n\n /**\n * Failed to run the mail transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_HELPER_EXEC_FAILED = 8221,\n\n\n /**\n * Provider failed to send mail. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_HELPER_COMMAND_FAILED = 8222,\n\n\n /**\n * The provided IBAN address is not an acceptable IBAN.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_IBAN_INVALID = 8230,\n\n\n /**\n * The provider has not yet received the IBAN wire transfer authorizing the disclosure of the key share.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_IBAN_MISSING_TRANSFER = 8231,\n\n\n /**\n * The backend did not find a TOTP key in the data provided.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TOTP_KEY_MISSING = 8240,\n\n\n /**\n * The key provided does not satisfy the format restrictions for an Anastasis TOTP key.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TOTP_KEY_INVALID = 8241,\n\n\n /**\n * The given if-none-match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_IF_NONE_MATCH = 8301,\n\n\n /**\n * The server is out of memory to handle the upload. Trying again later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 8304,\n\n\n /**\n * The signature provided in the \"Anastasis-Policy-Signature\" header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_SIGNATURE = 8305,\n\n\n /**\n * The given if-match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_IF_MATCH = 8306,\n\n\n /**\n * The uploaded data does not match the Etag.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_INVALID_UPLOAD = 8307,\n\n\n /**\n * The provider is unaware of the requested policy.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_NOT_FOUND = 8350,\n\n\n /**\n * The given action is invalid for the current state of the reducer.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_ACTION_INVALID = 8400,\n\n\n /**\n * The given state of the reducer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_STATE_INVALID = 8401,\n\n\n /**\n * The given input to the reducer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_INVALID = 8402,\n\n\n /**\n * The selected authentication method does not work for the Anastasis provider.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED = 8403,\n\n\n /**\n * The given input and action do not work for the current state.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_INVALID_FOR_STATE = 8404,\n\n\n /**\n * We experienced an unexpected failure interacting with the backend.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_BACKEND_FAILURE = 8405,\n\n\n /**\n * The contents of a resource file did not match our expectations.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_RESOURCE_MALFORMED = 8406,\n\n\n /**\n * A required resource file is missing.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_RESOURCE_MISSING = 8407,\n\n\n /**\n * An input did not match the regular expression.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_REGEX_FAILED = 8408,\n\n\n /**\n * An input did not match the custom validation logic.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_VALIDATION_FAILED = 8409,\n\n\n /**\n * Our attempts to download the recovery document failed with all providers. Most likely the personal information you entered differs from the information you provided during the backup process and you should go back to the previous step. Alternatively, if you used a backup provider that is unknown to this application, you should add that provider manually.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED = 8410,\n\n\n /**\n * Anastasis provider reported a fatal failure.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_BACKUP_PROVIDER_FAILED = 8411,\n\n\n /**\n * Anastasis provider failed to respond to the configuration request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED = 8412,\n\n\n /**\n * The policy we downloaded is malformed. Must have been a client error while creating the backup.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_POLICY_MALFORMED = 8413,\n\n\n /**\n * We failed to obtain the policy, likely due to a network issue.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_NETWORK_FAILED = 8414,\n\n\n /**\n * The recovered secret did not match the required syntax.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_SECRET_MALFORMED = 8415,\n\n\n /**\n * The challenge data provided is too large for the available providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_CHALLENGE_DATA_TOO_BIG = 8416,\n\n\n /**\n * The provided core secret is too large for some of the providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_SECRET_TOO_BIG = 8417,\n\n\n /**\n * The provider returned in invalid configuration.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG = 8418,\n\n\n /**\n * The reducer encountered an internal error, likely a bug that needs to be reported.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INTERNAL_ERROR = 8419,\n\n\n /**\n * The reducer already synchronized with all providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED = 8420,\n\n\n /**\n * The Donau failed to perform the operation as it could not find the private keys. This is a problem with the Donau setup, not with the client's request.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_KEYS_MISSING = 8607,\n\n\n /**\n * The signature of the charity key is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_CHARITY_SIGNATURE_INVALID = 8608,\n\n\n /**\n * The charity is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_CHARITY_NOT_FOUND = 8609,\n\n\n /**\n * The donation amount specified in the request exceeds the limit of the charity.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_EXCEEDING_DONATION_LIMIT = 8610,\n\n\n /**\n * The Donau is not aware of the donation unit requested for the operation.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_DONATION_UNIT_UNKNOWN = 8611,\n\n\n /**\n * The Donau failed to talk to the process responsible for its private donation unit keys or the helpers had no donation units (properly) configured.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONATION_UNIT_HELPER_UNAVAILABLE = 8612,\n\n\n /**\n * The Donau failed to talk to the process responsible for its private signing keys.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_SIGNKEY_HELPER_UNAVAILABLE = 8613,\n\n\n /**\n * The response from the online signing key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_SIGNKEY_HELPER_BUG = 8614,\n\n\n /**\n * The number of segments included in the URI does not match the number of segments expected by the endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 8615,\n\n\n /**\n * The signature of the donation receipt is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONATION_RECEIPT_SIGNATURE_INVALID = 8616,\n\n\n /**\n * The client re-used a unique donor identifier nonce, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONOR_IDENTIFIER_NONCE_REUSE = 8617,\n\n\n /**\n * A generic error happened in the LibEuFin nexus. See the enclose details JSON for more information.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_NEXUS_GENERIC_ERROR = 9000,\n\n\n /**\n * An uncaught exception happened in the LibEuFin nexus service.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_NEXUS_UNCAUGHT_EXCEPTION = 9001,\n\n\n /**\n * A generic error happened in the LibEuFin sandbox. See the enclose details JSON for more information.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_SANDBOX_GENERIC_ERROR = 9500,\n\n\n /**\n * An uncaught exception happened in the LibEuFin sandbox service.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_SANDBOX_UNCAUGHT_EXCEPTION = 9501,\n\n\n /**\n * This validation method is not supported by the service.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n TALDIR_METHOD_NOT_SUPPORTED = 9600,\n\n\n /**\n * Number of allowed attempts for initiating a challenge exceeded.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n TALDIR_REGISTER_RATE_LIMITED = 9601,\n\n\n /**\n * The client is unknown or unauthorized.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_CLIENT_UNKNOWN = 9750,\n\n\n /**\n * The client is not authorized to use the given redirect URI.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_CLIENT_FORBIDDEN_BAD_REDIRECT_URI = 9751,\n\n\n /**\n * The service failed to execute its helper process to send the challenge.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_HELPER_EXEC_FAILED = 9752,\n\n\n /**\n * The grant is unknown to the service (it could also have expired).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GRANT_UNKNOWN = 9753,\n\n\n /**\n * The code given is not even well-formed.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_CLIENT_FORBIDDEN_BAD_CODE = 9754,\n\n\n /**\n * The service is not aware of the referenced validation process.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_VALIDATION_UNKNOWN = 9755,\n\n\n /**\n * The code given is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_CLIENT_FORBIDDEN_INVALID_CODE = 9756,\n\n\n /**\n * Too many attempts have been made, validation is temporarily disabled for this address.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_TOO_MANY_ATTEMPTS = 9757,\n\n\n /**\n * The PIN code provided is incorrect.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_INVALID_PIN = 9758,\n\n\n /**\n * The token cannot be valid as no address was ever provided by the client.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_MISSING_ADDRESS = 9759,\n\n\n /**\n * End of error code range.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n END = 9999,\n\n\n}\n", "/*\nMIT License\n\nCopyright (c) 2017 Conrad Reuter\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nconst NOOP = () => {};\n\n/**\n * A token that can be passed around to inform consumers of the token that a\n * certain operation has been cancelled.\n */\nclass CancellationToken {\n private _reason: any;\n private _callbacks?: Set<(reason?: any) => void> = new Set();\n\n /**\n * A cancellation token that is already cancelled.\n */\n public static readonly CANCELLED: CancellationToken = new CancellationToken(\n true,\n true,\n );\n\n /**\n * A cancellation token that is never cancelled.\n */\n public static readonly CONTINUE: CancellationToken = new CancellationToken(\n false,\n false,\n );\n\n /**\n * Whether the token has been cancelled.\n */\n public get isCancelled(): boolean {\n return this._isCancelled;\n }\n\n /**\n * Whether the token can be cancelled.\n */\n public get canBeCancelled(): boolean {\n return this._canBeCancelled;\n }\n\n /**\n * Why this token has been cancelled.\n */\n public get reason(): any {\n if (this.isCancelled) {\n return this._reason;\n } else {\n throw new Error(\"This token is not cancelled.\");\n }\n }\n\n /**\n * Make a promise that resolves when the async operation resolves,\n * or rejects when the operation is rejected or this token is cancelled.\n */\n public racePromise(asyncOperation: Promise): Promise {\n if (!this.canBeCancelled) {\n return asyncOperation;\n }\n return new Promise((resolve, reject) => {\n // we could use Promise.finally here as soon as it's implemented in the major browsers\n const unregister = this.onCancelled((reason) =>\n reject(new CancellationToken.CancellationError(reason)),\n );\n asyncOperation.then(\n (value) => {\n resolve(value);\n unregister();\n },\n (err) => {\n reject(err);\n unregister();\n },\n );\n });\n }\n\n /**\n * Throw a {CancellationToken.CancellationError} if this token is cancelled.\n */\n public throwIfCancelled(): void {\n if (this._isCancelled) {\n throw new CancellationToken.CancellationError(this._reason);\n }\n }\n\n /**\n * Invoke the callback when this token is cancelled.\n * If this token is already cancelled, the callback is invoked immediately.\n * Returns a function that unregisters the cancellation callback.\n */\n public onCancelled(cb: (reason?: any) => void): () => void {\n if (!this.canBeCancelled) {\n return NOOP;\n }\n if (this.isCancelled) {\n cb(this.reason);\n return NOOP;\n }\n\n /* istanbul ignore next */\n this._callbacks?.add(cb);\n return () => this._callbacks?.delete(cb);\n }\n\n private constructor(\n /**\n * Whether the token is already cancelled.\n */\n private _isCancelled: boolean,\n /**\n * Whether the token can be cancelled.\n */\n private _canBeCancelled: boolean,\n ) {}\n\n /**\n * Create a {CancellationTokenSource}.\n */\n public static create(): CancellationToken.Source {\n const token = new CancellationToken(false, true);\n\n const cancel = (reason?: any) => {\n if (token._isCancelled) return;\n token._isCancelled = true;\n token._reason = reason;\n token._callbacks?.forEach((cb) => cb(reason));\n dispose();\n };\n\n const dispose = () => {\n token._canBeCancelled = token.isCancelled;\n delete token._callbacks; // release memory\n };\n\n return { token, cancel, dispose };\n }\n\n /**\n * Create a {CancellationTokenSource}.\n * The token will be cancelled automatically after the specified timeout in milliseconds.\n */\n public static timeout(ms: number): CancellationToken.Source {\n const {\n token,\n cancel: originalCancel,\n dispose: originalDispose,\n } = CancellationToken.create();\n\n let timer: NodeJS.Timeout | null;\n timer = setTimeout(() => originalCancel(`CancellationToken.timeout ${ms}`), ms);\n const disposeTimer = () => {\n if (timer == null) return;\n clearTimeout(timer);\n timer = null;\n };\n\n const cancel = (reason?: any) => {\n disposeTimer();\n originalCancel(reason);\n };\n\n /* istanbul ignore next */\n const dispose = () => {\n disposeTimer();\n originalDispose();\n };\n\n return { token, cancel, dispose };\n }\n\n /**\n * Create a {CancellationToken} that is cancelled when all of the given tokens are cancelled.\n *\n * This is like {Promise.all} for {CancellationToken}s.\n */\n public static all(...tokens: CancellationToken[]): CancellationToken {\n // If *any* of the tokens cannot be cancelled, then the token we return can never be.\n if (tokens.some((token) => !token.canBeCancelled)) {\n return CancellationToken.CONTINUE;\n }\n\n const combined = CancellationToken.create();\n let countdown = tokens.length;\n const handleNextTokenCancelled = () => {\n if (--countdown === 0) {\n const reasons = tokens.map((token) => token._reason);\n combined.cancel(reasons);\n }\n };\n tokens.forEach((token) => token.onCancelled(handleNextTokenCancelled));\n return combined.token;\n }\n\n /**\n * Create a {CancellationToken} that is cancelled when at least one of the given tokens is cancelled.\n *\n * This is like {Promise.race} for {CancellationToken}s.\n */\n public static race(...tokens: CancellationToken[]): CancellationToken {\n // If *any* of the tokens is already cancelled, immediately return that token.\n for (const token of tokens) {\n if (token._isCancelled) {\n return token;\n }\n }\n\n const combined = CancellationToken.create();\n let unregistrations: (() => void)[];\n const handleAnyTokenCancelled = (reason?: any) => {\n unregistrations.forEach((unregister) => unregister()); // release memory\n combined.cancel(reason);\n };\n unregistrations = tokens.map((token) =>\n token.onCancelled(handleAnyTokenCancelled),\n );\n return combined.token;\n }\n}\n\n/* istanbul ignore next */\nnamespace CancellationToken {\n /**\n * Provides a {CancellationToken}, along with some methods to operate on it.\n */\n export interface Source {\n /**\n * The token provided by this source.\n */\n token: CancellationToken;\n\n /**\n * Cancel the provided token with the given reason.\n * Do nothing if the provided token cannot be cancelled or is already cancelled.\n */\n cancel(reason?: any): void;\n\n /**\n * Dispose of the token and this source and release memory.\n */\n dispose(): void;\n }\n\n /**\n * The error that is thrown when a {CancellationToken} has been cancelled and a\n * consumer of the token calls {CancellationToken.throwIfCancelled} on it.\n */\n export class CancellationError extends Error {\n public constructor(\n /**\n * The reason why the token was cancelled.\n */\n public readonly reason: any,\n ) {\n super(\"Operation cancelled\");\n Object.setPrototypeOf(this, CancellationError.prototype);\n }\n }\n}\n\nexport { CancellationToken };\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Types and helper functions for dealing with Taler amounts.\n */\n\n/**\n * Imports.\n */\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n codecForNumber,\n codecForString,\n renderContext,\n} from \"./codec.js\";\nimport { CurrencySpecification } from \"./index.js\";\nimport { AmountString } from \"./types-taler-common.js\";\n\n/**\n * Number of fractional units that one value unit represents.\n */\nexport const amountFractionalBase = 1e8;\n\n/**\n * How many digits behind the comma are required to represent the\n * fractional value in human readable decimal format? Must match\n * lg(fractionalBase)\n */\nexport const amountFractionalLength = 8;\n\n/**\n * Maximum allowed value field of an amount.\n */\nexport const amountMaxValue = 2 ** 52;\n\n/**\n * Separator character between integer and fractional\n */\nexport const FRAC_SEPARATOR = \".\";\n\n/**\n * Non-negative financial amount. Fractional values are expressed as multiples\n * of 1e-8.\n */\nexport interface AmountJson {\n /**\n * Value, must be an integer.\n */\n readonly value: number;\n\n /**\n * Fraction, must be an integer. Represent 1/1e8 of a unit.\n */\n readonly fraction: number;\n\n /**\n * Currency of the amount.\n */\n readonly currency: string;\n}\n\n/**\n * Immutable amount.\n */\nexport class Amount {\n static from(a: AmountLike): Amount {\n return new Amount(Amounts.parseOrThrow(a), 0);\n }\n\n static zeroOfCurrency(currency: string): Amount {\n return new Amount(Amounts.zeroOfCurrency(currency), 0);\n }\n\n add(...a: AmountLike[]): Amount {\n if (this.saturated) {\n return this;\n }\n const r = Amounts.add(this.val, ...a);\n return new Amount(r.amount, r.saturated ? 1 : 0);\n }\n\n mult(n: number): Amount {\n if (this.saturated) {\n return this;\n }\n const r = Amounts.mult(this, n);\n return new Amount(r.amount, r.saturated ? 1 : 0);\n }\n\n toJson(): AmountJson {\n return { ...this.val };\n }\n\n toString(): AmountString {\n return Amounts.stringify(this.val);\n }\n\n private constructor(\n private val: AmountJson,\n private saturated: number,\n ) {}\n}\n\nexport const codecForAmountJson = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"value\", codecForNumber())\n .property(\"fraction\", codecForNumber())\n .build(\"AmountJson\");\n\nexport function codecForAmountString(): Codec {\n return {\n decode(x: any, c?: Context): AmountString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (Amounts.parse(x) === undefined) {\n throw new DecodingError(\n `invalid amount at ${renderContext(c)} got \"${x}\"`,\n );\n }\n return x as AmountString;\n },\n };\n}\n\n/**\n * Result of a possibly overflowing operation.\n */\nexport interface Result {\n /**\n * Resulting, possibly saturated amount.\n */\n amount: AmountJson;\n /**\n * Was there an over-/underflow?\n */\n saturated: boolean;\n}\n\n/**\n * Type for things that are treated like amounts.\n */\nexport type AmountLike = string | AmountString | AmountJson | Amount;\n\nexport interface DivmodResult {\n quotient: number;\n remainder: AmountJson;\n}\n\n/**\n * Helper class for dealing with amounts.\n */\nexport class Amounts {\n private constructor() {\n throw Error(\"not instantiable\");\n }\n\n static currencyOf(amount: AmountLike) {\n const amt = Amounts.parseOrThrow(amount);\n return amt.currency;\n }\n\n static zeroOfAmount(amount: AmountLike): AmountJson {\n const amt = Amounts.parseOrThrow(amount);\n return {\n currency: amt.currency,\n fraction: 0,\n value: 0,\n };\n }\n\n /**\n * Get an amount that represents zero units of a currency.\n */\n static zeroOfCurrency(currency: string): AmountJson {\n return {\n currency,\n fraction: 0,\n value: 0,\n };\n }\n\n static jsonifyAmount(amt: AmountLike): AmountJson {\n if (typeof amt === \"string\") {\n return Amounts.parseOrThrow(amt);\n }\n if (amt instanceof Amount) {\n return amt.toJson();\n }\n return amt;\n }\n\n static divmod(a1: AmountLike, a2: AmountLike): DivmodResult {\n const am1 = Amounts.jsonifyAmount(a1);\n const am2 = Amounts.jsonifyAmount(a2);\n if (am1.currency != am2.currency) {\n throw Error(`incompatible currency (${am1.currency} vs${am2.currency})`);\n }\n\n const x1 =\n BigInt(am1.value) * BigInt(amountFractionalBase) + BigInt(am1.fraction);\n const x2 =\n BigInt(am2.value) * BigInt(amountFractionalBase) + BigInt(am2.fraction);\n\n const quotient = x1 / x2;\n const remainderScaled = x1 % x2;\n\n return {\n quotient: Number(quotient),\n remainder: {\n currency: am1.currency,\n value: Number(remainderScaled / BigInt(amountFractionalBase)),\n fraction: Number(remainderScaled % BigInt(amountFractionalBase)),\n },\n };\n }\n\n static sum(amounts: AmountLike[]): Result {\n if (amounts.length <= 0) {\n throw Error(\"can't sum zero amounts\");\n }\n const jsonAmounts = amounts.map((x) => Amounts.jsonifyAmount(x));\n return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));\n }\n\n static sumOrZero(currency: string, amounts: AmountLike[]): Result {\n if (amounts.length <= 0) {\n return {\n amount: Amounts.zeroOfCurrency(currency),\n saturated: false,\n };\n }\n const jsonAmounts = amounts.map((x) => Amounts.jsonifyAmount(x));\n return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));\n }\n\n /**\n * Add two amounts. Return the result and whether\n * the addition overflowed. The overflow is always handled\n * by saturating and never by wrapping.\n *\n * Throws when currencies don't match.\n */\n static add(first: AmountLike, ...rest: AmountLike[]): Result {\n const firstJ = Amounts.jsonifyAmount(first);\n const currency = firstJ.currency;\n let value =\n firstJ.value + Math.floor(firstJ.fraction / amountFractionalBase);\n if (value > amountMaxValue) {\n return {\n amount: {\n currency,\n value: amountMaxValue,\n fraction: amountFractionalBase - 1,\n },\n saturated: true,\n };\n }\n let fraction = firstJ.fraction % amountFractionalBase;\n for (const x of rest) {\n const xJ = Amounts.jsonifyAmount(x);\n if (xJ.currency.toUpperCase() !== currency.toUpperCase()) {\n throw Error(`Mismatched currency: ${xJ.currency} and ${currency}`);\n }\n\n value =\n value +\n xJ.value +\n Math.floor((fraction + xJ.fraction) / amountFractionalBase);\n fraction = Math.floor((fraction + xJ.fraction) % amountFractionalBase);\n if (value > amountMaxValue) {\n return {\n amount: {\n currency,\n value: amountMaxValue,\n fraction: amountFractionalBase - 1,\n },\n saturated: true,\n };\n }\n }\n return { amount: { currency, value, fraction }, saturated: false };\n }\n\n /**\n * Subtract two amounts. Return the result and whether\n * the subtraction overflowed. The overflow is always handled\n * by saturating and never by wrapping.\n *\n * Throws when currencies don't match.\n */\n static sub(a: AmountLike, ...rest: AmountLike[]): Result {\n const aJ = Amounts.jsonifyAmount(a);\n const currency = aJ.currency;\n let value = aJ.value;\n let fraction = aJ.fraction;\n\n for (const b of rest) {\n const bJ = Amounts.jsonifyAmount(b);\n if (bJ.currency.toUpperCase() !== aJ.currency.toUpperCase()) {\n throw Error(`Mismatched currency: ${bJ.currency} and ${currency}`);\n }\n if (fraction < bJ.fraction) {\n if (value < 1) {\n return {\n amount: { currency, value: 0, fraction: 0 },\n saturated: true,\n };\n }\n value--;\n fraction += amountFractionalBase;\n }\n console.assert(fraction >= bJ.fraction);\n fraction -= bJ.fraction;\n if (value < bJ.value) {\n return { amount: { currency, value: 0, fraction: 0 }, saturated: true };\n }\n value -= bJ.value;\n }\n\n return { amount: { currency, value, fraction }, saturated: false };\n }\n\n /**\n * Compare two amounts. Returns 0 when equal, -1 when a < b\n * and +1 when a > b. Throws when currencies don't match.\n */\n static cmp(a: AmountLike, b: AmountLike): -1 | 0 | 1 {\n a = Amounts.jsonifyAmount(a);\n b = Amounts.jsonifyAmount(b);\n if (a.currency !== b.currency) {\n throw Error(`Mismatched currency: ${a.currency} and ${b.currency}`);\n }\n const av = a.value + Math.floor(a.fraction / amountFractionalBase);\n const af = a.fraction % amountFractionalBase;\n const bv = b.value + Math.floor(b.fraction / amountFractionalBase);\n const bf = b.fraction % amountFractionalBase;\n switch (true) {\n case av < bv:\n return -1;\n case av > bv:\n return 1;\n case af < bf:\n return -1;\n case af > bf:\n return 1;\n case af === bf:\n return 0;\n default:\n throw Error(\"assertion failed\");\n }\n }\n\n /**\n * Create a copy of an amount.\n */\n static copy(a: AmountJson): AmountJson {\n return {\n currency: a.currency,\n fraction: a.fraction,\n value: a.value,\n };\n }\n\n /**\n * Divide an amount. Throws on division by zero.\n */\n static divide(a: AmountJson, n: number): AmountJson {\n if (n === 0) {\n throw Error(`Division by 0`);\n }\n if (n === 1) {\n return { value: a.value, fraction: a.fraction, currency: a.currency };\n }\n const r = a.value % n;\n return {\n currency: a.currency,\n fraction: Math.floor((r * amountFractionalBase + a.fraction) / n),\n value: Math.floor(a.value / n),\n };\n }\n\n /**\n * Check if an amount is non-zero.\n */\n static isNonZero(a: AmountLike): boolean {\n a = Amounts.jsonifyAmount(a);\n return a.value > 0 || a.fraction > 0;\n }\n\n static isZero(a: AmountLike): boolean {\n a = Amounts.jsonifyAmount(a);\n return a.value === 0 && a.fraction === 0;\n }\n\n /**\n * Check whether a string is a valid currency for a Taler amount.\n */\n static isCurrency(s: string): boolean {\n return /^[a-zA-Z]{1,11}$/.test(s);\n }\n\n /**\n * Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct.\n *\n * Currency name size limit is 11 of ASCII letters\n * Fraction size limit is 8\n */\n static parse(s: string): AmountJson | undefined {\n const res = s.match(/^([a-zA-Z]{1,11}):([0-9]+)([.][0-9]{1,8})?$/);\n if (!res) {\n return undefined;\n }\n const tail = res[3] || FRAC_SEPARATOR + \"0\";\n if (tail.length > amountFractionalLength + 1) {\n return undefined;\n }\n const value = Number.parseInt(res[2]);\n if (value > amountMaxValue) {\n return undefined;\n }\n return {\n currency: res[1].toUpperCase(),\n fraction: Math.round(amountFractionalBase * Number.parseFloat(tail)),\n value,\n };\n }\n\n /**\n * Parse amount in standard string form (like 'EUR:20.5'),\n * throw if the input is not a valid amount.\n */\n static parseOrThrow(s: AmountLike): AmountJson {\n if (s instanceof Amount) {\n return s.toJson();\n }\n if (typeof s === \"object\") {\n if (typeof s.currency !== \"string\") {\n throw Error(\"invalid amount object\");\n }\n if (typeof s.value !== \"number\") {\n throw Error(\"invalid amount object\");\n }\n if (typeof s.fraction !== \"number\") {\n throw Error(\"invalid amount object\");\n }\n return { currency: s.currency, value: s.value, fraction: s.fraction };\n } else if (typeof s === \"string\") {\n const res = Amounts.parse(s);\n if (!res) {\n throw Error(`Can't parse amount: \"${s}\"`);\n }\n return res;\n } else {\n throw Error(\"invalid amount (illegal type)\");\n }\n }\n\n static min(a: AmountLike, b: AmountLike): AmountJson {\n const cr = Amounts.cmp(a, b);\n if (cr >= 0) {\n return Amounts.jsonifyAmount(b);\n } else {\n return Amounts.jsonifyAmount(a);\n }\n }\n\n static max(a: AmountLike, b: AmountLike): AmountJson {\n const cr = Amounts.cmp(a, b);\n if (cr >= 0) {\n return Amounts.jsonifyAmount(a);\n } else {\n return Amounts.jsonifyAmount(b);\n }\n }\n\n static mult(a: AmountLike, n: number): Result {\n a = this.jsonifyAmount(a);\n if (!Number.isInteger(n)) {\n throw Error(\"amount can only be multiplied by an integer\");\n }\n if (n < 0) {\n throw Error(\"amount can only be multiplied by a positive integer\");\n }\n if (n == 0) {\n return {\n amount: Amounts.zeroOfCurrency(a.currency),\n saturated: false,\n };\n }\n let x = a;\n let acc = Amounts.zeroOfCurrency(a.currency);\n while (n > 1) {\n if (n % 2 == 0) {\n n = n / 2;\n } else {\n n = (n - 1) / 2;\n const r2 = Amounts.add(acc, x);\n if (r2.saturated) {\n return r2;\n }\n acc = r2.amount;\n }\n const r2 = Amounts.add(x, x);\n if (r2.saturated) {\n return r2;\n }\n x = r2.amount;\n }\n return Amounts.add(acc, x);\n }\n\n /**\n * Check if the argument is a valid amount in string form.\n */\n static check(a: any): boolean {\n if (typeof a !== \"string\") {\n return false;\n }\n try {\n const parsedAmount = Amounts.parse(a);\n return !!parsedAmount;\n } catch {\n return false;\n }\n }\n\n /**\n * Convert to standard human-readable string representation that's\n * also used in JSON formats.\n */\n static stringify(a: AmountLike): AmountString {\n a = Amounts.jsonifyAmount(a);\n const s = this.stringifyValue(a);\n\n return `${a.currency}:${s}` as AmountString;\n }\n\n static amountHasSameCurrency(a1: AmountLike, a2: AmountLike): boolean {\n const x1 = this.jsonifyAmount(a1);\n const x2 = this.jsonifyAmount(a2);\n return x1.currency.toUpperCase() === x2.currency.toUpperCase();\n }\n\n static isSameCurrency(curr1: string, curr2: string): boolean {\n return curr1.toLowerCase() === curr2.toLowerCase();\n }\n\n static stringifyValue(a: AmountLike, minFractional = 0): string {\n const aJ = Amounts.jsonifyAmount(a);\n const av = aJ.value + Math.floor(aJ.fraction / amountFractionalBase);\n const af = aJ.fraction % amountFractionalBase;\n let s = av.toString();\n\n if (af || minFractional) {\n s = s + FRAC_SEPARATOR;\n let n = af;\n for (let i = 0; i < amountFractionalLength; i++) {\n if (!n && i >= minFractional) {\n break;\n }\n s = s + Math.floor((n / amountFractionalBase) * 10).toString();\n n = (n * 10) % amountFractionalBase;\n }\n }\n\n return s;\n }\n\n /**\n * Number of fractional digits needed to fully represent the amount\n * @param a amount\n * @returns\n */\n static maxFractionalDigits(a: AmountJson): number {\n if (a.fraction === 0) return 0;\n if (a.fraction < 0) {\n console.error(\"amount fraction can not be negative\", a);\n return 0;\n }\n let i = 0;\n let check = true;\n let rest = a.fraction;\n while (rest > 0 && check) {\n check = rest % 10 === 0;\n rest = rest / 10;\n i++;\n }\n return amountFractionalLength - i + 1;\n }\n\n static stringifyValueWithSpec(\n value: AmountJson,\n spec: CurrencySpecification,\n ): { currency: string; normal: string; small?: string } {\n const strValue = Amounts.stringifyValue(value);\n const pos = strValue.indexOf(FRAC_SEPARATOR);\n const originalPosition = pos < 0 ? strValue.length : pos;\n\n let currency = value.currency;\n const names = Object.keys(spec.alt_unit_names);\n let FRAC_POS_NEW_POSITION = originalPosition;\n //find symbol\n //FIXME: this should be based on a cache to speed up\n if (names.length > 0) {\n let unitIndex: string = \"0\"; //default entry by DD51\n names.forEach((index) => {\n const i = Number.parseInt(index, 10);\n if (Number.isNaN(i)) return; //skip\n if (originalPosition - i <= 0) return; //too big\n if (originalPosition - i < FRAC_POS_NEW_POSITION) {\n FRAC_POS_NEW_POSITION = originalPosition - i;\n unitIndex = index;\n }\n });\n currency = spec.alt_unit_names[unitIndex];\n }\n\n if (originalPosition === FRAC_POS_NEW_POSITION) {\n const { normal, small } = splitNormalAndSmall(\n strValue,\n originalPosition,\n spec,\n );\n return { currency, normal, small };\n }\n\n const intPart = strValue.substring(0, originalPosition);\n const fracPArt = strValue.substring(originalPosition + 1);\n //indexSize is always smaller than originalPosition\n const newValue =\n intPart.substring(0, FRAC_POS_NEW_POSITION) +\n FRAC_SEPARATOR +\n intPart.substring(FRAC_POS_NEW_POSITION) +\n fracPArt;\n const { normal, small } = splitNormalAndSmall(\n newValue,\n FRAC_POS_NEW_POSITION,\n spec,\n );\n return { currency, normal, small };\n }\n}\n\nfunction splitNormalAndSmall(\n decimal: string,\n fracSeparatorIndex: number,\n spec: CurrencySpecification,\n): { normal: string; small?: string } {\n let normal: string;\n let small: string | undefined;\n if (\n decimal.length - fracSeparatorIndex - 1 >\n spec.num_fractional_normal_digits\n ) {\n const limit = fracSeparatorIndex + spec.num_fractional_normal_digits + 1;\n normal = decimal.substring(0, limit);\n small = decimal.substring(limit);\n } else {\n normal = decimal;\n small = undefined;\n }\n return { normal, small };\n}\n", "/*\nCopyright Mathias Bynens \nCopyright (c) 2022 Taler Systems S.A.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = \"-\"; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n overflow: \"Overflow: input needs wider integers to process\",\n \"not-basic\": \"Illegal input >= 0x80 (not a basic code point)\",\n \"invalid-input\": \"Invalid input\",\n} as { [x: string]: string };\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type: string) {\n throw new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array: any[], fn: (arg0: any) => any) {\n const result = [];\n let length = array.length;\n while (length--) {\n result[length] = fn(array[length]);\n }\n return result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(\n string: string,\n fn: { (string: any): any; (string: any): any; (arg0: any): any },\n) {\n const parts = string.split(\"@\");\n let result = \"\";\n if (parts.length > 1) {\n // In email addresses, only the domain name should be punycoded. Leave\n // the local part (i.e. everything up to `@`) intact.\n result = parts[0] + \"@\";\n string = parts[1];\n }\n // Avoid `split(regex)` for IE8 compatibility. See #17.\n string = string.replace(regexSeparators, \"\\x2E\");\n const labels = string.split(\".\");\n const encoded = map(labels, fn).join(\".\");\n return result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string: string) {\n const output = [];\n let counter = 0;\n const length = string.length;\n while (counter < length) {\n const value = string.charCodeAt(counter++);\n if (value >= 0xd800 && value <= 0xdbff && counter < length) {\n // It's a high surrogate, and there is a next character.\n const extra = string.charCodeAt(counter++);\n if ((extra & 0xfc00) == 0xdc00) {\n // Low surrogate.\n output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = (array: any): string => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function (codePoint: number) {\n if (codePoint - 0x30 < 0x0a) {\n return codePoint - 0x16;\n }\n if (codePoint - 0x41 < 0x1a) {\n return codePoint - 0x41;\n }\n if (codePoint - 0x61 < 0x1a) {\n return codePoint - 0x61;\n }\n return base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function (digit: number, flag: number) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * Number(digit < 26) - (Number(flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function (delta: number, numPoints: number, firstTime: boolean) {\n let k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n for (\n ;\n /* no initialization */ delta > (baseMinusTMin * tMax) >> 1;\n k += base\n ) {\n delta = floor(delta / baseMinusTMin);\n }\n return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function (input: string) {\n // Don't use UCS-2.\n const output = [];\n const inputLength = input.length;\n let i = 0;\n let n = initialN;\n let bias = initialBias;\n\n // Handle the basic code points: let `basic` be the number of input code\n // points before the last delimiter, or `0` if there is none, then copy\n // the first basic code points to the output.\n\n let basic = input.lastIndexOf(delimiter);\n if (basic < 0) {\n basic = 0;\n }\n\n for (let j = 0; j < basic; ++j) {\n // if it's not a basic code point\n if (input.charCodeAt(j) >= 0x80) {\n error(\"not-basic\");\n }\n output.push(input.charCodeAt(j));\n }\n\n // Main decoding loop: start just after the last delimiter if any basic code\n // points were copied; start at the beginning otherwise.\n\n for (\n let index = basic > 0 ? basic + 1 : 0;\n index < inputLength /* no final expression */;\n\n ) {\n // `index` is the index of the next character to be consumed.\n // Decode a generalized variable-length integer into `delta`,\n // which gets added to `i`. The overflow checking is easier\n // if we increase `i` as we go, then subtract off its starting\n // value at the end to obtain `delta`.\n let oldi = i;\n for (let w = 1, k = base /* no condition */; ; k += base) {\n if (index >= inputLength) {\n error(\"invalid-input\");\n }\n\n const digit = basicToDigit(input.charCodeAt(index++));\n\n if (digit >= base || digit > floor((maxInt - i) / w)) {\n error(\"overflow\");\n }\n\n i += digit * w;\n const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (digit < t) {\n break;\n }\n\n const baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT)) {\n error(\"overflow\");\n }\n\n w *= baseMinusT;\n }\n\n const out = output.length + 1;\n bias = adapt(i - oldi, out, oldi == 0);\n\n // `i` was supposed to wrap around from `out` to `0`,\n // incrementing `n` each time, so we'll fix that now:\n if (floor(i / out) > maxInt - n) {\n error(\"overflow\");\n }\n\n n += floor(i / out);\n i %= out;\n\n // Insert `n` at position `i` of the output.\n output.splice(i++, 0, n);\n }\n\n return String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function (inputArg: string) {\n const output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n let input = ucs2decode(inputArg);\n\n // Cache the length.\n let inputLength = input.length;\n\n // Initialize the state.\n let n = initialN;\n let delta = 0;\n let bias = initialBias;\n\n // Handle the basic code points.\n for (const currentValue of input) {\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n let basicLength = output.length;\n let handledCPCount = basicLength;\n\n // `handledCPCount` is the number of code points that have been handled;\n // `basicLength` is the number of basic code points.\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next\n // larger one:\n let m = maxInt;\n for (const currentValue of input) {\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's state to ,\n // but guard against overflow.\n const handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n error(\"overflow\");\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (const currentValue of input) {\n if (currentValue < n && ++delta > maxInt) {\n error(\"overflow\");\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n let q = delta;\n for (let k = base /* no condition */; ; k += base) {\n const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n if (q < t) {\n break;\n }\n const qMinusT = q - t;\n const baseMinusT = base - t;\n output.push(\n stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)),\n );\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q, 0)));\n bias = adapt(\n delta,\n handledCPCountPlusOne,\n handledCPCount == basicLength,\n );\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join(\"\");\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function (input: string) {\n return mapDomain(input, function (string) {\n return regexPunycode.test(string)\n ? decode(string.slice(4).toLowerCase())\n : string;\n });\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function (input: string) {\n return mapDomain(input, function (string) {\n return regexNonASCII.test(string) ? \"xn--\" + encode(string) : string;\n });\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nexport const punycode = {\n /**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n version: \"2.1.0\",\n /**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n ucs2: {\n decode: ucs2decode,\n encode: ucs2encode,\n },\n decode: decode,\n encode: encode,\n toASCII: toASCII,\n toUnicode: toUnicode,\n};\n", "/*\nThe MIT License (MIT)\n\nCopyright (c) Sebastian Mayr\nCopyright (c) 2022 Taler Systems S.A.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// Vendored with modifications (TypeScript etc.) from https://github.com/jsdom/whatwg-url\n\nconst utf8Encoder = new TextEncoder();\nconst utf8Decoder = new TextDecoder(\"utf-8\", { ignoreBOM: true });\n\nfunction utf8Encode(string: string | undefined) {\n return utf8Encoder.encode(string);\n}\n\nfunction utf8DecodeWithoutBOM(\n bytes: DataView | ArrayBuffer | null | undefined,\n) {\n return utf8Decoder.decode(bytes);\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-parser\nfunction parseUrlencoded(input: Uint8Array) {\n const sequences = strictlySplitByteSequence(input, p(\"&\"));\n const output = [];\n for (const bytes of sequences) {\n if (bytes.length === 0) {\n continue;\n }\n\n let name, value;\n const indexOfEqual = bytes.indexOf(p(\"=\")!);\n\n if (indexOfEqual >= 0) {\n name = bytes.slice(0, indexOfEqual);\n value = bytes.slice(indexOfEqual + 1);\n } else {\n name = bytes;\n value = new Uint8Array(0);\n }\n\n name = replaceByteInByteSequence(name, 0x2b, 0x20);\n value = replaceByteInByteSequence(value, 0x2b, 0x20);\n\n const nameString = utf8DecodeWithoutBOM(percentDecodeBytes(name));\n const valueString = utf8DecodeWithoutBOM(percentDecodeBytes(value));\n\n output.push([nameString, valueString]);\n }\n return output;\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-string-parser\nfunction parseUrlencodedString(input: string | undefined) {\n return parseUrlencoded(utf8Encode(input));\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-serializer\nfunction serializeUrlencoded(tuples: any[], encodingOverride = undefined) {\n let encoding = \"utf-8\";\n if (encodingOverride !== undefined) {\n // TODO \"get the output encoding\", i.e. handle encoding labels vs. names.\n encoding = encodingOverride;\n }\n\n let output = \"\";\n for (const [i, tuple] of tuples.entries()) {\n // TODO: handle encoding override\n\n const name = utf8PercentEncodeString(\n tuple[0],\n isURLEncodedPercentEncode,\n true,\n );\n\n let value = tuple[1];\n if (tuple.length > 2 && tuple[2] !== undefined) {\n if (tuple[2] === \"hidden\" && name === \"_charset_\") {\n value = encoding;\n } else if (tuple[2] === \"file\") {\n // value is a File object\n value = value.name;\n }\n }\n\n value = utf8PercentEncodeString(value, isURLEncodedPercentEncode, true);\n\n if (i !== 0) {\n output += \"&\";\n }\n output += `${name}=${value}`;\n }\n return output;\n}\n\nfunction strictlySplitByteSequence(buf: Uint8Array, cp: any) {\n const list = [];\n let last = 0;\n let i = buf.indexOf(cp);\n while (i >= 0) {\n list.push(buf.slice(last, i));\n last = i + 1;\n i = buf.indexOf(cp, last);\n }\n if (last !== buf.length) {\n list.push(buf.slice(last));\n }\n return list;\n}\n\nfunction replaceByteInByteSequence(buf: Uint8Array, from: number, to: number) {\n let i = buf.indexOf(from);\n while (i >= 0) {\n buf[i] = to;\n i = buf.indexOf(from, i + 1);\n }\n return buf;\n}\n\nfunction p(char: string) {\n return char.codePointAt(0);\n}\n\n// https://url.spec.whatwg.org/#percent-encode\nfunction percentEncode(c: number) {\n let hex = c.toString(16).toUpperCase();\n if (hex.length === 1) {\n hex = `0${hex}`;\n }\n\n return `%${hex}`;\n}\n\n// https://url.spec.whatwg.org/#percent-decode\nfunction percentDecodeBytes(input: Uint8Array) {\n const output = new Uint8Array(input.byteLength);\n let outputIndex = 0;\n for (let i = 0; i < input.byteLength; ++i) {\n const byte = input[i];\n if (byte !== 0x25) {\n output[outputIndex++] = byte;\n } else if (\n byte === 0x25 &&\n (!isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2]))\n ) {\n output[outputIndex++] = byte;\n } else {\n const bytePoint = parseInt(\n String.fromCodePoint(input[i + 1], input[i + 2]),\n 16,\n );\n output[outputIndex++] = bytePoint;\n i += 2;\n }\n }\n\n return output.slice(0, outputIndex);\n}\n\n// https://url.spec.whatwg.org/#string-percent-decode\nfunction percentDecodeString(input: string) {\n const bytes = utf8Encode(input);\n return percentDecodeBytes(bytes);\n}\n\n// https://url.spec.whatwg.org/#c0-control-percent-encode-set\nfunction isC0ControlPercentEncode(c: number) {\n return c <= 0x1f || c > 0x7e;\n}\n\n// https://url.spec.whatwg.org/#fragment-percent-encode-set\nconst extraFragmentPercentEncodeSet = new Set([\n p(\" \"),\n p('\"'),\n p(\"<\"),\n p(\">\"),\n p(\"`\"),\n]);\n\nfunction isFragmentPercentEncode(c: number) {\n return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#query-percent-encode-set\nconst extraQueryPercentEncodeSet = new Set([\n p(\" \"),\n p('\"'),\n p(\"#\"),\n p(\"<\"),\n p(\">\"),\n]);\n\nfunction isQueryPercentEncode(c: number) {\n return isC0ControlPercentEncode(c) || extraQueryPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#special-query-percent-encode-set\nfunction isSpecialQueryPercentEncode(c: number) {\n return isQueryPercentEncode(c) || c === p(\"'\");\n}\n\n// https://url.spec.whatwg.org/#path-percent-encode-set\nconst extraPathPercentEncodeSet = new Set([p(\"?\"), p(\"`\"), p(\"{\"), p(\"}\")]);\nfunction isPathPercentEncode(c: number) {\n return isQueryPercentEncode(c) || extraPathPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#userinfo-percent-encode-set\nconst extraUserinfoPercentEncodeSet = new Set([\n p(\"/\"),\n p(\":\"),\n p(\";\"),\n p(\"=\"),\n p(\"@\"),\n p(\"[\"),\n p(\"\\\\\"),\n p(\"]\"),\n p(\"^\"),\n p(\"|\"),\n]);\nfunction isUserinfoPercentEncode(c: number) {\n return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#component-percent-encode-set\nconst extraComponentPercentEncodeSet = new Set([\n p(\"$\"),\n p(\"%\"),\n p(\"&\"),\n p(\"+\"),\n p(\",\"),\n]);\nfunction isComponentPercentEncode(c: number) {\n return isUserinfoPercentEncode(c) || extraComponentPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set\nconst extraURLEncodedPercentEncodeSet = new Set([\n p(\"!\"),\n p(\"'\"),\n p(\"(\"),\n p(\")\"),\n p(\"~\"),\n]);\n\nfunction isURLEncodedPercentEncode(c: number) {\n return isComponentPercentEncode(c) || extraURLEncodedPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#code-point-percent-encode-after-encoding\n// https://url.spec.whatwg.org/#utf-8-percent-encode\n// Assuming encoding is always utf-8 allows us to trim one of the logic branches. TODO: support encoding.\n// The \"-Internal\" variant here has code points as JS strings. The external version used by other files has code points\n// as JS numbers, like the rest of the codebase.\nfunction utf8PercentEncodeCodePointInternal(\n codePoint: string,\n percentEncodePredicate: (arg0: number) => any,\n) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}\n\nfunction utf8PercentEncodeCodePoint(\n codePoint: number,\n percentEncodePredicate: (arg0: number) => any,\n) {\n return utf8PercentEncodeCodePointInternal(\n String.fromCodePoint(codePoint),\n percentEncodePredicate,\n );\n}\n\n// https://url.spec.whatwg.org/#string-percent-encode-after-encoding\n// https://url.spec.whatwg.org/#string-utf-8-percent-encode\nfunction utf8PercentEncodeString(\n input: string,\n percentEncodePredicate: {\n (c: number): boolean;\n (c: number): boolean;\n (arg0: number): any;\n },\n spaceAsPlus = false,\n) {\n let output = \"\";\n for (const codePoint of input) {\n if (spaceAsPlus && codePoint === \" \") {\n output += \"+\";\n } else {\n output += utf8PercentEncodeCodePointInternal(\n codePoint,\n percentEncodePredicate,\n );\n }\n }\n return output;\n}\n\n// Note that we take code points as JS numbers, not JS strings.\n\nfunction isASCIIDigit(c: number) {\n return c >= 0x30 && c <= 0x39;\n}\n\nfunction isASCIIAlpha(c: number) {\n return (c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a);\n}\n\nfunction isASCIIAlphanumeric(c: number) {\n return isASCIIAlpha(c) || isASCIIDigit(c);\n}\n\nfunction isASCIIHex(c: number) {\n return (\n isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66)\n );\n}\n\nexport class URLSearchParamsImpl {\n _list: any[];\n _url: any;\n constructor(init: any, { doNotStripQMark = false }: any = {}) {\n this._list = [];\n this._url = null;\n\n if (!doNotStripQMark && typeof init === \"string\" && init[0] === \"?\") {\n init = init.slice(1);\n }\n\n if (Array.isArray(init)) {\n for (const pair of init) {\n if (pair.length !== 2) {\n throw new TypeError(\n \"Failed to construct 'URLSearchParams': parameter 1 sequence's element does not \" +\n \"contain exactly two elements.\",\n );\n }\n this._list.push([pair[0], pair[1]]);\n }\n } else if (\n typeof init === \"object\" &&\n Object.getPrototypeOf(init) === null\n ) {\n for (const name of Object.keys(init)) {\n const value = init[name];\n this._list.push([name, value]);\n }\n } else {\n this._list = parseUrlencodedString(init);\n }\n }\n\n _updateSteps() {\n if (this._url !== null) {\n let query: string | null = serializeUrlencoded(this._list);\n if (query === \"\") {\n query = null;\n }\n this._url._url.query = query;\n }\n }\n\n append(name: string, value: string) {\n this._list.push([name, value]);\n this._updateSteps();\n }\n\n delete(name: string) {\n let i = 0;\n while (i < this._list.length) {\n if (this._list[i][0] === name) {\n this._list.splice(i, 1);\n } else {\n i++;\n }\n }\n this._updateSteps();\n }\n\n get(name: string) {\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n return tuple[1];\n }\n }\n return null;\n }\n\n getAll(name: string) {\n const output = [];\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n output.push(tuple[1]);\n }\n }\n return output;\n }\n\n entries() {\n return [...this._list.map(x => [x[0], x[1]])];\n }\n\n forEach(\n callbackfn: (\n value: string,\n key: string,\n parent: URLSearchParamsImpl,\n ) => void,\n thisArg?: any,\n ): void {\n for (const tuple of this._list) {\n callbackfn.call(thisArg, tuple[1], tuple[0], this);\n }\n }\n\n has(name: string) {\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n return true;\n }\n }\n return false;\n }\n\n set(name: string, value: string) {\n let found = false;\n let i = 0;\n while (i < this._list.length) {\n if (this._list[i][0] === name) {\n if (found) {\n this._list.splice(i, 1);\n } else {\n found = true;\n this._list[i][1] = value;\n i++;\n }\n } else {\n i++;\n }\n }\n if (!found) {\n this._list.push([name, value]);\n }\n this._updateSteps();\n }\n\n sort() {\n this._list.sort((a, b) => {\n if (a[0] < b[0]) {\n return -1;\n }\n if (a[0] > b[0]) {\n return 1;\n }\n return 0;\n });\n\n this._updateSteps();\n }\n\n [Symbol.iterator]() {\n return this._list[Symbol.iterator]();\n }\n\n toString() {\n return serializeUrlencoded(this._list);\n }\n}\n\nconst specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443,\n} as { [x: string]: number | null };\n\nconst failure = Symbol(\"failure\");\n\nfunction countSymbols(str: any) {\n return [...str].length;\n}\n\nfunction at(input: any, idx: any) {\n const c = input[idx];\n return isNaN(c) ? undefined : String.fromCodePoint(c);\n}\n\nfunction isSingleDot(buffer: string) {\n return buffer === \".\" || buffer.toLowerCase() === \"%2e\";\n}\n\nfunction isDoubleDot(buffer: string) {\n buffer = buffer.toLowerCase();\n return (\n buffer === \"..\" ||\n buffer === \"%2e.\" ||\n buffer === \".%2e\" ||\n buffer === \"%2e%2e\"\n );\n}\n\nfunction isWindowsDriveLetterCodePoints(cp1: number, cp2: number) {\n return isASCIIAlpha(cp1) && (cp2 === p(\":\") || cp2 === p(\"|\"));\n}\n\nfunction isWindowsDriveLetterString(string: string) {\n return (\n string.length === 2 &&\n isASCIIAlpha(string.codePointAt(0)!) &&\n (string[1] === \":\" || string[1] === \"|\")\n );\n}\n\nfunction isNormalizedWindowsDriveLetterString(string: string) {\n return (\n string.length === 2 &&\n isASCIIAlpha(string.codePointAt(0)!) &&\n string[1] === \":\"\n );\n}\n\nfunction containsForbiddenHostCodePoint(string: string) {\n return (\n string.search(\n /\\u0000|\\u0009|\\u000A|\\u000D|\\u0020|#|\\/|:|<|>|\\?|@|\\[|\\\\|\\]|\\^|\\|/u,\n ) !== -1\n );\n}\n\nfunction containsForbiddenDomainCodePoint(string: string) {\n return (\n containsForbiddenHostCodePoint(string) ||\n string.search(/[\\u0000-\\u001F]|%|\\u007F/u) !== -1\n );\n}\n\nfunction isSpecialScheme(scheme: string) {\n return specialSchemes[scheme] !== undefined;\n}\n\nfunction isSpecial(url: any) {\n return isSpecialScheme(url.scheme);\n}\n\nfunction isNotSpecial(url: UrlObj) {\n return !isSpecialScheme(url.scheme);\n}\n\nfunction defaultPort(scheme: string) {\n return specialSchemes[scheme];\n}\n\nfunction parseIPv4Number(input: string) {\n if (input === \"\") {\n return failure;\n }\n\n let R = 10;\n\n if (\n input.length >= 2 &&\n input.charAt(0) === \"0\" &&\n input.charAt(1).toLowerCase() === \"x\"\n ) {\n input = input.substring(2);\n R = 16;\n } else if (input.length >= 2 && input.charAt(0) === \"0\") {\n input = input.substring(1);\n R = 8;\n }\n\n if (input === \"\") {\n return 0;\n }\n\n let regex = /[^0-7]/u;\n if (R === 10) {\n regex = /[^0-9]/u;\n }\n if (R === 16) {\n regex = /[^0-9A-Fa-f]/u;\n }\n\n if (regex.test(input)) {\n return failure;\n }\n\n return parseInt(input, R);\n}\n\nfunction parseIPv4(input: string) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length > 1) {\n parts.pop();\n }\n }\n\n if (parts.length > 4) {\n return failure;\n }\n\n const numbers = [];\n for (const part of parts) {\n const n = parseIPv4Number(part);\n if (n === failure) {\n return failure;\n }\n\n numbers.push(n);\n }\n\n for (let i = 0; i < numbers.length - 1; ++i) {\n if (numbers[i] > 255) {\n return failure;\n }\n }\n if (numbers[numbers.length - 1] >= 256 ** (5 - numbers.length)) {\n return failure;\n }\n\n let ipv4 = numbers.pop();\n let counter = 0;\n\n for (const n of numbers) {\n ipv4! += n * 256 ** (3 - counter);\n ++counter;\n }\n\n return ipv4;\n}\n\nfunction serializeIPv4(address: number) {\n let output = \"\";\n let n = address;\n\n for (let i = 1; i <= 4; ++i) {\n output = String(n % 256) + output;\n if (i !== 4) {\n output = `.${output}`;\n }\n n = Math.floor(n / 256);\n }\n\n return output;\n}\n\nfunction parseIPv6(inputArg: string) {\n const address = [0, 0, 0, 0, 0, 0, 0, 0];\n let pieceIndex = 0;\n let compress = null;\n let pointer = 0;\n\n const input = Array.from(inputArg, (c) => c.codePointAt(0));\n\n if (input[pointer] === p(\":\")) {\n if (input[pointer + 1] !== p(\":\")) {\n return failure;\n }\n\n pointer += 2;\n ++pieceIndex;\n compress = pieceIndex;\n }\n\n while (pointer < input.length) {\n if (pieceIndex === 8) {\n return failure;\n }\n\n if (input[pointer] === p(\":\")) {\n if (compress !== null) {\n return failure;\n }\n ++pointer;\n ++pieceIndex;\n compress = pieceIndex;\n continue;\n }\n\n let value = 0;\n let length = 0;\n\n while (length < 4 && isASCIIHex(input[pointer]!)) {\n value = value * 0x10 + parseInt(at(input, pointer)!, 16);\n ++pointer;\n ++length;\n }\n\n if (input[pointer] === p(\".\")) {\n if (length === 0) {\n return failure;\n }\n\n pointer -= length;\n\n if (pieceIndex > 6) {\n return failure;\n }\n\n let numbersSeen = 0;\n\n while (input[pointer] !== undefined) {\n let ipv4Piece = null;\n\n if (numbersSeen > 0) {\n if (input[pointer] === p(\".\") && numbersSeen < 4) {\n ++pointer;\n } else {\n return failure;\n }\n }\n\n if (!isASCIIDigit(input[pointer]!)) {\n return failure;\n }\n\n while (isASCIIDigit(input[pointer]!)) {\n const number = parseInt(at(input, pointer)!);\n if (ipv4Piece === null) {\n ipv4Piece = number;\n } else if (ipv4Piece === 0) {\n return failure;\n } else {\n ipv4Piece = ipv4Piece * 10 + number;\n }\n if (ipv4Piece > 255) {\n return failure;\n }\n ++pointer;\n }\n\n address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece!;\n\n ++numbersSeen;\n\n if (numbersSeen === 2 || numbersSeen === 4) {\n ++pieceIndex;\n }\n }\n\n if (numbersSeen !== 4) {\n return failure;\n }\n\n break;\n } else if (input[pointer] === p(\":\")) {\n ++pointer;\n if (input[pointer] === undefined) {\n return failure;\n }\n } else if (input[pointer] !== undefined) {\n return failure;\n }\n\n address[pieceIndex] = value;\n ++pieceIndex;\n }\n\n if (compress !== null) {\n let swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex !== 0 && swaps > 0) {\n const temp = address[compress + swaps - 1];\n address[compress + swaps - 1] = address[pieceIndex];\n address[pieceIndex] = temp;\n --pieceIndex;\n --swaps;\n }\n } else if (compress === null && pieceIndex !== 8) {\n return failure;\n }\n\n return address;\n}\n\nfunction serializeIPv6(address: any[]) {\n let output = \"\";\n const compress = findLongestZeroSequence(address);\n let ignore0 = false;\n\n for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {\n if (ignore0 && address[pieceIndex] === 0) {\n continue;\n } else if (ignore0) {\n ignore0 = false;\n }\n\n if (compress === pieceIndex) {\n const separator = pieceIndex === 0 ? \"::\" : \":\";\n output += separator;\n ignore0 = true;\n continue;\n }\n\n output += address[pieceIndex].toString(16);\n\n if (pieceIndex !== 7) {\n output += \":\";\n }\n }\n\n return output;\n}\n\nfunction parseHost(input: string, isNotSpecialArg = false) {\n if (input[0] === \"[\") {\n if (input[input.length - 1] !== \"]\") {\n return failure;\n }\n\n return parseIPv6(input.substring(1, input.length - 1));\n }\n\n if (isNotSpecialArg) {\n return parseOpaqueHost(input);\n }\n\n const domain = utf8DecodeWithoutBOM(percentDecodeString(input));\n const asciiDomain = domainToASCII(domain);\n if (asciiDomain === failure) {\n return failure;\n }\n\n if (containsForbiddenDomainCodePoint(asciiDomain)) {\n return failure;\n }\n\n if (endsInANumber(asciiDomain)) {\n return parseIPv4(asciiDomain);\n }\n\n return asciiDomain;\n}\n\nfunction endsInANumber(input: string) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length === 1) {\n return false;\n }\n parts.pop();\n }\n\n const last = parts[parts.length - 1];\n if (parseIPv4Number(last) !== failure) {\n return true;\n }\n\n if (/^[0-9]+$/u.test(last)) {\n return true;\n }\n\n return false;\n}\n\nfunction parseOpaqueHost(input: string) {\n if (containsForbiddenHostCodePoint(input)) {\n return failure;\n }\n\n return utf8PercentEncodeString(input, isC0ControlPercentEncode);\n}\n\nfunction findLongestZeroSequence(arr: number[]) {\n let maxIdx = null;\n let maxLen = 1; // only find elements > 1\n let currStart = null;\n let currLen = 0;\n\n for (let i = 0; i < arr.length; ++i) {\n if (arr[i] !== 0) {\n if (currLen > maxLen) {\n maxIdx = currStart;\n maxLen = currLen;\n }\n\n currStart = null;\n currLen = 0;\n } else {\n if (currStart === null) {\n currStart = i;\n }\n ++currLen;\n }\n }\n\n // if trailing zeros\n if (currLen > maxLen) {\n return currStart;\n }\n\n return maxIdx;\n}\n\nfunction serializeHost(host: number | number[] | string) {\n if (typeof host === \"number\") {\n return serializeIPv4(host);\n }\n\n // IPv6 serializer\n if (host instanceof Array) {\n return `[${serializeIPv6(host)}]`;\n }\n\n return host;\n}\n\nimport { punycode } from \"./punycode.js\";\n\nfunction domainToASCII(domain: string, beStrict = false) {\n // const result = tr46.toASCII(domain, {\n // checkBidi: true,\n // checkHyphens: false,\n // checkJoiners: true,\n // useSTD3ASCIIRules: beStrict,\n // verifyDNSLength: beStrict,\n // });\n let result;\n try {\n result = punycode.toASCII(domain);\n } catch (e) {\n return failure;\n }\n if (result === null || result === \"\") {\n return failure;\n }\n return result;\n}\n\nfunction trimControlChars(url: string) {\n return url.replace(/^[\\u0000-\\u001F\\u0020]+|[\\u0000-\\u001F\\u0020]+$/gu, \"\");\n}\n\nfunction trimTabAndNewline(url: string) {\n return url.replace(/\\u0009|\\u000A|\\u000D/gu, \"\");\n}\n\nfunction shortenPath(url: UrlObj) {\n const { path } = url;\n if (path.length === 0) {\n return;\n }\n if (\n url.scheme === \"file\" &&\n path.length === 1 &&\n isNormalizedWindowsDriveLetter(path[0])\n ) {\n return;\n }\n\n path.pop();\n}\n\nfunction includesCredentials(url: UrlObj) {\n return url.username !== \"\" || url.password !== \"\";\n}\n\nfunction cannotHaveAUsernamePasswordPort(url: UrlObj) {\n return url.host === null || url.host === \"\" || url.scheme === \"file\";\n}\n\nfunction hasAnOpaquePath(url: UrlObj) {\n return typeof url.path === \"string\";\n}\n\nfunction isNormalizedWindowsDriveLetter(string: string) {\n return /^[A-Za-z]:$/u.test(string);\n}\n\nexport interface UrlObj {\n scheme: string;\n username: string;\n password: string;\n host: string | number[] | number | null | undefined;\n port: number | null;\n path: string[];\n query: any;\n fragment: any;\n}\n\nclass URLStateMachine {\n pointer: number;\n input: number[];\n base: any;\n encodingOverride: string;\n url: UrlObj;\n state: string;\n stateOverride: string;\n failure: boolean;\n parseError: boolean;\n buffer: string;\n atFlag: boolean;\n arrFlag: boolean;\n passwordTokenSeenFlag: boolean;\n\n constructor(\n input: string,\n base: any,\n encodingOverride: string,\n url: UrlObj,\n stateOverride: string,\n ) {\n this.pointer = 0;\n this.base = base || null;\n this.encodingOverride = encodingOverride || \"utf-8\";\n this.url = url;\n this.failure = false;\n this.parseError = false;\n\n if (!this.url) {\n this.url = {\n scheme: \"\",\n username: \"\",\n password: \"\",\n host: null,\n port: null,\n path: [],\n query: null,\n fragment: null,\n };\n\n const res = trimControlChars(input);\n if (res !== input) {\n this.parseError = true;\n }\n input = res;\n }\n\n const res = trimTabAndNewline(input);\n if (res !== input) {\n this.parseError = true;\n }\n input = res;\n\n this.state = stateOverride || \"scheme start\";\n\n this.buffer = \"\";\n this.atFlag = false;\n this.arrFlag = false;\n this.passwordTokenSeenFlag = false;\n\n this.input = Array.from(input, (c) => c.codePointAt(0)!);\n\n for (; this.pointer <= this.input.length; ++this.pointer) {\n const c = this.input[this.pointer];\n const cStr = isNaN(c) ? undefined : String.fromCodePoint(c);\n\n // exec state machine\n const ret = this.table[`parse ${this.state}`].call(this, c, cStr!);\n if (!ret) {\n break; // terminate algorithm\n } else if (ret === failure) {\n this.failure = true;\n break;\n }\n }\n }\n\n table = {\n \"parse scheme start\": this.parseSchemeStart,\n \"parse scheme\": this.parseScheme,\n \"parse no scheme\": this.parseNoScheme,\n \"parse special relative or authority\": this.parseSpecialRelativeOrAuthority,\n \"parse path or authority\": this.parsePathOrAuthority,\n \"parse relative\": this.parseRelative,\n \"parse relative slash\": this.parseRelativeSlash,\n \"parse special authority slashes\": this.parseSpecialAuthoritySlashes,\n \"parse special authority ignore slashes\":\n this.parseSpecialAuthorityIgnoreSlashes,\n \"parse authority\": this.parseAuthority,\n \"parse host\": this.parseHostName,\n \"parse hostname\": this.parseHostName /* intentional duplication */,\n \"parse port\": this.parsePort,\n \"parse file\": this.parseFile,\n \"parse file slash\": this.parseFileSlash,\n \"parse file host\": this.parseFileHost,\n \"parse path start\": this.parsePathStart,\n \"parse path\": this.parsePath,\n \"parse opaque path\": this.parseOpaquePath,\n \"parse query\": this.parseQuery,\n \"parse fragment\": this.parseFragment,\n } as { [x: string]: (c: number, cStr: string) => any };\n\n parseSchemeStart(c: number, cStr: string) {\n if (isASCIIAlpha(c)) {\n this.buffer += cStr.toLowerCase();\n this.state = \"scheme\";\n } else if (!this.stateOverride) {\n this.state = \"no scheme\";\n --this.pointer;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseScheme(c: number, cStr: string) {\n if (\n isASCIIAlphanumeric(c) ||\n c === p(\"+\") ||\n c === p(\"-\") ||\n c === p(\".\")\n ) {\n this.buffer += cStr.toLowerCase();\n } else if (c === p(\":\")) {\n if (this.stateOverride) {\n if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if (\n (includesCredentials(this.url) || this.url.port !== null) &&\n this.buffer === \"file\"\n ) {\n return false;\n }\n\n if (this.url.scheme === \"file\" && this.url.host === \"\") {\n return false;\n }\n }\n this.url.scheme = this.buffer;\n if (this.stateOverride) {\n if (this.url.port === defaultPort(this.url.scheme)) {\n this.url.port = null;\n }\n return false;\n }\n this.buffer = \"\";\n if (this.url.scheme === \"file\") {\n if (\n this.input[this.pointer + 1] !== p(\"/\") ||\n this.input[this.pointer + 2] !== p(\"/\")\n ) {\n this.parseError = true;\n }\n this.state = \"file\";\n } else if (\n isSpecial(this.url) &&\n this.base !== null &&\n this.base.scheme === this.url.scheme\n ) {\n this.state = \"special relative or authority\";\n } else if (isSpecial(this.url)) {\n this.state = \"special authority slashes\";\n } else if (this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"path or authority\";\n ++this.pointer;\n } else {\n this.url.path = [\"\"];\n this.state = \"opaque path\";\n }\n } else if (!this.stateOverride) {\n this.buffer = \"\";\n this.state = \"no scheme\";\n this.pointer = -1;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseNoScheme(c: number) {\n if (this.base === null || (hasAnOpaquePath(this.base) && c !== p(\"#\"))) {\n return failure;\n } else if (hasAnOpaquePath(this.base) && c === p(\"#\")) {\n this.url.scheme = this.base.scheme;\n this.url.path = this.base.path;\n this.url.query = this.base.query;\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (this.base.scheme === \"file\") {\n this.state = \"file\";\n --this.pointer;\n } else {\n this.state = \"relative\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialRelativeOrAuthority(c: number) {\n if (c === p(\"/\") && this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"special authority ignore slashes\";\n ++this.pointer;\n } else {\n this.parseError = true;\n this.state = \"relative\";\n --this.pointer;\n }\n\n return true;\n }\n\n parsePathOrAuthority(c: number) {\n if (c === p(\"/\")) {\n this.state = \"authority\";\n } else {\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseRelative(c: number) {\n this.url.scheme = this.base.scheme;\n if (c === p(\"/\")) {\n this.state = \"relative slash\";\n } else if (isSpecial(this.url) && c === p(\"\\\\\")) {\n this.parseError = true;\n this.state = \"relative slash\";\n } else {\n this.url.username = this.base.username;\n this.url.password = this.base.password;\n this.url.host = this.base.host;\n this.url.port = this.base.port;\n this.url.path = this.base.path.slice();\n this.url.query = this.base.query;\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (!isNaN(c)) {\n this.url.query = null;\n this.url.path.pop();\n this.state = \"path\";\n --this.pointer;\n }\n }\n\n return true;\n }\n\n parseRelativeSlash(c: number) {\n if (isSpecial(this.url) && (c === p(\"/\") || c === p(\"\\\\\"))) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"special authority ignore slashes\";\n } else if (c === p(\"/\")) {\n this.state = \"authority\";\n } else {\n this.url.username = this.base.username;\n this.url.password = this.base.password;\n this.url.host = this.base.host;\n this.url.port = this.base.port;\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialAuthoritySlashes(c: number) {\n if (c === p(\"/\") && this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"special authority ignore slashes\";\n ++this.pointer;\n } else {\n this.parseError = true;\n this.state = \"special authority ignore slashes\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialAuthorityIgnoreSlashes(c: number) {\n if (c !== p(\"/\") && c !== p(\"\\\\\")) {\n this.state = \"authority\";\n --this.pointer;\n } else {\n this.parseError = true;\n }\n\n return true;\n }\n\n parseAuthority(c: number, cStr: string) {\n if (c === p(\"@\")) {\n this.parseError = true;\n if (this.atFlag) {\n this.buffer = `%40${this.buffer}`;\n }\n this.atFlag = true;\n\n // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars\n const len = countSymbols(this.buffer);\n for (let pointer = 0; pointer < len; ++pointer) {\n const codePoint = this.buffer.codePointAt(pointer);\n\n if (codePoint === p(\":\") && !this.passwordTokenSeenFlag) {\n this.passwordTokenSeenFlag = true;\n continue;\n }\n const encodedCodePoints = utf8PercentEncodeCodePoint(\n codePoint!,\n isUserinfoPercentEncode,\n );\n if (this.passwordTokenSeenFlag) {\n this.url.password += encodedCodePoints;\n } else {\n this.url.username += encodedCodePoints;\n }\n }\n this.buffer = \"\";\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n if (this.atFlag && this.buffer === \"\") {\n this.parseError = true;\n return failure;\n }\n this.pointer -= countSymbols(this.buffer) + 1;\n this.buffer = \"\";\n this.state = \"host\";\n } else {\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parseHostName(c: number, cStr: string) {\n if (this.stateOverride && this.url.scheme === \"file\") {\n --this.pointer;\n this.state = \"file host\";\n } else if (c === p(\":\") && !this.arrFlag) {\n if (this.buffer === \"\") {\n this.parseError = true;\n return failure;\n }\n\n if (this.stateOverride === \"hostname\") {\n return false;\n }\n\n const host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n\n this.url.host = host;\n this.buffer = \"\";\n this.state = \"port\";\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n --this.pointer;\n if (isSpecial(this.url) && this.buffer === \"\") {\n this.parseError = true;\n return failure;\n } else if (\n this.stateOverride &&\n this.buffer === \"\" &&\n (includesCredentials(this.url) || this.url.port !== null)\n ) {\n this.parseError = true;\n return false;\n }\n\n const host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n\n this.url.host = host;\n this.buffer = \"\";\n this.state = \"path start\";\n if (this.stateOverride) {\n return false;\n }\n } else {\n if (c === p(\"[\")) {\n this.arrFlag = true;\n } else if (c === p(\"]\")) {\n this.arrFlag = false;\n }\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parsePort(c: number, cStr: any) {\n if (isASCIIDigit(c)) {\n this.buffer += cStr;\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\")) ||\n this.stateOverride\n ) {\n if (this.buffer !== \"\") {\n const port = parseInt(this.buffer);\n if (port > 2 ** 16 - 1) {\n this.parseError = true;\n return failure;\n }\n this.url.port = port === defaultPort(this.url.scheme) ? null : port;\n this.buffer = \"\";\n }\n if (this.stateOverride) {\n return false;\n }\n this.state = \"path start\";\n --this.pointer;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseFile(c: number) {\n this.url.scheme = \"file\";\n this.url.host = \"\";\n\n if (c === p(\"/\") || c === p(\"\\\\\")) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"file slash\";\n } else if (this.base !== null && this.base.scheme === \"file\") {\n this.url.host = this.base.host;\n this.url.path = this.base.path.slice();\n this.url.query = this.base.query;\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (!isNaN(c)) {\n this.url.query = null;\n if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {\n shortenPath(this.url);\n } else {\n this.parseError = true;\n this.url.path = [];\n }\n\n this.state = \"path\";\n --this.pointer;\n }\n } else {\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseFileSlash(c: number) {\n if (c === p(\"/\") || c === p(\"\\\\\")) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"file host\";\n } else {\n if (this.base !== null && this.base.scheme === \"file\") {\n if (\n !startsWithWindowsDriveLetter(this.input, this.pointer) &&\n isNormalizedWindowsDriveLetterString(this.base.path[0])\n ) {\n this.url.path.push(this.base.path[0]);\n }\n this.url.host = this.base.host;\n }\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseFileHost(c: number, cStr: string) {\n if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"\\\\\") ||\n c === p(\"?\") ||\n c === p(\"#\")\n ) {\n --this.pointer;\n if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) {\n this.parseError = true;\n this.state = \"path\";\n } else if (this.buffer === \"\") {\n this.url.host = \"\";\n if (this.stateOverride) {\n return false;\n }\n this.state = \"path start\";\n } else {\n let host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n if (host === \"localhost\") {\n host = \"\";\n }\n this.url.host = host as any;\n\n if (this.stateOverride) {\n return false;\n }\n\n this.buffer = \"\";\n this.state = \"path start\";\n }\n } else {\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parsePathStart(c: number) {\n if (isSpecial(this.url)) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"path\";\n\n if (c !== p(\"/\") && c !== p(\"\\\\\")) {\n --this.pointer;\n }\n } else if (!this.stateOverride && c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (!this.stateOverride && c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (c !== undefined) {\n this.state = \"path\";\n if (c !== p(\"/\")) {\n --this.pointer;\n }\n } else if (this.stateOverride && this.url.host === null) {\n this.url.path.push(\"\");\n }\n\n return true;\n }\n\n parsePath(c: number) {\n if (\n isNaN(c) ||\n c === p(\"/\") ||\n (isSpecial(this.url) && c === p(\"\\\\\")) ||\n (!this.stateOverride && (c === p(\"?\") || c === p(\"#\")))\n ) {\n if (isSpecial(this.url) && c === p(\"\\\\\")) {\n this.parseError = true;\n }\n\n if (isDoubleDot(this.buffer)) {\n shortenPath(this.url);\n if (c !== p(\"/\") && !(isSpecial(this.url) && c === p(\"\\\\\"))) {\n this.url.path.push(\"\");\n }\n } else if (\n isSingleDot(this.buffer) &&\n c !== p(\"/\") &&\n !(isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n this.url.path.push(\"\");\n } else if (!isSingleDot(this.buffer)) {\n if (\n this.url.scheme === \"file\" &&\n this.url.path.length === 0 &&\n isWindowsDriveLetterString(this.buffer)\n ) {\n this.buffer = `${this.buffer[0]}:`;\n }\n this.url.path.push(this.buffer);\n }\n this.buffer = \"\";\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n }\n if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n }\n } else {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.buffer += utf8PercentEncodeCodePoint(c, isPathPercentEncode);\n }\n\n return true;\n }\n\n parseOpaquePath(c: number) {\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else {\n // TODO: Add: not a URL code point\n if (!isNaN(c) && c !== p(\"%\")) {\n this.parseError = true;\n }\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n if (!isNaN(c)) {\n // @ts-ignore\n this.url.path += utf8PercentEncodeCodePoint(\n c,\n isC0ControlPercentEncode,\n );\n }\n }\n\n return true;\n }\n\n parseQuery(c: number, cStr: string) {\n if (\n !isSpecial(this.url) ||\n this.url.scheme === \"ws\" ||\n this.url.scheme === \"wss\"\n ) {\n this.encodingOverride = \"utf-8\";\n }\n\n if ((!this.stateOverride && c === p(\"#\")) || isNaN(c)) {\n const queryPercentEncodePredicate = isSpecial(this.url)\n ? isSpecialQueryPercentEncode\n : isQueryPercentEncode;\n this.url.query += utf8PercentEncodeString(\n this.buffer,\n queryPercentEncodePredicate,\n );\n\n this.buffer = \"\";\n\n if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n }\n } else if (!isNaN(c)) {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parseFragment(c: number) {\n if (!isNaN(c)) {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.url.fragment += utf8PercentEncodeCodePoint(\n c,\n isFragmentPercentEncode,\n );\n }\n\n return true;\n }\n}\n\nconst fileOtherwiseCodePoints = new Set([p(\"/\"), p(\"\\\\\"), p(\"?\"), p(\"#\")]);\n\nfunction startsWithWindowsDriveLetter(input: number[], pointer: number) {\n const length = input.length - pointer;\n return (\n length >= 2 &&\n isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) &&\n (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2]))\n );\n}\n\nfunction serializeURL(url: any, excludeFragment?: boolean) {\n let output = `${url.scheme}:`;\n if (url.host !== null) {\n output += \"//\";\n\n if (url.username !== \"\" || url.password !== \"\") {\n output += url.username;\n if (url.password !== \"\") {\n output += `:${url.password}`;\n }\n output += \"@\";\n }\n\n output += serializeHost(url.host);\n\n if (url.port !== null) {\n output += `:${url.port}`;\n }\n }\n\n if (\n url.host === null &&\n !hasAnOpaquePath(url) &&\n url.path.length > 1 &&\n url.path[0] === \"\"\n ) {\n output += \"/.\";\n }\n output += serializePath(url);\n\n if (url.query !== null) {\n output += `?${url.query}`;\n }\n\n if (!excludeFragment && url.fragment !== null) {\n output += `#${url.fragment}`;\n }\n\n return output;\n}\n\nfunction serializeOrigin(tuple: {\n scheme: string;\n port: number;\n host: number | number[] | string;\n}) {\n let result = `${tuple.scheme}://`;\n result += serializeHost(tuple.host);\n\n if (tuple.port !== null) {\n result += `:${tuple.port}`;\n }\n\n return result;\n}\n\nfunction serializePath(url: UrlObj): string {\n if (typeof url.path === \"string\") {\n return url.path;\n }\n\n let output = \"\";\n for (const segment of url.path) {\n output += `/${segment}`;\n }\n return output;\n}\n\nfunction serializeURLOrigin(url: any): any {\n // https://url.spec.whatwg.org/#concept-url-origin\n switch (url.scheme) {\n case \"blob\":\n try {\n return serializeURLOrigin(parseURL(serializePath(url)));\n } catch (e) {\n // serializing an opaque origin returns \"null\"\n return \"null\";\n }\n case \"ftp\":\n case \"http\":\n case \"https\":\n case \"ws\":\n case \"wss\":\n return serializeOrigin({\n scheme: url.scheme,\n host: url.host,\n port: url.port,\n });\n case \"file\":\n // The spec says:\n // > Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.\n // Browsers tested so far:\n // - Chrome says \"file://\", but treats file: URLs as cross-origin for most (all?) purposes; see e.g.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=37586\n // - Firefox says \"null\", but treats file: URLs as same-origin sometimes based on directory stuff; see\n // https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs\n return \"null\";\n default:\n // serializing an opaque origin returns \"null\"\n return \"null\";\n }\n}\n\nexport function basicURLParse(input: string, options?: any) {\n if (options === undefined) {\n options = {};\n }\n\n const usm = new URLStateMachine(\n input,\n options.baseURL,\n options.encodingOverride,\n options.url,\n options.stateOverride,\n );\n\n if (usm.failure) {\n return null;\n }\n\n return usm.url;\n}\n\nfunction setTheUsername(url: UrlObj, username: string) {\n url.username = utf8PercentEncodeString(username, isUserinfoPercentEncode);\n}\n\nfunction setThePassword(url: UrlObj, password: string) {\n url.password = utf8PercentEncodeString(password, isUserinfoPercentEncode);\n}\n\nfunction serializeInteger(integer: number) {\n return String(integer);\n}\n\nfunction parseURL(\n input: any,\n options?: { baseURL?: any; encodingOverride?: any },\n) {\n if (options === undefined) {\n options = {};\n }\n\n // We don't handle blobs, so this just delegates:\n return basicURLParse(input, {\n baseURL: options.baseURL,\n encodingOverride: options.encodingOverride,\n });\n}\n\nexport class URLImpl {\n //Include URL type for \"url\" and \"base\" params.\n constructor(url: string | URL, base?: string | URL) {\n let parsedBase = null;\n if (base !== undefined) {\n if (base instanceof URL) {\n base = base.href;\n }\n parsedBase = basicURLParse(base);\n if (parsedBase === null) {\n throw new TypeError(`Invalid base URL: ${base}`);\n }\n }\n\n if (url instanceof URL) {\n url = url.href;\n }\n const parsedURL = basicURLParse(url, { baseURL: parsedBase });\n if (parsedURL === null) {\n throw new TypeError(`Invalid URL: ${url}`);\n }\n\n const query = parsedURL.query !== null ? parsedURL.query : \"\";\n\n this._url = parsedURL;\n\n // We cannot invoke the \"new URLSearchParams object\" algorithm without going through the constructor, which strips\n // question mark by default. Therefore the doNotStripQMark hack is used.\n this._query = new URLSearchParamsImpl(query, {\n doNotStripQMark: true,\n });\n this._query._url = this;\n }\n\n get href() {\n return serializeURL(this._url);\n }\n\n set href(v) {\n const parsedURL = basicURLParse(v);\n if (parsedURL === null) {\n throw new TypeError(`Invalid URL: ${v}`);\n }\n\n this._url = parsedURL;\n\n this._query._list.splice(0);\n const { query } = parsedURL;\n if (query !== null) {\n this._query._list = parseUrlencodedString(query);\n }\n }\n\n get origin() {\n return serializeURLOrigin(this._url);\n }\n\n get protocol() {\n return `${this._url.scheme}:`;\n }\n\n set protocol(v) {\n basicURLParse(`${v}:`, {\n url: this._url,\n stateOverride: \"scheme start\",\n });\n }\n\n get username() {\n return this._url.username;\n }\n\n set username(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n setTheUsername(this._url, v);\n }\n\n get password() {\n return this._url.password;\n }\n\n set password(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n setThePassword(this._url, v);\n }\n\n get host() {\n const url = this._url;\n\n if (url.host === null) {\n return \"\";\n }\n\n if (url.port === null) {\n return serializeHost(url.host);\n }\n\n return `${serializeHost(url.host)}:${serializeInteger(url.port)}`;\n }\n\n set host(v) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n basicURLParse(v, { url: this._url, stateOverride: \"host\" });\n }\n\n get hostname() {\n if (this._url.host === null) {\n return \"\";\n }\n\n return serializeHost(this._url.host);\n }\n\n set hostname(v) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n basicURLParse(v, { url: this._url, stateOverride: \"hostname\" });\n }\n\n get port() {\n if (this._url.port === null) {\n return \"\";\n }\n\n return serializeInteger(this._url.port);\n }\n\n set port(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n if (v === \"\") {\n this._url.port = null;\n } else {\n basicURLParse(v, { url: this._url, stateOverride: \"port\" });\n }\n }\n\n get pathname() {\n return serializePath(this._url);\n }\n\n set pathname(v: string) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n this._url.path = [];\n basicURLParse(v, { url: this._url, stateOverride: \"path start\" });\n }\n\n get search() {\n if (this._url.query === null || this._url.query === \"\") {\n return \"\";\n }\n\n return `?${this._url.query}`;\n }\n\n set search(v) {\n const url = this._url;\n\n if (v === \"\") {\n url.query = null;\n this._query._list = [];\n return;\n }\n\n const input = v[0] === \"?\" ? v.substring(1) : v;\n url.query = \"\";\n basicURLParse(input, { url, stateOverride: \"query\" });\n this._query._list = parseUrlencodedString(input);\n }\n\n get searchParams() {\n return this._query;\n }\n\n get hash() {\n if (this._url.fragment === null || this._url.fragment === \"\") {\n return \"\";\n }\n\n return `#${this._url.fragment}`;\n }\n\n set hash(v) {\n if (v === \"\") {\n this._url.fragment = null;\n return;\n }\n\n const input = v[0] === \"#\" ? v.substring(1) : v;\n this._url.fragment = \"\";\n basicURLParse(input, { url: this._url, stateOverride: \"fragment\" });\n }\n\n toJSON() {\n return this.href;\n }\n\n // FIXME: type!\n _url: any;\n _query: any;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2020 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { URLImpl, URLSearchParamsImpl } from \"./whatwg-url.js\";\n\ninterface URL {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n toString(): string;\n readonly origin: string;\n password: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n readonly searchParams: URLSearchParams;\n username: string;\n toJSON(): string;\n}\n\ninterface URLSearchParams {\n append(name: string, value: string): void;\n delete(name: string): void;\n get(name: string): string | null;\n getAll(name: string): string[];\n has(name: string): boolean;\n set(name: string, value: string): void;\n sort(): void;\n toString(): string;\n forEach(\n callbackfn: (value: string, key: string, parent: URLSearchParams) => void,\n thisArg?: any,\n ): void;\n entries(): IterableIterator<[string, string]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n [Symbol.iterator](): IterableIterator<[string, string]>;\n}\n\nexport interface URLSearchParamsCtor {\n new (\n init?:\n | URLSearchParams\n | string\n | Record>\n | Iterable<[string, string]>\n | ReadonlyArray<[string, string]>,\n ): URLSearchParams;\n}\n\nexport interface URLCtor {\n new (url: string, base?: string | URL): URL;\n}\n\n// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis\n(function () {\n if (typeof globalThis === \"object\") return;\n Object.defineProperty(Object.prototype, \"__magic__\", {\n get: function () {\n return this;\n },\n configurable: true, // This makes it possible to `delete` the getter later.\n });\n // @ts-ignore: polyfill magic\n __magic__.globalThis = __magic__; // lolwat\n // @ts-ignore: polyfill magic\n delete Object.prototype.__magic__;\n})();\n\n// Use native or pure JS URL implementation?\nconst useOwnUrlImp = true;\n\n// @ts-ignore\nlet _URL = globalThis.URL;\nif (useOwnUrlImp || !_URL) {\n // @ts-ignore\n globalThis.URL = _URL = URLImpl;\n // @ts-ignore\n _URL = URLImpl;\n}\n\nexport const URL = _URL;\n\n// @ts-ignore\nlet _URLSearchParams = globalThis.URLSearchParams;\n\nif (useOwnUrlImp || !_URLSearchParams) {\n // @ts-ignore\n globalThis.URLSearchParams = URLSearchParamsImpl;\n // @ts-ignore\n _URLSearchParams = URLSearchParamsImpl;\n}\n\nexport const URLSearchParams: URLSearchParamsCtor = _URLSearchParams;\n", "/*\n This file is part of TALER\n (C) 2016 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Small helper functions that don't fit anywhere else.\n */\n\n/**\n * Imports.\n */\nimport { AmountJson } from \"./amounts.js\";\nimport * as Amounts from \"./amounts.js\";\nimport { URL } from \"./url.js\";\n\n/**\n * Show an amount in a form suitable for the user.\n * FIXME: In the future, this should consider currency-specific\n * settings such as significant digits or currency symbols.\n */\nexport function amountToPretty(amount: AmountJson): string {\n const x = amount.value + amount.fraction / Amounts.amountFractionalBase;\n return `${x} ${amount.currency}`;\n}\n\n/**\n * Canonicalize a base url, typically for the exchange.\n *\n * See http://api.taler.net/wallet.html#general\n */\nexport function canonicalizeBaseUrl(url: string): string {\n if (!url.startsWith(\"http\") && !url.startsWith(\"https\")) {\n url = \"https://\" + url;\n }\n const x = new URL(url);\n if (!x.pathname.endsWith(\"/\")) {\n x.pathname = x.pathname + \"/\";\n }\n x.search = \"\";\n x.hash = \"\";\n return x.href;\n}\n\n/**\n * Convert object to JSON with canonical ordering of keys\n * and whitespace omitted.\n *\n * See RFC 4885 (https://tools.ietf.org/html/rfc8785).\n */\nexport function canonicalJson(obj: any): string {\n // Check for cycles, etc.\n obj = JSON.parse(JSON.stringify(obj));\n if (typeof obj === \"string\") {\n return JSON.stringify(obj);\n }\n if (typeof obj === \"number\" || typeof obj === \"boolean\" || obj === null) {\n return JSON.stringify(obj);\n }\n if (Array.isArray(obj)) {\n const objs: string[] = obj.map((e) => canonicalJson(e));\n return `[${objs.join(\",\")}]`;\n }\n const keys: string[] = [];\n for (const key in obj) {\n keys.push(key);\n }\n keys.sort();\n let s = \"{\";\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n s += JSON.stringify(key) + \":\" + canonicalJson(obj[key]);\n if (i !== keys.length - 1) {\n s += \",\";\n }\n }\n return s + \"}\";\n}\n\n/**\n * Lexically compare two strings.\n */\nexport function strcmp(s1: string, s2: string): -1 | 0 | 1 {\n if (s1 < s2) {\n return -1;\n }\n if (s1 > s2) {\n return 1;\n }\n return 0;\n}\n\n/**\n * Shorthand function for formatted JSON stringification.\n */\nexport function j2s(x: any): string {\n return JSON.stringify(x, undefined, 2);\n}\n\n/**\n * Use this to filter null or undefined from an array in a type-safe fashion\n *\n * example:\n * const array: Array = [undefined, null]\n * const filtered: Array = array.filter(notEmpty)\n *\n * @param value\n * @returns\n */\nexport function notEmpty(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Safe function to stringify errors.\n */\nexport function stringifyError(x: any): string {\n if (typeof x === \"undefined\") {\n return \"\";\n }\n if (x === null) {\n return ``;\n }\n if (typeof x === \"object\") {\n return x.toString();\n }\n return ``;\n}\n", "/*\n This file is part of TALER\n (C) 2019 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Check if we are running under nodejs.\n */\n\nconst isNode =\n typeof process !== \"undefined\" &&\n typeof process.release !== \"undefined\" &&\n process.release.name === \"node\";\n\nexport enum LogLevel {\n Trace = \"trace\",\n Message = \"message\",\n Info = \"info\",\n Warn = \"warn\",\n Error = \"error\",\n None = \"none\",\n}\n\nlet globalLogLevel = LogLevel.Info;\nconst byTagLogLevel: Record = {};\n\nlet nativeLogging: boolean = false;\n\n// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/toString\nError.prototype.toString = function () {\n if (\n this === null ||\n (typeof this !== \"object\" && typeof this !== \"function\")\n ) {\n throw new TypeError();\n }\n let name = this.name;\n name = name === undefined ? \"Error\" : `${name}`;\n let msg = this.message;\n msg = msg === undefined ? \"\" : `${msg}`;\n\n let cause = \"\";\n if (\"cause\" in this) {\n cause = `\\n Caused by: ${this.cause}`;\n }\n return `${name}: ${msg}${cause}`;\n};\n\nexport function getGlobalLogLevel(): string {\n return globalLogLevel;\n}\n\nexport function setGlobalLogLevelFromString(logLevelStr: string): void {\n globalLogLevel = getLevelForString(logLevelStr);\n}\n\nexport function setLogLevelFromString(tag: string, logLevelStr: string): void {\n byTagLogLevel[tag] = getLevelForString(logLevelStr);\n}\n\nexport function enableNativeLogging() {\n nativeLogging = true;\n}\n\nfunction getLevelForString(logLevelStr: string): LogLevel {\n switch (logLevelStr.toLowerCase()) {\n case \"trace\":\n return LogLevel.Trace;\n case \"info\":\n return LogLevel.Info;\n case \"warn\":\n case \"warning\":\n return LogLevel.Warn;\n case \"error\":\n return LogLevel.Error;\n case \"none\":\n return LogLevel.None;\n default:\n if (isNode) {\n process.stderr.write(`Invalid log level, defaulting to WARNING\\n`);\n } else {\n console.warn(`Invalid log level, defaulting to WARNING`);\n }\n return LogLevel.Warn;\n }\n}\n\nfunction writeNativeLog(\n message: any,\n tag: string,\n level: number,\n args: any[],\n): void {\n const logFn = (globalThis as any).__nativeLog;\n if (logFn) {\n let m: string;\n if (args.length == 0) {\n m = message;\n } else {\n m = message + \" \" + args.toString();\n }\n logFn(level, tag, message);\n }\n}\n\nfunction writeNodeLog(\n message: any,\n tag: string,\n level: string,\n args: any[],\n): void {\n try {\n let msg = `${new Date().toISOString()} ${tag} ${level} ${message}`;\n if (args.length != 0) {\n msg += ` ${JSON.stringify(args, undefined, 2)}\\n`;\n } else {\n msg += `\\n`;\n }\n process.stderr.write(msg);\n } catch (e) {\n // This can happen when we're trying to log something that doesn't want to be\n // converted to a string.\n let msg = `${new Date().toISOString()} (logger) FATAL `;\n if (e instanceof Error) {\n msg += `failed to write log: ${e.message}\\n`;\n } else {\n msg += \"failed to write log\\n\";\n }\n process.stderr.write(msg);\n }\n}\n\n/**\n * Logger that writes to stderr when running under node,\n * and uses the corresponding console.* method to log in the browser.\n */\nexport class Logger {\n constructor(private tag: string) {}\n\n shouldLogTrace(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n return true;\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogInfo(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n return true;\n case LogLevel.Warn:\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogWarn(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n return true;\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogError(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n case LogLevel.Error:\n return true;\n case LogLevel.None:\n return false;\n }\n }\n\n info(message: string, ...args: any[]): void {\n if (!this.shouldLogInfo()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 2, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"INFO\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} INFO ` + message,\n ...args,\n );\n }\n }\n\n warn(message: string, ...args: any[]): void {\n if (!this.shouldLogWarn()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 3, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"WARN\", args);\n } else {\n console.warn(\n `${new Date().toISOString()} ${this.tag} INFO ` + message,\n ...args,\n );\n }\n }\n\n error(message: string, ...args: any[]): void {\n if (!this.shouldLogError()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 4, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"ERROR\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} ERROR ` + message,\n ...args,\n );\n }\n }\n\n trace(message: string, ...args: any[]): void {\n if (!this.shouldLogTrace()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 1, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"TRACE\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} TRACE ` + message,\n ...args,\n );\n }\n }\n\n reportBreak(): void {\n if (!this.shouldLogError()) {\n return;\n }\n const location = new Error(\"programming error\");\n this.error(`assertion failed: ${location.stack}`);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2018-2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { j2s } from \"./helpers.js\";\nimport { Logger } from \"./logging.js\";\n\n/**\n * Type-safe codecs for converting from/to JSON.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\n\nconst logger = new Logger(\"codec.ts\");\n\n/**\n * Error thrown when decoding fails.\n */\nexport class DecodingError extends Error {\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, DecodingError.prototype);\n this.name = \"DecodingError\";\n }\n}\n\n/**\n * Context information to show nicer error messages when decoding fails.\n */\nexport interface Context {\n readonly path?: string[];\n}\n\nexport function renderContext(c?: Context): string {\n const p = c?.path;\n if (p) {\n return p.join(\".\");\n } else {\n return \"(unknown)\";\n }\n}\n\nfunction joinContext(c: Context | undefined, part: string): Context {\n const path = c?.path ?? [];\n return {\n path: path.concat([part]),\n };\n}\n\n/**\n * A codec converts untyped JSON to a typed object.\n */\nexport interface Codec {\n /**\n * Decode untyped JSON to an object of type [[V]].\n */\n readonly decode: (x: any, c?: Context) => V;\n}\n\ntype SingletonRecord = { [Y in K]: V };\n\ninterface Prop {\n name: string;\n codec: Codec;\n}\n\ninterface Alternative {\n tagValue: any;\n codec: Codec;\n}\n\nclass ObjectCodecBuilder {\n private propList: Prop[] = [];\n\n /**\n * Define a property for the object.\n */\n property(\n x: K,\n codec: Codec,\n ): ObjectCodecBuilder> {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.propList.push({ name: x, codec: codec });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(objectDisplayName: string): Codec {\n const propList = this.propList;\n return {\n decode(x: any, c?: Context): PartialOutputType {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n if (typeof x !== \"object\") {\n throw new DecodingError(\n `expected object for ${objectDisplayName} at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n const obj: any = {};\n for (const prop of propList) {\n const propRawVal = x[prop.name];\n const propVal = prop.codec.decode(\n propRawVal,\n joinContext(c, prop.name),\n );\n obj[prop.name] = propVal;\n }\n return obj as PartialOutputType;\n },\n };\n }\n}\n\nclass UnionCodecBuilder<\n TargetType,\n TagPropertyLabel extends keyof TargetType,\n CommonBaseType,\n PartialTargetType,\n> {\n private alternatives = new Map();\n\n constructor(\n private discriminator: TagPropertyLabel,\n private baseCodec?: Codec,\n ) { }\n\n /**\n * Define a property for the object.\n */\n alternative(\n tagValue: TargetType[TagPropertyLabel],\n codec: Codec,\n ): UnionCodecBuilder<\n TargetType,\n TagPropertyLabel,\n CommonBaseType,\n PartialTargetType | V\n > {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.alternatives.set(tagValue, { codec, tagValue });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(\n objectDisplayName: string,\n ): Codec {\n const alternatives = this.alternatives;\n const discriminator = this.discriminator;\n const baseCodec = this.baseCodec;\n return {\n decode(x: any, c?: Context): R {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n const d = x[discriminator];\n if (d === undefined) {\n throw new DecodingError(\n `expected tag for ${objectDisplayName} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const alt = alternatives.get(d);\n if (!alt) {\n throw new DecodingError(\n `unknown tag for ${objectDisplayName} ${d} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const altDecoded = alt.codec.decode(x);\n if (baseCodec) {\n const baseDecoded = baseCodec.decode(x, c);\n return { ...baseDecoded, ...altDecoded };\n } else {\n return altDecoded;\n }\n },\n };\n }\n}\n\nexport class UnionCodecPreBuilder {\n discriminateOn(\n discriminator: D,\n baseCodec?: Codec,\n ): UnionCodecBuilder {\n return new UnionCodecBuilder(discriminator, baseCodec);\n }\n}\n\n/**\n * Return a builder for a codec that decodes an object with properties.\n */\nexport function buildCodecForObject(): ObjectCodecBuilder {\n return new ObjectCodecBuilder();\n}\n\nexport function buildCodecForUnion(): UnionCodecPreBuilder {\n return new UnionCodecPreBuilder();\n}\n\n/**\n * Return a codec for a mapping from a string to values described by the inner codec.\n */\nexport function codecForMap(\n innerCodec: Codec,\n): Codec<{ [x: string]: T }> {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): { [x: string]: T } {\n const map: { [x: string]: T } = {};\n if (typeof x !== \"object\") {\n throw new DecodingError(`expected object at ${renderContext(c)}`);\n }\n for (const i in x) {\n map[i] = innerCodec.decode(x[i], joinContext(c, `[${i}]`));\n }\n return map;\n },\n };\n}\n\n/**\n * Return a codec for a list, containing values described by the inner codec.\n */\nexport function codecForList(innerCodec: Codec): Codec {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): T[] {\n const arr: T[] = [];\n if (!Array.isArray(x)) {\n throw new DecodingError(`expected array at ${renderContext(c)}`);\n }\n for (const i in x) {\n arr.push(innerCodec.decode(x[i], joinContext(c, `[${i}]`)));\n }\n return arr;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForNumber(): Codec {\n return {\n decode(x: any, c?: Context): number {\n if (typeof x === \"number\") {\n return x;\n }\n throw new DecodingError(\n `expected number at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForBoolean(): Codec {\n return {\n decode(x: any, c?: Context): boolean {\n if (typeof x === \"boolean\") {\n return x;\n }\n throw new DecodingError(\n `expected boolean at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForString(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n return x;\n }\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForStringURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return x;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): URL {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return url;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Codec that allows any value.\n */\nexport function codecForAny(): Codec {\n return {\n decode(x: any, c?: Context): any {\n return x;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForConstString(s: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === s) {\n return x;\n }\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got string value \"${x}\"`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstTrue(): Codec {\n return {\n decode(x: any, c?: Context): true {\n if (x === true) {\n return x;\n }\n throw new DecodingError(\n `expected boolean true at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstFalse(): Codec {\n return {\n decode(x: any, c?: Context): false {\n if (x === false) {\n return x;\n }\n throw new DecodingError(\n `expected boolean false at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a constant number.\n */\nexport function codecForConstNumber(n: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === n) {\n return x;\n }\n throw new DecodingError(\n `expected number constant \"${n}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n },\n };\n}\n\nexport function codecOptional(innerCodec: Codec): Codec {\n return {\n decode(x: any, c?: Context): V | undefined {\n if (x === undefined || x === null) {\n return undefined;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport function codecOptionalDefault(innerCodec: Codec, def: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === undefined || x === null) {\n return def;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport function codecForLazy(innerCodec: () => Codec): Codec {\n let instance: Codec | undefined = undefined\n return {\n decode(x: any, c?: Context): V {\n if (instance === undefined) {\n instance = innerCodec()\n }\n return instance.decode(x, c);\n },\n };\n}\n\n\nexport type CodecType = T extends Codec ? X : any;\n\nexport function codecForEither>>(\n ...alts: [...T]\n): Codec> {\n return {\n decode(x: any, c?: Context): any {\n for (const alt of alts) {\n try {\n return alt.decode(x, c);\n } catch (e) {\n continue;\n }\n }\n if (logger.shouldLogTrace()) {\n logger.trace(`offending value: ${j2s(x)}`);\n }\n throw new DecodingError(\n `No alternative matched at at ${renderContext(c)}`,\n );\n },\n };\n}\n", "/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n *\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum HttpStatusCode {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n Continue = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SwitchingProtocols = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n Processing = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n Ok = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n Created = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n Accepted = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NonAuthoritativeInformation = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NoContent = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n ResetContent = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PartialContent = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MultiStatus = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n AlreadyReported = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n ImUsed = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MultipleChoices = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MovedPermanently = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n Found = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SeeOther = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NotModified = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n UseProxy = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SwitchProxy = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TemporaryRedirect = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PermanentRedirect = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BadRequest = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n Unauthorized = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PaymentRequired = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n Forbidden = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NotFound = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n MethodNotAllowed = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NotAcceptable = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n ProxyAuthenticationRequired = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n RequestTimeout = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n Conflict = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n Gone = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LengthRequired = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PreconditionFailed = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PayloadTooLarge = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n UriTooLong = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UnsupportedMediaType = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RangeNotSatisfiable = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n ExpectationFailed = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n IAmATeapot = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MisdirectedRequest = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UnprocessableEntity = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n Locked = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FailedDependency = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UpgradeRequired = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PreconditionRequired = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TooManyRequests = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n RequestHeaderFieldsTooLarge = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UnavailableForLegalReasons = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n InternalServerError = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NotImplemented = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BadGateway = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n ServiceUnavailable = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GatewayTimeout = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HttpVersionNotSupported = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VariantAlsoNegotiates = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n InsufficientStorage = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LoopDetected = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NotExtended = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NetworkAuthenticationRequired = 511,\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL3.0-or-later\n*/\n\n/**\n * Imports.\n */\nimport {\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n} from \"./http.js\";\n\n/**\n * Implementation of the HTTP request library interface for node.\n */\nexport class HttpLibImpl implements HttpRequestLibrary {\n fetch(\n url: string,\n opt?: HttpRequestOptions | undefined,\n ): Promise {\n throw new Error(\"Method not implemented.\");\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for relative and absolute time.\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, renderContext } from \"./codec.js\";\n\ndeclare const flavor_AbsoluteTime: unique symbol;\ndeclare const flavor_TalerProtocolTimestamp: unique symbol;\ndeclare const flavor_TalerPreciseTimestamp: unique symbol;\n\nconst opaque_AbsoluteTime: unique symbol = Symbol(\"opaque_AbsoluteTime\");\n\n// FIXME: Make this opaque!\nexport interface AbsoluteTime {\n /**\n * Timestamp in milliseconds.\n */\n readonly t_ms: number | \"never\";\n\n readonly _flavor?: typeof flavor_AbsoluteTime;\n\n // Make the type opaque, we only want our constructors\n // to able to create an AbsoluteTime value.\n [opaque_AbsoluteTime]: true;\n}\n\nexport interface TalerProtocolTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n readonly _flavor?: typeof flavor_TalerProtocolTimestamp;\n}\n\n/**\n * Precise timestamp, typically used in the wallet-core\n * API but not in other Taler APIs so far.\n */\nexport interface TalerPreciseTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n /**\n * Optional microsecond offset (non-negative integer).\n */\n readonly off_us?: number;\n\n readonly _flavor?: typeof flavor_TalerPreciseTimestamp;\n}\n\nexport namespace TalerPreciseTimestamp {\n export function now(): TalerPreciseTimestamp {\n const absNow = AbsoluteTime.now();\n return AbsoluteTime.toPreciseTimestamp(absNow);\n }\n\n export function round(t: TalerPreciseTimestamp): TalerProtocolTimestamp {\n return {\n t_s: t.t_s,\n };\n }\n\n export function fromSeconds(s: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(s),\n off_us: Math.floor((s - Math.floor(s)) / 1000 / 1000),\n };\n }\n\n export function fromMilliseconds(ms: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(ms / 1000),\n off_us: Math.floor((ms - Math.floor(ms / 1000) * 1000) * 1000),\n };\n }\n}\n\nexport namespace TalerProtocolTimestamp {\n export function now(): TalerProtocolTimestamp {\n return AbsoluteTime.toProtocolTimestamp(AbsoluteTime.now());\n }\n\n export function zero(): TalerProtocolTimestamp {\n return {\n t_s: 0,\n };\n }\n\n export function never(): TalerProtocolTimestamp {\n return {\n t_s: \"never\",\n };\n }\n\n export function isNever(t: TalerProtocolTimestamp): boolean {\n return t.t_s === \"never\";\n }\n\n export function fromSeconds(s: number): TalerProtocolTimestamp {\n return {\n t_s: s,\n };\n }\n\n export function min(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\") {\n return { t_s: t2.t_s };\n }\n if (t2.t_s === \"never\") {\n return { t_s: t1.t_s };\n }\n return { t_s: Math.min(t1.t_s, t2.t_s) };\n }\n export function max(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\" || t2.t_s === \"never\") {\n return { t_s: \"never\" };\n }\n return { t_s: Math.max(t1.t_s, t2.t_s) };\n }\n}\n\nexport interface Duration {\n /**\n * Duration in milliseconds.\n */\n readonly d_ms: number | \"forever\";\n}\n\nexport interface TalerProtocolDuration {\n readonly d_us: number | \"forever\";\n}\n\n/**\n * Timeshift in milliseconds.\n */\nlet timeshift = 0;\n\n/**\n * Set timetravel offset in milliseconds.\n *\n * Use carefully and only for testing.\n */\nexport function setDangerousTimetravel(dt: number): void {\n timeshift = dt;\n}\n\nexport namespace Duration {\n export function toMilliseconds(d: Duration): number {\n if (d.d_ms === \"forever\") {\n return Number.MAX_VALUE;\n }\n return d.d_ms;\n }\n export function getRemaining(\n deadline: AbsoluteTime,\n now = AbsoluteTime.now(),\n ): Duration {\n if (deadline.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (now.t_ms === \"never\") {\n throw Error(\"invalid argument for 'now'\");\n }\n if (deadline.t_ms < now.t_ms) {\n return { d_ms: 0 };\n }\n return { d_ms: deadline.t_ms - now.t_ms };\n }\n\n export function fromPrettyString(s: string): Duration {\n let dMs = 0;\n let currentNum = \"\";\n let parsingNum = true;\n for (let i = 0; i < s.length; i++) {\n const cc = s.charCodeAt(i);\n if (cc >= \"0\".charCodeAt(0) && cc <= \"9\".charCodeAt(0)) {\n if (!parsingNum) {\n throw Error(\"invalid duration, unexpected number\");\n }\n currentNum += s[i];\n continue;\n }\n if (s[i] == \" \") {\n if (currentNum != \"\") {\n parsingNum = false;\n }\n continue;\n }\n\n if (currentNum == \"\") {\n throw Error(\"invalid duration, missing number\");\n }\n\n if (s[i] === \"s\") {\n dMs += 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"m\") {\n dMs += 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"h\") {\n dMs += 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"d\") {\n dMs += 24 * 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else {\n throw Error(\"invalid duration, unsupported unit\");\n }\n currentNum = \"\";\n parsingNum = true;\n }\n return {\n d_ms: dMs,\n };\n }\n\n /**\n * Compare two durations. Returns 0 when equal, -1 when a < b\n * and +1 when a > b.\n */\n export function cmp(d1: Duration, d2: Duration): 1 | 0 | -1 {\n if (d1.d_ms === \"forever\") {\n if (d2.d_ms === \"forever\") {\n return 0;\n }\n return 1;\n }\n if (d2.d_ms === \"forever\") {\n return -1;\n }\n if (d1.d_ms == d2.d_ms) {\n return 0;\n }\n if (d1.d_ms > d2.d_ms) {\n return 1;\n }\n return -1;\n }\n\n export function max(d1: Duration, d2: Duration): Duration {\n return durationMax(d1, d2);\n }\n\n export function min(d1: Duration, d2: Duration): Duration {\n return durationMin(d1, d2);\n }\n\n export function multiply(d1: Duration, n: number): Duration {\n return durationMul(d1, n);\n }\n\n export function toIntegerYears(d: Duration): number {\n if (typeof d.d_ms !== \"number\") {\n throw Error(\"infinite duration\");\n }\n return Math.ceil(d.d_ms / 1000 / 60 / 60 / 24 / 365);\n }\n\n export function fromSpec(spec: {\n seconds?: number;\n minutes?: number;\n hours?: number;\n days?: number;\n months?: number;\n years?: number;\n }): Duration {\n let d_ms = 0;\n d_ms += (spec.seconds ?? 0) * SECONDS;\n d_ms += (spec.minutes ?? 0) * MINUTES;\n d_ms += (spec.hours ?? 0) * HOURS;\n d_ms += (spec.days ?? 0) * DAYS;\n d_ms += (spec.months ?? 0) * MONTHS;\n d_ms += (spec.years ?? 0) * YEARS;\n return { d_ms };\n }\n\n export function getForever(): Duration {\n return { d_ms: \"forever\" };\n }\n\n export function getZero(): Duration {\n return { d_ms: 0 };\n }\n\n export function fromTalerProtocolDuration(\n d: TalerProtocolDuration,\n ): Duration {\n if (d.d_us === \"forever\") {\n return {\n d_ms: \"forever\",\n };\n }\n return {\n d_ms: Math.floor(d.d_us / 1000),\n };\n }\n\n export function toTalerProtocolDuration(d: Duration): TalerProtocolDuration {\n if (d.d_ms === \"forever\") {\n return {\n d_us: \"forever\",\n };\n }\n return {\n d_us: d.d_ms * 1000,\n };\n }\n\n export function fromMilliseconds(ms: number): Duration {\n return {\n d_ms: ms,\n };\n }\n\n export function clamp(args: {\n lower: Duration;\n upper: Duration;\n value: Duration;\n }): Duration {\n return durationMax(durationMin(args.value, args.upper), args.lower);\n }\n}\n\nexport namespace AbsoluteTime {\n export function getStampMsNow(): number {\n return new Date().getTime();\n }\n\n export function getStampMsNever(): number {\n return Number.MAX_SAFE_INTEGER;\n }\n\n export function now(): AbsoluteTime {\n return {\n t_ms: new Date().getTime() + timeshift,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function never(): AbsoluteTime {\n return {\n t_ms: \"never\",\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromMilliseconds(ms: number): AbsoluteTime {\n return {\n t_ms: ms,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function cmp(t1: AbsoluteTime, t2: AbsoluteTime): number {\n if (t1.t_ms === \"never\") {\n if (t2.t_ms === \"never\") {\n return 0;\n }\n return 1;\n }\n if (t2.t_ms === \"never\") {\n return -1;\n }\n if (t1.t_ms == t2.t_ms) {\n return 0;\n }\n if (t1.t_ms > t2.t_ms) {\n return 1;\n }\n return -1;\n }\n\n export function min(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.min(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function max(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function difference(t1: AbsoluteTime, t2: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (t2.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.abs(t1.t_ms - t2.t_ms) };\n }\n\n export function isExpired(t: AbsoluteTime) {\n return cmp(t, now()) <= 0;\n }\n\n export function isNever(t: AbsoluteTime): boolean {\n return t.t_ms === \"never\";\n }\n\n export function fromProtocolTimestamp(\n t: TalerProtocolTimestamp,\n ): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return {\n t_ms: t.t_s * 1000,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromStampMs(stampMs: number): AbsoluteTime {\n return {\n t_ms: stampMs,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromPreciseTimestamp(t: TalerPreciseTimestamp): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n const offsetUs = t.off_us ?? 0;\n return {\n t_ms: t.t_s * 1000 + Math.floor(offsetUs / 1000),\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function toStampMs(at: AbsoluteTime): number {\n if (at.t_ms === \"never\") {\n return Number.MAX_SAFE_INTEGER;\n }\n return at.t_ms;\n }\n\n export function toPreciseTimestamp(at: AbsoluteTime): TalerPreciseTimestamp {\n if (at.t_ms == \"never\") {\n return {\n t_s: \"never\",\n };\n }\n const t_s = Math.floor(at.t_ms / 1000);\n const off_us = Math.floor(1000 * (at.t_ms - t_s * 1000));\n return {\n t_s,\n off_us,\n };\n }\n\n export function toProtocolTimestamp(\n at: AbsoluteTime,\n ): TalerProtocolTimestamp {\n if (at.t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n return {\n t_s: Math.floor(at.t_ms / 1000),\n };\n }\n\n export function isBetween(\n t: AbsoluteTime,\n start: AbsoluteTime,\n end: AbsoluteTime,\n ): boolean {\n if (cmp(t, start) < 0) {\n return false;\n }\n if (cmp(t, end) > 0) {\n return false;\n }\n return true;\n }\n\n export function toIsoString(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"\";\n } else {\n return new Date(t.t_ms).toISOString();\n }\n }\n\n export function addDuration(t1: AbsoluteTime, d: Duration): AbsoluteTime {\n if (t1.t_ms === \"never\" || d.d_ms === \"forever\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: t1.t_ms + d.d_ms, [opaque_AbsoluteTime]: true };\n }\n\n /**\n * Get the remaining duration until {@param t1}.\n *\n * If {@param t1} already happened, the remaining duration\n * is zero.\n */\n export function remaining(t1: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return Duration.getForever();\n }\n const stampNow = now();\n if (stampNow.t_ms === \"never\") {\n throw Error(\"invariant violated\");\n }\n return Duration.fromMilliseconds(Math.max(0, t1.t_ms - stampNow.t_ms));\n }\n\n export function subtractDuraction(\n t1: AbsoluteTime,\n d: Duration,\n ): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (d.d_ms === \"forever\") {\n return { t_ms: 0, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(0, t1.t_ms - d.d_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function stringify(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"never\";\n }\n return new Date(t.t_ms).toISOString();\n }\n}\n\nconst SECONDS = 1000;\nconst MINUTES = SECONDS * 60;\nconst HOURS = MINUTES * 60;\nconst DAYS = HOURS * 24;\nconst MONTHS = DAYS * 30;\nconst YEARS = DAYS * 365;\n\nexport function durationMin(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: d2.d_ms };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: d1.d_ms };\n }\n return { d_ms: Math.min(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMax(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.max(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMul(d: Duration, n: number): Duration {\n if (d.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.round(d.d_ms * n) };\n}\n\nexport function durationAdd(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\" || d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: d1.d_ms + d2.d_ms };\n}\n\nexport const codecForAbsoluteTime: Codec = {\n decode(x: any, c?: Context): AbsoluteTime {\n if (x === undefined) {\n throw Error(`got undefined and expected absolute time at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_ms, [opaque_AbsoluteTime]: true };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForTimestamp: Codec = {\n decode(x: any, c?: Context): TalerProtocolTimestamp {\n // Compatibility, should be removed soon.\n if (x === undefined) {\n throw Error(`got undefined and expected timestamp at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n const t_s = x.t_s;\n if (typeof t_s === \"string\") {\n if (t_s === \"never\") {\n return { t_s: \"never\" };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n }\n if (typeof t_s === \"number\") {\n return { t_s };\n }\n throw Error(`expected protocol timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForPreciseTimestamp: Codec = {\n decode(x: any, c?: Context): TalerPreciseTimestamp {\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n throw Error(`expected precise timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForDuration: Codec = {\n decode(x: any, c?: Context): TalerProtocolDuration {\n const d_us = x.d_us;\n if (typeof d_us === \"string\") {\n if (d_us === \"forever\") {\n return { d_us: \"forever\" };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n }\n if (typeof d_us === \"number\") {\n return { d_us };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n },\n};\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL3.0-or-later\n*/\n\nimport type { CancellationToken } from \"./CancellationToken.js\";\nimport { Codec } from \"./codec.js\";\nimport { j2s } from \"./helpers.js\";\nimport {\n TalerError,\n base64FromArrayBuffer,\n makeErrorDetail,\n stringToBytes,\n} from \"./index.js\";\nimport { Logger } from \"./logging.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport { AbsoluteTime, Duration } from \"./time.js\";\nimport { TalerErrorDetail } from \"./types-taler-wallet.js\";\n\nconst textEncoder = new TextEncoder();\n\nconst logger = new Logger(\"http.ts\");\n\n/**\n * An HTTP response that is returned by all request methods of this library.\n */\nexport interface HttpResponse {\n requestUrl: string;\n requestMethod: string;\n status: number;\n headers: Headers;\n json(): Promise;\n text(): Promise;\n bytes(): Promise;\n}\n\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 60000;\n\nexport interface HttpRequestOptions {\n method?: \"POST\" | \"PATCH\" | \"PUT\" | \"GET\" | \"DELETE\";\n headers?: { [name: string]: string | undefined };\n\n /**\n * Timeout after which the request should be aborted.\n */\n timeout?: Duration;\n\n /**\n * Cancellation token that should abort the request when\n * cancelled.\n */\n cancellationToken?: CancellationToken;\n\n body?: string | ArrayBuffer | object;\n\n /**\n * How to handle redirects.\n * Same semantics as WHATWG fetch.\n */\n redirect?: \"follow\" | \"error\" | \"manual\";\n}\n\n/**\n * Headers, roughly modeled after the fetch API's headers object.\n */\nexport class Headers {\n private headerMap = new Map();\n\n get(name: string): string | null {\n const r = this.headerMap.get(name.toLowerCase());\n if (r) {\n return r;\n }\n return null;\n }\n\n set(name: string, value: string): void {\n const normalizedName = name.toLowerCase();\n const existing = this.headerMap.get(normalizedName);\n if (existing !== undefined) {\n this.headerMap.set(normalizedName, existing + \",\" + value);\n } else {\n this.headerMap.set(normalizedName, value);\n }\n }\n\n toJSON(): any {\n const m: Record = {};\n this.headerMap.forEach((v, k) => (m[k] = v));\n return m;\n }\n}\n\n/**\n * Interface for the HTTP request library used by the wallet.\n *\n * The request library is bundled into an interface to make mocking and\n * request tunneling easy.\n */\nexport interface HttpRequestLibrary {\n /**\n * Make an HTTP POST request with a JSON body.\n */\n fetch(url: string, opt?: HttpRequestOptions): Promise;\n}\n\ntype TalerErrorResponse = {\n code: number;\n} & unknown;\n\ntype ResponseOrError =\n | { isError: false; response: T }\n | { isError: true; talerErrorResponse: TalerErrorResponse };\n\n/**\n * Read Taler error details from an HTTP response.\n */\nexport async function readTalerErrorResponse(\n httpResponse: HttpResponse,\n): Promise {\n const contentType = httpResponse.headers.get(\"content-type\");\n if (contentType !== \"application/json\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n contentType: contentType || \"\",\n },\n \"Error response did not even contain JSON. The request URL might be wrong or the service might be unavailable.\",\n );\n }\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n logger.warn(\n `malformed error response (status ${httpResponse.status}): ${j2s(\n errJson,\n )}`,\n );\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n },\n \"Error response did not contain error code\",\n );\n }\n return errJson;\n}\n\nexport async function readUnexpectedResponseDetails(\n httpResponse: HttpResponse,\n): Promise {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n return makeErrorDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n },\n \"Error response did not contain error code\",\n );\n }\n return makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n errorResponse: errJson,\n },\n `Unexpected HTTP status (${httpResponse.status}) in response`,\n );\n}\n\nexport async function readSuccessResponseJsonOrErrorCode(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise> {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n return {\n isError: true,\n talerErrorResponse: await readTalerErrorResponse(httpResponse),\n };\n }\n let respJson;\n try {\n respJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from response\",\n );\n }\n let parsedResponse: T;\n try {\n parsedResponse = codec.decode(respJson);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Response invalid\",\n );\n }\n return {\n isError: false,\n response: parsedResponse,\n };\n}\n\nexport async function readResponseJsonOrErrorCode(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise<{ isError: boolean; response: T }> {\n let respJson;\n try {\n respJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from response\",\n );\n }\n let parsedResponse: T;\n try {\n parsedResponse = codec.decode(respJson);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Response invalid\",\n );\n }\n return {\n isError: !(httpResponse.status >= 200 && httpResponse.status < 300),\n response: parsedResponse,\n };\n}\n\n\ntype HttpErrorDetails = {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n};\n\nexport function getHttpResponseErrorDetails(\n httpResponse: HttpResponse,\n): HttpErrorDetails {\n return {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n };\n}\n\nexport function throwUnexpectedRequestError(\n httpResponse: HttpResponse,\n talerErrorResponse: TalerErrorResponse,\n): never {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n errorResponse: talerErrorResponse,\n },\n `Unexpected HTTP status ${httpResponse.status} in response`,\n );\n}\n\nexport async function readSuccessResponseJsonOrThrow(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise {\n const r = await readSuccessResponseJsonOrErrorCode(httpResponse, codec);\n if (!r.isError) {\n return r.response;\n }\n throwUnexpectedRequestError(httpResponse, r.talerErrorResponse);\n}\n\nexport async function expectSuccessResponseOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n if (httpResponse.status >= 200 && httpResponse.status <= 299) {\n return;\n }\n const errResp = await readTalerErrorResponse(httpResponse);\n throwUnexpectedRequestError(httpResponse, errResp);\n}\n\nexport async function readSuccessResponseTextOrErrorCode(\n httpResponse: HttpResponse,\n): Promise> {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n httpStatusCode: httpResponse.status,\n requestUrl: httpResponse.requestUrl,\n response: await httpResponse.text(),\n requestMethod: httpResponse.requestMethod,\n },\n \"Error response did not contain error code\",\n );\n }\n return {\n isError: true,\n talerErrorResponse: errJson,\n };\n }\n const respJson = await httpResponse.text();\n return {\n isError: false,\n response: respJson,\n };\n}\n\nexport async function checkSuccessResponseOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n httpStatusCode: httpResponse.status,\n requestUrl: httpResponse.requestUrl,\n response: await httpResponse.text(),\n requestMethod: httpResponse.requestMethod,\n },\n \"Error response did not contain error code\",\n );\n }\n throwUnexpectedRequestError(httpResponse, errJson);\n }\n}\n\nexport async function readSuccessResponseTextOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n const r = await readSuccessResponseTextOrErrorCode(httpResponse);\n if (!r.isError) {\n return r.response;\n }\n throwUnexpectedRequestError(httpResponse, r.talerErrorResponse);\n}\n\n/**\n * Get the timestamp at which the response's content is considered expired.\n */\nexport function getExpiry(\n httpResponse: HttpResponse,\n opt: { minDuration?: Duration },\n): AbsoluteTime {\n const expiryDateMs = new Date(\n httpResponse.headers.get(\"expiry\") ?? \"\",\n ).getTime();\n let t: AbsoluteTime;\n if (Number.isNaN(expiryDateMs)) {\n t = AbsoluteTime.now();\n } else {\n t = AbsoluteTime.fromMilliseconds(expiryDateMs);\n }\n if (opt.minDuration) {\n const t2 = AbsoluteTime.addDuration(AbsoluteTime.now(), opt.minDuration);\n return AbsoluteTime.max(t, t2);\n }\n return t;\n}\n\nexport interface HttpLibArgs {\n enableThrottling?: boolean;\n /**\n * Only allow HTTPS connections, not plain http.\n */\n requireTls?: boolean;\n printAsCurl?: boolean;\n}\n\nexport function encodeBody(body: unknown): ArrayBuffer {\n if (body == null) {\n return new ArrayBuffer(0);\n }\n if (typeof body === \"string\") {\n return textEncoder.encode(body).buffer;\n } else if (ArrayBuffer.isView(body)) {\n return body.buffer;\n } else if (body instanceof ArrayBuffer) {\n return body;\n } else if (typeof body === \"object\") {\n return textEncoder.encode(JSON.stringify(body)).buffer;\n }\n throw new TypeError(\"unsupported request body type\");\n}\n\nexport function getDefaultHeaders(method: string): Record {\n const headers: Record = {};\n\n if (method === \"POST\" || method === \"PUT\" || method === \"PATCH\") {\n // Default to JSON if we have a body\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n headers[\"Accept\"] = \"application/json\";\n\n return headers;\n}\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nexport function makeBasicAuthHeader(\n username: string,\n password: string,\n): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n", "/*\n This file is part of TALER\n (C) 2016 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for doing XMLHttpRequest-s that are based on ES6 promises.\n * Allows for easy mocking for test cases.\n *\n * The API is inspired by the HTML5 fetch API.\n */\n\n/**\n * Imports\n */\n\nimport * as impl from \"#http-impl\";\nimport * as common from \"./http-common.js\";\n\nexport * from \"./http-common.js\";\n\nexport function createPlatformHttpLib(\n args?: common.HttpLibArgs,\n): common.HttpRequestLibrary {\n return new impl.HttpLibImpl(args);\n}\n", "/*\n This file is part of TALER\n (C) 2017 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Semantic versioning, but libtool-style.\n * See https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html\n */\n\n/**\n * Result of comparing two libtool versions.\n */\nexport interface VersionMatchResult {\n /**\n * Is the first version compatible with the second?\n */\n compatible: boolean;\n\n /**\n * Is the first version older (-1), newer (+1) or\n * identical (0)?\n */\n currentCmp: number;\n}\n\nexport interface Version {\n current: number;\n revision: number;\n age: number;\n}\n\nexport namespace LibtoolVersion {\n /**\n * Compare two libtool-style version strings.\n */\n export function compare(\n me: string,\n other: string,\n ): VersionMatchResult | undefined {\n const meVer = parseVersion(me);\n const otherVer = parseVersion(other);\n\n if (!(meVer && otherVer)) {\n return undefined;\n }\n\n const compatible =\n meVer.current - meVer.age <= otherVer.current &&\n meVer.current >= otherVer.current - otherVer.age;\n\n const currentCmp = Math.sign(meVer.current - otherVer.current);\n\n return { compatible, currentCmp };\n }\n\n export function parseVersion(v: string): Version | undefined {\n const [currentStr, revisionStr, ageStr, ...rest] = v.split(\":\");\n if (rest.length !== 0) {\n return undefined;\n }\n const current = Number.parseInt(currentStr);\n const revision = Number.parseInt(revisionStr);\n const age = Number.parseInt(ageStr);\n\n if (Number.isNaN(current)) {\n return undefined;\n }\n\n if (Number.isNaN(revision)) {\n return undefined;\n }\n\n if (Number.isNaN(age)) {\n return undefined;\n }\n\n return { current, revision, age };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2023-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n HttpResponse,\n readResponseJsonOrErrorCode,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"./http-common.js\";\nimport {\n Codec,\n HttpStatusCode,\n TalerError,\n TalerErrorCode,\n TalerErrorDetail,\n} from \"./index.js\";\n\ntype OperationFailWithBodyOrNever =\n ErrorEnum extends keyof ErrorMap ? OperationFailWithBody : never;\n\nexport type OperationResult =\n | OperationOk\n | OperationAlternative\n | OperationFail\n | OperationFailWithBodyOrNever;\n\nexport function isOperationOk(\n c: OperationResult,\n): c is OperationOk {\n return c.type === \"ok\";\n}\n\nexport function isOperationFail(\n c: OperationResult,\n): c is OperationFail {\n return c.type === \"fail\";\n}\n\n/**\n * successful operation\n */\nexport interface OperationOk {\n type: \"ok\";\n\n /**\n * Parsed response body.\n */\n body: BodyT;\n}\n\n/**\n * unsuccessful operation, see details\n */\nexport interface OperationFail {\n type: \"fail\";\n\n /**\n * Error case (either HTTP status code or TalerErrorCode)\n */\n case: T;\n\n detail: TalerErrorDetail;\n}\n\n/**\n * unsuccessful operation, see body\n */\nexport interface OperationAlternative {\n type: \"fail\";\n\n case: T;\n body: B;\n}\n\nexport interface OperationFailWithBody {\n type: \"fail\";\n\n case: keyof B;\n body: B[OperationFailWithBody[\"case\"]];\n}\n\nexport async function opSuccessFromHttp(\n resp: HttpResponse,\n codec: Codec,\n): Promise> {\n const body = await readSuccessResponseJsonOrThrow(resp, codec);\n return { type: \"ok\" as const, body };\n}\n\n/**\n * Success case, but instead of the body we're returning a fixed response\n * to the client.\n */\nexport function opFixedSuccess(body: T): OperationOk {\n return { type: \"ok\" as const, body };\n}\n\nexport function opEmptySuccess(resp: HttpResponse): OperationOk {\n return { type: \"ok\" as const, body: void 0 };\n}\n\nexport async function opKnownFailureWithBody(\n case_: keyof B,\n body: B[typeof case_],\n): Promise> {\n return { type: \"fail\", case: case_, body };\n}\n\nexport async function opKnownAlternativeFailure(\n resp: HttpResponse,\n s: T,\n codec: Codec,\n): Promise> {\n const body = (await readResponseJsonOrErrorCode(resp, codec)).response;\n return { type: \"fail\", case: s, body };\n}\n\nexport async function opKnownHttpFailure(\n s: T,\n resp: HttpResponse,\n): Promise> {\n const detail = await readTalerErrorResponse(resp);\n return { type: \"fail\", case: s, detail };\n}\n\nexport function opKnownTalerFailure(\n s: T,\n detail: TalerErrorDetail,\n): OperationFail {\n return { type: \"fail\", case: s, detail };\n}\n\nexport function opUnknownFailure(\n resp: HttpResponse,\n error: TalerErrorDetail,\n): never {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: resp.requestUrl,\n requestMethod: resp.requestMethod,\n httpStatusCode: resp.status,\n errorResponse: error,\n },\n `Unexpected HTTP status ${resp.status} in response`,\n );\n}\n\n/**\n * Convenience function to throw an error if the operation is not a success.\n */\nexport function narrowOpSuccessOrThrow(\n opName: string,\n opRes: OperationResult,\n): asserts opRes is OperationOk {\n if (opRes.type !== \"ok\") {\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR,\n {\n operation: opName,\n error: String(opRes.case),\n detail: \"detail\" in opRes ? opRes.detail : undefined,\n },\n `Operation ${opName} failed: ${String(opRes.case)}`,\n );\n }\n}\n\nexport async function succeedOrThrow(\n promise: Promise>,\n): Promise {\n const resp = await promise;\n if (isOperationOk(resp)) {\n return resp.body;\n }\n\n if (isOperationFail(resp)) {\n throw TalerError.fromUncheckedDetail({ ...resp, case: resp.case } as any);\n }\n throw TalerError.fromException(resp);\n}\n\nexport async function failOrThrow(\n s: E,\n promise: Promise>,\n): Promise {\n const resp = await promise;\n if (isOperationOk(resp)) {\n throw TalerError.fromException(\n new Error(`request succeed but failure \"${s}\" was expected`),\n );\n }\n if (isOperationFail(resp) && resp.case === s) {\n return resp.detail;\n }\n throw TalerError.fromException(\n new Error(\n `request failed with \"${JSON.stringify(\n resp,\n )}\" but case \"${s}\" was expected`,\n ),\n );\n}\n\nexport type ResultByMethod<\n TT extends object,\n p extends keyof TT,\n> = TT[p] extends (...args: any[]) => infer Ret\n ? Ret extends Promise\n ? Result extends OperationResult\n ? Result\n : never\n : never //api always use Promises\n : never; //error cases just for functions\n\nexport type FailCasesByMethod = Exclude<\n ResultByMethod,\n OperationOk\n>;\n\nexport type RedirectResult = { redirectURL: URL };\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Type and schema definitions and helpers for the core GNU Taler protocol.\n *\n * Even though the rest of the wallet uses camelCase for fields, use snake_case\n * here, since that's the convention for the Taler JSON+HTTP API.\n */\n\n/**\n * Imports.\n */\n\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForList,\n codecForMap,\n codecForNumber,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport { codecForEither } from \"./index.js\";\nimport {\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForTimestamp,\n} from \"./time.js\";\n\n// 64-byte hash code.\nexport type HashCode = string;\n\nexport type PaytoHash = string;\n\nexport type AmlOfficerPublicKeyP = string;\n\n// 32-byte hash code.\nexport type ShortHashCode = string;\n\nexport type SHA256HashCode = ShortHashCode;\n\nexport type SHA512HashCode = HashCode;\n\n// 32-byte nonce value, must only be used once.\nexport type CSNonce = string;\n\n// 32-byte nonce value, must only be used once.\nexport type RefreshMasterSeed = string;\n\n// 32-byte value representing a scalar multiplier\n// for scalar operations on points on Curve25519.\nexport type Cs25519Scalar = string;\n\n///\n/// KEYS\n///\n\n// 16-byte access token used to authorize access.\nexport type ClaimToken = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EddsaPublicKey = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EddsaPrivateKey = string;\n\n// Edx25519 public keys are points on Curve25519 and represented using the\n// standard 256 bits Ed25519 compact format converted to Crockford\n// Base32.\n//export type Edx25519PublicKey = string;\n\n// Edx25519 private keys are always points on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\n//export type Edx25519PrivateKey = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EcdhePublicKey = string;\n\n// Point on Curve25519 represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type CsRPublic = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EcdhePrivateKey = string;\n\nexport type CoinPublicKey = EddsaPublicKey;\n\n// RSA public key converted to Crockford Base32.\nexport type RsaPublicKey = string;\n\nexport type WireTransferIdentifierRawP = string;\n// Subset of numbers: Integers in the\n// inclusive range 0 .. (2^53 - 1).\nexport type SafeUint64 = number;\n\nexport type WadId = string;\n\nexport type Timestamp = TalerProtocolTimestamp;\n\nexport type RelativeTime = TalerProtocolDuration;\n\nexport type RsaSignature = string;\n\nexport type BlindedRsaSignature = string;\n\n/**\n * DD51 https://docs.taler.net/design-documents/051-fractional-digits.html\n */\nexport interface CurrencySpecification {\n // Name of the currency.\n name: string;\n\n // how many digits the user may enter after the decimal_separator\n num_fractional_input_digits: Integer;\n\n // Number of fractional digits to render in normal font and size.\n num_fractional_normal_digits: Integer;\n\n // Number of fractional digits to render always, if needed by\n // padding with zeros.\n num_fractional_trailing_zero_digits: Integer;\n\n // map of powers of 10 to alternative currency names / symbols, must\n // always have an entry under \"0\" that defines the base name,\n // e.g. \"0 => \u20AC\" or \"3 => k\u20AC\". For BTC, would be \"0 => BTC, -3 => mBTC\".\n // Communicates the currency symbol to be used.\n alt_unit_names: { [log10: string]: string };\n}\n\nexport interface InternationalizedString {\n [lang_tag: string]: string;\n}\n\nexport type RsaPublicKeySring = string;\nexport type AgeMask = number;\n\n// The string must be a data URL according to RFC 2397\n// with explicit mediatype and base64 parameters.\n//\n// data:;base64,\n//\n// Supported mediatypes are image/jpeg and image/png.\n// Invalid strings will be rejected by the wallet.\nexport type ImageDataUrl = string;\n\n/**\n * 32-byte value representing a point on Curve25519.\n */\nexport type Cs25519Point = string;\n\n/**\n * Response from the bank.\n */\nexport class WithdrawOperationStatusResponse {\n status: \"selected\" | \"aborted\" | \"confirmed\" | \"pending\";\n\n selection_done: boolean;\n\n transfer_done: boolean;\n\n aborted: boolean;\n\n amount: string | undefined;\n\n sender_wire?: string;\n\n suggested_exchange?: string;\n\n confirm_transfer_url?: string;\n\n wire_types: string[];\n}\n\nexport type LitAmountString = `${string}:${number}`;\n\nexport type LibtoolVersionString = string;\n\nexport type DecimalNumber = string;\n\ndeclare const __amount_str: unique symbol;\nexport type AmountString =\n | (string & { [__amount_str]: true })\n | LitAmountString;\n// export type AmountString = string;\nexport type Base32String = string;\nexport type EddsaSignatureString = string;\nexport type EddsaPublicKeyString = string;\nexport type EddsaPrivateKeyString = string;\nexport type CoinPublicKeyString = string;\n\n// FIXME: implement this codec\nexport const codecForURLString = codecForString;\n// FIXME: implement this codec\nexport const codecForLibtoolVersion = codecForString;\n// FIXME: implement this codec\nexport const codecForCurrencyName = codecForString;\n// FIXME: implement this codec\nexport const codecForDecimalNumber = codecForString;\n\nexport const codecForInternationalizedString =\n (): Codec => codecForMap(codecForString());\n\nexport const codecForWithdrawOperationStatusResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"selected\"),\n codecForConstString(\"confirmed\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"pending\"),\n ),\n )\n .property(\"selection_done\", codecForBoolean())\n .property(\"transfer_done\", codecForBoolean())\n .property(\"aborted\", codecForBoolean())\n .property(\"amount\", codecOptional(codecForString()))\n .property(\"sender_wire\", codecOptional(codecForString()))\n .property(\"suggested_exchange\", codecOptional(codecForString()))\n .property(\"confirm_transfer_url\", codecOptional(codecForString()))\n .property(\"wire_types\", codecForList(codecForString()))\n .build(\"WithdrawOperationStatusResponse\");\n\nexport const codecForCurrencySpecificiation =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"num_fractional_input_digits\", codecForNumber())\n .property(\"num_fractional_normal_digits\", codecForNumber())\n .property(\"num_fractional_trailing_zero_digits\", codecForNumber())\n .property(\"alt_unit_names\", codecForMap(codecForString()))\n .build(\"CurrencySpecification\");\n\nexport interface TalerCommonConfigResponse {\n name: string;\n version: string;\n}\n\nexport const codecForTalerCommonConfigResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"version\", codecForString())\n .build(\"TalerCommonConfigResponse\");\n\nexport enum ExchangeProtocolVersion {\n /**\n * Current version supported by the wallet.\n */\n V12 = 12,\n}\n\nexport enum MerchantProtocolVersion {\n /**\n * Current version supported by the wallet.\n */\n V3 = 3,\n}\n\nexport type HashCodeString = string;\n\nexport type WireSalt = string;\n\nexport interface WalletKycUuid {\n // UUID that the wallet should use when initiating\n // the KYC check.\n requirement_row: number;\n\n // Hash of the payto:// account URI for the wallet.\n h_payto: string;\n}\n\nexport const codecForWalletKycUuid = (): Codec =>\n buildCodecForObject()\n .property(\"requirement_row\", codecForNumber())\n .property(\"h_payto\", codecForString())\n .build(\"WalletKycUuid\");\n\nexport interface MerchantUsingTemplateDetails {\n summary?: string;\n amount?: AmountString;\n}\n\nexport type Integer = number;\n\nexport interface BankConversionInfoConfig {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the API.\n name: \"taler-conversion-info\";\n\n regional_currency: string;\n\n fiat_currency: string;\n\n // Currency used by this bank.\n regional_currency_specification: CurrencySpecification;\n\n // External currency used during conversion.\n fiat_currency_specification: CurrencySpecification;\n}\n\nexport const codecForBankConversionInfoConfig =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-conversion-info\"))\n .property(\"version\", codecForString())\n .property(\"fiat_currency\", codecForString())\n .property(\"regional_currency\", codecForString())\n .property(\"fiat_currency_specification\", codecForCurrencySpecificiation())\n .property(\n \"regional_currency_specification\",\n codecForCurrencySpecificiation(),\n )\n .build(\"BankConversionInfoConfig\");\n\nexport interface DenominationExpiredMessage {\n // Taler error code. Note that beyond\n // expiration this message format is also\n // used if the key is not yet valid, or\n // has been revoked.\n code: number;\n\n // Signature by the exchange over a\n // TALER_DenominationExpiredAffirmationPS.\n // Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED.\n exchange_sig: EddsaSignatureString;\n\n // Public key of the exchange used to create\n // the 'exchange_sig.\n exchange_pub: EddsaPublicKeyString;\n\n // Hash of the denomination public key that is unknown.\n h_denom_pub: HashCodeString;\n\n // When was the signature created.\n timestamp: TalerProtocolTimestamp;\n\n // What kind of operation was requested that now\n // failed?\n oper: string;\n}\n\nexport const codecForDenominationExpiredMessage = () =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"oper\", codecForString())\n .build(\"DenominationExpiredMessage\");\n\nexport interface CoinHistoryResponse {\n // Current balance of the coin.\n balance: AmountString;\n\n // Hash of the coin's denomination.\n h_denom_pub: HashCodeString;\n\n // Transaction history for the coin.\n history: any[];\n}\n\nexport const codecForCoinHistoryResponse = () =>\n buildCodecForObject()\n .property(\"balance\", codecForAmountString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"history\", codecForAny())\n .build(\"CoinHistoryResponse\");\n\nexport interface TokenRequest {\n // Service-defined scope for the token.\n // Typical scopes would be \"readonly\" or \"readwrite\".\n scope: string;\n\n // Server may impose its own upper bound\n // on the token validity duration\n duration?: RelativeTime;\n\n // Is the token refreshable into a new token during its\n // validity?\n // Refreshable tokens effectively provide indefinite\n // access if they are refreshed in time.\n refreshable?: boolean;\n}\n\nexport interface TokenSuccessResponse {\n // Expiration determined by the server.\n // Can be based on the token_duration\n // from the request, but ultimately the\n // server decides the expiration.\n expiration: Timestamp;\n\n // Opque access token.\n access_token: AccessToken;\n}\nexport interface TokenSuccessResponseMerchant {\n // Expiration determined by the server.\n // Can be based on the token_duration\n // from the request, but ultimately the\n // server decides the expiration.\n expiration: Timestamp;\n\n // Opque access token.\n token: AccessToken;\n}\n\n//FIXME: implement this codec\nexport const codecForAccessToken = codecForString as () => Codec;\nexport const codecForTokenSuccessResponse = (): Codec =>\n buildCodecForObject()\n .property(\"access_token\", codecForAccessToken())\n .property(\"expiration\", codecForTimestamp)\n .build(\"TalerAuthentication.TokenSuccessResponse\");\n\nexport const codecForTokenSuccessResponseMerchant =\n (): Codec =>\n buildCodecForObject()\n .property(\"token\", codecForAccessToken())\n .property(\"expiration\", codecForTimestamp)\n .build(\"TalerAuthentication.TokenSuccessResponseMerchant\");\n\n// FIXME: implement this codec\nexport const codecForURN = codecForString;\n\ndeclare const __ac_token: unique symbol;\n\n/**\n * Use `createAccessToken(string)` function to build one.\n */\nexport type AccessToken = string & {\n [__ac_token]: true;\n};\n\n/**\n * Create a rfc8959 access token.\n * Adds secret-token: prefix if there is none.\n * Encode the token with rfc7230 to send in a http header.\n *\n * @param token\n * @returns\n */\nexport function createRFC8959AccessTokenEncoded(token: string): AccessToken {\n return (\n token.startsWith(\"secret-token:\")\n ? token\n : `secret-token:${encodeURIComponent(token)}`\n ) as AccessToken;\n}\n\n/**\n * Create a rfc8959 access token.\n * Adds secret-token: prefix if there is none.\n *\n * @param token\n * @returns\n */\nexport function createRFC8959AccessTokenPlain(token: string): AccessToken {\n return (\n token.startsWith(\"secret-token:\") ? token : `secret-token:${token}`\n ) as AccessToken;\n}\n\n/**\n * Convert string to access token.\n *\n * @param clientSecret\n * @returns\n */\nexport function createClientSecretAccessToken(\n clientSecret: string,\n): AccessToken {\n return clientSecret as AccessToken;\n}\n\nexport type UserAndPassword = {\n username: string;\n password: string;\n};\n\nexport type UserAndToken = {\n username: string;\n token: AccessToken;\n};\n\ndeclare const opaque_OfficerAccount: unique symbol;\nexport type LockedAccount = string & { [opaque_OfficerAccount]: true };\n\ndeclare const opaque_OfficerId: unique symbol;\nexport type OfficerId = string & { [opaque_OfficerId]: true };\n\ndeclare const opaque_OfficerSigningKey: unique symbol;\nexport type SigningKey = Uint8Array & { [opaque_OfficerSigningKey]: true };\n\nexport interface OfficerAccount {\n id: OfficerId;\n signingKey: SigningKey;\n}\n\nexport type PaginationParams = {\n /**\n * row identifier as the starting point of the query\n */\n offset?: string;\n /**\n * max number of element in the result response\n * always greater than 0\n */\n limit?: number;\n /**\n * order\n */\n order?: \"asc\" | \"dec\";\n};\n\nexport type LongPollParams = {\n /**\n * milliseconds the server should wait for at least one result to be shown\n */\n timeoutMs?: number;\n};\n\nexport interface LoginToken {\n token: AccessToken;\n expiration: Timestamp;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForList,\n codecForNumber,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport {\n AccessToken,\n CoinEnvelope,\n ExchangeWireAccount,\n PaytoString,\n buildCodecForUnion,\n codecForConstNumber,\n codecForConstString,\n codecForEither,\n codecForExchangeWireAccount,\n codecForMap,\n codecForPaytoString,\n codecForTalerUriString,\n} from \"./index.js\";\nimport {\n AbsoluteTime,\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForDuration,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AmountString,\n Base32String,\n BlindedRsaSignature,\n ClaimToken,\n CoinPublicKey,\n CurrencySpecification,\n EddsaPublicKey,\n EddsaPublicKeyString,\n EddsaSignatureString,\n HashCode,\n HashCodeString,\n ImageDataUrl,\n Integer,\n InternationalizedString,\n RelativeTime,\n RsaSignature,\n Timestamp,\n WireTransferIdentifierRawP,\n codecForCurrencySpecificiation,\n codecForInternationalizedString,\n codecForURLString,\n} from \"./types-taler-common.js\";\n\n/**\n * Proposal returned from the contract URL.\n */\nexport interface Proposal {\n /**\n * Contract terms for the propoal.\n * Raw, un-decoded JSON object.\n */\n contract_terms: any;\n\n /**\n * Signature over contract, made by the merchant. The public key used for signing\n * must be contract_terms.merchant_pub.\n */\n sig: string;\n}\n\nexport interface MerchantPayResponse {\n sig: string;\n pos_confirmation?: string;\n}\n\ninterface MerchantOrderStatusPaid {\n // Was the payment refunded (even partially, via refund or abort)?\n refunded: boolean;\n\n // Is any amount of the refund still waiting to be picked up (even partially)?\n refund_pending: boolean;\n\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Amount that already taken by the wallet.\n refund_taken: AmountString;\n}\n\ninterface MerchantOrderRefundResponse {\n /**\n * Amount that was refunded in total.\n */\n refund_amount: AmountString;\n\n /**\n * Successful refunds for this payment, empty array for none.\n */\n refunds: MerchantCoinRefundStatus[];\n\n /**\n * Public key of the merchant.\n */\n merchant_pub: EddsaPublicKeyString;\n}\n\n/**\n * Response from the internal merchant API.\n */\nexport class CheckPaymentResponse {\n order_status: string;\n refunded: boolean | undefined;\n refunded_amount: string | undefined;\n contract_terms: any | undefined;\n taler_pay_uri: string | undefined;\n contract_url: string | undefined;\n}\n\nexport const codecForMerchantRefundPermission =\n (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_fee\", codecForAmountString())\n .property(\"coin_pub\", codecForString())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"exchange_code\", codecOptional(codecForNumber()))\n .property(\"exchange_reply\", codecOptional(codecForAny()))\n .property(\"exchange_sig\", codecOptional(codecForString()))\n .property(\"exchange_pub\", codecOptional(codecForString()))\n .build(\"MerchantRefundPermission\");\n\nexport const codecForProposal = (): Codec =>\n buildCodecForObject()\n .property(\"contract_terms\", codecForAny())\n .property(\"sig\", codecForString())\n .build(\"Proposal\");\n\nexport const codecForCheckPaymentResponse = (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForString())\n .property(\"refunded\", codecOptional(codecForBoolean()))\n .property(\"refunded_amount\", codecOptional(codecForString()))\n .property(\"contract_terms\", codecOptional(codecForAny()))\n .property(\"taler_pay_uri\", codecOptional(codecForString()))\n .property(\"contract_url\", codecOptional(codecForString()))\n .build(\"CheckPaymentResponse\");\n\nexport type MerchantCoinRefundStatus =\n | MerchantCoinRefundSuccessStatus\n | MerchantCoinRefundFailureStatus;\n\nexport interface MerchantCoinRefundSuccessStatus {\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // the EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund\n exchange_sig: EddsaSignatureString;\n\n // public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n\n // Refund transaction ID.\n rtransaction_id: number;\n\n // public key of a coin that was refunded\n coin_pub: EddsaPublicKeyString;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n execution_time: TalerProtocolTimestamp;\n}\n\nexport interface MerchantCoinRefundFailureStatus {\n type: \"failure\";\n\n // HTTP status of the exchange request, must NOT be 200.\n exchange_status: number;\n\n // Taler error code from the exchange reply, if available.\n exchange_code?: number;\n\n // If available, HTTP reply from the exchange.\n exchange_reply?: any;\n\n // Refund transaction ID.\n rtransaction_id: number;\n\n // public key of a coin that was refunded\n coin_pub: EddsaPublicKeyString;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n execution_time: TalerProtocolTimestamp;\n}\n\nexport interface MerchantOrderStatusUnpaid {\n /**\n * URI that the wallet must process to complete the payment.\n */\n taler_pay_uri: string;\n\n /**\n * Alternative order ID which was paid for already in the same session.\n *\n * Only given if the same product was purchased before in the same session.\n */\n already_paid_order_id?: string;\n}\n\nexport const codecForMerchantPayResponse = (): Codec =>\n buildCodecForObject()\n .property(\"sig\", codecForString())\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .build(\"MerchantPayResponse\");\n\nexport const codecForMerchantOrderStatusPaid =\n (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_taken\", codecForAmountString())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"refunded\", codecForBoolean())\n .build(\"MerchantOrderStatusPaid\");\n\nexport const codecForMerchantOrderStatusUnpaid =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_pay_uri\", codecForString())\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .build(\"MerchantOrderStatusUnpaid\");\n\nexport interface AbortRequest {\n // hash of the order's contract terms (this is used to authenticate the\n // wallet/customer in case $ORDER_ID is guessable).\n h_contract: string;\n\n // List of coins the wallet would like to see refunds for.\n // (Should be limited to the coins for which the original\n // payment succeeded, as far as the wallet knows.)\n coins: AbortingCoin[];\n}\n\nexport interface AbortingCoin {\n // Public key of a coin for which the wallet is requesting an abort-related refund.\n coin_pub: EddsaPublicKeyString;\n\n // The amount to be refunded (matches the original contribution)\n contribution: AmountString;\n\n // URL of the exchange this coin was withdrawn from.\n exchange_url: string;\n}\n\nexport interface AbortResponse {\n // List of refund responses about the coins that the wallet\n // requested an abort for. In the same order as the 'coins'\n // from the original request.\n // The rtransaction_id is implied to be 0.\n refunds: MerchantAbortPayRefundStatus[];\n}\n\nexport type MerchantAbortPayRefundStatus =\n | MerchantAbortPayRefundSuccessStatus\n | MerchantAbortPayRefundFailureStatus;\n\n// Details about why a refund failed.\nexport interface MerchantAbortPayRefundFailureStatus {\n // Used as tag for the sum type RefundStatus sum type.\n type: \"failure\";\n\n // HTTP status of the exchange request, must NOT be 200.\n exchange_status: number;\n\n // Taler error code from the exchange reply, if available.\n exchange_code?: number;\n\n // If available, HTTP reply from the exchange.\n exchange_reply?: unknown;\n}\n\n// Additional details needed to verify the refund confirmation signature\n// (h_contract_terms and merchant_pub) are already known\n// to the wallet and thus not included.\nexport interface MerchantAbortPayRefundSuccessStatus {\n // Used as tag for the sum type MerchantCoinRefundStatus sum type.\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // the EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund\n exchange_sig: string;\n\n // public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: string;\n}\n\n/**\n * Information about an exchange as stored inside a\n * merchant's contract terms.\n */\nexport interface ExchangeHandle {\n // The exchange's base URL.\n url: string;\n\n // Master public key of the exchange.\n master_pub: EddsaPublicKeyString;\n}\n\nexport interface AuditorHandle {\n /**\n * Official name of the auditor.\n */\n name: string;\n\n /**\n * Master public signing key of the auditor.\n */\n auditor_pub: EddsaPublicKeyString;\n\n /**\n * Base URL of the auditor.\n */\n url: string;\n}\n\n// Delivery location, loosely modeled as a subset of\n// ISO20022's PostalAddress25.\nexport interface Location {\n // Nation with its own government.\n country?: string;\n\n // Identifies a subdivision of a country such as state, region, county.\n country_subdivision?: string;\n\n // Identifies a subdivision within a country sub-division.\n district?: string;\n\n // Name of a built-up area, with defined boundaries, and a local government.\n town?: string;\n\n // Specific location name within the town.\n town_location?: string;\n\n // Identifier consisting of a group of letters and/or numbers that\n // is added to a postal address to assist the sorting of mail.\n post_code?: string;\n\n // Name of a street or thoroughfare.\n street?: string;\n\n // Name of the building or house.\n building_name?: string;\n\n // Number that identifies the position of a building on a street.\n building_number?: string;\n\n // Free-form address lines, should not exceed 7 elements.\n address_lines?: string[];\n}\n\nexport interface MerchantInfo {\n // The merchant's legal name of business.\n name: string;\n\n // Label for a location with the business address of the merchant.\n email?: string;\n\n // Label for a location with the business address of the merchant.\n website?: string;\n\n // An optional base64-encoded product image.\n logo?: ImageDataUrl;\n\n // Label for a location with the business address of the merchant.\n address?: Location;\n\n // Label for a location that denotes the jurisdiction for disputes.\n // Some of the typical fields for a location (such as a street address) may be absent.\n jurisdiction?: Location;\n}\n\nexport interface Tax {\n // the name of the tax\n name: string;\n\n // amount paid in tax\n tax: AmountString;\n}\n\nexport interface Product {\n // merchant-internal identifier for the product.\n product_id?: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions\n description_i18n?: InternationalizedString;\n\n // The number of units of the product to deliver to the customer.\n quantity?: Integer;\n\n // The unit in which the product is measured (liters, kilograms, packages, etc.)\n unit?: string;\n\n // The price of the product; this is the total price for quantity times unit of this product.\n price?: AmountString;\n\n // An optional base64-encoded product image\n image?: ImageDataUrl;\n\n // a list of taxes paid by the merchant for this product. Can be empty.\n taxes?: Tax[];\n\n // time indicating when this product should be delivered\n delivery_date?: TalerProtocolTimestamp;\n}\n\n/**\n * Contract terms from a merchant.\n * FIXME: Add type field!\n */\nexport interface MerchantContractTerms {\n // The hash of the merchant instance's wire details.\n h_wire: string;\n\n // Specifies for how long the wallet should try to get an\n // automatic refund for the purchase. If this field is\n // present, the wallet should wait for a few seconds after\n // the purchase and then automatically attempt to obtain\n // a refund. The wallet should probe until \"delay\"\n // after the payment was successful (i.e. via long polling\n // or via explicit requests with exponential back-off).\n //\n // In particular, if the wallet is offline\n // at that time, it MUST repeat the request until it gets\n // one response from the merchant after the delay has expired.\n // If the refund is granted, the wallet MUST automatically\n // recover the payment. This is used in case a merchant\n // knows that it might be unable to satisfy the contract and\n // desires for the wallet to attempt to get the refund without any\n // customer interaction. Note that it is NOT an error if the\n // merchant does not grant a refund.\n auto_refund?: TalerProtocolDuration;\n\n // Wire transfer method identifier for the wire method associated with h_wire.\n // The wallet may only select exchanges via a matching auditor if the\n // exchange also supports this wire method.\n // The wire transfer fees must be added based on this wire transfer method.\n wire_method: string;\n\n // Human-readable description of the whole purchase.\n summary: string;\n\n // Map from IETF BCP 47 language tags to localized summaries.\n summary_i18n?: InternationalizedString;\n\n // Unique, free-form identifier for the proposal.\n // Must be unique within a merchant instance.\n // For merchants that do not store proposals in their DB\n // before the customer paid for them, the order_id can be used\n // by the frontend to restore a proposal from the information\n // encoded in it (such as a short product identifier and timestamp).\n order_id: string;\n\n // Total price for the transaction.\n // The exchange will subtract deposit fees from that amount\n // before transferring it to the merchant.\n amount: string;\n\n // Nonce generated by the wallet and echoed by the merchant\n // in this field when the proposal is generated.\n nonce: string;\n\n // After this deadline, the merchant won't accept payments for the contract.\n pay_deadline: TalerProtocolTimestamp;\n\n // More info about the merchant, see below.\n merchant: MerchantInfo;\n\n // Merchant's public key used to sign this proposal; this information\n // is typically added by the backend. Note that this can be an ephemeral key.\n merchant_pub: string;\n\n // Time indicating when the order should be delivered.\n // May be overwritten by individual products.\n delivery_date?: TalerProtocolTimestamp;\n\n // Delivery location for (all!) products.\n delivery_location?: Location;\n\n // Exchanges that the merchant accepts even if it does not accept any auditors that audit them.\n exchanges: ExchangeHandle[];\n\n // List of products that are part of the purchase (see Product).\n products?: Product[];\n\n // After this deadline has passed, no refunds will be accepted.\n refund_deadline: TalerProtocolTimestamp;\n\n // Transfer deadline for the exchange. Must be in the\n // deposit permissions of coins used to pay for this order.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // Time when this contract was generated.\n timestamp: TalerProtocolTimestamp;\n\n // Base URL of the (public!) merchant backend API.\n // Must be an absolute URL that ends with a slash.\n merchant_base_url: string;\n\n // URL that will show that the order was successful after\n // it has been paid for. Optional, but either fulfillment_url\n // or fulfillment_message must be specified in every\n // contract terms.\n //\n // If a non-unique fulfillment URL is used, a customer can only\n // buy the order once and will be redirected to a previous purchase\n // when trying to buy an order with the same fulfillment URL a second\n // time. This is useful for digital goods that a customer only needs\n // to buy once but should be able to repeatedly download.\n //\n // For orders where the customer is expected to be able to make\n // repeated purchases (for equivalent goods), the fulfillment URL\n // should be made unique for every order. The easiest way to do\n // this is to include a unique order ID in the fulfillment URL.\n //\n // When POSTing to the merchant, the placeholder text \"${ORDER_ID}\"\n // is be replaced with the actual order ID (useful if the\n // order ID is generated server-side and needs to be\n // in the URL). Note that this placeholder can only be used once.\n // Front-ends may use other means to generate a unique fulfillment URL.\n fulfillment_url?: string;\n\n // URL where the same contract could be ordered again (if\n // available). Returned also at the public order endpoint\n // for people other than the actual buyer (hence public,\n // in case order IDs are guessable).\n public_reorder_url?: string;\n\n // Message shown to the customer after paying for the order.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n\n // Map from IETF BCP 47 language tags to localized fulfillment\n // messages.\n fulfillment_message_i18n?: InternationalizedString;\n\n // Maximum total deposit fee accepted by the merchant for this contract.\n // Overrides defaults of the merchant instance.\n max_fee: string;\n\n // Extra data that is only interpreted by the merchant frontend.\n // Useful when the merchant needs to store extra information on a\n // contract without storing it separately in their database.\n // Must really be an Object (not a string, integer, float or array).\n extra?: any;\n\n // Minimum age the buyer must have (in years). Default is 0.\n // This value is at least as large as the maximum over all\n // minimum age requirements of the products in this contract.\n // It might also be set independent of any product, due to\n // legal requirements.\n minimum_age?: Integer;\n}\n\n/**\n * Refund permission in the format that the merchant gives it to us.\n */\nexport interface MerchantAbortPayRefundDetails {\n /**\n * Amount to be refunded.\n */\n refund_amount: string;\n\n /**\n * Fee for the refund.\n */\n refund_fee: string;\n\n /**\n * Public key of the coin being refunded.\n */\n coin_pub: string;\n\n /**\n * Refund transaction ID between merchant and exchange.\n */\n rtransaction_id: number;\n\n /**\n * Exchange's key used for the signature.\n */\n exchange_pub?: string;\n\n /**\n * Exchange's signature to confirm the refund.\n */\n exchange_sig?: string;\n\n /**\n * Error replay from the exchange (if any).\n */\n exchange_reply?: any;\n\n /**\n * Error code from the exchange (if any).\n */\n exchange_code?: number;\n\n /**\n * HTTP status code of the exchange's response\n * to the merchant's refund request.\n */\n exchange_http_status: number;\n}\n\n/**\n * Reserve signature, defined as separate class to facilitate\n * schema validation.\n */\nexport interface MerchantBlindSigWrapperV1 {\n /**\n * Reserve signature.\n */\n blind_sig: string;\n}\n\nexport const codecForExchangeHandle = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"url\", codecForString())\n .build(\"ExchangeHandle\");\n\nexport const codecForAuditorHandle = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"auditor_pub\", codecForString())\n .property(\"url\", codecForString())\n .build(\"AuditorHandle\");\n\nexport const codecForLocation = (): Codec =>\n buildCodecForObject()\n .property(\"country\", codecOptional(codecForString()))\n .property(\"country_subdivision\", codecOptional(codecForString()))\n .property(\"building_name\", codecOptional(codecForString()))\n .property(\"building_number\", codecOptional(codecForString()))\n .property(\"district\", codecOptional(codecForString()))\n .property(\"street\", codecOptional(codecForString()))\n .property(\"post_code\", codecOptional(codecForString()))\n .property(\"town\", codecOptional(codecForString()))\n .property(\"town_location\", codecOptional(codecForString()))\n .property(\"address_lines\", codecOptional(codecForList(codecForString())))\n .build(\"Location\");\n\nexport const codecForMerchantInfo = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"jurisdiction\", codecOptional(codecForLocation()))\n .build(\"MerchantInfo\");\n\nexport const codecForMerchantContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"fulfillment_message\", codecOptional(codecForString()))\n .property(\n \"fulfillment_message_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"merchant_base_url\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"auto_refund\", codecOptional(codecForDuration))\n .property(\"wire_method\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .property(\"nonce\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"pay_deadline\", codecForTimestamp)\n .property(\"refund_deadline\", codecForTimestamp)\n .property(\"wire_transfer_deadline\", codecForTimestamp)\n .property(\"timestamp\", codecForTimestamp)\n .property(\"delivery_location\", codecOptional(codecForLocation()))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .property(\"max_fee\", codecForAmountString())\n .property(\"merchant\", codecForMerchantInfo())\n .property(\"merchant_pub\", codecForString())\n .property(\"exchanges\", codecForList(codecForExchangeHandle()))\n .property(\"products\", codecOptional(codecForList(codecForProduct())))\n .property(\"extra\", codecForAny())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"MerchantContractTerms\");\n\nexport interface TalerMerchantConfigResponse {\n // libtool-style representation of the Merchant protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the protocol.\n name: \"taler-merchant\";\n\n // URN of the implementation (needed to interpret 'revision' in version).\n // @since **v8**, may become mandatory in the future.\n implementation?: string;\n\n // Default (!) currency supported by this backend.\n // This is the currency that the backend should\n // suggest by default to the user when entering\n // amounts. See currencies for a list of\n // supported currencies and how to render them.\n currency: string;\n\n // How services should render currencies supported\n // by this backend. Maps\n // currency codes (e.g. \"EUR\" or \"KUDOS\") to\n // the respective currency specification.\n // All currencies in this map are supported by\n // the backend. Note that the actual currency\n // specifications are a *hint* for applications\n // that would like *advice* on how to render amounts.\n // Applications *may* ignore the currency specification\n // if they know how to render currencies that they are\n // used with.\n currencies: { [currency: string]: CurrencySpecification };\n\n // Array of exchanges trusted by the merchant.\n // Since protocol **v6**.\n exchanges: ExchangeConfigInfo[];\n}\n\nexport interface ExchangeConfigInfo {\n // Base URL of the exchange REST API.\n base_url: string;\n\n // Currency for which the merchant is configured\n // to trust the exchange.\n // May not be the one the exchange actually uses,\n // but is the only one we would trust this exchange for.\n currency: string;\n\n // Offline master public key of the exchange. The\n // /keys data must be signed with this public\n // key for us to trust it.\n master_pub: EddsaPublicKey;\n}\n\nexport interface ClaimRequest {\n // Nonce to identify the wallet that claimed the order.\n nonce: string;\n\n // Token that authorizes the wallet to claim the order.\n // *Optional* as the merchant may not have required it\n // (create_token set to false in PostOrderRequest).\n token?: ClaimToken;\n}\n\nexport interface ClaimResponse {\n // Contract terms of the claimed order\n contract_terms: ContractTerms;\n\n // Signature by the merchant over the contract terms.\n sig: EddsaSignatureString;\n}\n\nexport interface PaymentResponse {\n // Signature on TALER_PaymentResponsePS with the public\n // key of the merchant instance.\n sig: EddsaSignatureString;\n\n // Text to be shown to the point-of-sale staff as a proof of\n // payment.\n pos_confirmation?: string;\n}\n\nexport interface PaymentStatusRequestParams {\n // Hash of the order\u2019s contract terms (this is used to\n // authenticate the wallet/customer in case\n // $ORDER_ID is guessable).\n // Required once an order was claimed.\n contractTermHash?: string;\n // Authorizes the request via the claim token that\n // was returned in the PostOrderResponse. Used with\n // unclaimed orders only. Whether token authorization is\n // required is determined by the merchant when the\n // frontend creates the order.\n claimToken?: string;\n // Session ID that the payment must be bound to.\n // If not specified, the payment is not session-bound.\n sessionId?: string;\n // If specified, the merchant backend will wait up to\n // timeout_ms milliseconds for completion of the payment\n // before sending the HTTP response. A client must never\n // rely on this behavior, as the merchant backend may return\n // a response immediately.\n timeout?: number;\n // If set to \u201Cyes\u201D, poll for the order\u2019s pending refunds\n // to be picked up. timeout_ms specifies how long we\n // will wait for the refund.\n awaitRefundObtained?: boolean;\n // Indicates that we are polling for a refund above the\n // given AMOUNT. timeout_ms will specify how long we\n // will wait for the refund.\n refund?: AmountString;\n // Since protocol v9 refunded orders are only returned\n // under \u201Calready_paid_order_id\u201D if this flag is set\n // explicitly to \u201CYES\u201D.\n allowRefundedForRepurchase?: boolean;\n}\nexport interface GetKycStatusRequestParams {\n // If specified, the KYC check should return\n // the KYC status only for this wire account.\n // Otherwise, for all wire accounts.\n wireHash?: string;\n // If specified, the KYC check should return\n // the KYC status only for the given exchange.\n // Otherwise, for all exchanges we interacted with.\n exchangeURL?: string;\n // If specified, the merchant will wait up to\n // timeout_ms milliseconds for the exchanges to\n // confirm completion of the KYC process(es).\n timeout?: number;\n}\nexport interface GetOtpDeviceRequestParams {\n // Timestamp in seconds to use when calculating\n // the current OTP code of the device. Since protocol v10.\n faketime?: number;\n // Price to use when calculating the current OTP\n // code of the device. Since protocol v10.\n price?: AmountString;\n}\nexport interface GetOrderRequestParams {\n // Session ID that the payment must be bound to.\n // If not specified, the payment is not session-bound.\n sessionId?: string;\n // Timeout in milliseconds to wait for a payment if\n // the answer would otherwise be negative (long polling).\n timeout?: number;\n // Since protocol v9 refunded orders are only returned\n // under \u201Calready_paid_order_id\u201D if this flag is set\n // explicitly to \u201CYES\u201D.\n allowRefundedForRepurchase?: boolean;\n}\nexport interface ListWireTransferRequestParams {\n // Filter for transfers to the given bank account\n // (subject and amount MUST NOT be given in the payto URI).\n paytoURI?: string;\n // Filter for transfers executed before the given timestamp.\n before?: number;\n // Filter for transfers executed after the given timestamp.\n after?: number;\n // At most return the given number of results. Negative for\n // descending in execution time, positive for ascending in\n // execution time. Default is -20.\n limit?: number;\n // Starting transfer_serial_id for an iteration.\n offset?: string;\n // Filter transfers by verification status.\n verified?: boolean;\n order?: \"asc\" | \"dec\";\n}\nexport interface ListOrdersRequestParams {\n // If set to yes, only return paid orders, if no only\n // unpaid orders. Do not give (or use \u201Call\u201D) to see all\n // orders regardless of payment status.\n paid?: boolean;\n // If set to yes, only return refunded orders, if no only\n // unrefunded orders. Do not give (or use \u201Call\u201D) to see\n // all orders regardless of refund status.\n refunded?: boolean;\n // If set to yes, only return wired orders, if no only\n // orders with missing wire transfers. Do not give (or\n // use \u201Call\u201D) to see all orders regardless of wire transfer\n // status.\n wired?: boolean;\n // At most return the given number of results. Negative\n // for descending by row ID, positive for ascending by\n // row ID. Default is 20. Since protocol v12.\n limit?: number;\n // Non-negative date in seconds after the UNIX Epoc, see delta\n // for its interpretation. If not specified, we default to the\n // oldest or most recent entry, depending on delta.\n date?: AbsoluteTime;\n // Starting product_serial_id for an iteration.\n // Since protocol v12.\n offset?: string;\n // Timeout in milliseconds to wait for additional orders if the\n // answer would otherwise be negative (long polling). Only useful\n // if delta is positive. Note that the merchant MAY still return\n // a response that contains fewer than delta orders.\n timeout?: number;\n // Since protocol v6. Filters by session ID.\n sessionId?: string;\n // Since protocol v6. Filters by fulfillment URL.\n fulfillmentUrl?: string;\n\n order?: \"asc\" | \"dec\";\n}\n\nexport interface PayRequest {\n // The coins used to make the payment.\n coins: CoinPaySig[];\n\n // Custom inputs from the wallet for the contract.\n wallet_data?: Object;\n\n // The session for which the payment is made (or replayed).\n // Only set for session-based payments.\n session_id?: string;\n}\n\nexport interface CoinPaySig {\n // Signature by the coin.\n coin_sig: EddsaSignatureString;\n\n // Public key of the coin being spent.\n coin_pub: EddsaPublicKey;\n\n // Signature made by the denomination public key.\n ub_sig: RsaSignature;\n\n // The hash of the denomination public key associated with this coin.\n h_denom: HashCodeString;\n\n // The amount that is subtracted from this coin with this payment.\n contribution: AmountString;\n\n // URL of the exchange this coin was withdrawn from.\n exchange_url: string;\n}\n\nexport interface StatusPaid {\n type: \"paid\";\n\n // Was the payment refunded (even partially, via refund or abort)?\n refunded: boolean;\n\n // Is any amount of the refund still waiting to be picked up (even partially)?\n refund_pending: boolean;\n\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Amount that already taken by the wallet.\n refund_taken: AmountString;\n}\nexport interface StatusGotoResponse {\n type: \"goto\";\n // The client should go to the reorder URL, there a fresh\n // order might be created as this one is taken by another\n // customer or wallet (or repurchase detection logic may\n // apply).\n public_reorder_url: string;\n}\nexport interface StatusUnpaidResponse {\n type: \"unpaid\";\n // URI that the wallet must process to complete the payment.\n taler_pay_uri: string;\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n fulfillment_url?: string;\n\n // Alternative order ID which was paid for already in the same session.\n // Only given if the same product was purchased before in the same session.\n already_paid_order_id?: string;\n}\n\nexport interface PaidRefundStatusResponse {\n // Text to be shown to the point-of-sale staff as a proof of\n // payment (present only if reusable OTP algorithm is used).\n pos_confirmation?: string;\n\n // True if the order has been subjected to\n // refunds. False if it was simply paid.\n refunded: boolean;\n}\n\nexport interface PaidRequest {\n // Signature on TALER_PaymentResponsePS with the public\n // key of the merchant instance.\n sig: EddsaSignatureString;\n\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer and to enable signature verification without\n // database access).\n h_contract: HashCodeString;\n\n // Hash over custom inputs from the wallet for the contract.\n wallet_data_hash?: HashCodeString;\n\n // Session id for which the payment is proven.\n session_id: string;\n}\n\nexport interface AbortRequest {\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer in case $ORDER_ID is guessable).\n h_contract: HashCodeString;\n\n // List of coins the wallet would like to see refunds for.\n // (Should be limited to the coins for which the original\n // payment succeeded, as far as the wallet knows.)\n coins: AbortingCoin[];\n}\n\nexport interface AbortResponse {\n // List of refund responses about the coins that the wallet\n // requested an abort for. In the same order as the coins\n // from the original request.\n // The rtransaction_id is implied to be 0.\n refunds: MerchantAbortPayRefundStatus[];\n}\n\nexport interface WalletRefundRequest {\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer).\n h_contract: HashCodeString;\n}\n\nexport interface WalletRefundResponse {\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Successful refunds for this payment, empty array for none.\n refunds: MerchantCoinRefundStatus[];\n\n // Public key of the merchant.\n merchant_pub: EddsaPublicKey;\n}\n\n// Additional details needed to verify the refund confirmation signature\n// (h_contract_terms and merchant_pub) are already known\n// to the wallet and thus not included.\nexport interface MerchantCoinRefundSuccessStatus {\n // Used as tag for the sum type MerchantCoinRefundStatus sum type.\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // The EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKey;\n\n // Refund transaction ID.\n rtransaction_id: Integer;\n\n // Public key of a coin that was refunded.\n coin_pub: EddsaPublicKey;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n // Timestamp when the merchant approved the refund.\n // Useful for grouping refunds.\n execution_time: Timestamp;\n}\n\ninterface RewardInformation {\n // Exchange from which the reward will be withdrawn. Needed by the\n // wallet to determine denominations, fees, etc.\n exchange_url: string;\n\n // URL where to go after obtaining the reward.\n next_url: string;\n\n // (Remaining) amount of the reward (including fees).\n reward_amount: AmountString;\n\n // Timestamp indicating when the reward is set to expire (may be in the past).\n // Note that rewards that have expired MAY also result in a 404 response.\n expiration: Timestamp;\n}\n\ninterface PlanchetDetail {\n // Hash of the denomination's public key (hashed to reduce\n // bandwidth consumption).\n denom_pub_hash: HashCodeString;\n\n // Coin's blinded public key.\n coin_ev: CoinEnvelope;\n}\n\ninterface BlindSignature {\n // The (blind) RSA signature. Still needs to be unblinded.\n blind_sig: BlindedRsaSignature;\n}\n\nexport interface InstanceConfigurationMessage {\n // Name of the merchant instance to create (will become $INSTANCE).\n // Must match the regex ^[A-Za-z0-9][A-Za-z0-9_.@-]+$.\n id: string;\n\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (business or individual).\n // Defaults to 'business'. Should become mandatory field\n // in the future, left as optional for API compatibility for now.\n user_type?: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Authentication settings for this instance\n auth: InstanceAuthConfigurationMessage;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n}\n\nexport interface InstanceAuthConfigurationMessage {\n // Type of authentication.\n // \"external\": The mechant backend does not do\n // any authentication checks. Instead an API\n // gateway must do the authentication.\n // \"token\": The merchant checks an auth token.\n // See \"token\" for details.\n method: \"external\" | \"token\";\n\n // For method \"token\", this field is mandatory.\n // The token MUST begin with the string \"secret-token:\".\n // After the auth token has been set (with method \"token\"),\n // the value must be provided in a \"Authorization: Bearer $token\"\n // header.\n token?: AccessToken;\n}\n\nexport interface InstanceReconfigurationMessage {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (business or individual).\n // Defaults to 'business'. Should become mandatory field\n // in the future, left as optional for API compatibility for now.\n user_type?: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n}\n\nexport interface InstancesResponse {\n // List of instances that are present in the backend (see Instance).\n instances: Instance[];\n}\n\nexport interface Instance {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (\"business\" or \"individual\").\n user_type: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Merchant instance this response is about ($INSTANCE).\n id: string;\n\n // Public key of the merchant/instance, in Crockford Base32 encoding.\n merchant_pub: EddsaPublicKey;\n\n // List of the payment targets supported by this instance. Clients can\n // specify the desired payment target in /order requests. Note that\n // front-ends do not have to support wallets selecting payment targets.\n payment_targets: string[];\n\n // Has this instance been deleted (but not purged)?\n deleted: boolean;\n}\n\nexport interface QueryInstancesResponse {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (\"business\" or \"individual\").\n user_type: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Public key of the merchant/instance, in Crockford Base32 encoding.\n merchant_pub: EddsaPublicKey;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n\n // Authentication configuration.\n // Does not contain the token when token auth is configured.\n auth: {\n method: \"external\" | \"token\";\n };\n}\n\nexport interface AccountKycRedirects {\n // Array of pending KYCs.\n pending_kycs: MerchantAccountKycRedirect[];\n\n // Array of exchanges with no reply.\n timeout_kycs: ExchangeKycTimeout[];\n}\n\nexport interface MerchantAccountKycRedirect {\n // URL that the user should open in a browser to\n // proceed with the KYC process (as returned\n // by the exchange's /kyc-check/ endpoint).\n // Optional, missing if the account is blocked\n // due to AML and not due to KYC.\n kyc_url?: string;\n\n // AML status of the account.\n aml_status: Integer;\n\n // Base URL of the exchange this is about.\n exchange_url: string;\n\n // Our bank wire account this is about.\n payto_uri: PaytoString;\n}\n\nexport interface ExchangeKycTimeout {\n // Base URL of the exchange this is about.\n exchange_url: string;\n\n // Numeric error code indicating errors the exchange\n // returned, or TALER_EC_INVALID for none.\n exchange_code: number;\n\n // HTTP status code returned by the exchange when we asked for\n // information about the KYC status.\n // 0 if there was no response at all.\n exchange_http_status: number;\n}\n\nexport interface AccountAddDetails {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // Credentials to use when accessing the credit facade.\n // Never returned on a GET (as this may be somewhat\n // sensitive data). Can be set in POST\n // or PATCH requests to update (or delete) credentials.\n // To really delete credentials, set them to the type: \"none\".\n credit_facade_credentials?: FacadeCredentials;\n}\n\nexport type FacadeCredentials =\n | NoFacadeCredentials\n | BasicAuthFacadeCredentials;\n\nexport interface NoFacadeCredentials {\n type: \"none\";\n}\n\nexport interface BasicAuthFacadeCredentials {\n type: \"basic\";\n\n // Username to use to authenticate\n username: string;\n\n // Password to use to authenticate\n password: string;\n}\n\nexport interface AccountAddResponse {\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // Salt used to compute h_wire.\n salt: HashCode;\n}\n\nexport interface AccountPatchDetails {\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // Credentials to use when accessing the credit facade.\n // Never returned on a GET (as this may be somewhat\n // sensitive data). Can be set in POST\n // or PATCH requests to update (or delete) credentials.\n // To really delete credentials, set them to the type: \"none\".\n // If the argument is omitted, the old credentials\n // are simply preserved.\n credit_facade_credentials?: FacadeCredentials;\n}\n\nexport interface AccountsSummaryResponse {\n // List of accounts that are known for the instance.\n accounts: BankAccountEntry[];\n}\n\n// TODO: missing in docs\nexport interface BankAccountEntry {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // true if this account is active,\n // false if it is historic.\n active?: boolean;\n}\nexport interface BankAccountDetail {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // Salt used to compute h_wire.\n salt: HashCode;\n\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // true if this account is active,\n // false if it is historic.\n active?: boolean;\n}\n\nexport interface ProductAddDetail {\n // Product ID to use.\n product_id: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age?: Integer;\n}\n\nexport interface ProductPatchDetail {\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Number of units of the product that were lost (spoiled, stolen, etc.).\n total_lost?: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age?: Integer;\n}\n\nexport interface InventorySummaryResponse {\n // List of products that are present in the inventory.\n products: InventoryEntry[];\n}\n\nexport interface InventoryEntry {\n // Product identifier, as found in the product.\n product_id: string;\n // product_serial_id of the product in the database.\n product_serial: Integer;\n}\n\nexport interface FullInventoryDetailsResponse {\n // List of products that are present in the inventory.\n products: MerchantPosProductDetail[];\n\n // List of categories in the inventory.\n categories: MerchantCategory[];\n}\n\nexport interface MerchantPosProductDetail {\n // A unique numeric ID of the product\n product_serial: number;\n\n // A merchant-internal unique identifier for the product\n product_id?: string;\n\n // A list of category IDs this product belongs to.\n // Typically, a product only belongs to one category, but more than one is supported.\n categories: number[];\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // Optional, if missing treat as \"infinite\".\n total_stock?: Integer;\n\n // Minimum age buyer must have (in years).\n minimum_age?: Integer;\n}\n\nexport interface MerchantCategory {\n // A unique numeric ID of the category\n id: number;\n\n // The name of the category. This will be shown to users and used in the order summary.\n name: string;\n\n // Map from IETF BCP 47 language tags to localized names\n name_i18n?: { [lang_tag: string]: string };\n}\n\nexport interface ProductDetail {\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Number of units of the product that have already been sold.\n total_sold: Integer;\n\n // Number of units of the product that were lost (spoiled, stolen, etc.).\n total_lost: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years).\n minimum_age?: Integer;\n}\nexport interface LockRequest {\n // UUID that identifies the frontend performing the lock\n // Must be unique for the lifetime of the lock.\n lock_uuid: string;\n\n // How long does the frontend intend to hold the lock?\n duration: RelativeTime;\n\n // How many units should be locked?\n quantity: Integer;\n}\n\nexport interface PostOrderRequest {\n // The order must at least contain the minimal\n // order detail, but can override all.\n order: Order;\n\n // If set, the backend will then set the refund deadline to the current\n // time plus the specified delay. If it's not set, refunds will not be\n // possible.\n refund_delay?: RelativeTime;\n\n // Specifies the payment target preferred by the client. Can be used\n // to select among the various (active) wire methods supported by the instance.\n payment_target?: string;\n\n // Specifies that some products are to be included in the\n // order from the inventory. For these inventory management\n // is performed (so the products must be in stock) and\n // details are completed from the product data of the backend.\n inventory_products?: MinimalInventoryProduct[];\n\n // Specifies a lock identifier that was used to\n // lock a product in the inventory. Only useful if\n // inventory_products is set. Used in case a frontend\n // reserved quantities of the individual products while\n // the shopping cart was being built. Multiple UUIDs can\n // be used in case different UUIDs were used for different\n // products (i.e. in case the user started with multiple\n // shopping sessions that were combined during checkout).\n lock_uuids?: string[];\n\n // Should a token for claiming the order be generated?\n // False can make sense if the ORDER_ID is sufficiently\n // high entropy to prevent adversarial claims (like it is\n // if the backend auto-generates one). Default is 'true'.\n create_token?: boolean;\n\n // OTP device ID to associate with the order.\n // This parameter is optional.\n otp_id?: string;\n}\n\nexport type Order = MinimalOrderDetail & Partial;\n\nexport interface MinimalOrderDetail {\n // Amount to be paid by the customer.\n amount: AmountString;\n\n // Short summary of the order.\n summary: string;\n\n // See documentation of fulfillment_url in ContractTerms.\n // Either fulfillment_url or fulfillment_message must be specified.\n // When creating an order, the fulfillment URL can\n // contain ${ORDER_ID} which will be substituted with the\n // order ID of the newly created order.\n fulfillment_url?: string;\n\n // See documentation of fulfillment_message in ContractTerms.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n}\n\nexport interface MinimalInventoryProduct {\n // Which product is requested (here mandatory!).\n product_id: string;\n\n // How many units of the product are requested.\n quantity: Integer;\n}\n\nexport interface PostOrderResponse {\n // Order ID of the response that was just created.\n order_id: string;\n\n // Token that authorizes the wallet to claim the order.\n // Provided only if \"create_token\" was set to 'true'\n // in the request.\n token?: ClaimToken;\n}\nexport interface OutOfStockResponse {\n // Product ID of an out-of-stock item.\n product_id: string;\n\n // Requested quantity.\n requested_quantity: Integer;\n\n // Available quantity (must be below requested_quantity).\n available_quantity: Integer;\n\n // When do we expect the product to be again in stock?\n // Optional, not given if unknown.\n restock_expected?: Timestamp;\n}\n\nexport interface OrderHistory {\n // Timestamp-sorted array of all orders matching the query.\n // The order of the sorting depends on the sign of delta.\n orders: OrderHistoryEntry[];\n}\n\nexport interface OrderHistoryEntry {\n // Order ID of the transaction related to this entry.\n order_id: string;\n\n // Row ID of the order in the database.\n row_id: number;\n\n // When the order was created.\n timestamp: Timestamp;\n\n // The amount of money the order is for.\n amount: AmountString;\n\n // The summary of the order.\n summary: string;\n\n // Whether some part of the order is refundable,\n // that is the refund deadline has not yet expired\n // and the total amount refunded so far is below\n // the value of the original transaction.\n refundable: boolean;\n\n // Whether the order has been paid or not.\n paid: boolean;\n}\n\nexport type MerchantOrderStatusResponse =\n | CheckPaymentPaidResponse\n | CheckPaymentClaimedResponse\n | CheckPaymentUnpaidResponse;\n\nexport interface CheckPaymentPaidResponse {\n // The customer paid for this contract.\n order_status: \"paid\";\n\n // Was the payment refunded (even partially)?\n refunded: boolean;\n\n // True if there are any approved refunds that the wallet has\n // not yet obtained.\n refund_pending: boolean;\n\n // Did the exchange wire us the funds?\n wired: boolean;\n\n // Total amount the exchange deposited into our bank account\n // for this contract, excluding fees.\n deposit_total: AmountString;\n\n // Numeric error code indicating errors the exchange\n // encountered tracking the wire transfer for this purchase (before\n // we even got to specific coin issues).\n // 0 if there were no issues.\n exchange_code: number;\n\n // HTTP status code returned by the exchange when we asked for\n // information to track the wire transfer for this purchase.\n // 0 if there were no issues.\n exchange_http_status: number;\n\n // Total amount that was refunded, 0 if refunded is false.\n refund_amount: AmountString;\n\n // Contract terms.\n contract_terms: ContractTerms;\n\n // The wire transfer status from the exchange for this order if\n // available, otherwise empty array.\n wire_details: TransactionWireTransfer[];\n\n // Reports about trouble obtaining wire transfer details,\n // empty array if no trouble were encountered.\n wire_reports: TransactionWireReport[];\n\n // The refund details for this order. One entry per\n // refunded coin; empty array if there are no refunds.\n refund_details: RefundDetails[];\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n order_status_url: string;\n}\n\nexport interface CheckPaymentClaimedResponse {\n // A wallet claimed the order, but did not yet pay for the contract.\n order_status: \"claimed\";\n\n // Contract terms.\n contract_terms: ContractTerms;\n}\n\nexport interface CheckPaymentUnpaidResponse {\n // The order was neither claimed nor paid.\n order_status: \"unpaid\";\n\n // URI that the wallet must process to complete the payment.\n taler_pay_uri: string;\n\n // when was the order created\n creation_time: Timestamp;\n\n // Order summary text.\n summary: string;\n\n // Total amount of the order (to be paid by the customer).\n total_amount: AmountString;\n\n // Alternative order ID which was paid for already in the same session.\n // Only given if the same product was purchased before in the same session.\n already_paid_order_id?: string;\n\n // Fulfillment URL of an already paid order. Only given if under this\n // session an already paid order with a fulfillment URL exists.\n already_paid_fulfillment_url?: string;\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n order_status_url: string;\n\n // We do we NOT return the contract terms here because they may not\n // exist in case the wallet did not yet claim them.\n}\nexport interface RefundDetails {\n // Reason given for the refund.\n reason: string;\n\n // Set to true if a refund is still available for the wallet for this payment.\n pending: boolean;\n\n // When was the refund approved.\n timestamp: Timestamp;\n\n // Total amount that was refunded (minus a refund fee).\n amount: AmountString;\n}\n\nexport interface TransactionWireTransfer {\n // Responsible exchange.\n exchange_url: string;\n\n // 32-byte wire transfer identifier.\n wtid: Base32String;\n\n // Execution time of the wire transfer.\n execution_time: Timestamp;\n\n // Total amount that has been wire transferred\n // to the merchant.\n amount: AmountString;\n\n // Was this transfer confirmed by the merchant via the\n // POST /transfers API, or is it merely claimed by the exchange?\n confirmed: boolean;\n}\n\nexport interface TransactionWireReport {\n // Numerical error code.\n code: number;\n\n // Human-readable error description.\n hint: string;\n\n // Numerical error code from the exchange.\n exchange_code: number;\n\n // HTTP status code received from the exchange.\n exchange_http_status: number;\n\n // Public key of the coin for which we got the exchange error.\n coin_pub: CoinPublicKey;\n}\n\nexport interface ForgetRequest {\n // Array of valid JSON paths to forgettable fields in the order's\n // contract terms.\n fields: string[];\n}\n\nexport interface RefundRequest {\n // Amount to be refunded.\n refund: AmountString;\n\n // Human-readable refund justification.\n reason: string;\n}\nexport interface MerchantRefundResponse {\n // URL (handled by the backend) that the wallet should access to\n // trigger refund processing.\n // taler://refund/...\n taler_refund_uri: string;\n\n // Contract hash that a client may need to authenticate an\n // HTTP request to obtain the above URI in a wallet-friendly way.\n h_contract: HashCode;\n}\n\nexport interface TransferInformation {\n // How much was wired to the merchant (minus fees).\n credit_amount: AmountString;\n\n // Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).\n wtid: WireTransferIdentifierRawP;\n\n // Target account that received the wire transfer.\n payto_uri: PaytoString;\n\n // Base URL of the exchange that made the wire transfer.\n exchange_url: string;\n}\n\nexport interface TransferList {\n // List of all the transfers that fit the filter that we know.\n transfers: TransferDetails[];\n}\nexport interface TransferDetails {\n // How much was wired to the merchant (minus fees).\n credit_amount: AmountString;\n\n // Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).\n wtid: WireTransferIdentifierRawP;\n\n // Target account that received the wire transfer.\n payto_uri: PaytoString;\n\n // Base URL of the exchange that made the wire transfer.\n exchange_url: string;\n\n // Serial number identifying the transfer in the merchant backend.\n // Used for filtering via offset.\n transfer_serial_id: number;\n\n // Time of the execution of the wire transfer by the exchange, according to the exchange\n // Only provided if we did get an answer from the exchange.\n execution_time?: Timestamp;\n\n // True if we checked the exchange's answer and are happy with it.\n // False if we have an answer and are unhappy, missing if we\n // do not have an answer from the exchange.\n verified?: boolean;\n\n // True if the merchant uses the POST /transfers API to confirm\n // that this wire transfer took place (and it is thus not\n // something merely claimed by the exchange).\n confirmed?: boolean;\n}\n\nexport interface OtpDeviceAddDetails {\n // Device ID to use.\n otp_device_id: string;\n\n // Human-readable description for the device.\n otp_device_description: string;\n\n // A key encoded with RFC 3548 Base32.\n // IMPORTANT: This is not using the typical\n // Taler base32-crockford encoding.\n // Instead it uses the RFC 3548 encoding to\n // be compatible with the TOTP standard.\n otp_key: string;\n\n // Algorithm for computing the POS confirmation.\n // \"NONE\" or 0: No algorithm (no pos confirmation will be generated)\n // \"TOTP_WITHOUT_PRICE\" or 1: Without amounts (typical OTP device)\n // \"TOTP_WITH_PRICE\" or 2: With amounts (special-purpose OTP device)\n // The \"String\" variants are supported @since protocol **v7**.\n otp_algorithm: Integer | string;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n}\n\nexport interface OtpDevicePatchDetails {\n // Human-readable description for the device.\n otp_device_description: string;\n\n // A key encoded with RFC 3548 Base32.\n // IMPORTANT: This is not using the typical\n // Taler base32-crockford encoding.\n // Instead it uses the RFC 3548 encoding to\n // be compatible with the TOTP standard.\n otp_key: string;\n\n // Algorithm for computing the POS confirmation.\n otp_algorithm: Integer;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n}\n\nexport interface OtpDeviceSummaryResponse {\n // Array of devices that are present in our backend.\n otp_devices: OtpDeviceEntry[];\n}\nexport interface OtpDeviceEntry {\n // Device identifier.\n otp_device_id: string;\n\n // Human-readable description for the device.\n device_description: string;\n}\n\nexport interface OtpDeviceDetails {\n // Human-readable description for the device.\n device_description: string;\n\n // Algorithm for computing the POS confirmation.\n //\n // Currently, the following numbers are defined:\n // 0: None\n // 1: TOTP without price\n // 2: TOTP with price\n otp_algorithm: Integer;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n\n // Current time for time-based OTP devices.\n // Will match the faketime argument of the\n // query if one was present, otherwise the current\n // time at the backend.\n //\n // Available since protocol **v10**.\n otp_timestamp: Integer;\n\n // Current OTP confirmation string of the device.\n // Matches exactly the string that would be returned\n // as part of a payment confirmation for the given\n // amount and time (so may contain multiple OTP codes).\n //\n // If the otp_algorithm is time-based, the code is\n // returned for the current time, or for the faketime\n // if a TIMESTAMP query argument was provided by the client.\n //\n // When using OTP with counters, the counter is **NOT**\n // increased merely because this endpoint created\n // an OTP code (this is a GET request, after all!).\n //\n // If the otp_algorithm requires an amount, the\n // amount argument must be specified in the\n // query, otherwise the otp_code is not\n // generated.\n //\n // This field is *optional* in the response, as it is\n // only provided if we could compute it based on the\n // otp_algorithm and matching client query arguments.\n //\n // Available since protocol **v10**.\n otp_code?: string;\n}\nexport interface TemplateAddDetails {\n // Template ID to use.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\nexport interface TemplateContractDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // Required currency for payments to the template.\n // The user may specify any amount, but it must be\n // in this currency.\n // This parameter is optional and should not be present\n // if \"amount\" is given.\n currency?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: AmountString;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age: Integer;\n\n // The time the customer need to pay before his order will be deleted.\n // It is deleted if the customer did not pay and if the duration is over.\n pay_duration: RelativeTime;\n}\n\nexport interface TemplateContractDetailsDefaults {\n summary?: string;\n\n currency?: string;\n\n /**\n * Amount *or* a plain currency string.\n */\n amount?: string;\n}\n\nexport interface TemplatePatchDetails {\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\n\nexport interface TemplateSummaryResponse {\n // List of templates that are present in our backend.\n templates: TemplateEntry[];\n}\n\nexport interface TemplateEntry {\n // Template identifier, as found in the template.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n}\n\nexport interface WalletTemplateDetails {\n // Hard-coded information about the contrac terms\n // for this template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\n\nexport interface TemplateDetails {\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\nexport interface UsingTemplateDetails {\n // Summary of the template\n summary?: string;\n\n // The amount entered by the customer.\n amount?: AmountString;\n}\n\nexport interface WebhookAddDetails {\n // Webhook ID to use.\n webhook_id: string;\n\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface WebhookPatchDetails {\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface WebhookSummaryResponse {\n // Return webhooks that are present in our backend.\n webhooks: WebhookEntry[];\n}\n\nexport interface WebhookEntry {\n // Webhook identifier, as found in the webhook.\n webhook_id: string;\n\n // The event of the webhook: why the webhook is used.\n event_type: string;\n}\n\nexport interface WebhookDetails {\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface TokenFamilyCreateRequest {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n // If not specified, merchant backend will use the current time.\n valid_after?: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n}\n\nexport enum TokenFamilyKind {\n Discount = \"discount\",\n Subscription = \"subscription\",\n}\n\nexport interface TokenFamilyUpdateRequest {\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n}\n\nexport interface TokenFamiliesList {\n // All configured token families of this instance.\n token_families: TokenFamilySummary[];\n}\n\nexport interface TokenFamilySummary {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n}\n\nexport interface TokenFamilyDetails {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n\n // How many tokens have been issued for this family.\n issued: Integer;\n\n // How many tokens have been redeemed for this family.\n redeemed: Integer;\n}\nexport interface ContractTerms {\n // Human-readable description of the whole purchase.\n summary: string;\n\n // Map from IETF BCP 47 language tags to localized summaries.\n summary_i18n?: { [lang_tag: string]: string };\n\n // Unique, free-form identifier for the proposal.\n // Must be unique within a merchant instance.\n // For merchants that do not store proposals in their DB\n // before the customer paid for them, the order_id can be used\n // by the frontend to restore a proposal from the information\n // encoded in it (such as a short product identifier and timestamp).\n order_id: string;\n\n // Total price for the transaction.\n // The exchange will subtract deposit fees from that amount\n // before transferring it to the merchant.\n amount: AmountString;\n\n // URL where the same contract could be ordered again (if\n // available). Returned also at the public order endpoint\n // for people other than the actual buyer (hence public,\n // in case order IDs are guessable).\n public_reorder_url?: string;\n\n // URL that will show that the order was successful after\n // it has been paid for. Optional. When POSTing to the\n // merchant, the placeholder \"${ORDER_ID}\" will be\n // replaced with the actual order ID (useful if the\n // order ID is generated server-side and needs to be\n // in the URL).\n // Note that this placeholder can only be used once.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_url?: string;\n\n // Message shown to the customer after paying for the order.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n\n // Map from IETF BCP 47 language tags to localized fulfillment\n // messages.\n fulfillment_message_i18n?: { [lang_tag: string]: string };\n\n // Maximum total deposit fee accepted by the merchant for this contract.\n // Overrides defaults of the merchant instance.\n max_fee: AmountString;\n\n // List of products that are part of the purchase (see Product).\n products: Product[];\n\n // Time when this contract was generated.\n timestamp: Timestamp;\n\n // After this deadline has passed, no refunds will be accepted.\n refund_deadline: Timestamp;\n\n // After this deadline, the merchant won't accept payments for the contract.\n pay_deadline: Timestamp;\n\n // Transfer deadline for the exchange. Must be in the\n // deposit permissions of coins used to pay for this order.\n wire_transfer_deadline: Timestamp;\n\n // Merchant's public key used to sign this proposal; this information\n // is typically added by the backend. Note that this can be an ephemeral key.\n merchant_pub: EddsaPublicKey;\n\n // Base URL of the (public!) merchant backend API.\n // Must be an absolute URL that ends with a slash.\n merchant_base_url: string;\n\n // More info about the merchant, see below.\n merchant: Merchant;\n\n // The hash of the merchant instance's wire details.\n h_wire: HashCode;\n\n // Wire transfer method identifier for the wire method associated with h_wire.\n // The wallet may only select exchanges via a matching auditor if the\n // exchange also supports this wire method.\n // The wire transfer fees must be added based on this wire transfer method.\n wire_method: string;\n\n // Exchanges that the merchant accepts even if it does not accept any auditors that audit them.\n exchanges: Exchange[];\n\n // Delivery location for (all!) products.\n delivery_location?: Location;\n\n // Time indicating when the order should be delivered.\n // May be overwritten by individual products.\n delivery_date?: Timestamp;\n\n // Nonce generated by the wallet and echoed by the merchant\n // in this field when the proposal is generated.\n nonce: string;\n\n // Specifies for how long the wallet should try to get an\n // automatic refund for the purchase. If this field is\n // present, the wallet should wait for a few seconds after\n // the purchase and then automatically attempt to obtain\n // a refund. The wallet should probe until \"delay\"\n // after the payment was successful (i.e. via long polling\n // or via explicit requests with exponential back-off).\n //\n // In particular, if the wallet is offline\n // at that time, it MUST repeat the request until it gets\n // one response from the merchant after the delay has expired.\n // If the refund is granted, the wallet MUST automatically\n // recover the payment. This is used in case a merchant\n // knows that it might be unable to satisfy the contract and\n // desires for the wallet to attempt to get the refund without any\n // customer interaction. Note that it is NOT an error if the\n // merchant does not grant a refund.\n auto_refund?: RelativeTime;\n\n // Extra data that is only interpreted by the merchant frontend.\n // Useful when the merchant needs to store extra information on a\n // contract without storing it separately in their database.\n extra?: any;\n\n // Minimum age the buyer must have (in years). Default is 0.\n // This value is at least as large as the maximum over all\n // minimum age requirements of the products in this contract.\n // It might also be set independent of any product, due to\n // legal requirements.\n minimum_age?: Integer;\n}\n\nexport interface Product {\n // Merchant-internal identifier for the product.\n product_id?: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // The number of units of the product to deliver to the customer.\n quantity?: Integer;\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit?: string;\n\n // The price of the product; this is the total price for quantity times unit of this product.\n price?: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for this product. Can be empty.\n taxes?: Tax[];\n\n // Time indicating when this product should be delivered.\n delivery_date?: Timestamp;\n}\n\nexport interface Tax {\n // The name of the tax.\n name: string;\n\n // Amount paid in tax.\n tax: AmountString;\n}\nexport interface Merchant {\n // The merchant's legal name of business.\n name: string;\n\n // Label for a location with the business address of the merchant.\n email?: string;\n\n // Label for a location with the business address of the merchant.\n website?: string;\n\n // An optional base64-encoded product image.\n logo?: ImageDataUrl;\n\n // Label for a location with the business address of the merchant.\n address?: Location;\n\n // Label for a location that denotes the jurisdiction for disputes.\n // Some of the typical fields for a location (such as a street address) may be absent.\n jurisdiction?: Location;\n}\n// Delivery location, loosely modeled as a subset of\n// ISO20022's PostalAddress25.\nexport interface Location {\n // Nation with its own government.\n country?: string;\n\n // Identifies a subdivision of a country such as state, region, county.\n country_subdivision?: string;\n\n // Identifies a subdivision within a country sub-division.\n district?: string;\n\n // Name of a built-up area, with defined boundaries, and a local government.\n town?: string;\n\n // Specific location name within the town.\n town_location?: string;\n\n // Identifier consisting of a group of letters and/or numbers that\n // is added to a postal address to assist the sorting of mail.\n post_code?: string;\n\n // Name of a street or thoroughfare.\n street?: string;\n\n // Name of the building or house.\n building_name?: string;\n\n // Number that identifies the position of a building on a street.\n building_number?: string;\n\n // Free-form address lines, should not exceed 7 elements.\n address_lines?: string[];\n}\ninterface Auditor {\n // Official name.\n name: string;\n\n // Auditor's public key.\n auditor_pub: EddsaPublicKey;\n\n // Base URL of the auditor.\n url: string;\n}\nexport interface Exchange {\n // The exchange's base URL.\n url: string;\n\n // How much would the merchant like to use this exchange.\n // The wallet should use a suitable exchange with high\n // priority. The following priority values are used, but\n // it should be noted that they are NOT in any way normative.\n //\n // 0: likely it will not work (recently seen with account\n // restriction that would be bad for this merchant)\n // 512: merchant does not know, might be down (merchant\n // did not yet get /wire response).\n // 1024: good choice (recently confirmed working)\n priority: Integer;\n\n // Master public key of the exchange.\n master_pub: EddsaPublicKey;\n}\n\nexport interface MerchantReserveCreateConfirmation {\n // Public key identifying the reserve.\n reserve_pub: EddsaPublicKey;\n\n // Wire accounts of the exchange where to transfer the funds.\n accounts: ExchangeWireAccount[];\n}\n\nexport interface TemplateEditableDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // Required currency for payments to the template.\n // The user may specify any amount, but it must be\n // in this currency.\n // This parameter is optional and should not be present\n // if \"amount\" is given.\n currency?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: AmountString;\n}\n\nexport interface MerchantTemplateContractDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: string;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age: number;\n\n // The time the customer need to pay before his order will be deleted.\n // It is deleted if the customer did not pay and if the duration is over.\n pay_duration: TalerProtocolDuration;\n}\n\nexport interface MerchantTemplateAddDetails {\n // Template ID to use.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n\n // A base64-encoded image selected by the merchant.\n // This parameter is optional.\n // We are not sure about it.\n image?: string;\n\n editable_defaults?: TemplateEditableDetails;\n\n // Additional information in a separate template.\n template_contract: MerchantTemplateContractDetails;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n}\n\nconst codecForExchangeConfigInfo = (): Codec =>\n buildCodecForObject()\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .property(\"master_pub\", codecForString())\n .build(\"TalerMerchantApi.ExchangeConfigInfo\");\n\nexport const codecForTalerMerchantConfigResponse = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-merchant\"))\n .property(\"currency\", codecForString())\n .property(\"version\", codecForString())\n .property(\"currencies\", codecForMap(codecForCurrencySpecificiation()))\n .property(\"exchanges\", codecForList(codecForExchangeConfigInfo()))\n .build(\"TalerMerchantApi.VersionResponse\");\n\nexport const codecForClaimResponse = (): Codec =>\n buildCodecForObject()\n .property(\"contract_terms\", codecForContractTerms())\n .property(\"sig\", codecForString())\n .build(\"TalerMerchantApi.ClaimResponse\");\n\nexport const codecForPaymentResponse = (): Codec =>\n buildCodecForObject()\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .property(\"sig\", codecForString())\n .build(\"TalerMerchantApi.PaymentResponse\");\n\nexport const codecForStatusPaid = (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"refund_taken\", codecForAmountString())\n .property(\"refunded\", codecForBoolean())\n .property(\"type\", codecForConstString(\"paid\"))\n .build(\"TalerMerchantApi.StatusPaid\");\n\nexport const codecForStatusGoto = (): Codec =>\n buildCodecForObject()\n .property(\"public_reorder_url\", codecForURLString())\n .property(\"type\", codecForConstString(\"goto\"))\n .build(\"TalerMerchantApi.StatusGotoResponse\");\n\nexport const codecForStatusStatusUnpaid = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"unpaid\"))\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"taler_pay_uri\", codecForTalerUriString())\n .build(\"TalerMerchantApi.PaymentResponse\");\n\nexport const codecForPaidRefundStatusResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .property(\"refunded\", codecForBoolean())\n .build(\"TalerMerchantApi.PaidRefundStatusResponse\");\n\nexport const codecForMerchantAbortPayRefundSuccessStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_status\", codecForConstNumber(200))\n .property(\"type\", codecForConstString(\"success\"))\n .build(\"TalerMerchantApi.MerchantAbortPayRefundSuccessStatus\");\n\nexport const codecForMerchantAbortPayRefundFailureStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_reply\", codecForAny())\n .property(\"exchange_status\", codecForNumber())\n .property(\"type\", codecForConstString(\"failure\"))\n .build(\"TalerMerchantApi.MerchantAbortPayRefundFailureStatus\");\n\nexport const codecForMerchantAbortPayRefundStatus =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"success\", codecForMerchantAbortPayRefundSuccessStatus())\n .alternative(\"failure\", codecForMerchantAbortPayRefundFailureStatus())\n .build(\"TalerMerchantApi.MerchantAbortPayRefundStatus\");\n\nexport const codecForAbortResponse = (): Codec =>\n buildCodecForObject()\n .property(\"refunds\", codecForList(codecForMerchantAbortPayRefundStatus()))\n .build(\"TalerMerchantApi.AbortResponse\");\n\nexport const codecForWalletRefundResponse = (): Codec =>\n buildCodecForObject()\n .property(\"merchant_pub\", codecForString())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refunds\", codecForList(codecForMerchantCoinRefundStatus()))\n .build(\"TalerMerchantApi.AbortResponse\");\n\nexport const codecForMerchantCoinRefundSuccessStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"success\"))\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_status\", codecForConstNumber(200))\n .property(\"exchange_sig\", codecForString())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"exchange_pub\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TalerMerchantApi.MerchantCoinRefundSuccessStatus\");\n\nexport const codecForMerchantCoinRefundFailureStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"failure\"))\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_status\", codecForNumber())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"exchange_code\", codecOptional(codecForNumber()))\n .property(\"exchange_reply\", codecOptional(codecForAny()))\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TalerMerchantApi.MerchantCoinRefundFailureStatus\");\n\nexport const codecForMerchantCoinRefundStatus =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"success\", codecForMerchantCoinRefundSuccessStatus())\n .alternative(\"failure\", codecForMerchantCoinRefundFailureStatus())\n .build(\"TalerMerchantApi.MerchantCoinRefundStatus\");\n\nexport const codecForQueryInstancesResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"user_type\", codecForString())\n .property(\"email\", codecOptional(codecForString()))\n .property(\"website\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"merchant_pub\", codecForString())\n .property(\"address\", codecForLocation())\n .property(\"jurisdiction\", codecForLocation())\n .property(\"use_stefan\", codecForBoolean())\n .property(\"default_wire_transfer_delay\", codecForDuration)\n .property(\"default_pay_delay\", codecForDuration)\n .property(\n \"auth\",\n buildCodecForObject<{\n method: \"external\" | \"token\";\n }>()\n .property(\n \"method\",\n codecForEither(\n codecForConstString(\"token\"),\n codecForConstString(\"external\"),\n ),\n )\n .build(\"TalerMerchantApi.QueryInstancesResponse.auth\"),\n )\n .build(\"TalerMerchantApi.QueryInstancesResponse\");\n\nexport const codecForAccountKycRedirects = (): Codec =>\n buildCodecForObject()\n .property(\n \"pending_kycs\",\n codecForList(codecForMerchantAccountKycRedirect()),\n )\n .property(\"timeout_kycs\", codecForList(codecForExchangeKycTimeout()))\n\n .build(\"TalerMerchantApi.AccountKycRedirects\");\n\nexport const codecForMerchantAccountKycRedirect =\n (): Codec =>\n buildCodecForObject()\n .property(\"kyc_url\", codecForURLString())\n .property(\"aml_status\", codecForNumber())\n .property(\"exchange_url\", codecForURLString())\n .property(\"payto_uri\", codecForPaytoString())\n .build(\"TalerMerchantApi.MerchantAccountKycRedirect\");\n\nexport const codecForExchangeKycTimeout = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_url\", codecForURLString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .build(\"TalerMerchantApi.ExchangeKycTimeout\");\n\nexport const codecForAccountAddResponse = (): Codec =>\n buildCodecForObject()\n .property(\"h_wire\", codecForString())\n .property(\"salt\", codecForString())\n .build(\"TalerMerchantApi.AccountAddResponse\");\n\nexport const codecForAccountsSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForBankAccountEntry()))\n .build(\"TalerMerchantApi.AccountsSummaryResponse\");\n\nexport const codecForBankAccountEntry = (): Codec =>\n buildCodecForObject()\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"h_wire\", codecForString())\n .property(\"active\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.BankAccountEntry\");\n\nexport const codecForBankAccountDetail = (): Codec =>\n buildCodecForObject()\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"h_wire\", codecForString())\n .property(\"salt\", codecForString())\n .property(\"credit_facade_url\", codecOptional(codecForURLString()))\n .property(\"active\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.BankAccountEntry\");\n\nexport const codecForInventorySummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"products\", codecForList(codecForInventoryEntry()))\n .build(\"TalerMerchantApi.InventorySummaryResponse\");\n\nexport const codecForInventoryEntry = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecForString())\n .property(\"product_serial\", codecForNumber())\n .build(\"TalerMerchantApi.InventoryEntry\");\n\nexport const codecForMerchantPosProductDetail =\n (): Codec =>\n buildCodecForObject()\n .property(\"product_serial\", codecForNumber())\n .property(\"product_id\", codecOptional(codecForString()))\n .property(\"categories\", codecForList(codecForNumber()))\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"unit\", codecForString())\n .property(\"price\", codecForAmountString())\n .property(\"image\", codecForString())\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"total_stock\", codecForNumber())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"TalerMerchantApi.MerchantPosProductDetail\");\n\nexport const codecForMerchantCategory = (): Codec =>\n buildCodecForObject()\n .property(\"id\", codecForNumber())\n .property(\"name\", codecForString())\n .property(\"name_i18n\", codecForInternationalizedString())\n .build(\"TalerMerchantApi.MerchantCategory\");\n\nexport const codecForFullInventoryDetailsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"categories\", codecForList(codecForMerchantCategory()))\n .property(\"products\", codecForList(codecForMerchantPosProductDetail()))\n .build(\"TalerMerchantApi.FullInventoryDetailsResponse\");\n\nexport const codecForProductDetail = (): Codec =>\n buildCodecForObject()\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"unit\", codecForString())\n .property(\"price\", codecForAmountString())\n .property(\"image\", codecForString())\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"next_restock\", codecOptional(codecForTimestamp))\n .property(\"total_stock\", codecForNumber())\n .property(\"total_sold\", codecForNumber())\n .property(\"total_lost\", codecForNumber())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"TalerMerchantApi.ProductDetail\");\n\nexport const codecForTax = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"tax\", codecForAmountString())\n .build(\"TalerMerchantApi.Tax\");\n\nexport const codecForPostOrderResponse = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"token\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.PostOrderResponse\");\n\nexport const codecForOutOfStockResponse = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecForString())\n .property(\"available_quantity\", codecForNumber())\n .property(\"requested_quantity\", codecForNumber())\n .property(\"restock_expected\", codecForTimestamp)\n .build(\"TalerMerchantApi.OutOfStockResponse\");\n\nexport const codecForOrderHistory = (): Codec =>\n buildCodecForObject()\n .property(\"orders\", codecForList(codecForOrderHistoryEntry()))\n .build(\"TalerMerchantApi.OrderHistory\");\n\nexport const codecForOrderHistoryEntry = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"row_id\", codecForNumber())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .property(\"summary\", codecForString())\n .property(\"refundable\", codecForBoolean())\n .property(\"paid\", codecForBoolean())\n .build(\"TalerMerchantApi.OrderHistoryEntry\");\n\nexport const codecForMerchant = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"email\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"website\", codecOptional(codecForString()))\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"jurisdiction\", codecOptional(codecForLocation()))\n .build(\"TalerMerchantApi.MerchantInfo\");\n\nexport const codecForExchange = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"priority\", codecForNumber())\n .property(\"url\", codecForString())\n .build(\"TalerMerchantApi.Exchange\");\n\nexport const codecForContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"fulfillment_message\", codecOptional(codecForString()))\n .property(\n \"fulfillment_message_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"merchant_base_url\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"auto_refund\", codecOptional(codecForDuration))\n .property(\"wire_method\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .property(\"nonce\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"pay_deadline\", codecForTimestamp)\n .property(\"refund_deadline\", codecForTimestamp)\n .property(\"wire_transfer_deadline\", codecForTimestamp)\n .property(\"timestamp\", codecForTimestamp)\n .property(\"delivery_location\", codecOptional(codecForLocation()))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .property(\"max_fee\", codecForAmountString())\n .property(\"merchant\", codecForMerchant())\n .property(\"merchant_pub\", codecForString())\n .property(\"exchanges\", codecForList(codecForExchange()))\n .property(\"products\", codecForList(codecForProduct()))\n .property(\"extra\", codecForAny())\n .build(\"TalerMerchantApi.ContractTerms\");\n\nexport const codecForProduct = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecOptional(codecForString()))\n .property(\"description\", codecForString())\n .property(\n \"description_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"quantity\", codecOptional(codecForNumber()))\n .property(\"unit\", codecOptional(codecForString()))\n .property(\"price\", codecOptional(codecForAmountString()))\n .property(\"image\", codecOptional(codecForString()))\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .build(\"TalerMerchantApi.Product\");\n\nexport const codecForCheckPaymentPaidResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"paid\"))\n .property(\"refunded\", codecForBoolean())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"wired\", codecForBoolean())\n .property(\"deposit_total\", codecForAmountString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"contract_terms\", codecForContractTerms())\n .property(\"wire_reports\", codecForList(codecForTransactionWireReport()))\n .property(\"wire_details\", codecForList(codecForTransactionWireTransfer()))\n .property(\"refund_details\", codecForList(codecForRefundDetails()))\n .property(\"order_status_url\", codecForURLString())\n .build(\"TalerMerchantApi.CheckPaymentPaidResponse\");\n\nexport const codecForCheckPaymentUnpaidResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"unpaid\"))\n .property(\"taler_pay_uri\", codecForTalerUriString())\n .property(\"creation_time\", codecForTimestamp)\n .property(\"summary\", codecForString())\n .property(\"total_amount\", codecForAmountString())\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .property(\"already_paid_fulfillment_url\", codecOptional(codecForString()))\n .property(\"order_status_url\", codecForString())\n .build(\"TalerMerchantApi.CheckPaymentPaidResponse\");\n\nexport const codecForCheckPaymentClaimedResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"claimed\"))\n .property(\"contract_terms\", codecForContractTerms())\n .build(\"TalerMerchantApi.CheckPaymentClaimedResponse\");\n\nexport const codecForMerchantOrderPrivateStatusResponse =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"order_status\")\n .alternative(\"paid\", codecForCheckPaymentPaidResponse())\n .alternative(\"unpaid\", codecForCheckPaymentUnpaidResponse())\n .alternative(\"claimed\", codecForCheckPaymentClaimedResponse())\n .build(\"TalerMerchantApi.MerchantOrderStatusResponse\");\n\nexport const codecForRefundDetails = (): Codec =>\n buildCodecForObject()\n .property(\"reason\", codecForString())\n .property(\"pending\", codecForBoolean())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .build(\"TalerMerchantApi.RefundDetails\");\n\nexport const codecForTransactionWireTransfer =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_url\", codecForURLString())\n .property(\"wtid\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .property(\"confirmed\", codecForBoolean())\n .build(\"TalerMerchantApi.TransactionWireTransfer\");\n\nexport const codecForTransactionWireReport = (): Codec =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"hint\", codecForString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"coin_pub\", codecForString())\n .build(\"TalerMerchantApi.TransactionWireReport\");\n\nexport const codecForMerchantRefundResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_refund_uri\", codecForTalerUriString())\n .property(\"h_contract\", codecForString())\n .build(\"TalerMerchantApi.MerchantRefundResponse\");\n\nexport const codecForTansferList = (): Codec =>\n buildCodecForObject()\n .property(\"transfers\", codecForList(codecForTransferDetails()))\n .build(\"TalerMerchantApi.TransferList\");\n\nexport const codecForTransferDetails = (): Codec =>\n buildCodecForObject()\n .property(\"credit_amount\", codecForAmountString())\n .property(\"wtid\", codecForString())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"exchange_url\", codecForURLString())\n .property(\"transfer_serial_id\", codecForNumber())\n .property(\"execution_time\", codecOptional(codecForTimestamp))\n .property(\"verified\", codecOptional(codecForBoolean()))\n .property(\"confirmed\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.TransferDetails\");\n\nexport const codecForOtpDeviceSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"otp_devices\", codecForList(codecForOtpDeviceEntry()))\n .build(\"TalerMerchantApi.OtpDeviceSummaryResponse\");\n\nexport const codecForOtpDeviceEntry = (): Codec =>\n buildCodecForObject()\n .property(\"otp_device_id\", codecForString())\n .property(\"device_description\", codecForString())\n .build(\"TalerMerchantApi.OtpDeviceEntry\");\n\nexport const codecForOtpDeviceDetails = (): Codec =>\n buildCodecForObject()\n .property(\"device_description\", codecForString())\n .property(\"otp_algorithm\", codecForNumber())\n .property(\"otp_ctr\", codecOptional(codecForNumber()))\n .property(\"otp_timestamp\", codecForNumber())\n .property(\"otp_code\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.OtpDeviceDetails\");\n\nexport const codecForTemplateSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"templates\", codecForList(codecForTemplateEntry()))\n .build(\"TalerMerchantApi.TemplateSummaryResponse\");\n\nexport const codecForTemplateEntry = (): Codec =>\n buildCodecForObject()\n .property(\"template_id\", codecForString())\n .property(\"template_description\", codecForString())\n .build(\"TalerMerchantApi.TemplateEntry\");\n\nexport const codecForTemplateDetails = (): Codec =>\n buildCodecForObject()\n .property(\"template_description\", codecForString())\n .property(\"otp_id\", codecOptional(codecForString()))\n .property(\"template_contract\", codecForTemplateContractDetails())\n .property(\n \"editable_defaults\",\n codecOptional(codecForTemplateContractDetailsDefaults()),\n )\n .build(\"TalerMerchantApi.TemplateDetails\");\n\nexport const codecForTemplateContractDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"minimum_age\", codecForNumber())\n .property(\"pay_duration\", codecForDuration)\n .build(\"TalerMerchantApi.TemplateContractDetails\");\n\nexport const codecForTemplateContractDetailsDefaults =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .build(\"TalerMerchantApi.TemplateContractDetailsDefaults\");\n\nexport const codecForWalletTemplateDetails = (): Codec =>\n buildCodecForObject()\n .property(\"template_contract\", codecForTemplateContractDetails())\n .property(\n \"editable_defaults\",\n codecOptional(codecForTemplateContractDetailsDefaults()),\n )\n .build(\"TalerMerchantApi.WalletTemplateDetails\");\n\nexport const codecForWebhookSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"webhooks\", codecForList(codecForWebhookEntry()))\n .build(\"TalerMerchantApi.WebhookSummaryResponse\");\n\nexport const codecForWebhookEntry = (): Codec =>\n buildCodecForObject()\n .property(\"webhook_id\", codecForString())\n .property(\"event_type\", codecForString())\n .build(\"TalerMerchantApi.WebhookEntry\");\n\nexport const codecForWebhookDetails = (): Codec =>\n buildCodecForObject()\n .property(\"event_type\", codecForString())\n .property(\"url\", codecForString())\n .property(\"http_method\", codecForString())\n .property(\"header_template\", codecOptional(codecForString()))\n .property(\"body_template\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.WebhookDetails\");\n\nexport const codecForTokenFamilyKind = (): Codec =>\n codecForEither(\n codecForConstString(\"discount\"),\n codecForConstString(\"subscription\"),\n ) as any; //FIXME: create a codecForEnum\nexport const codecForTokenFamilyDetails = (): Codec =>\n buildCodecForObject()\n .property(\"slug\", codecForString())\n .property(\"name\", codecForString())\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"valid_after\", codecForTimestamp)\n .property(\"valid_before\", codecForTimestamp)\n .property(\"duration\", codecForDuration)\n .property(\"kind\", codecForTokenFamilyKind())\n .property(\"issued\", codecForNumber())\n .property(\"redeemed\", codecForNumber())\n .build(\"TalerMerchantApi.TokenFamilyDetails\");\n\nexport const codecForTokenFamiliesList = (): Codec =>\n buildCodecForObject()\n .property(\"token_families\", codecForList(codecForTokenFamilySummary()))\n .build(\"TalerMerchantApi.TokenFamiliesList\");\n\nexport const codecForTokenFamilySummary = (): Codec =>\n buildCodecForObject()\n .property(\"slug\", codecForString())\n .property(\"name\", codecForString())\n .property(\"valid_after\", codecForTimestamp)\n .property(\"valid_before\", codecForTimestamp)\n .property(\"kind\", codecForTokenFamilyKind())\n .build(\"TalerMerchantApi.TokenFamilySummary\");\n\nexport const codecForInstancesResponse = (): Codec =>\n buildCodecForObject()\n .property(\"instances\", codecForList(codecForInstance()))\n .build(\"TalerMerchantApi.InstancesResponse\");\n\nexport const codecForInstance = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"user_type\", codecForString())\n .property(\"website\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"id\", codecForString())\n .property(\"merchant_pub\", codecForString())\n .property(\"payment_targets\", codecForList(codecForString()))\n .property(\"deleted\", codecForBoolean())\n .build(\"TalerMerchantApi.Instance\");\n\nexport const codecForTemplateEditableDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .build(\"TemplateEditableDetails\");\n\nexport const codecForMerchantReserveCreateConfirmation =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .property(\"reserve_pub\", codecForString())\n .build(\"MerchantReserveCreateConfirmation\");\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { codecForAny } from \"./codec.js\";\nimport { HttpStatusCode } from \"./http-status-codes.js\";\nimport {\n createPlatformHttpLib,\n expectSuccessResponseOrThrow,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"./http.js\";\nimport { LibtoolVersion } from \"./libtool-version.js\";\nimport { Logger } from \"./logging.js\";\nimport {\n FailCasesByMethod,\n OperationFail,\n OperationOk,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"./operation.js\";\nimport { TalerProtocolDuration } from \"./time.js\";\nimport { AmountString } from \"./types-taler-common.js\";\nimport {\n OtpDeviceAddDetails,\n codecForTalerMerchantConfigResponse,\n codecForMerchantOrderPrivateStatusResponse,\n codecForPostOrderResponse,\n} from \"./types-taler-merchant.js\";\n\nimport * as TalerMerchantApi from \"./types-taler-merchant.js\";\n\nconst logger = new Logger(\"MerchantApiClient.ts\");\n\n// FIXME: Explain!\nexport type TalerMerchantResultByMethod =\n ResultByMethod;\n\n// FIXME: Explain!\nexport type TalerMerchantErrorsByMethod =\n FailCasesByMethod;\n\nexport interface MerchantAuthConfiguration {\n method: \"external\" | \"token\";\n token?: string;\n}\n\n// FIXME: Why do we need this? Describe / fix!\nexport interface PartialMerchantInstanceConfig {\n auth?: MerchantAuthConfiguration;\n id: string;\n name: string;\n paytoUris: string[];\n address?: unknown;\n jurisdiction?: unknown;\n defaultWireTransferDelay?: TalerProtocolDuration;\n defaultPayDelay?: TalerProtocolDuration;\n}\n\nexport interface CreateMerchantTippingReserveRequest {\n // Amount that the merchant promises to put into the reserve\n initial_balance: AmountString;\n\n // Exchange the merchant intends to use for tipping\n exchange_url: string;\n\n // Desired wire method, for example \"iban\" or \"x-taler-bank\"\n wire_method: string;\n}\n\nexport interface DeleteTippingReserveArgs {\n reservePub: string;\n purge?: boolean;\n}\n\nexport interface MerchantInstanceConfig {\n auth: MerchantAuthConfiguration;\n id: string;\n name: string;\n address: unknown;\n jurisdiction: unknown;\n use_stefan: boolean;\n default_wire_transfer_delay: TalerProtocolDuration;\n default_pay_delay: TalerProtocolDuration;\n}\n\nexport interface PrivateOrderStatusQuery {\n instance?: string;\n orderId: string;\n sessionId?: string;\n}\n\n/**\n * Client for the GNU Taler merchant backend.\n */\nexport class MerchantApiClient {\n /**\n * Base URL for the particular instance that this merchant API client\n * is for.\n */\n private baseUrl: string;\n\n readonly auth: MerchantAuthConfiguration;\n\n public readonly PROTOCOL_VERSION = \"6:0:2\";\n\n constructor(\n baseUrl: string,\n options: { auth?: MerchantAuthConfiguration } = {},\n ) {\n this.baseUrl = baseUrl;\n\n this.auth = options?.auth ?? {\n method: \"external\",\n };\n }\n\n httpClient = createPlatformHttpLib();\n\n async changeAuth(auth: MerchantAuthConfiguration): Promise {\n const url = new URL(\"private/auth\", this.baseUrl);\n const res = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: auth,\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(res);\n }\n\n async getPrivateInstanceInfo(): Promise {\n const url = new URL(\"private\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n headers: this.makeAuthHeader(),\n });\n return await resp.json();\n }\n\n async deleteInstance(instanceId: string) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"DELETE\",\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(resp);\n }\n\n async createInstance(req: MerchantInstanceConfig): Promise {\n const url = new URL(\"management/instances\", this.baseUrl);\n await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n }\n\n async getInstances(): Promise {\n const url = new URL(\"management/instances\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async getInstanceFullDetails(instanceId: string): Promise {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n try {\n const resp = await this.httpClient.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return resp.json();\n } catch (e) {\n throw e;\n }\n }\n\n async createOrder(\n req: TalerMerchantApi.PostOrderRequest,\n ): Promise {\n let url = new URL(\"private/orders\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForPostOrderResponse());\n }\n\n async deleteOrder(req: { orderId: string; force?: boolean }): Promise {\n let url = new URL(`private/orders/${req.orderId}`, this.baseUrl);\n if (req.force) {\n url.searchParams.set(\"force\", \"yes\");\n }\n const resp = await this.httpClient.fetch(url.href, {\n method: \"DELETE\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n if (resp.status !== 204) {\n throw Error(`failed to delete order (status ${resp.status})`);\n }\n }\n\n async queryPrivateOrderStatus(\n query: PrivateOrderStatusQuery,\n ): Promise {\n const reqUrl = new URL(`private/orders/${query.orderId}`, this.baseUrl);\n if (query.sessionId) {\n reqUrl.searchParams.set(\"session_id\", query.sessionId);\n }\n const resp = await this.httpClient.fetch(reqUrl.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(\n resp,\n codecForMerchantOrderPrivateStatusResponse(),\n );\n }\n\n async giveRefund(r: {\n instance: string;\n orderId: string;\n amount: string;\n justification: string;\n }): Promise<{ talerRefundUri: string }> {\n const reqUrl = new URL(`private/orders/${r.orderId}/refund`, this.baseUrl);\n const resp = await this.httpClient.fetch(reqUrl.href, {\n method: \"POST\",\n body: {\n refund: r.amount,\n reason: r.justification,\n },\n });\n const respBody = await resp.json();\n return {\n talerRefundUri: respBody.taler_refund_uri,\n };\n }\n\n async createTemplate(req: TalerMerchantApi.MerchantTemplateAddDetails) {\n let url = new URL(\"private/templates\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async getTemplate(templateId: string) {\n let url = new URL(`private/templates/${templateId}`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAny());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n *\n */\n async getConfig(): Promise> {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTalerMerchantConfigResponse());\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async createOtpDevice(\n req: OtpDeviceAddDetails,\n ): Promise | OperationFail> {\n let url = new URL(\"private/otp-devices\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n private makeAuthHeader(): Record {\n switch (this.auth.method) {\n case \"external\":\n return {};\n case \"token\":\n return {\n Authorization: `Bearer ${this.auth.token}`,\n };\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Logger } from \"./logging.js\";\nimport { AbsoluteTime } from \"./time.js\";\n\n/**\n * Implementation of token bucket throttling.\n */\n\nconst logger = new Logger(\"RequestThrottler.ts\");\n\n/**\n * Maximum request per second, per origin.\n */\nconst MAX_PER_SECOND = 100;\n\n/**\n * Maximum request per minute, per origin.\n */\nconst MAX_PER_MINUTE = 500;\n\n/**\n * Maximum request per hour, per origin.\n */\nconst MAX_PER_HOUR = 2000;\n\n/**\n * Throttling state for one origin.\n */\nclass OriginState {\n tokensSecond: number = MAX_PER_SECOND;\n tokensMinute: number = MAX_PER_MINUTE;\n tokensHour: number = MAX_PER_HOUR;\n private lastUpdate = AbsoluteTime.now();\n\n private refill(): void {\n const now = AbsoluteTime.now();\n if (AbsoluteTime.cmp(now, this.lastUpdate) < 0) {\n // Did the system time change?\n this.lastUpdate = now;\n return;\n }\n const d = AbsoluteTime.difference(now, this.lastUpdate);\n if (d.d_ms === \"forever\") {\n throw Error(\"assertion failed\");\n }\n this.tokensSecond = Math.min(\n MAX_PER_SECOND,\n this.tokensSecond + d.d_ms / 1000,\n );\n this.tokensMinute = Math.min(\n MAX_PER_MINUTE,\n this.tokensMinute + d.d_ms / 1000 / 60,\n );\n this.tokensHour = Math.min(\n MAX_PER_HOUR,\n this.tokensHour + d.d_ms / 1000 / 60 / 60,\n );\n this.lastUpdate = now;\n }\n\n /**\n * Return true if the request for this origin should be throttled.\n * Otherwise, take a token out of the respective buckets.\n */\n applyThrottle(): boolean {\n this.refill();\n if (this.tokensSecond < 1) {\n logger.warn(\"request throttled (per second limit exceeded)\");\n return true;\n }\n if (this.tokensMinute < 1) {\n logger.warn(\"request throttled (per minute limit exceeded)\");\n return true;\n }\n if (this.tokensHour < 1) {\n logger.warn(\"request throttled (per hour limit exceeded)\");\n return true;\n }\n this.tokensSecond--;\n this.tokensMinute--;\n this.tokensHour--;\n return false;\n }\n}\n\n/**\n * Request throttler, used as a \"last layer of defense\" when some\n * other part of the re-try logic is broken and we're sending too\n * many requests to the same exchange/bank/merchant.\n */\nexport class RequestThrottler {\n private perOriginInfo: { [origin: string]: OriginState } = {};\n\n /**\n * Get the throttling state for an origin, or\n * initialize if no state is associated with the\n * origin yet.\n */\n private getState(origin: string): OriginState {\n const s = this.perOriginInfo[origin];\n if (s) {\n return s;\n }\n const ns = (this.perOriginInfo[origin] = new OriginState());\n return ns;\n }\n\n /**\n * Apply throttling to a request.\n *\n * @returns whether the request should be throttled.\n */\n applyThrottle(requestUrl: string): boolean {\n const origin = new URL(requestUrl).origin;\n return this.getState(origin).applyThrottle();\n }\n\n /**\n * Get the throttle statistics for a particular URL.\n */\n getThrottleStats(requestUrl: string): Record {\n const origin = new URL(requestUrl).origin;\n const state = this.getState(origin);\n return {\n tokensHour: state.tokensHour,\n tokensMinute: state.tokensMinute,\n tokensSecond: state.tokensSecond,\n maxTokensHour: MAX_PER_HOUR,\n maxTokensMinute: MAX_PER_MINUTE,\n maxTokensSecond: MAX_PER_SECOND,\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type declarations for the exchange's reserve transaction information.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n codecForString,\n buildCodecForObject,\n codecForConstString,\n buildCodecForUnion,\n Codec,\n codecForNumber,\n} from \"./codec.js\";\nimport {\n AmountString,\n Base32String,\n EddsaSignatureString,\n EddsaPublicKeyString,\n CoinPublicKeyString,\n} from \"./types-taler-common.js\";\nimport {\n AbsoluteTime,\n codecForTimestamp,\n TalerProtocolTimestamp,\n} from \"./time.js\";\n\nexport enum ReserveTransactionType {\n Withdraw = \"WITHDRAW\",\n Credit = \"CREDIT\",\n Recoup = \"RECOUP\",\n Closing = \"CLOSING\",\n}\n\nexport interface ReserveWithdrawTransaction {\n type: ReserveTransactionType.Withdraw;\n\n /**\n * Amount withdrawn.\n */\n amount: AmountString;\n\n /**\n * Hash of the denomination public key of the coin.\n */\n h_denom_pub: Base32String;\n\n /**\n * Hash of the blinded coin to be signed\n */\n h_coin_envelope: Base32String;\n\n /**\n * Signature of 'TALER_WithdrawRequestPS' created with the reserves's\n * private key.\n */\n reserve_sig: EddsaSignatureString;\n\n /**\n * Fee that is charged for withdraw.\n */\n withdraw_fee: AmountString;\n}\n\nexport interface ReserveCreditTransaction {\n type: ReserveTransactionType.Credit;\n\n /**\n * Amount withdrawn.\n */\n amount: AmountString;\n\n /**\n * Sender account payto://-URL\n */\n sender_account_url: string;\n\n /**\n * Transfer details uniquely identifying the transfer.\n */\n wire_reference: number;\n\n /**\n * Timestamp of the incoming wire transfer.\n */\n timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ReserveClosingTransaction {\n type: ReserveTransactionType.Closing;\n\n /**\n * Closing balance.\n */\n amount: AmountString;\n\n /**\n * Closing fee charged by the exchange.\n */\n closing_fee: AmountString;\n\n /**\n * Wire transfer subject.\n */\n wtid: string;\n\n /**\n * Hash of the wire account into which the funds were returned to.\n */\n h_wire: string;\n\n /**\n * This is a signature over a\n * struct TALER_ReserveCloseConfirmationPS with purpose\n * TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED.\n */\n exchange_sig: EddsaSignatureString;\n\n /**\n * Public key used to create exchange_sig.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /**\n * Time when the reserve was closed.\n */\n timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ReserveRecoupTransaction {\n type: ReserveTransactionType.Recoup;\n\n /**\n * Amount paid back.\n */\n amount: AmountString;\n\n /**\n * This is a signature over\n * a struct TALER_PaybackConfirmationPS with purpose\n * TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK.\n */\n exchange_sig: EddsaSignatureString;\n\n /**\n * Public key used to create exchange_sig.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /**\n * Time when the funds were paid back into the reserve.\n */\n timestamp: TalerProtocolTimestamp;\n\n /**\n * Public key of the coin that was paid back.\n */\n coin_pub: CoinPublicKeyString;\n}\n\n/**\n * Format of the exchange's transaction history for a reserve.\n */\nexport type ReserveTransaction =\n | ReserveWithdrawTransaction\n | ReserveCreditTransaction\n | ReserveClosingTransaction\n | ReserveRecoupTransaction;\n\nexport const codecForReserveWithdrawTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"h_coin_envelope\", codecForString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"reserve_sig\", codecForString())\n .property(\"type\", codecForConstString(ReserveTransactionType.Withdraw))\n .property(\"withdraw_fee\", codecForAmountString())\n .build(\"ReserveWithdrawTransaction\");\n\nexport const codecForReserveCreditTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"sender_account_url\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"wire_reference\", codecForNumber())\n .property(\"type\", codecForConstString(ReserveTransactionType.Credit))\n .build(\"ReserveCreditTransaction\");\n\nexport const codecForReserveClosingTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"closing_fee\", codecForAmountString())\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"type\", codecForConstString(ReserveTransactionType.Closing))\n .property(\"wtid\", codecForString())\n .build(\"ReserveClosingTransaction\");\n\nexport const codecForReserveRecoupTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"type\", codecForConstString(ReserveTransactionType.Recoup))\n .build(\"ReserveRecoupTransaction\");\n\nexport const codecForReserveTransaction = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n ReserveTransactionType.Withdraw,\n codecForReserveWithdrawTransaction(),\n )\n .alternative(\n ReserveTransactionType.Closing,\n codecForReserveClosingTransaction(),\n )\n .alternative(\n ReserveTransactionType.Recoup,\n codecForReserveRecoupTransaction(),\n )\n .alternative(\n ReserveTransactionType.Credit,\n codecForReserveCreditTransaction(),\n )\n .build(\"ReserveTransaction\");\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Logger } from \"./logging.js\";\nimport { AbsoluteTime, Duration } from \"./time.js\";\n\n/**\n * Implementation of token bucket throttling.\n */\n\n/**\n * Logger.\n */\nconst logger = new Logger(\"OperationThrottler.ts\");\n\n/**\n * Maximum request per second, per origin.\n */\nconst MAX_PER_SECOND = 100;\n\n/**\n * Maximum request per minute, per origin.\n */\nconst MAX_PER_MINUTE = 500;\n\n/**\n * Maximum request per hour, per origin.\n */\nconst MAX_PER_HOUR = 2000;\n\n/**\n * Throttling state for one task.\n */\nclass TaskState {\n tokensSecond: number = MAX_PER_SECOND;\n tokensMinute: number = MAX_PER_MINUTE;\n tokensHour: number = MAX_PER_HOUR;\n lastUpdate = AbsoluteTime.now();\n\n private refill(): void {\n const now = AbsoluteTime.now();\n if (AbsoluteTime.cmp(now, this.lastUpdate) < 0) {\n // Did the system time change?\n this.lastUpdate = now;\n return;\n }\n const d = AbsoluteTime.difference(now, this.lastUpdate);\n if (d.d_ms === \"forever\") {\n throw Error(\"assertion failed\");\n }\n this.tokensSecond = Math.min(\n MAX_PER_SECOND,\n this.tokensSecond + d.d_ms / 1000,\n );\n this.tokensMinute = Math.min(\n MAX_PER_MINUTE,\n this.tokensMinute + d.d_ms / 1000 / 60,\n );\n this.tokensHour = Math.min(\n MAX_PER_HOUR,\n this.tokensHour + d.d_ms / 1000 / 60 / 60,\n );\n this.lastUpdate = now;\n }\n\n /**\n * Return true if the request for this origin should be throttled.\n * Otherwise, take a token out of the respective buckets.\n */\n applyThrottle(): boolean {\n this.refill();\n if (this.tokensSecond < 1) {\n logger.warn(\"request throttled (per second limit exceeded)\");\n return true;\n }\n if (this.tokensMinute < 1) {\n logger.warn(\"request throttled (per minute limit exceeded)\");\n return true;\n }\n if (this.tokensHour < 1) {\n logger.warn(\"request throttled (per hour limit exceeded)\");\n return true;\n }\n this.tokensSecond--;\n this.tokensMinute--;\n this.tokensHour--;\n return false;\n }\n}\n\n/**\n * Request throttler, used as a \"last layer of defense\" when some\n * other part of the re-try logic is broken and we're sending too\n * many requests to the same exchange/bank/merchant.\n */\nexport class TaskThrottler {\n private perTaskInfo: { [taskId: string]: TaskState } = {};\n\n /**\n * Get the throttling state for an origin, or\n * initialize if no state is associated with the\n * origin yet.\n */\n private getState(origin: string): TaskState {\n const s = this.perTaskInfo[origin];\n if (s) {\n return s;\n }\n const ns = (this.perTaskInfo[origin] = new TaskState());\n return ns;\n }\n\n /**\n * Apply throttling to a request.\n *\n * @returns whether the request should be throttled.\n */\n applyThrottle(taskId: string): boolean {\n for (let [k, v] of Object.entries(this.perTaskInfo)) {\n // Remove throttled tasks that haven't seen an update in more than one hour.\n if (\n Duration.cmp(\n AbsoluteTime.difference(v.lastUpdate, AbsoluteTime.now()),\n Duration.fromSpec({ hours: 1 }),\n ) > 1\n ) {\n delete this.perTaskInfo[k];\n }\n }\n return this.getState(taskId).applyThrottle();\n }\n\n /**\n * Get the throttle statistics for a particular URL.\n */\n getThrottleStats(taskId: string): Record {\n const state = this.getState(taskId);\n return {\n tokensHour: state.tokensHour,\n tokensMinute: state.tokensMinute,\n tokensSecond: state.tokensSecond,\n maxTokensHour: MAX_PER_HOUR,\n maxTokensMinute: MAX_PER_MINUTE,\n maxTokensSecond: MAX_PER_SECOND,\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Client for the Taler (demo-)bank.\n */\n\n/**\n * Imports.\n */\nimport {\n AccountData,\n AmountString,\n base64FromArrayBuffer,\n buildCodecForObject,\n Codec,\n codecForAny,\n codecForString,\n encodeCrock,\n getRandomBytes,\n HttpStatusCode,\n j2s,\n Logger,\n opEmptySuccess,\n opKnownHttpFailure,\n opUnknownFailure,\n RegisterAccountRequest,\n stringToBytes,\n TalerError,\n TalerErrorCode,\n} from \"@gnu-taler/taler-util\";\nimport {\n checkSuccessResponseOrThrow,\n createPlatformHttpLib,\n expectSuccessResponseOrThrow,\n HttpRequestLibrary,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\n\nconst logger = new Logger(\"bank-api-client.ts\");\n\nexport enum CreditDebitIndicator {\n Credit = \"credit\",\n Debit = \"debit\",\n}\n\nexport interface BankAccountBalanceResponse {\n balance: {\n amount: AmountString;\n credit_debit_indicator: CreditDebitIndicator;\n };\n}\n\nexport interface BankUser {\n username: string;\n password: string;\n accountPaytoUri: string;\n}\n\nexport interface WithdrawalOperationInfo {\n withdrawal_id: string;\n taler_withdraw_uri: string;\n}\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nfunction makeBasicAuthHeader(username: string, password: string): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n\nconst codecForWithdrawalOperationInfo = (): Codec =>\n buildCodecForObject()\n .property(\"withdrawal_id\", codecForString())\n .property(\"taler_withdraw_uri\", codecForString())\n .build(\"WithdrawalOperationInfo\");\n\nexport interface BankAccessApiClientArgs {\n auth?: { username: string; password: string };\n httpClient?: HttpRequestLibrary;\n}\n\nexport interface BankAccessApiCreateTransactionRequest {\n amount: AmountString;\n paytoUri: string;\n}\n\nexport class WireGatewayApiClientArgs {\n auth?: {\n username: string;\n password: string;\n };\n httpClient?: HttpRequestLibrary;\n}\n\n/**\n * This API look like it belongs to harness\n * but it will be nice to have in utils to be used by others\n */\nexport class WireGatewayApiClient {\n httpLib;\n\n constructor(\n private baseUrl: string,\n private args: WireGatewayApiClientArgs = {},\n ) {\n this.httpLib = args.httpClient ?? createPlatformHttpLib();\n }\n\n private makeAuthHeader(): Record {\n const auth = this.args.auth;\n if (auth) {\n return {\n Authorization: makeBasicAuthHeader(auth.username, auth.password),\n };\n }\n return {};\n }\n\n async adminAddIncoming(params: {\n amount: string;\n reservePub: string;\n debitAccountPayto: string;\n }): Promise {\n let url = new URL(`admin/add-incoming`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n amount: params.amount,\n reserve_pub: params.reservePub,\n debit_account: params.debitAccountPayto,\n },\n headers: this.makeAuthHeader(),\n });\n logger.info(`add-incoming response status: ${resp.status}`);\n await checkSuccessResponseOrThrow(resp);\n }\n}\n\nexport interface AccountBalance {\n amount: AmountString;\n credit_debit_indicator: \"credit\" | \"debit\";\n}\n\nexport interface ConfirmWithdrawalArgs {\n withdrawalOperationId: string;\n}\n\n/**\n * Client for the Taler corebank API.\n */\nexport class TalerCorebankApiClient {\n httpLib: HttpRequestLibrary;\n\n constructor(\n public baseUrl: string,\n private args: BankAccessApiClientArgs = {},\n ) {\n this.httpLib = args.httpClient ?? createPlatformHttpLib();\n }\n\n setAuth(auth: { username: string; password: string }) {\n this.args.auth = auth;\n }\n\n private makeAuthHeader(): Record {\n if (!this.args.auth) {\n return {};\n }\n const authHeaderValue = makeBasicAuthHeader(\n this.args.auth.username,\n this.args.auth.password,\n );\n return {\n Authorization: authHeaderValue,\n };\n }\n\n async getAccountBalance(\n username: string,\n ): Promise {\n const url = new URL(`accounts/${username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async getTransactions(username: string): Promise {\n const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl);\n const resp = await this.httpLib.fetch(reqUrl.href, {\n method: \"GET\",\n headers: {\n ...this.makeAuthHeader(),\n },\n });\n\n const res = await readSuccessResponseJsonOrThrow(resp, codecForAny());\n logger.info(`result: ${j2s(res)}`);\n }\n\n async createTransaction(\n username: string,\n req: BankAccessApiCreateTransactionRequest,\n ): Promise {\n const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(reqUrl.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n\n return await readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async registerAccountExtended(req: RegisterAccountRequest): Promise {\n const url = new URL(\"accounts\", this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n\n if (\n resp.status !== 200 &&\n resp.status !== 201 &&\n resp.status !== 202 &&\n resp.status !== 204\n ) {\n logger.error(`unexpected status ${resp.status} from POST ${url.href}`);\n logger.error(`${j2s(await resp.json())}`);\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n {\n httpStatusCode: resp.status,\n },\n );\n }\n }\n\n /**\n * Register a new account and return information about it.\n *\n * This is a helper, as it does both the registration and the\n * account info query.\n */\n async registerAccount(username: string, password: string): Promise {\n const url = new URL(\"accounts\", this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n username,\n password,\n name: username,\n },\n headers: this.makeAuthHeader(),\n });\n if (\n resp.status !== 200 &&\n resp.status !== 201 &&\n resp.status !== 202 &&\n resp.status !== 204\n ) {\n logger.error(`unexpected status ${resp.status} from POST ${url.href}`);\n logger.error(`${j2s(await resp.json())}`);\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n {\n httpStatusCode: resp.status,\n },\n );\n }\n // FIXME: Corebank should directly return this info!\n const infoUrl = new URL(`accounts/${username}`, this.baseUrl);\n const infoResp = await this.httpLib.fetch(infoUrl.href, {\n headers: {\n Authorization: makeBasicAuthHeader(username, password),\n },\n });\n // FIXME: Validate!\n const acctInfo: AccountData = await readSuccessResponseJsonOrThrow(\n infoResp,\n codecForAny(),\n );\n return {\n password,\n username,\n accountPaytoUri: acctInfo.payto_uri,\n };\n }\n\n async createRandomBankUser(): Promise {\n const username = \"user-\" + encodeCrock(getRandomBytes(10)).toLowerCase();\n const password = \"pw-\" + encodeCrock(getRandomBytes(10)).toLowerCase();\n return await this.registerAccount(username, password);\n }\n\n async createWithdrawalOperation(\n user: string,\n amount: string | undefined,\n ): Promise {\n const url = new URL(`accounts/${user}/withdrawals`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n amount,\n },\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(\n resp,\n codecForWithdrawalOperationInfo(),\n );\n }\n\n async confirmWithdrawalOperation(\n username: string,\n wopi: ConfirmWithdrawalArgs,\n ) {\n const url = new URL(\n `accounts/${username}/withdrawals/${wopi.withdrawalOperationId}/confirm`,\n this.baseUrl,\n );\n logger.info(`confirming withdrawal operation via ${url.href}`);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async abortWithdrawalOperation(wopi: WithdrawalOperationInfo): Promise {\n const url = new URL(\n `withdrawals/${wopi.withdrawal_id}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n await readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async abortWithdrawalOperationV2(\n username: string,\n wopi: WithdrawalOperationInfo,\n ): Promise {\n const url = new URL(\n `accounts/${username}/withdrawals/${wopi.withdrawal_id}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(resp);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Native implementation of GNU Taler crypto primitives.\n */\n\n/**\n * Imports.\n */\nimport bigint from \"big-integer\";\nimport * as fflate from \"fflate\";\nimport { AmountLike, Amounts } from \"./amounts.js\";\nimport * as argon2 from \"./argon2.js\";\nimport { canonicalJson } from \"./helpers.js\";\nimport { hmacSha256, hmacSha512 } from \"./kdf.js\";\nimport { Logger } from \"./logging.js\";\nimport * as nacl from \"./nacl-fast.js\";\nimport { secretbox } from \"./nacl-fast.js\";\nimport { TalerProtocolDuration, TalerProtocolTimestamp } from \"./time.js\";\nimport {\n CoinPublicKeyString,\n HashCodeString,\n} from \"./types-taler-common.js\";\nimport { CoinEnvelope, DenomKeyType, DenominationPubKey } from \"./types-taler-exchange.js\";\n\nexport type Flavor = T & {\n _flavor?: `taler.${FlavorT}`;\n};\n\nexport type FlavorP = T & {\n _flavor?: `taler.${FlavorT}`;\n _size?: S;\n};\n\nexport function getRandomBytes(n: number): Uint8Array {\n return nacl.randomBytes(n);\n}\n\nexport function getRandomBytesF(\n n: T,\n): FlavorP {\n return nacl.randomBytes(n);\n}\n\nexport const useNative = true;\n\n/**\n * Interface of the native Taler runtime library.\n */\ninterface NativeTartLib {\n decodeUtf8(buf: Uint8Array): string;\n decodeUtf8(str: string): Uint8Array;\n randomBytes(n: number): Uint8Array;\n encodeCrock(buf: Uint8Array | ArrayBuffer): string;\n decodeCrock(str: string): Uint8Array;\n hash(buf: Uint8Array): Uint8Array;\n hashArgon2id(\n password: Uint8Array,\n salt: Uint8Array,\n iterations: number,\n memorySize: number,\n hashLength: number,\n ): Uint8Array;\n eddsaGetPublic(buf: Uint8Array): Uint8Array;\n ecdheGetPublic(buf: Uint8Array): Uint8Array;\n eddsaSign(msg: Uint8Array, priv: Uint8Array): Uint8Array;\n eddsaVerify(msg: Uint8Array, sig: Uint8Array, pub: Uint8Array): boolean;\n kdf(\n outLen: number,\n ikm: Uint8Array,\n salt?: Uint8Array,\n info?: Uint8Array,\n ): Uint8Array;\n keyExchangeEcdhEddsa(ecdhPriv: Uint8Array, eddsaPub: Uint8Array): Uint8Array;\n keyExchangeEddsaEcdh(eddsaPriv: Uint8Array, ecdhPub: Uint8Array): Uint8Array;\n rsaBlind(hmsg: Uint8Array, bks: Uint8Array, rsaPub: Uint8Array): Uint8Array;\n rsaUnblind(\n blindSig: Uint8Array,\n rsaPub: Uint8Array,\n bks: Uint8Array,\n ): Uint8Array;\n rsaVerify(hmsg: Uint8Array, rsaSig: Uint8Array, rsaPub: Uint8Array): boolean;\n hashStateInit(): any;\n hashStateUpdate(st: any, data: Uint8Array): any;\n hashStateFinish(st: any): Uint8Array;\n}\n\n// @ts-ignore\nlet tart: NativeTartLib | undefined;\n\nif (useNative) {\n // @ts-ignore\n tart = globalThis._tart;\n}\n\nconst encTable = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nclass EncodingError extends Error {\n constructor() {\n super(\"Encoding error\");\n Object.setPrototypeOf(this, EncodingError.prototype);\n }\n}\n\nfunction getValue(chr: string): number {\n let a = chr;\n switch (chr) {\n case \"O\":\n case \"o\":\n a = \"0\";\n break;\n case \"i\":\n case \"I\":\n case \"l\":\n case \"L\":\n a = \"1\";\n break;\n case \"u\":\n case \"U\":\n a = \"V\";\n }\n\n if (a >= \"0\" && a <= \"9\") {\n return a.charCodeAt(0) - \"0\".charCodeAt(0);\n }\n\n if (a >= \"a\" && a <= \"z\") a = a.toUpperCase();\n let dec = 0;\n if (a >= \"A\" && a <= \"Z\") {\n if (\"I\" < a) dec++;\n if (\"L\" < a) dec++;\n if (\"O\" < a) dec++;\n if (\"U\" < a) dec++;\n return a.charCodeAt(0) - \"A\".charCodeAt(0) + 10 - dec;\n }\n throw new EncodingError();\n}\n\nexport function encodeCrock(data: ArrayBuffer): string {\n if (tart) {\n return tart.encodeCrock(data);\n }\n const dataBytes = new Uint8Array(data);\n let sb = \"\";\n const size = data.byteLength;\n let bitBuf = 0;\n let numBits = 0;\n let pos = 0;\n while (pos < size || numBits > 0) {\n if (pos < size && numBits < 5) {\n const d = dataBytes[pos++];\n bitBuf = (bitBuf << 8) | d;\n numBits += 8;\n }\n if (numBits < 5) {\n // zero-padding\n bitBuf = bitBuf << (5 - numBits);\n numBits = 5;\n }\n const v = (bitBuf >>> (numBits - 5)) & 31;\n sb += encTable[v];\n numBits -= 5;\n }\n return sb;\n}\n\nexport function kdf(\n outputLength: number,\n ikm: Uint8Array,\n salt?: Uint8Array,\n info?: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.kdf(outputLength, ikm, salt, info);\n }\n salt = salt ?? new Uint8Array(64);\n // extract\n const prk = hmacSha512(salt, ikm);\n\n info = info ?? new Uint8Array(0);\n\n // expand\n const N = Math.ceil(outputLength / 32);\n const output = new Uint8Array(N * 32);\n for (let i = 0; i < N; i++) {\n let buf;\n if (i == 0) {\n buf = new Uint8Array(info.byteLength + 1);\n buf.set(info, 0);\n } else {\n buf = new Uint8Array(info.byteLength + 1 + 32);\n for (let j = 0; j < 32; j++) {\n buf[j] = output[(i - 1) * 32 + j];\n }\n buf.set(info, 32);\n }\n buf[buf.length - 1] = i + 1;\n const chunk = hmacSha256(prk, buf);\n output.set(chunk, i * 32);\n }\n\n return output.slice(0, outputLength);\n}\n\n/**\n * HMAC-SHA512-SHA256 (see RFC 5869).\n */\nexport function kdfKw(args: {\n outputLength: number;\n ikm: Uint8Array;\n salt?: Uint8Array;\n info?: Uint8Array;\n}) {\n return kdf(args.outputLength, args.ikm, args.salt, args.info);\n}\n\nexport function decodeCrock(encoded: string): Uint8Array {\n if (tart) {\n return tart.decodeCrock(encoded);\n }\n const size = encoded.length;\n let bitpos = 0;\n let bitbuf = 0;\n let readPosition = 0;\n const outLen = Math.floor((size * 5) / 8);\n const out = new Uint8Array(outLen);\n let outPos = 0;\n\n while (readPosition < size || bitpos > 0) {\n if (readPosition < size) {\n const v = getValue(encoded[readPosition++]);\n bitbuf = (bitbuf << 5) | v;\n bitpos += 5;\n }\n while (bitpos >= 8) {\n const d = (bitbuf >>> (bitpos - 8)) & 0xff;\n out[outPos++] = d;\n bitpos -= 8;\n }\n if (readPosition == size && bitpos > 0) {\n bitbuf = (bitbuf << (8 - bitpos)) & 0xff;\n bitpos = bitbuf == 0 ? 0 : 8;\n }\n }\n return out;\n}\n\nexport async function hashArgon2id(\n password: Uint8Array,\n salt: Uint8Array,\n iterations: number,\n memorySize: number,\n hashLength: number,\n): Promise {\n if (tart) {\n return tart.hashArgon2id(\n password,\n salt,\n iterations,\n memorySize,\n hashLength,\n );\n }\n return await argon2.hashArgon2id(\n password,\n salt,\n iterations,\n memorySize,\n hashLength,\n );\n}\n\nexport function eddsaGetPublic(eddsaPriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.eddsaGetPublic(eddsaPriv);\n }\n const pair = nacl.crypto_sign_keyPair_fromSeed(eddsaPriv);\n return pair.publicKey;\n}\n\nexport function ecdhGetPublic(ecdhePriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.ecdheGetPublic(ecdhePriv);\n }\n return nacl.scalarMult_base(ecdhePriv);\n}\n\nexport function keyExchangeEddsaEcdh(\n eddsaPriv: Uint8Array,\n ecdhPub: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.keyExchangeEddsaEcdh(eddsaPriv, ecdhPub);\n }\n const ph = hash(eddsaPriv);\n const a = new Uint8Array(32);\n for (let i = 0; i < 32; i++) {\n a[i] = ph[i];\n }\n const x = nacl.scalarMult(a, ecdhPub);\n return hash(x);\n}\n\nexport function keyExchangeEcdhEddsa(\n ecdhPriv: Uint8Array & MaterialEcdhePriv,\n eddsaPub: Uint8Array & MaterialEddsaPub,\n): Uint8Array {\n if (tart) {\n return tart.keyExchangeEcdhEddsa(ecdhPriv, eddsaPub);\n }\n const curve25519Pub = nacl.sign_ed25519_pk_to_curve25519(eddsaPub);\n const x = nacl.scalarMult(ecdhPriv, curve25519Pub);\n return hash(x);\n}\n\ninterface RsaPub {\n N: bigint.BigInteger;\n e: bigint.BigInteger;\n}\n\n/**\n * KDF modulo a big integer.\n */\nfunction kdfMod(\n n: bigint.BigInteger,\n ikm: Uint8Array,\n salt: Uint8Array,\n info: Uint8Array,\n): bigint.BigInteger {\n const nbits = n.bitLength().toJSNumber();\n const buflen = Math.floor((nbits - 1) / 8 + 1);\n const mask = (1 << (8 - (buflen * 8 - nbits))) - 1;\n let counter = 0;\n while (true) {\n const ctx = new Uint8Array(info.byteLength + 2);\n ctx.set(info, 0);\n ctx[ctx.length - 2] = (counter >>> 8) & 0xff;\n ctx[ctx.length - 1] = counter & 0xff;\n const buf = kdf(buflen, ikm, salt, ctx);\n const arr = Array.from(buf);\n arr[0] = arr[0] & mask;\n const r = bigint.fromArray(arr, 256, false);\n if (r.lt(n)) {\n return r;\n }\n counter++;\n }\n}\n\nfunction csKdfMod(\n n: bigint.BigInteger,\n ikm: Uint8Array,\n salt: Uint8Array,\n info: Uint8Array,\n): Uint8Array {\n const nbits = n.bitLength().toJSNumber();\n const buflen = Math.floor((nbits - 1) / 8 + 1);\n const mask = (1 << (8 - (buflen * 8 - nbits))) - 1;\n let counter = 0;\n while (true) {\n const ctx = new Uint8Array(info.byteLength + 2);\n ctx.set(info, 0);\n ctx[ctx.length - 2] = (counter >>> 8) & 0xff;\n ctx[ctx.length - 1] = counter & 0xff;\n const buf = kdf(buflen, ikm, salt, ctx);\n const arr = Array.from(buf);\n arr[0] = arr[0] & mask;\n const r = bigint.fromArray(arr, 256, false);\n if (r.lt(n)) {\n return new Uint8Array(arr);\n }\n counter++;\n }\n}\n\n// Newer versions of node have TextEncoder and TextDecoder as a global,\n// just like modern browsers.\n// In older versions of node or environments that do not have these\n// globals, they must be polyfilled (by adding them to global/globalThis)\n// before stringToBytes or bytesToString is called the first time.\n\nlet encoder: any;\nlet decoder: any;\n\nexport function stringToBytes(s: string): Uint8Array {\n if (!encoder) {\n encoder = new TextEncoder();\n }\n return encoder.encode(s);\n}\n\nexport function bytesToString(b: Uint8Array): string {\n if (!decoder) {\n decoder = new TextDecoder();\n }\n return decoder.decode(b);\n}\n\nfunction loadBigInt(arr: Uint8Array): bigint.BigInteger {\n return bigint.fromArray(Array.from(arr), 256, false);\n}\n\nfunction rsaBlindingKeyDerive(\n rsaPub: RsaPub,\n bks: Uint8Array,\n): bigint.BigInteger {\n const salt = stringToBytes(\"Blinding KDF extractor HMAC key\");\n const info = stringToBytes(\"Blinding KDF\");\n return kdfMod(rsaPub.N, bks, salt, info);\n}\n\n/*\n * Test for malicious RSA key.\n *\n * Assuming n is an RSA modulous and r is generated using a call to\n * GNUNET_CRYPTO_kdf_mod_mpi, if gcd(r,n) != 1 then n must be a\n * malicious RSA key designed to deanomize the user.\n *\n * @param r KDF result\n * @param n RSA modulus of the public key\n */\nfunction rsaGcdValidate(r: bigint.BigInteger, n: bigint.BigInteger): void {\n const t = bigint.gcd(r, n);\n if (!t.equals(bigint.one)) {\n throw Error(\"malicious RSA public key\");\n }\n}\n\nfunction rsaFullDomainHash(hm: Uint8Array, rsaPub: RsaPub): bigint.BigInteger {\n const info = stringToBytes(\"RSA-FDA FTpsW!\");\n const salt = rsaPubEncode(rsaPub);\n const r = kdfMod(rsaPub.N, hm, salt, info);\n rsaGcdValidate(r, rsaPub.N);\n return r;\n}\n\nfunction rsaPubDecode(rsaPub: Uint8Array): RsaPub {\n const modulusLength = (rsaPub[0] << 8) | rsaPub[1];\n const exponentLength = (rsaPub[2] << 8) | rsaPub[3];\n if (4 + exponentLength + modulusLength != rsaPub.length) {\n throw Error(\"invalid RSA public key (format wrong)\");\n }\n const modulus = rsaPub.slice(4, 4 + modulusLength);\n const exponent = rsaPub.slice(\n 4 + modulusLength,\n 4 + modulusLength + exponentLength,\n );\n const res = {\n N: loadBigInt(modulus),\n e: loadBigInt(exponent),\n };\n return res;\n}\n\nfunction rsaPubEncode(rsaPub: RsaPub): Uint8Array {\n const mb = rsaPub.N.toArray(256).value;\n const eb = rsaPub.e.toArray(256).value;\n const out = new Uint8Array(4 + mb.length + eb.length);\n out[0] = (mb.length >>> 8) & 0xff;\n out[1] = mb.length & 0xff;\n out[2] = (eb.length >>> 8) & 0xff;\n out[3] = eb.length & 0xff;\n out.set(mb, 4);\n out.set(eb, 4 + mb.length);\n return out;\n}\n\nexport function rsaBlind(\n hm: Uint8Array,\n bks: Uint8Array,\n rsaPubEnc: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.rsaBlind(hm, bks, rsaPubEnc);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const data = rsaFullDomainHash(hm, rsaPub);\n const r = rsaBlindingKeyDerive(rsaPub, bks);\n const r_e = r.modPow(rsaPub.e, rsaPub.N);\n const bm = r_e.multiply(data).mod(rsaPub.N);\n return new Uint8Array(bm.toArray(256).value);\n}\n\nexport function rsaUnblind(\n sig: Uint8Array,\n rsaPubEnc: Uint8Array,\n bks: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.rsaUnblind(sig, rsaPubEnc, bks);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const blinded_s = loadBigInt(sig);\n const r = rsaBlindingKeyDerive(rsaPub, bks);\n const r_inv = r.modInv(rsaPub.N);\n const s = blinded_s.multiply(r_inv).mod(rsaPub.N);\n return new Uint8Array(s.toArray(256).value);\n}\n\nexport function rsaVerify(\n hm: Uint8Array,\n rsaSig: Uint8Array,\n rsaPubEnc: Uint8Array,\n): boolean {\n if (tart) {\n return tart.rsaVerify(hm, rsaSig, rsaPubEnc);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const d = rsaFullDomainHash(hm, rsaPub);\n const sig = loadBigInt(rsaSig);\n const sig_e = sig.modPow(rsaPub.e, rsaPub.N);\n return sig_e.equals(d);\n}\n\nexport type CsSignature = {\n s: Uint8Array;\n rPub: Uint8Array;\n};\n\nexport type CsBlindSignature = {\n sBlind: Uint8Array;\n rPubBlind: Uint8Array;\n};\n\nexport type CsBlindingSecrets = {\n alpha: [Uint8Array, Uint8Array];\n beta: [Uint8Array, Uint8Array];\n};\n\nexport function typedArrayConcat(chunks: Uint8Array[]): Uint8Array {\n let payloadLen = 0;\n for (const c of chunks) {\n payloadLen += c.byteLength;\n }\n const buf = new ArrayBuffer(payloadLen);\n const u8buf = new Uint8Array(buf);\n let p = 0;\n for (const c of chunks) {\n u8buf.set(c, p);\n p += c.byteLength;\n }\n return u8buf;\n}\n\n/**\n * Map to scalar subgroup function\n * perform clamping as described in RFC7748\n * @param scalar\n */\nfunction mtoSS(scalar: Uint8Array): Uint8Array {\n scalar[0] &= 248;\n scalar[31] &= 127;\n scalar[31] |= 64;\n return scalar;\n}\n\n/**\n * The function returns the CS blinding secrets from a seed\n * @param bseed seed to derive blinding secrets\n * @returns blinding secrets\n */\nexport function deriveSecrets(bseed: Uint8Array): CsBlindingSecrets {\n const outLen = 130;\n const salt = stringToBytes(\"alphabeta\");\n const rndout = kdf(outLen, bseed, salt);\n const secrets: CsBlindingSecrets = {\n alpha: [mtoSS(rndout.slice(0, 32)), mtoSS(rndout.slice(64, 96))],\n beta: [mtoSS(rndout.slice(32, 64)), mtoSS(rndout.slice(96, 128))],\n };\n return secrets;\n}\n\n/**\n * calculation of the blinded public point R in CS\n * @param csPub denomination publik key\n * @param secrets client blinding secrets\n * @param rPub public R received from /csr API\n */\nexport async function calcRBlind(\n csPub: Uint8Array,\n secrets: CsBlindingSecrets,\n rPub: [Uint8Array, Uint8Array],\n): Promise<[Uint8Array, Uint8Array]> {\n const aG0 = nacl.crypto_scalarmult_ed25519_base_noclamp(secrets.alpha[0]);\n const aG1 = nacl.crypto_scalarmult_ed25519_base_noclamp(secrets.alpha[1]);\n\n const bDp0 = nacl.crypto_scalarmult_ed25519_noclamp(secrets.beta[0], csPub);\n const bDp1 = nacl.crypto_scalarmult_ed25519_noclamp(secrets.beta[1], csPub);\n\n const res0 = nacl.crypto_core_ed25519_add(aG0, bDp0);\n const res1 = nacl.crypto_core_ed25519_add(aG1, bDp1);\n return [\n nacl.crypto_core_ed25519_add(rPub[0], res0),\n nacl.crypto_core_ed25519_add(rPub[1], res1),\n ];\n}\n\n/**\n * FDH function used in CS\n * @param hm message hash\n * @param rPub public R included in FDH\n * @param csPub denomination public key as context\n * @returns mapped Curve25519 scalar\n */\nfunction csFDH(\n hm: Uint8Array,\n rPub: Uint8Array,\n csPub: Uint8Array,\n): Uint8Array {\n const lMod = Array.from(\n new Uint8Array([\n 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x14, 0xde, 0xf9, 0xde, 0xa2, 0xf7, 0x9c, 0xd6,\n 0x58, 0x12, 0x63, 0x1a, 0x5c, 0xf5, 0xd3, 0xed,\n ]),\n );\n const L = bigint.fromArray(lMod, 256, false);\n\n const info = stringToBytes(\"Curve25519FDH\");\n const preshash = hash(typedArrayConcat([rPub, hm]));\n return csKdfMod(L, preshash, csPub, info).reverse();\n}\n\n/**\n * blinding seed derived from coin private key\n * @param coinPriv private key of the corresponding coin\n * @param rPub public R received from /csr API\n * @returns blinding seed\n */\nexport function deriveBSeed(\n coinPriv: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n): Uint8Array {\n const outLen = 32;\n const salt = stringToBytes(\"b-seed\");\n const ikm = typedArrayConcat([coinPriv, rPub[0], rPub[1]]);\n return kdf(outLen, ikm, salt);\n}\n\n/**\n * Derive withdraw nonce, used in /csr request\n * Note: In withdraw protocol, the nonce is chosen randomly\n * @param coinPriv coin private key\n * @returns nonce\n */\nexport function deriveWithdrawNonce(coinPriv: Uint8Array): Uint8Array {\n const outLen = 32;\n const salt = stringToBytes(\"n\");\n return kdf(outLen, coinPriv, salt);\n}\n\n/**\n * Blind operation for CS signatures, used after /csr call\n * @param bseed blinding seed to derive blinding secrets\n * @param rPub public R received from /csr\n * @param csPub denomination public key\n * @param hm message to blind\n * @returns two blinded c\n */\nexport async function csBlind(\n bseed: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n csPub: Uint8Array,\n hm: Uint8Array,\n): Promise<[Uint8Array, Uint8Array]> {\n const secrets = deriveSecrets(bseed);\n const rPubBlind = await calcRBlind(csPub, secrets, rPub);\n const c_0 = csFDH(hm, rPubBlind[0], csPub);\n const c_1 = csFDH(hm, rPubBlind[1], csPub);\n return [\n nacl.crypto_core_ed25519_scalar_add(c_0, secrets.beta[0]),\n nacl.crypto_core_ed25519_scalar_add(c_1, secrets.beta[1]),\n ];\n}\n\n/**\n * Unblind operation to unblind the signature\n * @param bseed seed to derive secrets\n * @param rPub public R received from /csr\n * @param csPub denomination public key\n * @param b returned from exchange to select c\n * @param csSig blinded signature\n * @returns unblinded signature\n */\nexport async function csUnblind(\n bseed: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n csPub: Uint8Array,\n b: number,\n csSig: CsBlindSignature,\n): Promise {\n if (b != 0 && b != 1) {\n throw new Error();\n }\n const secrets = deriveSecrets(bseed);\n const rPubDash = (await calcRBlind(csPub, secrets, rPub))[b];\n const sig: CsSignature = {\n s: nacl.crypto_core_ed25519_scalar_add(csSig.sBlind, secrets.alpha[b]),\n rPub: rPubDash,\n };\n return sig;\n}\n\n/**\n * Verification algorithm for CS signatures\n * @param hm message signed\n * @param csSig unblinded signature\n * @param csPub denomination public key\n * @returns true if valid, false if invalid\n */\nexport async function csVerify(\n hm: Uint8Array,\n csSig: CsSignature,\n csPub: Uint8Array,\n): Promise {\n const cDash = csFDH(hm, csSig.rPub, csPub);\n const sG = nacl.crypto_scalarmult_ed25519_base_noclamp(csSig.s);\n const cbDp = nacl.crypto_scalarmult_ed25519_noclamp(cDash, csPub);\n const sGeq = nacl.crypto_core_ed25519_add(csSig.rPub, cbDp);\n return nacl.verify(sG, sGeq);\n}\n\nexport interface EddsaKeyPair {\n eddsaPub: Uint8Array;\n eddsaPriv: Uint8Array;\n}\n\nexport interface EcdheKeyPair {\n ecdhePub: Uint8Array;\n ecdhePriv: Uint8Array;\n}\n\nexport interface Edx25519Keypair {\n edxPub: string;\n edxPriv: string;\n}\n\nexport function createEddsaKeyPair(): EddsaKeyPair {\n const eddsaPriv = nacl.randomBytes(32);\n const eddsaPub = eddsaGetPublic(eddsaPriv);\n return { eddsaPriv, eddsaPub };\n}\n\nexport function createEcdheKeyPair(): EcdheKeyPair {\n const ecdhePriv = nacl.randomBytes(32);\n const ecdhePub = ecdhGetPublic(ecdhePriv);\n return { ecdhePriv, ecdhePub };\n}\n\nexport function hash(d: Uint8Array): Uint8Array {\n if (tart) {\n return tart.hash(d);\n }\n return nacl.hash(d);\n}\n\n/**\n * Hash the input with SHA-512 and truncate the result\n * to 32 bytes.\n */\nexport function hashTruncate32(d: Uint8Array): Uint8Array {\n const sha512HashCode = hash(d);\n return sha512HashCode.subarray(0, 32);\n}\n\nexport function hashCoinEv(\n coinEv: CoinEnvelope,\n denomPubHash: HashCodeString,\n): Uint8Array {\n const hashContext = createHashContext();\n hashContext.update(decodeCrock(denomPubHash));\n hashCoinEvInner(coinEv, hashContext);\n return hashContext.finish();\n}\n\nconst logger = new Logger(\"talerCrypto.ts\");\n\nexport function hashCoinEvInner(\n coinEv: CoinEnvelope,\n hashState: TalerHashState,\n): void {\n const hashInputBuf = new ArrayBuffer(4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, DenomKeyType.toIntTag(coinEv.cipher));\n hashState.update(uint8ArrayBuf);\n switch (coinEv.cipher) {\n case DenomKeyType.Rsa:\n hashState.update(decodeCrock(coinEv.rsa_blinded_planchet));\n return;\n default:\n throw new Error();\n }\n}\n\nexport function hashCoinPub(\n coinPub: CoinPublicKeyString,\n ach?: HashCodeString,\n): Uint8Array {\n if (!ach) {\n return hash(decodeCrock(coinPub));\n }\n\n return hash(typedArrayConcat([decodeCrock(coinPub), decodeCrock(ach)]));\n}\n\n/**\n * Hash a denomination public key.\n */\nexport function hashDenomPub(pub: DenominationPubKey): Uint8Array {\n if (pub.cipher === DenomKeyType.Rsa) {\n const pubBuf = decodeCrock(pub.rsa_public_key);\n const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, pub.age_mask ?? 0);\n dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));\n uint8ArrayBuf.set(pubBuf, 8);\n return hash(uint8ArrayBuf);\n } else if (pub.cipher === DenomKeyType.ClauseSchnorr) {\n const pubBuf = decodeCrock(pub.cs_public_key);\n const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, pub.age_mask ?? 0);\n dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));\n uint8ArrayBuf.set(pubBuf, 8);\n return hash(uint8ArrayBuf);\n } else {\n throw Error(\n `unsupported cipher (${\n (pub as DenominationPubKey).cipher\n }), unable to hash`,\n );\n }\n}\n\nexport function eddsaSign(msg: Uint8Array, eddsaPriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.eddsaSign(msg, eddsaPriv);\n }\n const pair = nacl.crypto_sign_keyPair_fromSeed(eddsaPriv);\n return nacl.sign_detached(msg, pair.secretKey);\n}\n\nexport function eddsaVerify(\n msg: Uint8Array,\n sig: Uint8Array,\n eddsaPub: Uint8Array,\n): boolean {\n if (tart) {\n return tart.eddsaVerify(msg, sig, eddsaPub);\n }\n return nacl.sign_detached_verify(msg, sig, eddsaPub);\n}\n\nexport interface TalerHashState {\n update(data: Uint8Array): void;\n finish(): Uint8Array;\n}\n\nexport function createHashContext(): TalerHashState {\n if (tart) {\n const t = tart;\n const st = tart.hashStateInit();\n return {\n finish: () => t.hashStateFinish(st),\n update: (d) => t.hashStateUpdate(st, d),\n };\n }\n return new nacl.HashState();\n}\n\nexport interface FreshCoin {\n coinPub: Uint8Array;\n coinPriv: Uint8Array;\n bks: Uint8Array;\n maxAge: number;\n ageCommitmentProof: AgeCommitmentProof | undefined;\n}\n\nexport function bufferForUint32(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(4);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n dv.setUint32(0, n);\n return buf;\n}\n\n/**\n * This makes the assumption that the uint64 fits a float,\n * which should be true for all Taler protocol messages.\n */\nexport function bufferForUint64(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(8);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n if (n < 0 || !Number.isInteger(n)) {\n throw Error(\"non-negative integer expected\");\n }\n dv.setBigUint64(0, BigInt(n));\n return buf;\n}\n\nexport function bufferForUint8(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(1);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n dv.setUint8(0, n);\n return buf;\n}\n\nexport async function setupTipPlanchet(\n secretSeed: Uint8Array,\n denomPub: DenominationPubKey,\n coinNumber: number,\n): Promise {\n const info = stringToBytes(\"taler-tip-coin-derivation\");\n const saltArrBuf = new ArrayBuffer(4);\n const salt = new Uint8Array(saltArrBuf);\n const saltDataView = new DataView(saltArrBuf);\n saltDataView.setUint32(0, coinNumber);\n const out = kdf(64, secretSeed, salt, info);\n const coinPriv = out.slice(0, 32);\n const bks = out.slice(32, 64);\n let maybeAcp: AgeCommitmentProof | undefined;\n if (denomPub.age_mask != 0) {\n maybeAcp = await AgeRestriction.restrictionCommitSeeded(\n denomPub.age_mask,\n AgeRestriction.AGE_UNRESTRICTED,\n secretSeed,\n );\n }\n return {\n bks,\n coinPriv,\n coinPub: eddsaGetPublic(coinPriv),\n maxAge: AgeRestriction.AGE_UNRESTRICTED,\n ageCommitmentProof: maybeAcp,\n };\n}\n/**\n *\n * @param paytoUri\n * @param salt 16-byte salt\n * @returns\n */\nexport function hashWire(paytoUri: string, salt: string): string {\n const r = kdf(\n 64,\n stringToBytes(paytoUri + \"\\0\"),\n decodeCrock(salt),\n stringToBytes(\"merchant-wire-signature\"),\n );\n return encodeCrock(r);\n}\n\nexport enum TalerSignaturePurpose {\n MERCHANT_TRACK_TRANSACTION = 1103,\n WALLET_RESERVE_WITHDRAW = 1200,\n WALLET_RESERVE_HISTORY = 1208,\n WALLET_COIN_DEPOSIT = 1201,\n GLOBAL_FEES = 1022,\n MASTER_DENOMINATION_KEY_VALIDITY = 1025,\n MASTER_WIRE_FEES = 1028,\n MASTER_WIRE_DETAILS = 1030,\n WALLET_COIN_MELT = 1202,\n TEST = 4242,\n MERCHANT_PAYMENT_OK = 1104,\n MERCHANT_CONTRACT = 1101,\n MERCHANT_REFUND = 1102,\n WALLET_COIN_RECOUP = 1203,\n WALLET_COIN_LINK = 1204,\n WALLET_COIN_RECOUP_REFRESH = 1206,\n WALLET_AGE_ATTESTATION = 1207,\n WALLET_PURSE_CREATE = 1210,\n WALLET_PURSE_DEPOSIT = 1211,\n WALLET_PURSE_MERGE = 1213,\n WALLET_ACCOUNT_MERGE = 1214,\n WALLET_PURSE_ECONTRACT = 1216,\n WALLET_PURSE_DELETE = 1220,\n WALLET_COIN_HISTORY = 1209,\n EXCHANGE_CONFIRM_RECOUP = 1039,\n EXCHANGE_CONFIRM_RECOUP_REFRESH = 1041,\n TALER_SIGNATURE_AML_DECISION = 1350,\n TALER_SIGNATURE_AML_QUERY = 1351,\n TALER_SIGNATURE_MASTER_AML_KEY = 1017,\n ANASTASIS_POLICY_UPLOAD = 1400,\n ANASTASIS_POLICY_DOWNLOAD = 1401,\n SYNC_BACKUP_UPLOAD = 1450,\n}\n\nexport enum WalletAccountMergeFlags {\n /**\n * Not a legal mode!\n */\n None = 0,\n\n /**\n * We are merging a fully paid-up purse into a reserve.\n */\n MergeFullyPaidPurse = 1,\n\n CreateFromPurseQuota = 2,\n\n CreateWithPurseFee = 3,\n}\n\nexport class SignaturePurposeBuilder {\n private chunks: Uint8Array[] = [];\n\n constructor(private purposeNum: number) {}\n\n put(bytes: Uint8Array): SignaturePurposeBuilder {\n this.chunks.push(Uint8Array.from(bytes));\n return this;\n }\n\n build(): Uint8Array {\n let payloadLen = 0;\n for (const c of this.chunks) {\n payloadLen += c.byteLength;\n }\n const buf = new ArrayBuffer(4 + 4 + payloadLen);\n const u8buf = new Uint8Array(buf);\n let p = 8;\n for (const c of this.chunks) {\n u8buf.set(c, p);\n p += c.byteLength;\n }\n const dvbuf = new DataView(buf);\n dvbuf.setUint32(0, payloadLen + 4 + 4);\n dvbuf.setUint32(4, this.purposeNum);\n return u8buf;\n }\n}\n\nexport function buildSigPS(purposeNum: number): SignaturePurposeBuilder {\n return new SignaturePurposeBuilder(purposeNum);\n}\n\nexport type OpaqueData = Flavor;\nexport type Edx25519PublicKey = FlavorP;\nexport type Edx25519PrivateKey = FlavorP;\nexport type Edx25519Signature = FlavorP;\n\nexport type Edx25519PublicKeyEnc = FlavorP;\nexport type Edx25519PrivateKeyEnc = FlavorP<\n string,\n \"Edx25519PrivateKeyEnc\",\n 64\n>;\n\n/**\n * Convert a big integer to a fixed-size, little-endian array.\n */\nexport function bigintToNaclArr(\n x: bigint.BigInteger,\n size: number,\n): Uint8Array {\n const byteArr = new Uint8Array(size);\n const arr = x.toArray(256).value.reverse();\n byteArr.set(arr, 0);\n return byteArr;\n}\n\nexport function bigintFromNaclArr(arr: Uint8Array): bigint.BigInteger {\n let rev = new Uint8Array(arr);\n rev = rev.reverse();\n return bigint.fromArray(Array.from(rev), 256, false);\n}\n\nexport namespace Edx25519 {\n const revL = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2,\n 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,\n ];\n\n const L = bigint.fromArray(revL.reverse(), 256, false);\n\n export async function keyCreateFromSeed(\n seed: OpaqueData,\n ): Promise {\n return nacl.crypto_edx25519_private_key_create_from_seed(seed);\n }\n\n export async function keyCreate(): Promise {\n return nacl.crypto_edx25519_private_key_create();\n }\n\n export async function getPublic(\n priv: Edx25519PrivateKey,\n ): Promise {\n return nacl.crypto_edx25519_get_public(priv);\n }\n\n export function sign(\n msg: OpaqueData,\n key: Edx25519PrivateKey,\n ): Promise {\n throw Error(\"not implemented\");\n }\n\n async function deriveFactor(\n pub: Edx25519PublicKey,\n seed: OpaqueData,\n ): Promise {\n const res = kdfKw({\n outputLength: 64,\n salt: seed,\n ikm: pub,\n info: stringToBytes(\"edx25519-derivation\"),\n });\n\n return res;\n }\n\n export async function privateKeyDerive(\n priv: Edx25519PrivateKey,\n seed: OpaqueData,\n ): Promise {\n const pub = await getPublic(priv);\n const privDec = priv;\n const a = bigintFromNaclArr(privDec.subarray(0, 32));\n const factorEnc = await deriveFactor(pub, seed);\n const factorModL = bigintFromNaclArr(factorEnc).mod(L);\n\n const aPrime = a.divide(8).multiply(factorModL).mod(L).multiply(8).mod(L);\n const bPrime = nacl\n .hash(typedArrayConcat([privDec.subarray(32, 64), factorEnc]))\n .subarray(0, 32);\n\n const newPriv = typedArrayConcat([bigintToNaclArr(aPrime, 32), bPrime]);\n\n return newPriv;\n }\n\n export async function publicKeyDerive(\n pub: Edx25519PublicKey,\n seed: OpaqueData,\n ): Promise {\n const factorEnc = await deriveFactor(pub, seed);\n const factorReduced = nacl.crypto_core_ed25519_scalar_reduce(factorEnc);\n const res = nacl.crypto_scalarmult_ed25519_noclamp(factorReduced, pub);\n return res;\n }\n}\n\nexport interface AgeCommitment {\n mask: number;\n\n /**\n * Public keys, one for each age group specified in the age mask.\n */\n publicKeys: Edx25519PublicKeyEnc[];\n}\n\nexport interface AgeProof {\n /**\n * Private keys. Typically smaller than the number of public keys,\n * because we drop private keys from age groups that are restricted.\n */\n privateKeys: Edx25519PrivateKeyEnc[];\n}\n\nexport interface AgeCommitmentProof {\n commitment: AgeCommitment;\n proof: AgeProof;\n}\n\nfunction invariant(cond: boolean): asserts cond {\n if (!cond) {\n throw Error(\"invariant failed\");\n }\n}\n\nexport namespace AgeRestriction {\n /**\n * Smallest age value that the protocol considers \"unrestricted\".\n */\n export const AGE_UNRESTRICTED = 32;\n\n export function hashCommitment(ac: AgeCommitment): HashCodeString {\n const hc = new nacl.HashState();\n for (const pub of ac.publicKeys) {\n hc.update(decodeCrock(pub));\n }\n return encodeCrock(hc.finish().subarray(0, 32));\n }\n\n export function countAgeGroups(mask: number): number {\n let count = 0;\n let m = mask;\n while (m > 0) {\n count += m & 1;\n m = m >> 1;\n }\n return count;\n }\n\n /**\n * Get the starting points for age groups in the mask.\n */\n export function getAgeGroupsFromMask(mask: number): number[] {\n const groups: number[] = [];\n let age = 1;\n let m = mask >> 1;\n while (m > 0) {\n if (m & 1) {\n groups.push(age);\n }\n m = m >> 1;\n age++;\n }\n return groups;\n }\n\n export function getAgeGroupIndex(mask: number, age: number): number {\n invariant((mask & 1) === 1);\n let i = 0;\n let m = mask;\n let a = age;\n while (m > 0) {\n if (a <= 0) {\n break;\n }\n m = m >> 1;\n i += m & 1;\n a--;\n }\n return i;\n }\n\n export function ageGroupSpecToMask(ageGroupSpec: string): number {\n throw Error(\"not implemented\");\n }\n\n export async function restrictionCommit(\n ageMask: number,\n age: number,\n ): Promise {\n invariant((ageMask & 1) === 1);\n const numPubs = countAgeGroups(ageMask) - 1;\n const numPrivs = getAgeGroupIndex(ageMask, age);\n\n const pubs: Edx25519PublicKey[] = [];\n const privs: Edx25519PrivateKey[] = [];\n\n for (let i = 0; i < numPubs; i++) {\n const priv = await Edx25519.keyCreate();\n const pub = await Edx25519.getPublic(priv);\n pubs.push(pub);\n if (i < numPrivs) {\n privs.push(priv);\n }\n }\n\n return {\n commitment: {\n mask: ageMask,\n publicKeys: pubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: privs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n const PublishedAgeRestrictionBaseKey: Edx25519PublicKey = decodeCrock(\n \"CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG\",\n );\n\n export async function restrictionCommitSeeded(\n ageMask: number,\n age: number,\n seed: Uint8Array,\n ): Promise {\n invariant((ageMask & 1) === 1);\n const numPubs = countAgeGroups(ageMask) - 1;\n const numPrivs = getAgeGroupIndex(ageMask, age);\n\n const pubs: Edx25519PublicKey[] = [];\n const privs: Edx25519PrivateKey[] = [];\n\n for (let i = 0; i < numPrivs; i++) {\n const privSeed = await kdfKw({\n outputLength: 32,\n ikm: seed,\n info: stringToBytes(\"age-commitment\"),\n salt: bufferForUint32(i),\n });\n\n const priv = await Edx25519.keyCreateFromSeed(privSeed);\n const pub = await Edx25519.getPublic(priv);\n pubs.push(pub);\n privs.push(priv);\n }\n\n for (let i = numPrivs; i < numPubs; i++) {\n const deriveSeed = await kdfKw({\n outputLength: 32,\n ikm: seed,\n info: stringToBytes(\"age-factor\"),\n salt: bufferForUint32(i),\n });\n const pub = await Edx25519.publicKeyDerive(\n PublishedAgeRestrictionBaseKey,\n deriveSeed,\n );\n pubs.push(pub);\n }\n\n return {\n commitment: {\n mask: ageMask,\n publicKeys: pubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: privs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n /**\n * Check that c1 = c2*salt\n */\n export async function commitCompare(\n c1: AgeCommitment,\n c2: AgeCommitment,\n salt: OpaqueData,\n ): Promise {\n if (c1.publicKeys.length != c2.publicKeys.length) {\n return false;\n }\n for (let i = 0; i < c1.publicKeys.length; i++) {\n const k1 = decodeCrock(c1.publicKeys[i]);\n const k2 = await Edx25519.publicKeyDerive(\n decodeCrock(c2.publicKeys[i]),\n salt,\n );\n if (k1 != k2) {\n return false;\n }\n }\n return true;\n }\n\n export async function commitmentDerive(\n commitmentProof: AgeCommitmentProof,\n salt: OpaqueData,\n ): Promise {\n const newPrivs: Edx25519PrivateKey[] = [];\n const newPubs: Edx25519PublicKey[] = [];\n\n for (const oldPub of commitmentProof.commitment.publicKeys) {\n newPubs.push(await Edx25519.publicKeyDerive(decodeCrock(oldPub), salt));\n }\n\n for (const oldPriv of commitmentProof.proof.privateKeys) {\n newPrivs.push(\n await Edx25519.privateKeyDerive(decodeCrock(oldPriv), salt),\n );\n }\n\n return {\n commitment: {\n mask: commitmentProof.commitment.mask,\n publicKeys: newPubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: newPrivs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n export function commitmentAttest(\n commitmentProof: AgeCommitmentProof,\n age: number,\n ): Edx25519Signature {\n const d = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION)\n .put(bufferForUint32(commitmentProof.commitment.mask))\n .put(bufferForUint32(age))\n .build();\n const group = getAgeGroupIndex(commitmentProof.commitment.mask, age);\n if (group === 0) {\n // No attestation required.\n return new Uint8Array(64);\n }\n const priv = commitmentProof.proof.privateKeys[group - 1];\n const pub = commitmentProof.commitment.publicKeys[group - 1];\n const sig = nacl.crypto_edx25519_sign_detached(\n d,\n decodeCrock(priv),\n decodeCrock(pub),\n );\n return sig;\n }\n\n export function commitmentVerify(\n commitment: AgeCommitment,\n sig: string,\n age: number,\n ): boolean {\n const d = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION)\n .put(bufferForUint32(commitment.mask))\n .put(bufferForUint32(age))\n .build();\n const group = getAgeGroupIndex(commitment.mask, age);\n if (group === 0) {\n // No attestation required.\n return true;\n }\n const pub = commitment.publicKeys[group - 1];\n return nacl.crypto_edx25519_sign_detached_verify(\n d,\n decodeCrock(sig),\n decodeCrock(pub),\n );\n }\n}\n\n// FIXME: make it a branded type!\nexport type EncryptionNonce = FlavorP;\n\nasync function deriveKey(\n keySeed: OpaqueData,\n nonce: EncryptionNonce,\n salt: string,\n): Promise {\n return kdfKw({\n outputLength: 32,\n salt: nonce,\n ikm: keySeed,\n info: stringToBytes(salt),\n });\n}\n\nexport async function encryptWithDerivedKey(\n nonce: EncryptionNonce,\n keySeed: OpaqueData,\n plaintext: OpaqueData,\n salt: string,\n): Promise {\n const key = await deriveKey(keySeed, nonce, salt);\n const cipherText = secretbox(plaintext, nonce, key);\n return typedArrayConcat([nonce, cipherText]);\n}\n\nconst nonceSize = 24;\n\nexport async function decryptWithDerivedKey(\n ciphertext: OpaqueData,\n keySeed: OpaqueData,\n salt: string,\n): Promise {\n const ctBuf = ciphertext;\n const nonceBuf = ctBuf.slice(0, nonceSize);\n const enc = ctBuf.slice(nonceSize);\n const key = await deriveKey(keySeed, nonceBuf, salt);\n const clearText = nacl.secretbox_open(enc, nonceBuf, key);\n if (!clearText) {\n throw Error(\"could not decrypt\");\n }\n return clearText;\n}\n\nenum ContractFormatTag {\n PaymentOffer = 0,\n PaymentRequest = 1,\n}\n\ntype MaterialEddsaPub = {\n _materialType?: \"eddsa-pub\";\n _size?: 32;\n};\n\ntype MaterialEddsaPriv = {\n _materialType?: \"ecdhe-priv\";\n _size?: 32;\n};\n\ntype MaterialEcdhePub = {\n _materialType?: \"ecdhe-pub\";\n _size?: 32;\n};\n\ntype MaterialEcdhePriv = {\n _materialType?: \"ecdhe-priv\";\n _size?: 32;\n};\n\ntype PursePublicKey = FlavorP &\n MaterialEddsaPub;\n\ntype ContractPrivateKey = FlavorP &\n MaterialEcdhePriv;\n\ntype MergePrivateKey = FlavorP &\n MaterialEddsaPriv;\n\nconst mergeSalt = \"p2p-merge-contract\";\nconst depositSalt = \"p2p-deposit-contract\";\n\nexport function encryptContractForMerge(\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n mergePriv: MergePrivateKey,\n contractTerms: any,\n nonce: EncryptionNonce,\n): Promise {\n const contractTermsCanon = canonicalJson(contractTerms) + \"\\0\";\n const contractTermsBytes = stringToBytes(contractTermsCanon);\n const contractTermsCompressed = fflate.zlibSync(contractTermsBytes);\n const data = typedArrayConcat([\n bufferForUint32(ContractFormatTag.PaymentOffer),\n bufferForUint32(contractTermsBytes.length),\n mergePriv,\n contractTermsCompressed,\n ]);\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n return encryptWithDerivedKey(nonce, key, data, mergeSalt);\n}\n\nexport function encryptContractForDeposit(\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n contractTerms: any,\n nonce: EncryptionNonce,\n): Promise {\n const contractTermsCanon = canonicalJson(contractTerms) + \"\\0\";\n const contractTermsBytes = stringToBytes(contractTermsCanon);\n const contractTermsCompressed = fflate.zlibSync(contractTermsBytes);\n const data = typedArrayConcat([\n bufferForUint32(ContractFormatTag.PaymentRequest),\n bufferForUint32(contractTermsBytes.length),\n contractTermsCompressed,\n ]);\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n return encryptWithDerivedKey(nonce, key, data, depositSalt);\n}\n\nexport interface DecryptForMergeResult {\n contractTerms: any;\n mergePriv: Uint8Array;\n}\n\nexport interface DecryptForDepositResult {\n contractTerms: any;\n}\n\nexport async function decryptContractForMerge(\n enc: OpaqueData,\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n): Promise {\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n const dec = await decryptWithDerivedKey(enc, key, mergeSalt);\n const mergePriv = dec.slice(8, 8 + 32);\n const contractTermsCompressed = dec.slice(8 + 32);\n const contractTermsBuf = fflate.unzlibSync(contractTermsCompressed);\n // Slice of the '\\0' at the end and decode to a string\n const contractTermsString = bytesToString(\n contractTermsBuf.slice(0, contractTermsBuf.length - 1),\n );\n return {\n mergePriv: mergePriv,\n contractTerms: JSON.parse(contractTermsString),\n };\n}\n\nexport async function decryptContractForDeposit(\n enc: OpaqueData,\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n): Promise {\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n const dec = await decryptWithDerivedKey(enc, key, depositSalt);\n const contractTermsCompressed = dec.slice(8);\n const contractTermsBuf = fflate.unzlibSync(contractTermsCompressed);\n // Slice of the '\\0' at the end and decode to a string\n const contractTermsString = bytesToString(\n contractTermsBuf.slice(0, contractTermsBuf.length - 1),\n );\n return {\n contractTerms: JSON.parse(contractTermsString),\n };\n}\n\nexport function amountToBuffer(amount: AmountLike): Uint8Array {\n const amountJ = Amounts.jsonifyAmount(amount);\n const buffer = new ArrayBuffer(8 + 4 + 12);\n const dvbuf = new DataView(buffer);\n const u8buf = new Uint8Array(buffer);\n const curr = stringToBytes(amountJ.currency);\n if (typeof dvbuf.setBigUint64 !== \"undefined\") {\n dvbuf.setBigUint64(0, BigInt(amountJ.value));\n } else {\n const arr = bigint(amountJ.value).toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n dvbuf.setUint8(offset++, arr[i]);\n }\n }\n dvbuf.setUint32(8, amountJ.fraction);\n u8buf.set(curr, 8 + 4);\n\n return u8buf;\n}\n\nexport function timestampRoundedToBuffer(\n ts: TalerProtocolTimestamp,\n): Uint8Array {\n const b = new ArrayBuffer(8);\n const v = new DataView(b);\n // The buffer we sign over represents the timestamp in microseconds.\n if (typeof v.setBigUint64 !== \"undefined\") {\n const s = BigInt(ts.t_s) * BigInt(1000 * 1000);\n v.setBigUint64(0, s);\n } else {\n const s =\n ts.t_s === \"never\" ? bigint.zero : bigint(ts.t_s).multiply(1000 * 1000);\n const arr = s.toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n v.setUint8(offset++, arr[i]);\n }\n }\n return new Uint8Array(b);\n}\n\nexport function durationRoundedToBuffer(ts: TalerProtocolDuration): Uint8Array {\n const b = new ArrayBuffer(8);\n const v = new DataView(b);\n // The buffer we sign over represents the timestamp in microseconds.\n if (typeof v.setBigUint64 !== \"undefined\") {\n const s = BigInt(ts.d_us);\n v.setBigUint64(0, s);\n } else {\n const s = ts.d_us === \"forever\" ? bigint.zero : bigint(ts.d_us);\n const arr = s.toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n v.setUint8(offset++, arr[i]);\n }\n }\n return new Uint8Array(b);\n}\n", "// SHA-256 for JavaScript.\n//\n// Written in 2014-2016 by Dmitry Chestnykh.\n// Public domain, no warranty.\n//\n// Functions (accept and return Uint8Arrays):\n//\n// sha256(message) -> hash\n// sha256.hmac(key, message) -> mac\n//\n// Classes:\n//\n// new sha256.Hash()\nexport const digestLength = 32;\nexport const blockSize = 64;\n\n// SHA-256 constants\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nfunction hashBlocks(\n w: Int32Array,\n v: Int32Array,\n p: Uint8Array,\n pos: number,\n len: number,\n): number {\n let a: number,\n b: number,\n c: number,\n d: number,\n e: number,\n f: number,\n g: number,\n h: number,\n u: number,\n i: number,\n j: number,\n t1: number,\n t2: number;\n while (len >= 64) {\n a = v[0];\n b = v[1];\n c = v[2];\n d = v[3];\n e = v[4];\n f = v[5];\n g = v[6];\n h = v[7];\n\n for (i = 0; i < 16; i++) {\n j = pos + i * 4;\n w[i] =\n ((p[j] & 0xff) << 24) |\n ((p[j + 1] & 0xff) << 16) |\n ((p[j + 2] & 0xff) << 8) |\n (p[j + 3] & 0xff);\n }\n\n for (i = 16; i < 64; i++) {\n u = w[i - 2];\n t1 =\n ((u >>> 17) | (u << (32 - 17))) ^\n ((u >>> 19) | (u << (32 - 19))) ^\n (u >>> 10);\n\n u = w[i - 15];\n t2 =\n ((u >>> 7) | (u << (32 - 7))) ^\n ((u >>> 18) | (u << (32 - 18))) ^\n (u >>> 3);\n\n w[i] = ((t1 + w[i - 7]) | 0) + ((t2 + w[i - 16]) | 0);\n }\n\n for (i = 0; i < 64; i++) {\n t1 =\n ((((((e >>> 6) | (e << (32 - 6))) ^\n ((e >>> 11) | (e << (32 - 11))) ^\n ((e >>> 25) | (e << (32 - 25)))) +\n ((e & f) ^ (~e & g))) |\n 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) |\n 0;\n\n t2 =\n ((((a >>> 2) | (a << (32 - 2))) ^\n ((a >>> 13) | (a << (32 - 13))) ^\n ((a >>> 22) | (a << (32 - 22)))) +\n ((a & b) ^ (a & c) ^ (b & c))) |\n 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n\n v[0] += a;\n v[1] += b;\n v[2] += c;\n v[3] += d;\n v[4] += e;\n v[5] += f;\n v[6] += g;\n v[7] += h;\n\n pos += 64;\n len -= 64;\n }\n return pos;\n}\n\n// Hash implements SHA256 hash algorithm.\nexport class HashSha256 {\n digestLength: number = digestLength;\n blockSize: number = blockSize;\n\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n private state: Int32Array = new Int32Array(8); // hash state\n private temp: Int32Array = new Int32Array(64); // temporary state\n private buffer: Uint8Array = new Uint8Array(128); // buffer for data to hash\n private bufferLength = 0; // number of bytes in buffer\n private bytesHashed = 0; // number of total bytes hashed\n\n finished = false; // indicates whether the hash was finalized\n\n constructor() {\n this.reset();\n }\n\n // Resets hash state making it possible\n // to reuse this instance to hash other data.\n reset(): this {\n this.state[0] = 0x6a09e667;\n this.state[1] = 0xbb67ae85;\n this.state[2] = 0x3c6ef372;\n this.state[3] = 0xa54ff53a;\n this.state[4] = 0x510e527f;\n this.state[5] = 0x9b05688c;\n this.state[6] = 0x1f83d9ab;\n this.state[7] = 0x5be0cd19;\n this.bufferLength = 0;\n this.bytesHashed = 0;\n this.finished = false;\n return this;\n }\n\n // Cleans internal buffers and re-initializes hash state.\n clean(): void {\n for (let i = 0; i < this.buffer.length; i++) {\n this.buffer[i] = 0;\n }\n for (let i = 0; i < this.temp.length; i++) {\n this.temp[i] = 0;\n }\n this.reset();\n }\n\n // Updates hash state with the given data.\n //\n // Optionally, length of the data can be specified to hash\n // fewer bytes than data.length.\n //\n // Throws error when trying to update already finalized hash:\n // instance must be reset to use it again.\n update(data: Uint8Array, dataLength: number = data.length): this {\n if (this.finished) {\n throw new Error(\"SHA256: can't update because hash was finished.\");\n }\n let dataPos = 0;\n this.bytesHashed += dataLength;\n if (this.bufferLength > 0) {\n while (this.bufferLength < 64 && dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this.bufferLength === 64) {\n hashBlocks(this.temp, this.state, this.buffer, 0, 64);\n this.bufferLength = 0;\n }\n }\n if (dataLength >= 64) {\n dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);\n dataLength %= 64;\n }\n while (dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n }\n\n // Finalizes hash state and puts hash into out.\n //\n // If hash was already finalized, puts the same value.\n finish(out: Uint8Array): this {\n if (!this.finished) {\n const bytesHashed = this.bytesHashed;\n const left = this.bufferLength;\n const bitLenHi = (bytesHashed / 0x20000000) | 0;\n const bitLenLo = bytesHashed << 3;\n const padLength = bytesHashed % 64 < 56 ? 64 : 128;\n\n this.buffer[left] = 0x80;\n for (let i = left + 1; i < padLength - 8; i++) {\n this.buffer[i] = 0;\n }\n this.buffer[padLength - 8] = (bitLenHi >>> 24) & 0xff;\n this.buffer[padLength - 7] = (bitLenHi >>> 16) & 0xff;\n this.buffer[padLength - 6] = (bitLenHi >>> 8) & 0xff;\n this.buffer[padLength - 5] = (bitLenHi >>> 0) & 0xff;\n this.buffer[padLength - 4] = (bitLenLo >>> 24) & 0xff;\n this.buffer[padLength - 3] = (bitLenLo >>> 16) & 0xff;\n this.buffer[padLength - 2] = (bitLenLo >>> 8) & 0xff;\n this.buffer[padLength - 1] = (bitLenLo >>> 0) & 0xff;\n\n hashBlocks(this.temp, this.state, this.buffer, 0, padLength);\n\n this.finished = true;\n }\n\n for (let i = 0; i < 8; i++) {\n out[i * 4 + 0] = (this.state[i] >>> 24) & 0xff;\n out[i * 4 + 1] = (this.state[i] >>> 16) & 0xff;\n out[i * 4 + 2] = (this.state[i] >>> 8) & 0xff;\n out[i * 4 + 3] = (this.state[i] >>> 0) & 0xff;\n }\n\n return this;\n }\n\n // Returns the final hash digest.\n digest(): Uint8Array {\n const out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n }\n\n // Internal function for use in HMAC for optimization.\n _saveState(out: Uint32Array): void {\n for (let i = 0; i < this.state.length; i++) {\n out[i] = this.state[i];\n }\n }\n\n // Internal function for use in HMAC for optimization.\n _restoreState(from: Uint32Array, bytesHashed: number): void {\n for (let i = 0; i < this.state.length; i++) {\n this.state[i] = from[i];\n }\n this.bytesHashed = bytesHashed;\n this.finished = false;\n this.bufferLength = 0;\n }\n}\n\n// HMAC implements HMAC-SHA256 message authentication algorithm.\nexport class HMAC {\n private inner: HashSha256 = new HashSha256();\n private outer: HashSha256 = new HashSha256();\n\n blockSize: number = this.inner.blockSize;\n digestLength: number = this.inner.digestLength;\n\n // Copies of hash states after keying.\n // Need for quick reset without hashing they key again.\n private istate: Uint32Array;\n private ostate: Uint32Array;\n\n constructor(key: Uint8Array) {\n const pad = new Uint8Array(this.blockSize);\n if (key.length > this.blockSize) {\n new HashSha256().update(key).finish(pad).clean();\n } else {\n for (let i = 0; i < key.length; i++) {\n pad[i] = key[i];\n }\n }\n for (let i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36;\n }\n this.inner.update(pad);\n\n for (let i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36 ^ 0x5c;\n }\n this.outer.update(pad);\n\n this.istate = new Uint32Array(8);\n this.ostate = new Uint32Array(8);\n\n this.inner._saveState(this.istate);\n this.outer._saveState(this.ostate);\n\n for (let i = 0; i < pad.length; i++) {\n pad[i] = 0;\n }\n }\n\n // Returns HMAC state to the state initialized with key\n // to make it possible to run HMAC over the other data with the same\n // key without creating a new instance.\n reset(): this {\n this.inner._restoreState(this.istate, this.inner.blockSize);\n this.outer._restoreState(this.ostate, this.outer.blockSize);\n return this;\n }\n\n // Cleans HMAC state.\n clean(): void {\n for (let i = 0; i < this.istate.length; i++) {\n this.ostate[i] = this.istate[i] = 0;\n }\n this.inner.clean();\n this.outer.clean();\n }\n\n // Updates state with provided data.\n update(data: Uint8Array): this {\n this.inner.update(data);\n return this;\n }\n\n // Finalizes HMAC and puts the result in out.\n finish(out: Uint8Array): this {\n if (this.outer.finished) {\n this.outer.finish(out);\n } else {\n this.inner.finish(out);\n this.outer.update(out, this.digestLength).finish(out);\n }\n return this;\n }\n\n // Returns message authentication code.\n digest(): Uint8Array {\n const out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n }\n}\n\n// Returns SHA256 hash of data.\nexport function sha256(data: Uint8Array): Uint8Array {\n const h = new HashSha256().update(data);\n const digest = h.digest();\n h.clean();\n return digest;\n}\n\n// Returns HMAC-SHA256 of data under the key.\nexport function hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array {\n const h = new HMAC(key).update(data);\n const digest = h.digest();\n h.clean();\n return digest;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport * as nacl from \"./nacl-fast.js\";\nimport { sha256 } from \"./sha256.js\";\n\nexport function sha512(data: Uint8Array): Uint8Array {\n return nacl.hash(data);\n}\n\nexport function hmac(\n digest: (d: Uint8Array) => Uint8Array,\n blockSize: number,\n key: Uint8Array,\n message: Uint8Array,\n): Uint8Array {\n if (key.byteLength > blockSize) {\n key = digest(key);\n }\n if (key.byteLength < blockSize) {\n const k = key;\n key = new Uint8Array(blockSize);\n key.set(k, 0);\n }\n const okp = new Uint8Array(blockSize);\n const ikp = new Uint8Array(blockSize);\n for (let i = 0; i < blockSize; i++) {\n ikp[i] = key[i] ^ 0x36;\n okp[i] = key[i] ^ 0x5c;\n }\n const b1 = new Uint8Array(blockSize + message.byteLength);\n b1.set(ikp, 0);\n b1.set(message, blockSize);\n const h0 = digest(b1);\n const b2 = new Uint8Array(blockSize + h0.length);\n b2.set(okp, 0);\n b2.set(h0, blockSize);\n return digest(b2);\n}\n\nexport function hmacSha512(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha512, 128, key, message);\n}\n\nexport function hmacSha256(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha256, 64, key, message);\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForList,\n codecForNumber,\n codecForString,\n codecForStringURL,\n codecOptional,\n} from \"./codec.js\";\nimport {\n PaytoString,\n buildCodecForUnion,\n codecForAmountString,\n codecForBoolean,\n codecForConstString,\n codecForCurrencySpecificiation,\n codecForMap,\n codecForURN,\n strcmp,\n} from \"./index.js\";\nimport { Edx25519PublicKeyEnc } from \"./taler-crypto.js\";\nimport {\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForDuration,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AmlOfficerPublicKeyP,\n AmountString,\n Base32String,\n CoinPublicKeyString,\n Cs25519Point,\n CurrencySpecification,\n EddsaPublicKeyString,\n EddsaSignatureString,\n HashCodeString,\n Integer,\n InternationalizedString,\n LibtoolVersionString,\n PaytoHash,\n RelativeTime,\n RsaPublicKey,\n RsaPublicKeySring,\n Timestamp,\n WireSalt,\n} from \"./types-taler-common.js\";\n\nexport type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey;\n\nexport interface RsaDenominationPubKey {\n readonly cipher: DenomKeyType.Rsa;\n readonly rsa_public_key: string;\n readonly age_mask: number;\n}\n\nexport interface CsDenominationPubKey {\n readonly cipher: DenomKeyType.ClauseSchnorr;\n readonly age_mask: number;\n readonly cs_public_key: string;\n}\n\nexport namespace DenominationPubKey {\n export function cmp(\n p1: DenominationPubKey,\n p2: DenominationPubKey,\n ): -1 | 0 | 1 {\n if (p1.cipher < p2.cipher) {\n return -1;\n } else if (p1.cipher > p2.cipher) {\n return +1;\n } else if (\n p1.cipher === DenomKeyType.Rsa &&\n p2.cipher === DenomKeyType.Rsa\n ) {\n if ((p1.age_mask ?? 0) < (p2.age_mask ?? 0)) {\n return -1;\n } else if ((p1.age_mask ?? 0) > (p2.age_mask ?? 0)) {\n return 1;\n }\n return strcmp(p1.rsa_public_key, p2.rsa_public_key);\n } else if (\n p1.cipher === DenomKeyType.ClauseSchnorr &&\n p2.cipher === DenomKeyType.ClauseSchnorr\n ) {\n if ((p1.age_mask ?? 0) < (p2.age_mask ?? 0)) {\n return -1;\n } else if ((p1.age_mask ?? 0) > (p2.age_mask ?? 0)) {\n return 1;\n }\n return strcmp(p1.cs_public_key, p2.cs_public_key);\n } else {\n throw Error(\"unsupported cipher\");\n }\n }\n}\n\nexport const codecForRsaDenominationPubKey = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.Rsa))\n .property(\"rsa_public_key\", codecForString())\n .property(\"age_mask\", codecForNumber())\n .build(\"DenominationPubKey\");\n\nexport const codecForCsDenominationPubKey = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.ClauseSchnorr))\n .property(\"cs_public_key\", codecForString())\n .property(\"age_mask\", codecForNumber())\n .build(\"CsDenominationPubKey\");\n\nexport const codecForDenominationPubKey = () =>\n buildCodecForUnion()\n .discriminateOn(\"cipher\")\n .alternative(DenomKeyType.Rsa, codecForRsaDenominationPubKey())\n .alternative(DenomKeyType.ClauseSchnorr, codecForCsDenominationPubKey())\n .build(\"DenominationPubKey\");\n\n/**\n * Denomination as found in the /keys response from the exchange.\n */\nexport interface ExchangeDenomination {\n /**\n * Value of one coin of the denomination.\n */\n value: string;\n\n /**\n * Public signing key of the denomination.\n */\n denom_pub: DenominationPubKey;\n\n /**\n * Fee for withdrawing.\n */\n fee_withdraw: string;\n\n /**\n * Fee for depositing.\n */\n fee_deposit: string;\n\n /**\n * Fee for refreshing.\n */\n fee_refresh: string;\n\n /**\n * Fee for refunding.\n */\n fee_refund: string;\n\n /**\n * Start date from which withdraw is allowed.\n */\n stamp_start: TalerProtocolTimestamp;\n\n /**\n * End date for withdrawing.\n */\n stamp_expire_withdraw: TalerProtocolTimestamp;\n\n /**\n * Expiration date after which the exchange can forget about\n * the currency.\n */\n stamp_expire_legal: TalerProtocolTimestamp;\n\n /**\n * Date after which the coins of this denomination can't be\n * deposited anymore.\n */\n stamp_expire_deposit: TalerProtocolTimestamp;\n\n /**\n * Signature over the denomination information by the exchange's master\n * signing key.\n */\n master_sig: string;\n}\n\n/**\n * Signature by the auditor that a particular denomination key is audited.\n */\nexport interface AuditorDenomSig {\n /**\n * Denomination public key's hash.\n */\n denom_pub_h: string;\n\n /**\n * The signature.\n */\n auditor_sig: string;\n}\n\n/**\n * Auditor information as given by the exchange in /keys.\n */\nexport interface ExchangeAuditor {\n /**\n * Auditor's public key.\n */\n auditor_pub: string;\n\n /**\n * Base URL of the auditor.\n */\n auditor_url: string;\n\n /**\n * List of signatures for denominations by the auditor.\n */\n denomination_keys: AuditorDenomSig[];\n}\n\nexport type ExchangeWithdrawValue =\n | ExchangeRsaWithdrawValue\n | ExchangeCsWithdrawValue;\n\nexport interface ExchangeRsaWithdrawValue {\n cipher: \"RSA\";\n}\n\nexport interface ExchangeCsWithdrawValue {\n cipher: \"CS\";\n\n /**\n * CSR R0 value\n */\n r_pub_0: string;\n\n /**\n * CSR R1 value\n */\n r_pub_1: string;\n}\n\nexport interface RecoupRequest {\n /**\n * Hashed denomination public key of the coin we want to get\n * paid back.\n */\n denom_pub_hash: string;\n\n /**\n * Signature over the coin public key by the denomination.\n *\n * The string variant is for the legacy exchange protocol.\n */\n denom_sig: UnblindedSignature;\n\n /**\n * Blinding key that was used during withdraw,\n * used to prove that we were actually withdrawing the coin.\n */\n coin_blind_key_secret: string;\n\n /**\n * Signature of TALER_RecoupRequestPS created with the coin's private key.\n */\n coin_sig: string;\n\n ewv: ExchangeWithdrawValue;\n}\n\nexport interface RecoupRefreshRequest {\n /**\n * Hashed enomination public key of the coin we want to get\n * paid back.\n */\n denom_pub_hash: string;\n\n /**\n * Signature over the coin public key by the denomination.\n *\n * The string variant is for the legacy exchange protocol.\n */\n denom_sig: UnblindedSignature;\n\n /**\n * Coin's blinding factor.\n */\n coin_blind_key_secret: string;\n\n /**\n * Signature of TALER_RecoupRefreshRequestPS created with\n * the coin's private key.\n */\n coin_sig: string;\n\n ewv: ExchangeWithdrawValue;\n}\n\n/**\n * Response that we get from the exchange for a payback request.\n */\nexport interface RecoupConfirmation {\n /**\n * Public key of the reserve that will receive the payback.\n */\n reserve_pub?: string;\n\n /**\n * Public key of the old coin that will receive the recoup,\n * provided if refreshed was true.\n */\n old_coin_pub?: string;\n}\n\nexport type UnblindedSignature = RsaUnblindedSignature;\n\nexport interface RsaUnblindedSignature {\n cipher: DenomKeyType.Rsa;\n rsa_signature: string;\n}\n\n/**\n * Deposit permission for a single coin.\n */\nexport interface CoinDepositPermission {\n /**\n * Signature by the coin.\n */\n coin_sig: string;\n\n /**\n * Public key of the coin being spend.\n */\n coin_pub: string;\n\n /**\n * Signature made by the denomination public key.\n *\n * The string variant is for legacy protocol support.\n */\n\n ub_sig: UnblindedSignature;\n\n /**\n * The denomination public key associated with this coin.\n */\n h_denom: string;\n\n /**\n * The amount that is subtracted from this coin with this payment.\n */\n contribution: string;\n\n /**\n * URL of the exchange this coin was withdrawn from.\n */\n exchange_url: string;\n\n minimum_age_sig?: EddsaSignatureString;\n\n age_commitment?: Edx25519PublicKeyEnc[];\n\n h_age_commitment?: string;\n}\n\n/**\n * Element of the payback list that the\n * exchange gives us in /keys.\n */\nexport interface Recoup {\n /**\n * The hash of the denomination public key for which the payback is offered.\n */\n h_denom_pub: string;\n}\n\n/**\n * Structure that the exchange gives us in /keys.\n */\nexport interface ExchangeKeysJson {\n /**\n * Canonical, public base URL of the exchange.\n */\n base_url: string;\n\n currency: string;\n\n currency_specification?: CurrencySpecification;\n\n /**\n * The exchange's master public key.\n */\n master_public_key: string;\n\n /**\n * The list of auditors (partially) auditing the exchange.\n */\n auditors: ExchangeAuditor[];\n\n /**\n * Timestamp when this response was issued.\n */\n list_issue_date: TalerProtocolTimestamp;\n\n /**\n * List of revoked denominations.\n */\n recoup?: Recoup[];\n\n /**\n * Short-lived signing keys used to sign online\n * responses.\n */\n signkeys: ExchangeSignKeyJson[];\n\n /**\n * Protocol version.\n */\n version: string;\n\n reserve_closing_delay: TalerProtocolDuration;\n\n global_fees: GlobalFees[];\n\n accounts: ExchangeWireAccount[];\n\n wire_fees: { [methodName: string]: WireFeesJson[] };\n\n denominations: DenomGroup[];\n}\n\nexport interface ExchangeMeltRequest {\n coin_pub: CoinPublicKeyString;\n confirm_sig: EddsaSignatureString;\n denom_pub_hash: HashCodeString;\n denom_sig: UnblindedSignature;\n rc: string;\n value_with_fee: AmountString;\n age_commitment_hash?: HashCodeString;\n}\n\nexport interface ExchangeMeltResponse {\n /**\n * Which of the kappa indices does the client not have to reveal.\n */\n noreveal_index: number;\n\n /**\n * Signature of TALER_RefreshMeltConfirmationPS whereby the exchange\n * affirms the successful melt and confirming the noreveal_index\n */\n exchange_sig: EddsaSignatureString;\n\n /*\n * public EdDSA key of the exchange that was used to generate the signature.\n * Should match one of the exchange's signing keys from /keys. Again given\n * explicitly as the client might otherwise be confused by clock skew as to\n * which signing key was used.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /*\n * Base URL to use for operations on the refresh context\n * (so the reveal operation). If not given,\n * the base URL is the same as the one used for this request.\n * Can be used if the base URL for /refreshes/ differs from that\n * for /coins/, i.e. for load balancing. Clients SHOULD\n * respect the refresh_base_url if provided. Any HTTP server\n * belonging to an exchange MUST generate a 307 or 308 redirection\n * to the correct base URL should a client uses the wrong base\n * URL, or if the base URL has changed since the melt.\n *\n * When melting the same coin twice (technically allowed\n * as the response might have been lost on the network),\n * the exchange may return different values for the refresh_base_url.\n */\n refresh_base_url?: string;\n}\n\nexport interface ExchangeRevealItem {\n ev_sig: BlindedDenominationSignature;\n}\n\nexport interface ExchangeRevealResponse {\n // List of the exchange's blinded RSA signatures on the new coins.\n ev_sigs: ExchangeRevealItem[];\n}\n\nexport const codecForDenomination = (): Codec =>\n buildCodecForObject()\n .property(\"value\", codecForString())\n .property(\"denom_pub\", codecForDenominationPubKey())\n .property(\"fee_withdraw\", codecForString())\n .property(\"fee_deposit\", codecForString())\n .property(\"fee_refresh\", codecForString())\n .property(\"fee_refund\", codecForString())\n .property(\"stamp_start\", codecForTimestamp)\n .property(\"stamp_expire_withdraw\", codecForTimestamp)\n .property(\"stamp_expire_legal\", codecForTimestamp)\n .property(\"stamp_expire_deposit\", codecForTimestamp)\n .property(\"master_sig\", codecForString())\n .build(\"Denomination\");\n\nexport const codecForAuditorDenomSig = (): Codec =>\n buildCodecForObject()\n .property(\"denom_pub_h\", codecForString())\n .property(\"auditor_sig\", codecForString())\n .build(\"AuditorDenomSig\");\n\nexport const codecForAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"auditor_pub\", codecForString())\n .property(\"auditor_url\", codecForString())\n .property(\"denomination_keys\", codecForList(codecForAuditorDenomSig()))\n .build(\"Auditor\");\n\n/**\n * Structure of one exchange signing key in the /keys response.\n */\nexport class ExchangeSignKeyJson {\n stamp_start: TalerProtocolTimestamp;\n stamp_expire: TalerProtocolTimestamp;\n stamp_end: TalerProtocolTimestamp;\n key: EddsaPublicKeyString;\n master_sig: EddsaSignatureString;\n}\n\nexport type DenomGroup =\n | DenomGroupRsa\n | DenomGroupCs\n | DenomGroupRsaAgeRestricted\n | DenomGroupCsAgeRestricted;\n\nexport interface DenomGroupCommon {\n // How much are coins of this denomination worth?\n value: AmountString;\n\n // Fee charged by the exchange for withdrawing a coin of this denomination.\n fee_withdraw: AmountString;\n\n // Fee charged by the exchange for depositing a coin of this denomination.\n fee_deposit: AmountString;\n\n // Fee charged by the exchange for refreshing a coin of this denomination.\n fee_refresh: AmountString;\n\n // Fee charged by the exchange for refunding a coin of this denomination.\n fee_refund: AmountString;\n\n // XOR of all the SHA-512 hash values of the denominations' public keys\n // in this group. Note that for hashing, the binary format of the\n // public keys is used, and not their base32 encoding.\n hash: HashCodeString;\n}\n\nexport interface DenomCommon {\n // Signature of TALER_DenominationKeyValidityPS.\n master_sig: EddsaSignatureString;\n\n // When does the denomination key become valid?\n stamp_start: TalerProtocolTimestamp;\n\n // When is it no longer possible to deposit coins\n // of this denomination?\n stamp_expire_withdraw: TalerProtocolTimestamp;\n\n // Timestamp indicating by when legal disputes relating to these coins must\n // be settled, as the exchange will afterwards destroy its evidence relating to\n // transactions involving this coin.\n stamp_expire_legal: TalerProtocolTimestamp;\n\n stamp_expire_deposit: TalerProtocolTimestamp;\n\n // Set to 'true' if the exchange somehow \"lost\"\n // the private key. The denomination was not\n // necessarily revoked, but still cannot be used\n // to withdraw coins at this time (theoretically,\n // the private key could be recovered in the\n // future; coins signed with the private key\n // remain valid).\n lost?: boolean;\n}\n\nexport interface DenomGroupRsa extends DenomGroupCommon {\n cipher: \"RSA\";\n\n denoms: ({\n rsa_pub: RsaPublicKeySring;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupRsaAgeRestricted extends DenomGroupCommon {\n cipher: \"RSA+age_restricted\";\n age_mask: AgeMask;\n\n denoms: ({\n rsa_pub: RsaPublicKeySring;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupCs extends DenomGroupCommon {\n cipher: \"CS\";\n age_mask: AgeMask;\n\n denoms: ({\n cs_pub: Cs25519Point;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupCsAgeRestricted extends DenomGroupCommon {\n cipher: \"CS+age_restricted\";\n age_mask: AgeMask;\n\n denoms: ({\n cs_pub: Cs25519Point;\n } & DenomCommon)[];\n}\n\n/**\n * Wire fees as announced by the exchange.\n */\nexport class WireFeesJson {\n /**\n * Cost of a wire transfer.\n */\n wire_fee: string;\n\n /**\n * Cost of clising a reserve.\n */\n closing_fee: string;\n\n /**\n * Signature made with the exchange's master key.\n */\n sig: string;\n\n /**\n * Date from which the fee applies.\n */\n start_date: TalerProtocolTimestamp;\n\n /**\n * Data after which the fee doesn't apply anymore.\n */\n end_date: TalerProtocolTimestamp;\n}\n\nexport interface ExchangeWireAccount {\n // payto:// URI identifying the account and wire method\n payto_uri: string;\n\n // URI to convert amounts from or to the currency used by\n // this wire account of the exchange. Missing if no\n // conversion is applicable.\n conversion_url?: string;\n\n // Restrictions that apply to bank accounts that would send\n // funds to the exchange (crediting this exchange bank account).\n // Optional, empty array for unrestricted.\n credit_restrictions: AccountRestriction[];\n\n // Restrictions that apply to bank accounts that would receive\n // funds from the exchange (debiting this exchange bank account).\n // Optional, empty array for unrestricted.\n debit_restrictions: AccountRestriction[];\n\n // Signature using the exchange's offline key over\n // a TALER_MasterWireDetailsPS\n // with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.\n master_sig: EddsaSignatureString;\n\n // Display label wallets should use to show this\n // bank account.\n // Since protocol **v19**.\n bank_label?: string;\n priority?: number;\n}\n\nexport const codecForExchangeWireAccount = (): Codec =>\n buildCodecForObject()\n .property(\"conversion_url\", codecOptional(codecForStringURL()))\n .property(\"credit_restrictions\", codecForList(codecForAny()))\n .property(\"debit_restrictions\", codecForList(codecForAny()))\n .property(\"master_sig\", codecForString())\n .property(\"payto_uri\", codecForString())\n .property(\"bank_label\", codecOptional(codecForString()))\n .property(\"priority\", codecOptional(codecForNumber()))\n .build(\"WireAccount\");\n\nexport interface ExchangeRefundRequest {\n // Amount to be refunded, can be a fraction of the\n // coin's total deposit value (including deposit fee);\n // must be larger than the refund fee.\n refund_amount: AmountString;\n\n // SHA-512 hash of the contact of the merchant with the customer.\n h_contract_terms: HashCodeString;\n\n // 64-bit transaction id of the refund transaction between merchant and customer.\n rtransaction_id: number;\n\n // EdDSA public key of the merchant.\n merchant_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the merchant over a\n // TALER_RefundRequestPS with purpose\n // TALER_SIGNATURE_MERCHANT_REFUND\n // affirming the refund.\n merchant_sig: EddsaPublicKeyString;\n}\n\nexport interface ExchangeRefundSuccessResponse {\n // The EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND over\n // a TALER_RecoupRefreshConfirmationPS\n // using a current signing key of the\n // exchange affirming the successful refund.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n}\n\nexport const codecForExchangeRefundSuccessResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .build(\"ExchangeRefundSuccessResponse\");\n\nexport type AccountRestriction =\n | RegexAccountRestriction\n | DenyAllAccountRestriction;\n\nexport interface DenyAllAccountRestriction {\n type: \"deny\";\n}\n\n// Accounts interacting with this type of account\n// restriction must have a payto://-URI matching\n// the given regex.\nexport interface RegexAccountRestriction {\n type: \"regex\";\n\n // Regular expression that the payto://-URI of the\n // partner account must follow. The regular expression\n // should follow posix-egrep, but without support for character\n // classes, GNU extensions, back-references or intervals. See\n // https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html\n // for a description of the posix-egrep syntax. Applications\n // may support regexes with additional features, but exchanges\n // must not use such regexes.\n payto_regex: string;\n\n // Hint for a human to understand the restriction\n // (that is hopefully easier to comprehend than the regex itself).\n human_hint: string;\n\n // Map from IETF BCP 47 language tags to localized\n // human hints.\n human_hint_i18n?: InternationalizedString;\n}\n\nexport type CoinEnvelope = CoinEnvelopeRsa | CoinEnvelopeCs;\n\nexport interface CoinEnvelopeRsa {\n cipher: DenomKeyType.Rsa;\n rsa_blinded_planchet: string;\n}\n\nexport interface CoinEnvelopeCs {\n cipher: DenomKeyType.ClauseSchnorr;\n // FIXME: add remaining fields\n}\n\nexport interface ExchangeWithdrawRequest {\n denom_pub_hash: HashCodeString;\n reserve_sig: EddsaSignatureString;\n coin_ev: CoinEnvelope;\n}\n\nexport interface ExchangeBatchWithdrawRequest {\n planchets: ExchangeWithdrawRequest[];\n}\n\nexport interface ExchangeRefreshRevealRequest {\n new_denoms_h: HashCodeString[];\n coin_evs: CoinEnvelope[];\n /**\n * kappa - 1 transfer private keys (ephemeral ECDHE keys).\n */\n transfer_privs: string[];\n\n transfer_pub: EddsaPublicKeyString;\n\n link_sigs: EddsaSignatureString[];\n\n /**\n * Iff the corresponding denomination has support for age restriction,\n * the client MUST provide the original age commitment, i.e. the vector\n * of public keys.\n */\n old_age_commitment?: Edx25519PublicKeyEnc[];\n}\n\nexport const codecForRecoup = (): Codec =>\n buildCodecForObject()\n .property(\"h_denom_pub\", codecForString())\n .build(\"Recoup\");\n\nexport const codecForExchangeSigningKey = (): Codec =>\n buildCodecForObject()\n .property(\"key\", codecForString())\n .property(\"master_sig\", codecForString())\n .property(\"stamp_end\", codecForTimestamp)\n .property(\"stamp_start\", codecForTimestamp)\n .property(\"stamp_expire\", codecForTimestamp)\n .build(\"ExchangeSignKeyJson\");\n\nexport const codecForGlobalFees = (): Codec =>\n buildCodecForObject()\n .property(\"start_date\", codecForTimestamp)\n .property(\"end_date\", codecForTimestamp)\n .property(\"history_fee\", codecForAmountString())\n .property(\"account_fee\", codecForAmountString())\n .property(\"purse_fee\", codecForAmountString())\n .property(\"history_expiration\", codecForDuration)\n .property(\"purse_account_limit\", codecForNumber())\n .property(\"purse_timeout\", codecForDuration)\n .property(\"master_sig\", codecForString())\n .build(\"GlobalFees\");\n\n// FIXME: Validate properly!\nexport const codecForNgDenominations: Codec = codecForAny();\n\nexport const codecForExchangeKeysJson = (): Codec =>\n buildCodecForObject()\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .property(\n \"currency_specification\",\n codecOptional(codecForCurrencySpecificiation()),\n )\n .property(\"master_public_key\", codecForString())\n .property(\"auditors\", codecForList(codecForAuditor()))\n .property(\"list_issue_date\", codecForTimestamp)\n .property(\"recoup\", codecOptional(codecForList(codecForRecoup())))\n .property(\"signkeys\", codecForList(codecForExchangeSigningKey()))\n .property(\"version\", codecForString())\n .property(\"reserve_closing_delay\", codecForDuration)\n .property(\"global_fees\", codecForList(codecForGlobalFees()))\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .property(\"wire_fees\", codecForMap(codecForList(codecForWireFeesJson())))\n .property(\"denominations\", codecForList(codecForNgDenominations))\n .build(\"ExchangeKeysJson\");\n\nexport const codecForWireFeesJson = (): Codec =>\n buildCodecForObject()\n .property(\"wire_fee\", codecForString())\n .property(\"closing_fee\", codecForString())\n .property(\"sig\", codecForString())\n .property(\"start_date\", codecForTimestamp)\n .property(\"end_date\", codecForTimestamp)\n .build(\"WireFeesJson\");\n\nexport const codecForRecoupConfirmation = (): Codec =>\n buildCodecForObject()\n .property(\"reserve_pub\", codecOptional(codecForString()))\n .property(\"old_coin_pub\", codecOptional(codecForString()))\n .build(\"RecoupConfirmation\");\n\nexport const codecForWithdrawResponse = (): Codec =>\n buildCodecForObject()\n .property(\"ev_sig\", codecForBlindedDenominationSignature())\n .build(\"WithdrawResponse\");\n\nexport class ExchangeWithdrawResponse {\n ev_sig: BlindedDenominationSignature;\n}\n\nexport class ExchangeWithdrawBatchResponse {\n ev_sigs: ExchangeWithdrawResponse[];\n}\n\nexport enum DenomKeyType {\n Rsa = \"RSA\",\n ClauseSchnorr = \"CS\",\n}\n\nexport namespace DenomKeyType {\n export function toIntTag(t: DenomKeyType): number {\n switch (t) {\n case DenomKeyType.Rsa:\n return 1;\n case DenomKeyType.ClauseSchnorr:\n return 2;\n }\n }\n}\n\nexport interface RsaBlindedDenominationSignature {\n cipher: DenomKeyType.Rsa;\n blinded_rsa_signature: string;\n}\n\nexport interface CSBlindedDenominationSignature {\n cipher: DenomKeyType.ClauseSchnorr;\n}\n\nexport type BlindedDenominationSignature =\n | RsaBlindedDenominationSignature\n | CSBlindedDenominationSignature;\n\nexport const codecForRsaBlindedDenominationSignature = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.Rsa))\n .property(\"blinded_rsa_signature\", codecForString())\n .build(\"RsaBlindedDenominationSignature\");\n\nexport const codecForBlindedDenominationSignature = () =>\n buildCodecForUnion()\n .discriminateOn(\"cipher\")\n .alternative(DenomKeyType.Rsa, codecForRsaBlindedDenominationSignature())\n .build(\"BlindedDenominationSignature\");\n\nexport const codecForExchangeWithdrawBatchResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"ev_sigs\", codecForList(codecForWithdrawResponse()))\n .build(\"WithdrawBatchResponse\");\n\nexport const codecForExchangeMeltResponse = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"noreveal_index\", codecForNumber())\n .property(\"refresh_base_url\", codecOptional(codecForString()))\n .build(\"ExchangeMeltResponse\");\n\nexport const codecForExchangeRevealItem = (): Codec =>\n buildCodecForObject()\n .property(\"ev_sig\", codecForBlindedDenominationSignature())\n .build(\"ExchangeRevealItem\");\n\nexport const codecForExchangeRevealResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"ev_sigs\", codecForList(codecForExchangeRevealItem()))\n .build(\"ExchangeRevealResponse\");\n\nexport interface FutureKeysResponse {\n future_denoms: any[];\n\n future_signkeys: any[];\n\n master_pub: string;\n\n denom_secmod_public_key: string;\n\n // Public key of the signkey security module.\n signkey_secmod_public_key: string;\n}\n\nexport const codecForKeysManagementResponse = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"future_signkeys\", codecForList(codecForAny()))\n .property(\"future_denoms\", codecForList(codecForAny()))\n .property(\"denom_secmod_public_key\", codecForAny())\n .property(\"signkey_secmod_public_key\", codecForAny())\n .build(\"FutureKeysResponse\");\n\nexport interface PurseDeposit {\n /**\n * Amount to be deposited, can be a fraction of the\n * coin's total value.\n */\n amount: AmountString;\n\n /**\n * Hash of denomination RSA key with which the coin is signed.\n */\n denom_pub_hash: HashCodeString;\n\n /**\n * Exchange's unblinded RSA signature of the coin.\n */\n ub_sig: UnblindedSignature;\n\n /**\n * Age commitment for the coin, if the denomination is age-restricted.\n */\n age_commitment?: string[];\n\n /**\n * Attestation for the minimum age, if the denomination is age-restricted.\n */\n attest?: string;\n\n /**\n * Signature over TALER_PurseDepositSignaturePS\n * of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT\n * made by the customer with the\n * coin's private key.\n */\n coin_sig: EddsaSignatureString;\n\n /**\n * Public key of the coin being deposited into the purse.\n */\n coin_pub: EddsaPublicKeyString;\n}\n\nexport interface ExchangePurseMergeRequest {\n // payto://-URI of the account the purse is to be merged into.\n // Must be of the form: 'payto://taler/$EXCHANGE_URL/$RESERVE_PUB'.\n payto_uri: string;\n\n // EdDSA signature of the account/reserve affirming the merge\n // over a TALER_AccountMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE\n reserve_sig: EddsaSignatureString;\n\n // EdDSA signature of the purse private key affirming the merge\n // over a TALER_PurseMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_PURSE_MERGE.\n merge_sig: EddsaSignatureString;\n\n // Client-side timestamp of when the merge request was made.\n merge_timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ExchangeGetContractResponse {\n purse_pub: string;\n econtract_sig: string;\n econtract: string;\n}\n\nexport const codecForExchangeGetContractResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"purse_pub\", codecForString())\n .property(\"econtract_sig\", codecForString())\n .property(\"econtract\", codecForString())\n .build(\"ExchangeGetContractResponse\");\n\n/**\n * Contract terms between two wallets (as opposed to a merchant and wallet).\n */\nexport interface PeerContractTerms {\n amount: AmountString;\n summary: string;\n purse_expiration: TalerProtocolTimestamp;\n}\n\nexport interface EncryptedContract {\n // Encrypted contract.\n econtract: string;\n\n // Signature over the (encrypted) contract.\n econtract_sig: string;\n\n // Ephemeral public key for the DH operation to decrypt the encrypted contract.\n contract_pub: string;\n}\n\n/**\n * Payload for /reserves/{reserve_pub}/purse\n * endpoint of the exchange.\n */\nexport interface ExchangeReservePurseRequest {\n /**\n * Minimum amount that must be credited to the reserve, that is\n * the total value of the purse minus the deposit fees.\n * If the deposit fees are lower, the contribution to the\n * reserve can be higher!\n */\n purse_value: AmountString;\n\n // Minimum age required for all coins deposited into the purse.\n min_age: number;\n\n // Purse fee the reserve owner is willing to pay\n // for the purse creation. Optional, if not present\n // the purse is to be created from the purse quota\n // of the reserve.\n purse_fee: AmountString;\n\n // Optional encrypted contract, in case the buyer is\n // proposing the contract and thus establishing the\n // purse with the payment.\n econtract?: EncryptedContract;\n\n // EdDSA public key used to approve merges of this purse.\n merge_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the purse private key affirming the merge\n // over a TALER_PurseMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_PURSE_MERGE.\n merge_sig: EddsaSignatureString;\n\n // EdDSA signature of the account/reserve affirming the merge.\n // Must be of purpose TALER_SIGNATURE_WALLET_ACCOUNT_MERGE\n reserve_sig: EddsaSignatureString;\n\n // Purse public key.\n purse_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the purse over\n // TALER_PurseRequestSignaturePS of\n // purpose TALER_SIGNATURE_PURSE_REQUEST\n // confirming that the\n // above details hold for this purse.\n purse_sig: EddsaSignatureString;\n\n // SHA-512 hash of the contact of the purse.\n h_contract_terms: HashCodeString;\n\n // Client-side timestamp of when the merge request was made.\n merge_timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the purse should expire\n // if it has not been paid.\n purse_expiration: TalerProtocolTimestamp;\n}\n\nexport interface ExchangePurseDeposits {\n // Array of coins to deposit into the purse.\n deposits: PurseDeposit[];\n}\n\n/**\n * @deprecated batch deposit should be used.\n */\nexport interface ExchangeDepositRequest {\n // Amount to be deposited, can be a fraction of the\n // coin's total value.\n contribution: AmountString;\n\n // The merchant's account details.\n // In case of an auction policy, it refers to the seller.\n merchant_payto_uri: string;\n\n // The salt is used to hide the payto_uri from customers\n // when computing the h_wire of the merchant.\n wire_salt: string;\n\n // SHA-512 hash of the contract of the merchant with the customer. Further\n // details are never disclosed to the exchange.\n h_contract_terms: HashCodeString;\n\n // Hash of denomination RSA key with which the coin is signed.\n denom_pub_hash: HashCodeString;\n\n // Exchange's unblinded RSA signature of the coin.\n ub_sig: UnblindedSignature;\n\n // Timestamp when the contract was finalized.\n timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the exchange undertakes to transfer the funds to\n // the merchant, in case of successful payment. A wire transfer deadline of 'never'\n // is not allowed.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // EdDSA public key of the merchant, so that the client can identify the\n // merchant for refund requests.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n merchant_pub: EddsaPublicKeyString;\n\n // Date until which the merchant can issue a refund to the customer via the\n // exchange, to be omitted if refunds are not allowed.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n refund_deadline?: TalerProtocolTimestamp;\n\n // CAVEAT: THIS IS WORK IN PROGRESS\n // (Optional) policy for the deposit.\n // This might be a refund, auction or escrow policy.\n //\n // Note that support for policies is an optional feature of the exchange.\n // Optional features are so called \"extensions\" in Taler. The exchange\n // provides the list of supported extensions, including policies, in the\n // ExtensionsManifestsResponse response to the /keys endpoint.\n policy?: any;\n\n // Signature over TALER_DepositRequestPS, made by the customer with the\n // coin's private key.\n coin_sig: EddsaSignatureString;\n\n h_age_commitment?: string;\n}\n\nexport type TrackTransaction =\n | ({ type: \"accepted\" } & TrackTransactionAccepted)\n | ({ type: \"wired\" } & TrackTransactionWired);\n\nexport interface BatchDepositSuccess {\n // Optional base URL of the exchange for looking up wire transfers\n // associated with this transaction. If not given,\n // the base URL is the same as the one used for this request.\n // Can be used if the base URL for ``/transactions/`` differs from that\n // for ``/coins/``, i.e. for load balancing. Clients SHOULD\n // respect the ``transaction_base_url`` if provided. Any HTTP server\n // belonging to an exchange MUST generate a 307 or 308 redirection\n // to the correct base URL should a client uses the wrong base\n // URL, or if the base URL has changed since the deposit.\n transaction_base_url?: string;\n\n // Timestamp when the deposit was received by the exchange.\n exchange_timestamp: TalerProtocolTimestamp;\n\n // `Public EdDSA key of the exchange ` that was used to\n // generate the signature.\n // Should match one of the exchange's signing keys from ``/keys``. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n\n // Array of deposit confirmation signatures from the exchange\n // Entries must be in the same order the coins were given\n // in the batch deposit request.\n exchange_sig: EddsaSignatureString;\n}\n\nexport const codecForBatchDepositSuccess = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_timestamp\", codecForTimestamp)\n .property(\"transaction_base_url\", codecOptional(codecForString()))\n .build(\"BatchDepositSuccess\");\n\nexport interface TrackTransactionWired {\n // Raw wire transfer identifier of the deposit.\n wtid: Base32String;\n\n // When was the wire transfer given to the bank.\n execution_time: TalerProtocolTimestamp;\n\n // The contribution of this coin to the total (without fees)\n coin_contribution: AmountString;\n\n // Binary-only Signature_ with purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE\n // over a TALER_ConfirmWirePS\n // whereby the exchange affirms the successful wire transfer.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. Again given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n}\n\nexport const codecForTackTransactionWired = (): Codec =>\n buildCodecForObject()\n .property(\"wtid\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .property(\"coin_contribution\", codecForAmountString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .build(\"TackTransactionWired\");\n\nexport interface TrackTransactionAccepted {\n // Legitimization target that the merchant should\n // use to check for its KYC status using\n // the /kyc-check/$REQUIREMENT_ROW/... endpoint.\n // Optional, not present if the deposit has not\n // yet been aggregated to the point that a KYC\n // need has been evaluated.\n requirement_row?: number;\n\n // True if the KYC check for the merchant has been\n // satisfied. False does not mean that KYC\n // is strictly needed, unless also a\n // legitimization_uuid is provided.\n kyc_ok: boolean;\n\n // Time by which the exchange currently thinks the deposit will be executed.\n // Actual execution may be later if the KYC check is not satisfied by then.\n execution_time: TalerProtocolTimestamp;\n}\n\nexport const codecForTackTransactionAccepted =\n (): Codec =>\n buildCodecForObject()\n .property(\"requirement_row\", codecOptional(codecForNumber()))\n .property(\"kyc_ok\", codecForBoolean())\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TackTransactionAccepted\");\n\nexport const codecForPeerContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"purse_expiration\", codecForTimestamp)\n .build(\"PeerContractTerms\");\n\nexport interface ExchangeBatchDepositRequest {\n // The merchant's account details.\n merchant_payto_uri: string;\n\n // The salt is used to hide the ``payto_uri`` from customers\n // when computing the ``h_wire`` of the merchant.\n wire_salt: WireSalt;\n\n // SHA-512 hash of the contract of the merchant with the customer. Further\n // details are never disclosed to the exchange.\n h_contract_terms: HashCodeString;\n\n // The list of coins that are going to be deposited with this Request.\n coins: BatchDepositRequestCoin[];\n\n // Timestamp when the contract was finalized.\n timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the exchange undertakes to transfer the funds to\n // the merchant, in case of successful payment. A wire transfer deadline of 'never'\n // is not allowed.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // EdDSA `public key of the merchant `, so that the client can identify the\n // merchant for refund requests.\n merchant_pub: EddsaPublicKeyString;\n\n // Date until which the merchant can issue a refund to the customer via the\n // exchange, to be omitted if refunds are not allowed.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n refund_deadline?: TalerProtocolTimestamp;\n\n // CAVEAT: THIS IS WORK IN PROGRESS\n // (Optional) policy for the batch-deposit.\n // This might be a refund, auction or escrow policy.\n policy?: any;\n}\n\nexport interface BatchDepositRequestCoin {\n // EdDSA public key of the coin being deposited.\n coin_pub: EddsaPublicKeyString;\n\n // Hash of denomination RSA key with which the coin is signed.\n denom_pub_hash: HashCodeString;\n\n // Exchange's unblinded RSA signature of the coin.\n ub_sig: UnblindedSignature;\n\n // Amount to be deposited, can be a fraction of the\n // coin's total value.\n contribution: AmountString;\n\n // Signature over `TALER_DepositRequestPS`, made by the customer with the\n // `coin's private key `.\n coin_sig: EddsaSignatureString;\n\n h_age_commitment?: string;\n}\n\nexport enum AmlState {\n normal = 0,\n pending = 1,\n frozen = 2,\n}\n\nexport interface AmlRecords {\n // Array of AML records matching the query.\n records: AmlRecord[];\n}\nexport interface AmlRecord {\n // Which payto-address is this record about.\n // Identifies a GNU Taler wallet or an affected bank account.\n h_payto: PaytoHash;\n\n // What is the current AML state.\n current_state: AmlState;\n\n // Monthly transaction threshold before a review will be triggered\n threshold: AmountString;\n\n // RowID of the record.\n rowid: Integer;\n}\n\nexport interface AmlDecisionDetails {\n // Array of AML decisions made for this account. Possibly\n // contains only the most recent decision if \"history\" was\n // not set to 'true'.\n aml_history: AmlDecisionDetail[];\n\n // Array of KYC attributes obtained for this account.\n kyc_attributes: KycDetail[];\n}\nexport interface AmlDecisionDetail {\n // What was the justification given?\n justification: string;\n\n // What is the new AML state.\n new_state: Integer;\n\n // When was this decision made?\n decision_time: Timestamp;\n\n // What is the new AML decision threshold (in monthly transaction volume)?\n new_threshold: AmountString;\n\n // Who made the decision?\n decider_pub: AmlOfficerPublicKeyP;\n}\nexport interface KycDetail {\n // Name of the configuration section that specifies the provider\n // which was used to collect the KYC details\n provider_section: string;\n\n // The collected KYC data. NULL if the attribute data could not\n // be decrypted (internal error of the exchange, likely the\n // attribute key was changed).\n attributes?: Object;\n\n // Time when the KYC data was collected\n collection_time: Timestamp;\n\n // Time when the validity of the KYC data will expire\n expiration_time: Timestamp;\n}\n\nexport interface AmlDecision {\n // Human-readable justification for the decision.\n justification: string;\n\n // At what monthly transaction volume should the\n // decision be automatically reviewed?\n new_threshold: AmountString;\n\n // Which payto-address is the decision about?\n // Identifies a GNU Taler wallet or an affected bank account.\n h_payto: PaytoHash;\n\n // What is the new AML state (e.g. frozen, unfrozen, etc.)\n // Numerical values are defined in AmlDecisionState.\n new_state: Integer;\n\n // Signature by the AML officer over a\n // TALER_MasterAmlOfficerStatusPS.\n // Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.\n officer_sig: EddsaSignatureString;\n\n // When was the decision made?\n decision_time: Timestamp;\n\n // Optional argument to impose new KYC requirements\n // that the customer has to satisfy to unblock transactions.\n kyc_requirements?: string[];\n}\n\nexport interface ExchangeVersionResponse {\n // libtool-style representation of the Exchange protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the protocol.\n name: \"taler-exchange\";\n\n // URN of the implementation (needed to interpret 'revision' in version).\n // @since v18, may become mandatory in the future.\n implementation?: string;\n\n // Currency supported by this exchange, given\n // as a currency code (\"USD\" or \"EUR\").\n currency: string;\n\n // How wallets should render this currency.\n currency_specification: CurrencySpecification;\n\n // Names of supported KYC requirements.\n supported_kyc_requirements: string[];\n}\n\nexport interface WireAccount {\n // payto:// URI identifying the account and wire method\n payto_uri: PaytoString;\n\n // URI to convert amounts from or to the currency used by\n // this wire account of the exchange. Missing if no\n // conversion is applicable.\n conversion_url?: string;\n\n // Restrictions that apply to bank accounts that would send\n // funds to the exchange (crediting this exchange bank account).\n // Optional, empty array for unrestricted.\n credit_restrictions: AccountRestriction[];\n\n // Restrictions that apply to bank accounts that would receive\n // funds from the exchange (debiting this exchange bank account).\n // Optional, empty array for unrestricted.\n debit_restrictions: AccountRestriction[];\n\n // Signature using the exchange's offline key over\n // a TALER_MasterWireDetailsPS\n // with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.\n master_sig: EddsaSignatureString;\n}\n\nexport interface ExchangeKeysResponse {\n // libtool-style representation of the Exchange protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // The exchange's base URL.\n base_url: string;\n\n // The exchange's currency or asset unit.\n currency: string;\n\n /**\n * FIXME: PARTIALLY IMPLEMENTED!!\n */\n\n // How wallets should render this currency.\n // currency_specification: CurrencySpecification;\n\n // // Absolute cost offset for the STEFAN curve used\n // // to (over) approximate fees payable by amount.\n // stefan_abs: AmountString;\n\n // // Factor to multiply the logarithm of the amount\n // // with to (over) approximate fees payable by amount.\n // // Note that the total to be paid is first to be\n // // divided by the smallest denomination to obtain\n // // the value that the logarithm is to be taken of.\n // stefan_log: AmountString;\n\n // // Linear cost factor for the STEFAN curve used\n // // to (over) approximate fees payable by amount.\n // //\n // // Note that this is a scalar, as it is multiplied\n // // with the actual amount.\n // stefan_lin: Float;\n\n // // Type of the asset. \"fiat\", \"crypto\", \"regional\"\n // // or \"stock\". Wallets should adjust their UI/UX\n // // based on this value.\n // asset_type: string;\n\n // // Array of wire accounts operated by the exchange for\n // // incoming wire transfers.\n // accounts: WireAccount[];\n\n // // Object mapping names of wire methods (i.e. \"iban\" or \"x-taler-bank\")\n // // to wire fees.\n // wire_fees: { method: AggregateTransferFee[] };\n\n // // List of exchanges that this exchange is partnering\n // // with to enable wallet-to-wallet transfers.\n // wads: ExchangePartner[];\n\n // // Set to true if this exchange allows the use\n // // of reserves for rewards.\n // // @deprecated in protocol v18.\n // rewards_allowed: false;\n\n // // EdDSA master public key of the exchange, used to sign entries\n // // in denoms and signkeys.\n // master_public_key: EddsaPublicKey;\n\n // // Relative duration until inactive reserves are closed;\n // // not signed (!), can change without notice.\n // reserve_closing_delay: RelativeTime;\n\n // // Threshold amounts beyond which wallet should\n // // trigger the KYC process of the issuing\n // // exchange. Optional option, if not given there is no limit.\n // // Currency must match currency.\n // wallet_balance_limit_without_kyc?: AmountString[];\n\n // // Denominations offered by this exchange\n // denominations: DenomGroup[];\n\n // // Compact EdDSA signature (binary-only) over the\n // // contatentation of all of the master_sigs (in reverse\n // // chronological order by group) in the arrays under\n // // \"denominations\". Signature of TALER_ExchangeKeySetPS\n // exchange_sig: EddsaSignature;\n\n // // Public EdDSA key of the exchange that was used to generate the signature.\n // // Should match one of the exchange's signing keys from signkeys. It is given\n // // explicitly as the client might otherwise be confused by clock skew as to\n // // which signing key was used for the exchange_sig.\n // exchange_pub: EddsaPublicKey;\n\n // // Denominations for which the exchange currently offers/requests recoup.\n // recoup: Recoup[];\n\n // // Array of globally applicable fees by time range.\n // global_fees: GlobalFees[];\n\n // // The date when the denomination keys were last updated.\n // list_issue_date: Timestamp;\n\n // // Auditors of the exchange.\n // auditors: AuditorKeys[];\n\n // // The exchange's signing keys.\n // signkeys: SignKey[];\n\n // // Optional field with a dictionary of (name, object) pairs defining the\n // // supported and enabled extensions, such as age_restriction.\n // extensions?: { name: ExtensionManifest };\n\n // // Signature by the exchange master key of the SHA-256 hash of the\n // // normalized JSON-object of field extensions, if it was set.\n // // The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS.\n // extensions_sig?: EddsaSignature;\n}\n\ninterface ExtensionManifest {\n // The criticality of the extension MUST be provided. It has the same\n // semantics as \"critical\" has for extensions in X.509:\n // - if \"true\", the client must \"understand\" the extension before\n // proceeding,\n // - if \"false\", clients can safely skip extensions they do not\n // understand.\n // (see https://datatracker.ietf.org/doc/html/rfc5280#section-4.2)\n critical: boolean;\n\n // The version information MUST be provided in Taler's protocol version\n // ranges notation, see\n // https://docs.taler.net/core/api-common.html#protocol-version-ranges\n version: LibtoolVersionString;\n\n // Optional configuration object, defined by the feature itself\n config?: object;\n}\n\ninterface SignKey {\n // The actual exchange's EdDSA signing public key.\n key: EddsaPublicKeyString;\n\n // Initial validity date for the signing key.\n stamp_start: Timestamp;\n\n // Date when the exchange will stop using the signing key, allowed to overlap\n // slightly with the next signing key's validity to allow for clock skew.\n stamp_expire: Timestamp;\n\n // Date when all signatures made by the signing key expire and should\n // henceforth no longer be considered valid in legal disputes.\n stamp_end: Timestamp;\n\n // Signature over key and stamp_expire by the exchange master key.\n // Signature of TALER_ExchangeSigningKeyValidityPS.\n // Must have purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.\n master_sig: EddsaSignatureString;\n}\n\ninterface AuditorKeys {\n // The auditor's EdDSA signing public key.\n auditor_pub: EddsaPublicKeyString;\n\n // The auditor's URL.\n auditor_url: string;\n\n // The auditor's name (for humans).\n auditor_name: string;\n\n // An array of denomination keys the auditor affirms with its signature.\n // Note that the message only includes the hash of the public key, while the\n // signature is actually over the expanded information including expiration\n // times and fees. The exact format is described below.\n denomination_keys: AuditorDenominationKey[];\n}\n\ninterface AuditorDenominationKey {\n // Hash of the public RSA key used to sign coins of the respective\n // denomination. Note that the auditor's signature covers more than just\n // the hash, but this other information is already provided in denoms and\n // thus not repeated here.\n denom_pub_h: HashCodeString;\n\n // Signature of TALER_ExchangeKeyValidityPS.\n auditor_sig: EddsaSignatureString;\n}\n\nexport interface GlobalFees {\n // What date (inclusive) does these fees go into effect?\n start_date: Timestamp;\n\n // What date (exclusive) does this fees stop going into effect?\n end_date: Timestamp;\n\n // Account history fee, charged when a user wants to\n // obtain a reserve/account history.\n history_fee: AmountString;\n\n // Annual fee charged for having an open account at the\n // exchange. Charged to the account. If the account\n // balance is insufficient to cover this fee, the account\n // is automatically deleted/closed. (Note that the exchange\n // will keep the account history around for longer for\n // regulatory reasons.)\n account_fee: AmountString;\n\n // Purse fee, charged only if a purse is abandoned\n // and was not covered by the account limit.\n purse_fee: AmountString;\n\n // How long will the exchange preserve the account history?\n // After an account was deleted/closed, the exchange will\n // retain the account history for legal reasons until this time.\n history_expiration: RelativeTime;\n\n // Non-negative number of concurrent purses that any\n // account holder is allowed to create without having\n // to pay the purse_fee.\n purse_account_limit: Integer;\n\n // How long does an exchange keep a purse around after a purse\n // has expired (or been successfully merged)? A 'GET' request\n // for a purse will succeed until the purse expiration time\n // plus this value.\n purse_timeout: RelativeTime;\n\n // Signature of TALER_GlobalFeesPS.\n master_sig: EddsaSignatureString;\n}\n\nexport interface AggregateTransferFee {\n // Per transfer wire transfer fee.\n wire_fee: AmountString;\n\n // Per transfer closing fee.\n closing_fee: AmountString;\n\n // What date (inclusive) does this fee go into effect?\n // The different fees must cover the full time period in which\n // any of the denomination keys are valid without overlap.\n start_date: Timestamp;\n\n // What date (exclusive) does this fee stop going into effect?\n // The different fees must cover the full time period in which\n // any of the denomination keys are valid without overlap.\n end_date: Timestamp;\n\n // Signature of TALER_MasterWireFeePS with\n // purpose TALER_SIGNATURE_MASTER_WIRE_FEES.\n sig: EddsaSignatureString;\n}\n\ninterface ExchangePartner {\n // Base URL of the partner exchange.\n partner_base_url: string;\n\n // Public master key of the partner exchange.\n partner_master_pub: EddsaPublicKeyString;\n\n // Per exchange-to-exchange transfer (wad) fee.\n wad_fee: AmountString;\n\n // Exchange-to-exchange wad (wire) transfer frequency.\n wad_frequency: RelativeTime;\n\n // When did this partnership begin (under these conditions)?\n start_date: Timestamp;\n\n // How long is this partnership expected to last?\n end_date: Timestamp;\n\n // Signature using the exchange's offline key over\n // TALER_WadPartnerSignaturePS\n // with purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS.\n master_sig: EddsaSignatureString;\n}\n\n// Binary representation of the age groups.\n// The bits set in the mask mark the edges at the beginning of a next age\n// group. F.e. for the age groups\n// 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-21, 21-*\n// the following bits are set:\n//\n// 31 24 16 8 0\n// | | | | |\n// oooooooo oo1oo1o1 o1o1o1o1 ooooooo1\n//\n// A value of 0 means that the exchange does not support the extension for\n// age-restriction.\ntype AgeMask = Integer;\n\ntype DenominationKey = RsaDenominationKey | CSDenominationKey;\n\ninterface RsaDenominationKey {\n cipher: \"RSA\";\n\n // 32-bit age mask.\n age_mask: Integer;\n\n // RSA public key\n rsa_public_key: RsaPublicKey;\n}\n\ninterface CSDenominationKey {\n cipher: \"CS\";\n\n // 32-bit age mask.\n age_mask: Integer;\n\n // Public key of the denomination.\n cs_public_key: Cs25519Point;\n}\n\nexport const codecForExchangeConfig = (): Codec =>\n buildCodecForObject()\n .property(\"version\", codecForString())\n .property(\"name\", codecForConstString(\"taler-exchange\"))\n .property(\"implementation\", codecOptional(codecForURN()))\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\"supported_kyc_requirements\", codecForList(codecForString()))\n .build(\"TalerExchangeApi.ExchangeVersionResponse\");\n\nexport const codecForExchangeKeys = (): Codec =>\n buildCodecForObject()\n .property(\"version\", codecForString())\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .build(\"TalerExchangeApi.ExchangeKeysResponse\");\nexport const codecForAmlRecords = (): Codec =>\n buildCodecForObject()\n .property(\"records\", codecForList(codecForAmlRecord()))\n .build(\"TalerExchangeApi.AmlRecords\");\n\nexport const codecForAmlRecord = (): Codec =>\n buildCodecForObject()\n .property(\"current_state\", codecForNumber())\n .property(\"h_payto\", codecForString())\n .property(\"rowid\", codecForNumber())\n .property(\"threshold\", codecForAmountString())\n .build(\"TalerExchangeApi.AmlRecord\");\n\nexport const codecForAmlDecisionDetails = (): Codec =>\n buildCodecForObject()\n .property(\"aml_history\", codecForList(codecForAmlDecisionDetail()))\n .property(\"kyc_attributes\", codecForList(codecForKycDetail()))\n .build(\"TalerExchangeApi.AmlDecisionDetails\");\n\nexport const codecForAmlDecisionDetail = (): Codec =>\n buildCodecForObject()\n .property(\"justification\", codecForString())\n .property(\"new_state\", codecForNumber())\n .property(\"decision_time\", codecForTimestamp)\n .property(\"new_threshold\", codecForAmountString())\n .property(\"decider_pub\", codecForString())\n .build(\"TalerExchangeApi.AmlDecisionDetail\");\n\nexport const codecForKycDetail = (): Codec =>\n buildCodecForObject()\n .property(\"provider_section\", codecForString())\n .property(\"attributes\", codecOptional(codecForAny()))\n .property(\"collection_time\", codecForTimestamp)\n .property(\"expiration_time\", codecForTimestamp)\n .build(\"TalerExchangeApi.KycDetail\");\n\nexport const codecForAmlDecision = (): Codec =>\n buildCodecForObject()\n .property(\"justification\", codecForString())\n .property(\"new_threshold\", codecForAmountString())\n .property(\"h_payto\", codecForString())\n .property(\"new_state\", codecForNumber())\n .property(\"officer_sig\", codecForString())\n .property(\"decision_time\", codecForTimestamp)\n .property(\"kyc_requirements\", codecOptional(codecForList(codecForString())))\n .build(\"TalerExchangeApi.AmlDecision\");\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { canonicalJson } from \"./helpers.js\";\nimport { Logger } from \"./logging.js\";\nimport {\n decodeCrock,\n encodeCrock,\n getRandomBytes,\n hash,\n kdf,\n stringToBytes,\n} from \"./taler-crypto.js\";\n\nconst logger = new Logger(\"contractTerms.ts\");\n\nexport namespace ContractTermsUtil {\n export function forgetAllImpl(\n anyJson: any,\n path: string[],\n pred: PathPredicate,\n ): any {\n const dup = JSON.parse(JSON.stringify(anyJson));\n if (Array.isArray(dup)) {\n for (let i = 0; i < dup.length; i++) {\n dup[i] = forgetAllImpl(dup[i], [...path, `${i}`], pred);\n }\n } else if (typeof dup === \"object\" && dup != null) {\n if (typeof dup.$forgettable === \"object\") {\n for (const x of Object.keys(dup.$forgettable)) {\n if (!pred([...path, x])) {\n continue;\n }\n if (!dup.$forgotten) {\n dup.$forgotten = {};\n }\n if (!dup.$forgotten[x]) {\n const membValCanon = stringToBytes(\n canonicalJson(scrub(dup[x])) + \"\\0\",\n );\n const membSalt = stringToBytes(dup.$forgettable[x] + \"\\0\");\n const h = kdf(64, membValCanon, membSalt, new Uint8Array([]));\n dup.$forgotten[x] = encodeCrock(h);\n }\n delete dup[x];\n delete dup.$forgettable[x];\n }\n if (Object.keys(dup.$forgettable).length === 0) {\n delete dup.$forgettable;\n }\n }\n for (const x of Object.keys(dup)) {\n if (x.startsWith(\"$\")) {\n continue;\n }\n dup[x] = forgetAllImpl(dup[x], [...path, x], pred);\n }\n }\n return dup;\n }\n\n export type PathPredicate = (path: string[]) => boolean;\n\n /**\n * Scrub all forgettable members from an object.\n */\n export function scrub(anyJson: any): any {\n return forgetAllImpl(anyJson, [], () => true);\n }\n\n /**\n * Recursively forget all forgettable members of an object,\n * where the path matches a predicate.\n */\n export function forgetAll(anyJson: any, pred: PathPredicate): any {\n return forgetAllImpl(anyJson, [], pred);\n }\n\n /**\n * Generate a salt for all members marked as forgettable,\n * but which don't have an actual salt yet.\n */\n export function saltForgettable(anyJson: any): any {\n const dup = JSON.parse(JSON.stringify(anyJson));\n if (Array.isArray(dup)) {\n for (let i = 0; i < dup.length; i++) {\n dup[i] = saltForgettable(dup[i]);\n }\n } else if (typeof dup === \"object\" && dup !== null) {\n if (typeof dup.$forgettable === \"object\") {\n for (const k of Object.keys(dup.$forgettable)) {\n if (dup.$forgettable[k] === true) {\n dup.$forgettable[k] = encodeCrock(getRandomBytes(32));\n }\n }\n }\n for (const x of Object.keys(dup)) {\n if (x.startsWith(\"$\")) {\n continue;\n }\n dup[x] = saltForgettable(dup[x]);\n }\n }\n return dup;\n }\n\n const nameRegex = /^[0-9A-Za-z_]+$/;\n\n /**\n * Check that the given JSON object is well-formed with regards\n * to forgettable fields and other restrictions for forgettable JSON.\n */\n export function validateForgettable(anyJson: any): boolean {\n if (typeof anyJson === \"string\") {\n return true;\n }\n if (typeof anyJson === \"number\") {\n return (\n Number.isInteger(anyJson) &&\n anyJson >= Number.MIN_SAFE_INTEGER &&\n anyJson <= Number.MAX_SAFE_INTEGER\n );\n }\n if (typeof anyJson === \"boolean\") {\n return true;\n }\n if (anyJson === null) {\n return true;\n }\n if (Array.isArray(anyJson)) {\n return anyJson.every((x) => validateForgettable(x));\n }\n if (typeof anyJson === \"object\") {\n for (const k of Object.keys(anyJson)) {\n if (k.match(nameRegex)) {\n if (validateForgettable(anyJson[k])) {\n continue;\n } else {\n return false;\n }\n }\n if (k === \"$forgettable\") {\n const fga = anyJson.$forgettable;\n if (!fga || typeof fga !== \"object\") {\n return false;\n }\n for (const fk of Object.keys(fga)) {\n if (!fk.match(nameRegex)) {\n return false;\n }\n if (!(fk in anyJson)) {\n return false;\n }\n const fv = anyJson.$forgettable[fk];\n if (typeof fv !== \"string\") {\n return false;\n }\n }\n } else if (k === \"$forgotten\") {\n const fgo = anyJson.$forgotten;\n if (!fgo || typeof fgo !== \"object\") {\n return false;\n }\n for (const fk of Object.keys(fgo)) {\n if (!fk.match(nameRegex)) {\n return false;\n }\n // Check that the value has actually been forgotten.\n if (fk in anyJson) {\n return false;\n }\n const fv = anyJson.$forgotten[fk];\n if (typeof fv !== \"string\") {\n return false;\n }\n try {\n const decFv = decodeCrock(fv);\n if (decFv.length != 64) {\n return false;\n }\n } catch (e) {\n return false;\n }\n // Check that salt has been deleted after forgetting.\n if (anyJson.$forgettable?.[k] !== undefined) {\n return false;\n }\n }\n } else {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Check that no forgettable information has been forgotten.\n *\n * Must only be called on an object already validated with validateForgettable.\n */\n export function validateNothingForgotten(contractTerms: any): boolean {\n throw Error(\"not implemented yet\");\n }\n\n /**\n * Hash a contract terms object. Forgettable fields\n * are scrubbed and JSON canonicalization is applied\n * before hashing.\n */\n export function hashContractTerms(contractTerms: unknown): string {\n const cleaned = scrub(contractTerms);\n const canon = canonicalJson(cleaned) + \"\\0\";\n const bytes = stringToBytes(canon);\n return encodeCrock(hash(bytes));\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2020 Taler Systems SA\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Classes and helpers for error handling specific to wallet operations.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport {\n AbsoluteTime,\n CancellationToken,\n PaymentInsufficientBalanceDetails,\n TalerErrorCode,\n TalerErrorDetail,\n TransactionType,\n} from \"@gnu-taler/taler-util\";\n\ntype empty = Record;\n\nexport interface DetailsMap {\n [TalerErrorCode.WALLET_PENDING_OPERATION_FAILED]: {\n innerError: TalerErrorDetail;\n transactionId?: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT]: {\n exchangeBaseUrl: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE]: {\n exchangeProtocolVersion: string;\n walletProtocolVersion: string;\n };\n [TalerErrorCode.WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK]: empty;\n [TalerErrorCode.WALLET_REWARD_COIN_SIGNATURE_INVALID]: empty;\n [TalerErrorCode.WALLET_ORDER_ALREADY_CLAIMED]: {\n orderId: string;\n claimUrl: string;\n };\n [TalerErrorCode.WALLET_ORDER_ALREADY_PAID]: {\n orderId: string;\n fulfillmentUrl: string;\n };\n [TalerErrorCode.WALLET_CONTRACT_TERMS_MALFORMED]: empty;\n [TalerErrorCode.WALLET_CONTRACT_TERMS_SIGNATURE_INVALID]: {\n merchantPub: string;\n orderId: string;\n };\n [TalerErrorCode.WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH]: {\n baseUrlForDownload: string;\n baseUrlFromContractTerms: string;\n };\n [TalerErrorCode.WALLET_INVALID_TALER_PAY_URI]: {\n talerPayUri: string;\n };\n [TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR]: {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n errorResponse?: any;\n };\n [TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION]: {\n stack?: string;\n };\n [TalerErrorCode.WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE]: {\n bankProtocolVersion: string;\n walletProtocolVersion: string;\n };\n [TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN]: {\n operation: string;\n };\n [TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED]: {\n requestUrl: string;\n requestMethod: string;\n throttleStats: Record;\n };\n [TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT]: {\n requestUrl: string;\n requestMethod: string;\n timeoutMs: number;\n };\n [TalerErrorCode.GENERIC_TIMEOUT]: {\n requestUrl: string;\n requestMethod: string;\n timeoutMs: number;\n };\n [TalerErrorCode.WALLET_NETWORK_ERROR]: {\n requestUrl: string;\n requestMethod: string;\n };\n [TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE]: {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n /**\n * Original response which is malformed\n */\n response?: string;\n validationError?: string;\n /**\n * Content type of the response, usually only specified if not the\n * expected content type.\n */\n contentType?: string;\n };\n [TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR]: {\n operation: string;\n error: string;\n detail: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_COIN_SIGNATURE_INVALID]: empty;\n [TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE]: {\n numErrors: number;\n errorsPerCoin: Record;\n };\n [TalerErrorCode.WALLET_CORE_NOT_AVAILABLE]: {\n lastError?: TalerErrorDetail;\n };\n [TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR]: {\n httpStatusCode: number;\n };\n [TalerErrorCode.WALLET_PAY_MERCHANT_SERVER_ERROR]: {\n requestError: TalerErrorDetail;\n };\n [TalerErrorCode.WALLET_CRYPTO_WORKER_ERROR]: {\n innerError: TalerErrorDetail;\n };\n [TalerErrorCode.WALLET_CRYPTO_WORKER_BAD_REQUEST]: {\n detail: string;\n };\n [TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED]: {\n kycUrl: string;\n };\n [TalerErrorCode.WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE]: {\n insufficientBalanceDetails: PaymentInsufficientBalanceDetails;\n };\n [TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE]: {\n insufficientBalanceDetails: PaymentInsufficientBalanceDetails;\n };\n [TalerErrorCode.WALLET_REFRESH_GROUP_INCOMPLETE]: {\n numErrors: number;\n /**\n * Errors, can be truncated.\n */\n errors: TalerErrorDetail[];\n };\n [TalerErrorCode.WALLET_EXCHANGE_BASE_URL_MISMATCH]: {\n urlWallet: string;\n urlExchange: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_UNAVAILABLE]: {\n exchangeBaseUrl: string;\n innerError: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_DB_UNAVAILABLE]: {\n innerError: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_TOS_NOT_ACCEPTED]: {\n exchangeBaseUrl: string;\n tosStatus: string;\n currentEtag: string | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT]: {\n detail?: string;\n };\n}\n\ntype ErrBody = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;\n\nexport function makeErrorDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n): TalerErrorDetail {\n if (!hint && !(detail as any).hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n const when = AbsoluteTime.now();\n return { code, when, hint, ...detail };\n}\n\nexport function makePendingOperationFailedError(\n innerError: TalerErrorDetail,\n tag: TransactionType,\n uid: string,\n): TalerError {\n return TalerError.fromDetail(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED, {\n innerError,\n transactionId: `${tag}:${uid}`,\n });\n}\n\nexport function summarizeTalerErrorDetail(ed: TalerErrorDetail): string {\n const errName = TalerErrorCode[ed.code] ?? \"\";\n return `Error (${ed.code}/${errName})`;\n}\n\nexport function getDefaultTalerErrorHint(code: number): string {\n const errName = TalerErrorCode[code];\n if (errName) {\n return `Error (${errName})`;\n } else {\n return `Error ()`;\n }\n}\n\nexport class TalerProtocolViolationError extends Error {\n constructor(hint?: string) {\n let msg: string;\n if (hint) {\n msg = `Taler protocol violation error (${hint})`;\n } else {\n msg = `Taler protocol violation error`;\n }\n super(msg);\n Object.setPrototypeOf(this, TalerProtocolViolationError.prototype);\n }\n}\n\n// compute a subset of TalerError, just for http request\ntype HttpErrors =\n | TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT\n | TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED\n | TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE\n | TalerErrorCode.WALLET_NETWORK_ERROR\n | TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR;\n\ntype TalerHttpErrorsDetails = {\n [code in HttpErrors]: TalerError;\n};\n\nexport type TalerHttpError =\n TalerHttpErrorsDetails[keyof TalerHttpErrorsDetails];\n\n/**\n * Construct typed error details.\n * Fills in the hint with a default based on the error code name.\n */\nexport function makeTalerErrorDetail(\n code: C,\n errBody: ErrBody,\n hint?: string,\n): TalerErrorDetail {\n if (!hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n return { code, hint, ...errBody };\n}\n\nexport class TalerError extends Error {\n errorDetail: TalerErrorDetail & T;\n cause: Error | undefined;\n private constructor(d: TalerErrorDetail & T, cause?: Error) {\n super(d.hint ?? `Error (code ${d.code})`);\n this.errorDetail = d;\n this.cause = cause;\n Object.setPrototypeOf(this, TalerError.prototype);\n }\n\n static fromDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n cause?: Error,\n ): TalerError {\n if (!hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n const when = AbsoluteTime.now();\n return new TalerError({ code, when, hint, ...detail }, cause);\n }\n\n static fromUncheckedDetail(d: TalerErrorDetail, c?: Error): TalerError {\n return new TalerError({ ...d }, c);\n }\n\n static fromException(e: any): TalerError {\n const errDetail = getErrorDetailFromException(e);\n return new TalerError(errDetail, e);\n }\n\n hasErrorCode(\n code: C,\n ): this is TalerError {\n return this.errorDetail.code === code;\n }\n\n toString(): string {\n return `TalerError: ${JSON.stringify(this.errorDetail)}`;\n }\n}\n\nexport function safeStringifyException(e: any): string {\n return JSON.stringify(getErrorDetailFromException(e), undefined, 2);\n}\n\n/**\n * Convert an exception (or anything that was thrown) into\n * a TalerErrorDetail object.\n */\nexport function getErrorDetailFromException(e: any): TalerErrorDetail {\n if (e instanceof TalerError) {\n return e.errorDetail;\n }\n if (e instanceof CancellationToken.CancellationError) {\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_CORE_REQUEST_CANCELLED,\n {},\n );\n return err;\n }\n if (e instanceof Error) {\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,\n {\n stack: e.stack,\n },\n `unexpected exception (message: ${e.message})`,\n );\n return err;\n }\n // Something was thrown that is not even an exception!\n // Try to stringify it.\n let excString: string;\n try {\n excString = e.toString();\n } catch (e) {\n // Something went horribly wrong.\n excString = \"can't stringify exception\";\n }\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,\n {},\n `unexpected exception (not an exception, ${excString})`,\n );\n return err;\n}\n\nexport function assertUnreachable(x: never): never {\n throw new Error(\"Didn't expect to get here\");\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Functional programming utilities.\n */\nexport namespace fnutil {\n export function all(arr: T[], f: (x: T) => boolean): boolean {\n for (const x of arr) {\n if (!f(x)) {\n return false;\n }\n }\n return true;\n }\n\n export function any(arr: T[], f: (x: T) => boolean): boolean {\n for (const x of arr) {\n if (f(x)) {\n return true;\n }\n }\n return false;\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport { base64FromArrayBuffer } from \"../base64.js\";\nimport { encodeCrock, getRandomBytes, stringToBytes } from \"../taler-crypto.js\";\nimport {\n AccessToken,\n LongPollParams,\n PaginationParams,\n} from \"../types-taler-common.js\";\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nexport function makeBasicAuthHeader(\n username: string,\n password: string,\n): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n\n/**\n * rfc8959\n * @param token\n * @returns\n */\nexport function makeBearerTokenAuthHeader(token: AccessToken): string {\n return `Bearer ${token}`;\n}\n\n/**\n * https://bugs.gnunet.org/view.php?id=7949\n */\nexport function addPaginationParams(url: URL, pagination?: PaginationParams) {\n if (!pagination) return;\n if (pagination.offset) {\n url.searchParams.set(\"start\", pagination.offset);\n }\n const order = !pagination || pagination.order === \"asc\" ? 1 : -1;\n const limit =\n !pagination || !pagination.limit || pagination.limit === 0\n ? 5\n : Math.abs(pagination.limit);\n //always send delta\n url.searchParams.set(\"delta\", String(order * limit));\n}\n\nexport function addMerchantPaginationParams(\n url: URL,\n pagination?: PaginationParams,\n) {\n if (!pagination) return;\n if (pagination.offset) {\n url.searchParams.set(\"offset\", pagination.offset);\n }\n const order = !pagination || pagination.order === \"asc\" ? 1 : -1;\n const limit =\n !pagination || !pagination.limit || pagination.limit === 0\n ? 5\n : Math.abs(pagination.limit);\n //always send delta\n url.searchParams.set(\"limit\", String(order * limit));\n}\n\nexport function addLongPollingParam(url: URL, param?: LongPollParams) {\n if (!param) return;\n if (param.timeoutMs) {\n url.searchParams.set(\"long_poll_ms\", String(param.timeoutMs));\n }\n}\n\nexport interface CacheEvictor {\n notifySuccess: (op: T) => Promise;\n}\n\nexport const nullEvictor: CacheEvictor = {\n notifySuccess: () => Promise.resolve(),\n};\n\nexport class IdempotencyRetry {\n public readonly uid: string;\n public readonly timesLeft: number;\n public readonly maxTries: number;\n\n private constructor(timesLeft: number, maxTimesLeft: number) {\n this.timesLeft = timesLeft;\n this.maxTries = maxTimesLeft;\n this.uid = encodeCrock(getRandomBytes(32));\n }\n\n static tryFiveTimes() {\n return new IdempotencyRetry(5, 5);\n }\n\n next(): IdempotencyRetry | undefined {\n const left = this.timesLeft - 1;\n if (left <= 0) {\n return undefined;\n }\n return new IdempotencyRetry(left, this.maxTries);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { generateFakeSegwitAddress } from \"./bitcoin.js\";\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n codecForStringURL,\n renderContext,\n} from \"./codec.js\";\nimport {\n AccessToken,\n bytesToString,\n codecForAccessToken,\n codecOptional,\n hashTruncate32,\n stringToBytes,\n} from \"./index.js\";\nimport { URLSearchParams } from \"./url.js\";\n\nexport type PaytoUri =\n | PaytoUriUnknown\n | PaytoUriIBAN\n | PaytoUriTalerBank\n | PaytoUriBitcoin;\n\n// declare const __payto_str: unique symbol;\n// export type PaytoString = string & { [__payto_str]: true };\nexport type PaytoString = string;\n\nexport function codecForPaytoString(): Codec {\n return {\n decode(x: any, c?: Context): PaytoString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (!x.startsWith(paytoPfx)) {\n throw new DecodingError(\n `expected start with payto at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n return x as PaytoString;\n },\n };\n}\n\nexport interface PaytoUriGeneric {\n targetType: PaytoType | string;\n targetPath: string;\n params: { [name: string]: string };\n}\n\nexport interface PaytoUriUnknown extends PaytoUriGeneric {\n isKnown: false;\n}\n\nexport interface PaytoUriIBAN extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"iban\";\n iban: string;\n bic?: string;\n}\n\nexport interface PaytoUriTalerBank extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"x-taler-bank\";\n host: string;\n account: string;\n}\n\nexport interface PaytoUriBitcoin extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"bitcoin\";\n address: string;\n segwitAddrs: Array;\n}\n\nconst paytoPfx = \"payto://\";\n\nexport type PaytoType = \"iban\" | \"bitcoin\" | \"x-taler-bank\";\n\nexport function buildPayto(\n type: \"iban\",\n iban: string,\n bic: string | undefined,\n): PaytoUriIBAN;\nexport function buildPayto(\n type: \"bitcoin\",\n address: string,\n reserve: string | undefined,\n): PaytoUriBitcoin;\nexport function buildPayto(\n type: \"x-taler-bank\",\n host: string,\n account: string,\n): PaytoUriTalerBank;\nexport function buildPayto(\n type: PaytoType,\n first: string,\n second?: string,\n): PaytoUriGeneric {\n switch (type) {\n case \"bitcoin\": {\n const uppercased = first.toUpperCase();\n const result: PaytoUriBitcoin = {\n isKnown: true,\n targetType: \"bitcoin\",\n targetPath: first,\n address: uppercased,\n params: {},\n segwitAddrs: !second ? [] : generateFakeSegwitAddress(second, first),\n };\n return result;\n }\n case \"iban\": {\n const uppercased = first.toUpperCase();\n const result: PaytoUriIBAN = {\n isKnown: true,\n targetType: \"iban\",\n iban: uppercased,\n params: {},\n targetPath: !second ? uppercased : `${second}/${uppercased}`,\n };\n return result;\n }\n case \"x-taler-bank\": {\n if (!second) throw Error(\"missing account for payto://x-taler-bank\");\n const result: PaytoUriTalerBank = {\n isKnown: true,\n targetType: \"x-taler-bank\",\n host: first,\n account: second,\n params: {},\n targetPath: `${first}/${second}`,\n };\n return result;\n }\n default: {\n const unknownType: never = type;\n throw Error(`unknown payto:// type ${unknownType}`);\n }\n }\n}\n\n/**\n * Add query parameters to a payto URI.\n *\n * Existing parameters are preserved.\n */\nexport function addPaytoQueryParams(\n s: string,\n params: { [name: string]: string },\n): string {\n const [acct, search] = s.slice(paytoPfx.length).split(\"?\");\n const searchParams = new URLSearchParams(search || \"\");\n for (const [paramKey, paramValue] of Object.entries(params)) {\n searchParams.set(paramKey, paramValue);\n }\n const paramList = [...searchParams.entries()];\n if (paramList.length === 0) {\n return paytoPfx + acct;\n }\n return paytoPfx + acct + \"?\" + createSearchParams(paramList);\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986\n */\nfunction encodeRFC3986URIComponent(str: string): string {\n return encodeURIComponent(str).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n );\n}\nconst rfc3986 = encodeRFC3986URIComponent;\n\n/**\n *\n * https://www.rfc-editor.org/rfc/rfc3986\n */\nfunction createSearchParams(paramList: [string, string][]): string {\n return paramList\n .map(([key, value]) => `${rfc3986(key)}=${rfc3986(value)}`)\n .join(\"&\");\n}\n\n/**\n * Serialize a PaytoURI into a valid payto:// string\n *\n * @param p\n * @returns\n */\nexport function stringifyPaytoUri(p: PaytoUri): PaytoString {\n const url = new URL(`${paytoPfx}${p.targetType}/${p.targetPath}`);\n const paramList = !p.params ? [] : Object.entries(p.params);\n url.search = createSearchParams(paramList);\n return url.href as PaytoString;\n}\n\nexport function hashPaytoUri(p: PaytoUri): string {\n const paytoUri = stringifyPaytoUri(p);\n return bytesToString(hashTruncate32(stringToBytes(paytoUri + \"\\0\")));\n}\n\n/**\n * Parse a valid payto:// uri into a PaytoUri object\n * RFC 8905\n *\n * @param s\n * @returns\n */\nexport function parsePaytoUri(s: string): PaytoUri | undefined {\n if (!s.startsWith(paytoPfx)) {\n return undefined;\n }\n\n const [acct, search] = s.slice(paytoPfx.length).split(\"?\");\n\n const firstSlashPos = acct.indexOf(\"/\");\n\n if (firstSlashPos === -1) {\n return undefined;\n }\n\n const targetType = acct.slice(0, firstSlashPos);\n const targetPath = acct.slice(firstSlashPos + 1);\n\n const params: { [k: string]: string } = {};\n\n const searchParams = new URLSearchParams(search || \"\");\n\n searchParams.forEach((v, k) => {\n // URLSearchParams already decodes uri components\n params[k] = v; //decodeURIComponent(v);\n });\n\n if (targetType === \"x-taler-bank\") {\n const parts = targetPath.split(\"/\");\n const host = parts[0];\n const account = parts[1];\n return {\n targetPath,\n targetType,\n params,\n isKnown: true,\n host,\n account,\n };\n }\n if (targetType === \"iban\") {\n const parts = targetPath.split(\"/\");\n let iban: string | undefined = undefined;\n let bic: string | undefined = undefined;\n if (parts.length === 1) {\n iban = parts[0].toUpperCase();\n }\n if (parts.length === 2) {\n bic = parts[0];\n iban = parts[1].toUpperCase();\n } else {\n iban = targetPath.toUpperCase();\n }\n return {\n isKnown: true,\n targetPath,\n targetType,\n params,\n iban,\n bic,\n };\n }\n if (targetType === \"bitcoin\") {\n const msg = /\\b([A-Z0-9]{52})\\b/.exec(params[\"message\"]);\n const reserve = !msg ? params[\"subject\"] : msg[0];\n const segwitAddrs = !reserve\n ? []\n : generateFakeSegwitAddress(reserve, targetPath);\n\n const uppercased = targetType.toUpperCase();\n const result: PaytoUriBitcoin = {\n isKnown: true,\n targetPath,\n targetType,\n address: uppercased,\n params,\n segwitAddrs,\n };\n\n return result;\n }\n return {\n targetPath,\n targetType,\n params,\n isKnown: false,\n };\n}\n\nexport function talerPaytoFromExchangeReserve(\n exchangeBaseUrl: string,\n reservePub: string,\n): string {\n const url = new URL(exchangeBaseUrl);\n let proto: string;\n if (url.protocol === \"http:\") {\n proto = \"taler-reserve-http\";\n } else if (url.protocol === \"https:\") {\n proto = \"taler-reserve\";\n } else {\n throw Error(`unsupported exchange base URL protocol (${url.protocol})`);\n }\n\n let path = url.pathname;\n if (!path.endsWith(\"/\")) {\n path = path + \"/\";\n }\n\n return `payto://${proto}/${url.host}${url.pathname}${reservePub}`;\n}\n\n/**\n * The account letter is all the information\n * the merchant backend requires from the\n * bank account to check transfer.\n *\n */\nexport type AccountLetter = {\n accountURI: PaytoString;\n infoURL: string;\n accountToken?: AccessToken;\n};\n\nexport const codecForAccountLetter = (): Codec =>\n buildCodecForObject()\n .property(\"infoURL\", codecForStringURL(true))\n .property(\"accountURI\", codecForPaytoString())\n .property(\"accountToken\", codecOptional(codecForAccessToken()))\n .build(\"AccountLetter\");\n", "/*\n This file is part of GNU Taler\n (C) 2019-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Type and schema definitions for the wallet's transaction list.\n *\n * @author Florian Dold\n * @author Torsten Grote\n */\n\n/**\n * Imports.\n */\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForEither,\n codecForList,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport { TalerPreciseTimestamp, TalerProtocolTimestamp } from \"./time.js\";\nimport {\n AmountString,\n InternationalizedString,\n codecForInternationalizedString,\n} from \"./types-taler-common.js\";\nimport { MerchantInfo, codecForMerchantInfo } from \"./types-taler-merchant.js\";\nimport {\n RefreshReason,\n ScopeInfo,\n TalerErrorDetail,\n TransactionIdStr,\n TransactionStateFilter,\n WithdrawalExchangeAccountDetails,\n codecForScopeInfo,\n} from \"./types-taler-wallet.js\";\n\nexport interface TransactionsRequest {\n /**\n * return only transactions in the given currency\n *\n * it will be removed in next release\n *\n * @deprecated use scopeInfo\n */\n currency?: string;\n\n /**\n * return only transactions in the given scopeInfo\n */\n scopeInfo?: ScopeInfo;\n\n /**\n * if present, results will be limited to transactions related to the given search string\n */\n search?: string;\n\n /**\n * Sort order of the transaction items.\n * By default, items are sorted ascending by their\n * main timestamp.\n *\n * ascending: ascending by timestamp, but pending transactions first\n * descending: ascending by timestamp, but pending transactions first\n * stable-ascending: ascending by timestamp, with pending transactions amidst other transactions\n * (stable in the sense of: pending transactions don't jump around)\n */\n sort?: \"ascending\" | \"descending\" | \"stable-ascending\";\n\n /**\n * If true, include all refreshes in the transactions list.\n */\n includeRefreshes?: boolean;\n\n filterByState?: TransactionStateFilter;\n}\n\nexport interface TransactionState {\n major: TransactionMajorState;\n minor?: TransactionMinorState;\n}\n\nexport enum TransactionMajorState {\n // No state, only used when reporting transitions into the initial state\n None = \"none\",\n Pending = \"pending\",\n Done = \"done\",\n Aborting = \"aborting\",\n Aborted = \"aborted\",\n Dialog = \"dialog\",\n Finalizing = \"finalizing\",\n // Plain suspended is always a suspended pending state.\n Suspended = \"suspended\",\n SuspendedFinalizing = \"suspended-finalizing\",\n SuspendedAborting = \"suspended-aborting\",\n Failed = \"failed\",\n Expired = \"expired\",\n // Only used for the notification, never in the transaction history\n Deleted = \"deleted\",\n}\n\nexport enum TransactionMinorState {\n // Placeholder until D37 is fully implemented\n Unknown = \"unknown\",\n Deposit = \"deposit\",\n KycRequired = \"kyc\",\n AmlRequired = \"aml\",\n MergeKycRequired = \"merge-kyc\",\n Track = \"track\",\n SubmitPayment = \"submit-payment\",\n RebindSession = \"rebind-session\",\n Refresh = \"refresh\",\n Pickup = \"pickup\",\n AutoRefund = \"auto-refund\",\n User = \"user\",\n Bank = \"bank\",\n Exchange = \"exchange\",\n ClaimProposal = \"claim-proposal\",\n CheckRefund = \"check-refund\",\n CreatePurse = \"create-purse\",\n DeletePurse = \"delete-purse\",\n RefreshExpired = \"refresh-expired\",\n Ready = \"ready\",\n Merge = \"merge\",\n Repurchase = \"repurchase\",\n BankRegisterReserve = \"bank-register-reserve\",\n BankConfirmTransfer = \"bank-confirm-transfer\",\n WithdrawCoins = \"withdraw-coins\",\n ExchangeWaitReserve = \"exchange-wait-reserve\",\n AbortingBank = \"aborting-bank\",\n Aborting = \"aborting\",\n Refused = \"refused\",\n Withdraw = \"withdraw\",\n MerchantOrderProposed = \"merchant-order-proposed\",\n Proposed = \"proposed\",\n RefundAvailable = \"refund-available\",\n AcceptRefund = \"accept-refund\",\n PaidByOther = \"paid-by-other\",\n CompletedByOtherWallet = \"completed-by-other-wallet\",\n}\n\nexport enum TransactionAction {\n Delete = \"delete\",\n Suspend = \"suspend\",\n Resume = \"resume\",\n Abort = \"abort\",\n Fail = \"fail\",\n Retry = \"retry\",\n}\n\nexport interface TransactionsResponse {\n // a list of past and pending transactions sorted by pending, timestamp and transactionId.\n // In case two events are both pending and have the same timestamp,\n // they are sorted by the transactionId\n // (lexically ascending and locale-independent comparison).\n transactions: Transaction[];\n}\n\nexport interface TransactionCommon {\n // opaque unique ID for the transaction, used as a starting point for paginating queries\n // and for invoking actions on the transaction (e.g. deleting/hiding it from the history)\n transactionId: TransactionIdStr;\n\n // the type of the transaction; different types might provide additional information\n type: TransactionType;\n\n // main timestamp of the transaction\n timestamp: TalerPreciseTimestamp;\n\n /**\n * Transaction state, as per DD37.\n */\n txState: TransactionState;\n\n /**\n * Possible transitions based on the current state.\n */\n txActions: TransactionAction[];\n\n /**\n * Raw amount of the transaction (exclusive of fees or other extra costs).\n */\n amountRaw: AmountString;\n\n /**\n * Amount added or removed from the wallet's balance (including all fees and other costs).\n */\n amountEffective: AmountString;\n\n error?: TalerErrorDetail;\n\n /**\n * If the transaction minor state is in KycRequired this field is going to\n * have the location where the user need to go to complete KYC information.\n */\n kycUrl?: string;\n}\n\nexport type Transaction =\n | TransactionWithdrawal\n | TransactionPayment\n | TransactionRefund\n | TransactionRefresh\n | TransactionDeposit\n | TransactionPeerPullCredit\n | TransactionPeerPullDebit\n | TransactionPeerPushCredit\n | TransactionPeerPushDebit\n | TransactionInternalWithdrawal\n | TransactionRecoup\n | TransactionDenomLoss;\n\nexport enum TransactionType {\n Withdrawal = \"withdrawal\",\n InternalWithdrawal = \"internal-withdrawal\",\n Payment = \"payment\",\n Refund = \"refund\",\n Refresh = \"refresh\",\n Deposit = \"deposit\",\n PeerPushDebit = \"peer-push-debit\",\n PeerPushCredit = \"peer-push-credit\",\n PeerPullDebit = \"peer-pull-debit\",\n PeerPullCredit = \"peer-pull-credit\",\n Recoup = \"recoup\",\n DenomLoss = \"denom-loss\",\n}\n\nexport enum WithdrawalType {\n TalerBankIntegrationApi = \"taler-bank-integration-api\",\n ManualTransfer = \"manual-transfer\",\n}\n\nexport type WithdrawalDetails =\n | WithdrawalDetailsForManualTransfer\n | WithdrawalDetailsForTalerBankIntegrationApi;\n\ninterface WithdrawalDetailsForManualTransfer {\n type: WithdrawalType.ManualTransfer;\n\n /**\n * Payto URIs that the exchange supports.\n *\n * Already contains the amount and message.\n *\n * @deprecated in favor of exchangeCreditAccounts\n */\n exchangePaytoUris: string[];\n\n exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[];\n\n // Public key of the reserve\n reservePub: string;\n\n /**\n * Is the reserve ready for withdrawal?\n */\n reserveIsReady: boolean;\n}\n\ninterface WithdrawalDetailsForTalerBankIntegrationApi {\n type: WithdrawalType.TalerBankIntegrationApi;\n\n /**\n * Set to true if the bank has confirmed the withdrawal, false if not.\n * An unconfirmed withdrawal usually requires user-input and should be highlighted in the UI.\n * See also bankConfirmationUrl below.\n */\n confirmed: boolean;\n\n /**\n * If the withdrawal is unconfirmed, this can include a URL for user\n * initiated confirmation.\n */\n bankConfirmationUrl?: string;\n\n // Public key of the reserve\n reservePub: string;\n\n /**\n * Is the reserve ready for withdrawal?\n */\n reserveIsReady: boolean;\n\n /**\n * Is the bank transfer for the withdrawal externally confirmed?\n */\n externalConfirmation?: boolean;\n\n exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[];\n}\n\nexport enum DenomLossEventType {\n DenomExpired = \"denom-expired\",\n DenomVanished = \"denom-vanished\",\n DenomUnoffered = \"denom-unoffered\",\n}\n\n/**\n * A transaction to indicate financial loss due to denominations\n * that became unusable for deposits.\n */\nexport interface TransactionDenomLoss extends TransactionCommon {\n type: TransactionType.DenomLoss;\n lossEventType: DenomLossEventType;\n exchangeBaseUrl: string;\n}\n\n/**\n * A withdrawal transaction (either bank-integrated or manual).\n */\nexport interface TransactionWithdrawal extends TransactionCommon {\n type: TransactionType.Withdrawal;\n\n /**\n * Exchange of the withdrawal.\n */\n exchangeBaseUrl: string | undefined;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n withdrawalDetails: WithdrawalDetails;\n}\n\n/**\n * Internal withdrawal operation, only reported on request.\n *\n * Some transactions (peer-*-credit) internally do a withdrawal,\n * but only the peer-*-credit transaction is reported.\n *\n * The internal withdrawal transaction allows to access the details of\n * the underlying withdrawal for testing/debugging.\n *\n * It is usually not reported, so that amounts of transactions properly\n * add up, since the amountEffecive of the withdrawal is already reported\n * in the peer-*-credit transaction.\n */\nexport interface TransactionInternalWithdrawal extends TransactionCommon {\n type: TransactionType.InternalWithdrawal;\n\n /**\n * Exchange of the withdrawal.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n withdrawalDetails: WithdrawalDetails;\n}\n\nexport interface PeerInfoShort {\n expiration: TalerProtocolTimestamp | undefined;\n summary: string | undefined;\n}\n\n/**\n * Credit because we were paid for a P2P invoice we created.\n */\nexport interface TransactionPeerPullCredit extends TransactionCommon {\n type: TransactionType.PeerPullCredit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n /**\n * URI to send to the other party.\n *\n * Only available in the right state.\n */\n talerUri: string | undefined;\n}\n\n/**\n * Debit because we paid someone's invoice.\n */\nexport interface TransactionPeerPullDebit extends TransactionCommon {\n type: TransactionType.PeerPullDebit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n amountRaw: AmountString;\n\n amountEffective: AmountString;\n}\n\n/**\n * We sent money via a P2P payment.\n */\nexport interface TransactionPeerPushDebit extends TransactionCommon {\n type: TransactionType.PeerPushDebit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n /**\n * URI to accept the payment.\n *\n * Only present if the transaction is in a state where the other party can\n * accept the payment.\n */\n talerUri?: string;\n}\n\n/**\n * We received money via a P2P payment.\n */\nexport interface TransactionPeerPushCredit extends TransactionCommon {\n type: TransactionType.PeerPushCredit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n}\n\n/**\n * The exchange revoked a key and the wallet recoups funds.\n */\nexport interface TransactionRecoup extends TransactionCommon {\n type: TransactionType.Recoup;\n}\n\nexport enum PaymentStatus {\n /**\n * Explicitly aborted after timeout / failure\n */\n Aborted = \"aborted\",\n\n /**\n * Payment failed, wallet will auto-retry.\n * User should be given the option to retry now / abort.\n */\n Failed = \"failed\",\n\n /**\n * Paid successfully\n */\n Paid = \"paid\",\n\n /**\n * User accepted, payment is processing.\n */\n Accepted = \"accepted\",\n}\n\nexport interface TransactionPayment extends TransactionCommon {\n type: TransactionType.Payment;\n\n /**\n * Additional information about the payment.\n */\n info: OrderShortInfo;\n\n /**\n * Wallet-internal end-to-end identifier for the payment.\n */\n proposalId: string;\n\n /**\n * Amount that must be paid for the contract\n */\n amountRaw: AmountString;\n\n /**\n * Amount that was paid, including deposit, wire and refresh fees.\n */\n amountEffective: AmountString;\n\n /**\n * Amount that has been refunded by the merchant\n */\n totalRefundRaw: AmountString;\n\n /**\n * Amount will be added to the wallet's balance after fees and refreshing\n */\n totalRefundEffective: AmountString;\n\n /**\n * Amount pending to be picked up\n */\n refundPending: AmountString | undefined;\n\n /**\n * Reference to applied refunds\n */\n refunds: RefundInfoShort[];\n\n /**\n * Is the wallet currently checking for a refund?\n */\n refundQueryActive: boolean;\n\n /**\n * Does this purchase has an pos validation\n */\n posConfirmation: string | undefined;\n}\n\nexport interface OrderShortInfo {\n /**\n * Order ID, uniquely identifies the order within a merchant instance\n */\n orderId: string;\n\n /**\n * Hash of the contract terms.\n */\n contractTermsHash: string;\n\n /**\n * More information about the merchant\n */\n merchant: MerchantInfo;\n\n /**\n * Summary of the order, given by the merchant\n */\n summary: string;\n\n /**\n * Map from IETF BCP 47 language tags to localized summaries\n */\n summary_i18n?: InternationalizedString;\n\n /**\n * URL of the fulfillment, given by the merchant\n */\n fulfillmentUrl?: string;\n\n /**\n * Plain text message that should be shown to the user\n * when the payment is complete.\n */\n fulfillmentMessage?: string;\n\n /**\n * Translations of fulfillmentMessage.\n */\n fulfillmentMessage_i18n?: InternationalizedString;\n}\n\nexport interface RefundInfoShort {\n transactionId: string;\n timestamp: TalerProtocolTimestamp;\n amountEffective: AmountString;\n amountRaw: AmountString;\n}\n\n/**\n * Summary information about the payment that we got a refund for.\n */\nexport interface RefundPaymentInfo {\n summary: string;\n summary_i18n?: InternationalizedString;\n /**\n * More information about the merchant\n */\n merchant: MerchantInfo;\n}\n\nexport interface TransactionRefund extends TransactionCommon {\n type: TransactionType.Refund;\n\n // Amount that has been refunded by the merchant\n amountRaw: AmountString;\n\n // Amount will be added to the wallet's balance after fees and refreshing\n amountEffective: AmountString;\n\n // ID for the transaction that is refunded\n refundedTransactionId: string;\n\n paymentInfo: RefundPaymentInfo | undefined;\n}\n\n/**\n * A transaction shown for refreshes.\n * Only shown for (1) refreshes not associated with other transactions\n * and (2) refreshes in an error state.\n */\nexport interface TransactionRefresh extends TransactionCommon {\n type: TransactionType.Refresh;\n\n refreshReason: RefreshReason;\n\n /**\n * Transaction ID that caused this refresh.\n */\n originatingTransactionId?: string;\n\n /**\n * Always zero for refreshes\n */\n amountRaw: AmountString;\n\n /**\n * Fees, i.e. the effective, negative effect of the refresh\n * on the balance.\n *\n * Only applicable for stand-alone refreshes, and zero for\n * other refreshes where the transaction itself accounts for the\n * refresh fee.\n */\n amountEffective: AmountString;\n\n refreshInputAmount: AmountString;\n refreshOutputAmount: AmountString;\n}\n\nexport interface DepositTransactionTrackingState {\n // Raw wire transfer identifier of the deposit.\n wireTransferId: string;\n // When was the wire transfer given to the bank.\n timestampExecuted: TalerProtocolTimestamp;\n // Total amount transfer for this wtid (including fees)\n amountRaw: AmountString;\n // Wire fee amount for this exchange\n wireFee: AmountString;\n}\n\n/**\n * Deposit transaction, which effectively sends\n * money from this wallet somewhere else.\n */\nexport interface TransactionDeposit extends TransactionCommon {\n type: TransactionType.Deposit;\n\n depositGroupId: string;\n\n /**\n * Target for the deposit.\n */\n targetPaytoUri: string;\n\n /**\n * Raw amount that is being deposited\n */\n amountRaw: AmountString;\n\n /**\n * Effective amount that is being deposited\n */\n amountEffective: AmountString;\n\n wireTransferDeadline: TalerProtocolTimestamp;\n\n wireTransferProgress: number;\n\n /**\n * Did all the deposit requests succeed?\n */\n deposited: boolean;\n\n trackingState: Array;\n}\n\nexport interface TransactionByIdRequest {\n transactionId: string;\n}\n\nexport const codecForTransactionByIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"TransactionByIdRequest\");\n\nexport interface WithdrawalTransactionByURIRequest {\n talerWithdrawUri: string;\n}\n\nexport const codecForWithdrawalTransactionByURIRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .build(\"WithdrawalTransactionByURIRequest\");\n\nexport const codecForTransactionsRequest = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"scopeInfo\", codecOptional(codecForScopeInfo()))\n .property(\"search\", codecOptional(codecForString()))\n .property(\n \"sort\",\n codecOptional(\n codecForEither(\n codecForConstString(\"ascending\"),\n codecForConstString(\"descending\"),\n codecForConstString(\"stable-ascending\"),\n ),\n ),\n )\n .property(\"includeRefreshes\", codecOptional(codecForBoolean()))\n .build(\"TransactionsRequest\");\n\n// FIXME: do full validation here!\nexport const codecForTransactionsResponse = (): Codec =>\n buildCodecForObject()\n .property(\"transactions\", codecForList(codecForAny()))\n .build(\"TransactionsResponse\");\n\nexport const codecForOrderShortInfo = (): Codec =>\n buildCodecForObject()\n .property(\"contractTermsHash\", codecForString())\n .property(\"fulfillmentMessage\", codecOptional(codecForString()))\n .property(\n \"fulfillmentMessage_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"fulfillmentUrl\", codecOptional(codecForString()))\n .property(\"merchant\", codecForMerchantInfo())\n .property(\"orderId\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .build(\"OrderShortInfo\");\n\nexport interface ListAssociatedRefreshesRequest {\n transactionId: string;\n}\n\nexport const codecForListAssociatedRefreshesRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"ListAssociatedRefreshesRequest\");\n\nexport interface ListAssociatedRefreshesResponse {\n transactionIds: string[];\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Types used by clients of the wallet.\n *\n * These types are defined in a separate file make tree shaking easier, since\n * some components use these types (via RPC) but do not depend on the wallet\n * code directly.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport { AmountJson, codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n buildCodecForUnion,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForEither,\n codecForList,\n codecForMap,\n codecForNumber,\n codecForString,\n codecOptional,\n renderContext,\n} from \"./codec.js\";\nimport {\n AmountString,\n CurrencySpecification,\n EddsaPrivateKeyString,\n InternationalizedString,\n TalerMerchantApi,\n TemplateParams,\n WithdrawalOperationStatus,\n canonicalizeBaseUrl,\n} from \"./index.js\";\nimport { VersionMatchResult } from \"./libtool-version.js\";\nimport { PaytoString, PaytoUri, codecForPaytoString } from \"./payto.js\";\nimport { QrCodeSpec } from \"./qr.js\";\nimport { AgeCommitmentProof } from \"./taler-crypto.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport {\n AbsoluteTime,\n TalerPreciseTimestamp,\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForAbsoluteTime,\n codecForPreciseTimestamp,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AccountRestriction,\n AuditorDenomSig,\n CoinEnvelope,\n DenomKeyType,\n DenominationPubKey,\n ExchangeAuditor,\n ExchangeWireAccount,\n PeerContractTerms,\n UnblindedSignature,\n codecForExchangeWireAccount,\n codecForPeerContractTerms,\n} from \"./types-taler-exchange.js\";\nimport {\n MerchantContractTerms,\n MerchantInfo,\n codecForMerchantContractTerms,\n} from \"./types-taler-merchant.js\";\nimport { BackupRecovery } from \"./types-taler-sync.js\";\nimport {\n OrderShortInfo,\n TransactionState,\n TransactionType,\n} from \"./types-taler-wallet-transactions.js\";\n\n/**\n * Identifier for a transaction in the wallet.\n */\ndeclare const __txId: unique symbol;\nexport type TransactionIdStr = `txn:${string}:${string}` & { [__txId]: true };\n\n/**\n * Identifier for a pending task in the wallet.\n */\ndeclare const __pndId: unique symbol;\nexport type PendingIdStr = `pnd:${string}:${string}` & { [__pndId]: true };\n\ndeclare const __tmbId: unique symbol;\nexport type TombstoneIdStr = `tmb:${string}:${string}` & { [__tmbId]: true };\n\nfunction codecForTransactionIdStr(): Codec {\n return {\n decode(x: any, c?: Context): TransactionIdStr {\n if (typeof x === \"string\" && x.startsWith(\"txn:\")) {\n return x as TransactionIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"txn:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nfunction codecForPendingIdStr(): Codec {\n return {\n decode(x: any, c?: Context): PendingIdStr {\n if (typeof x === \"string\" && x.startsWith(\"txn:\")) {\n return x as PendingIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"txn:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nfunction codecForTombstoneIdStr(): Codec {\n return {\n decode(x: any, c?: Context): TombstoneIdStr {\n if (typeof x === \"string\" && x.startsWith(\"tmb:\")) {\n return x as TombstoneIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"tmb:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nexport function codecForCanonBaseUrl(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n const canon = canonicalizeBaseUrl(x);\n if (x !== canon) {\n throw new DecodingError(\n `expected canonicalized base URL at ${renderContext(\n c,\n )} but got value '${x}'`,\n );\n }\n return x;\n }\n throw new DecodingError(\n `expected base URL at ${renderContext(c)} but got type ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Response for the create reserve request to the wallet.\n */\nexport class CreateReserveResponse {\n /**\n * Exchange URL where the bank should create the reserve.\n * The URL is canonicalized in the response.\n */\n exchange: string;\n\n /**\n * Reserve public key of the newly created reserve.\n */\n reservePub: string;\n}\n\nexport interface GetBalanceDetailRequest {\n currency: string;\n}\n\nexport const codecForGetBalanceDetailRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .build(\"GetBalanceDetailRequest\");\n\n/**\n * How the amount should be interpreted in a transaction\n * Effective = how the balance is change\n * Raw = effective amount without fee\n *\n * Depending on the transaction, raw can be higher than effective\n */\nexport enum TransactionAmountMode {\n Effective = \"effective\",\n Raw = \"raw\",\n}\n\nexport type GetPlanForOperationRequest =\n | GetPlanForWithdrawRequest\n | GetPlanForDepositRequest;\n// | GetPlanForPushDebitRequest\n// | GetPlanForPullCreditRequest\n// | GetPlanForPaymentRequest\n// | GetPlanForTipRequest\n// | GetPlanForRefundRequest\n// | GetPlanForPullDebitRequest\n// | GetPlanForPushCreditRequest;\n\ninterface GetPlanForWalletInitiatedOperation {\n instructedAmount: AmountString;\n mode: TransactionAmountMode;\n}\n\nexport interface ConvertAmountRequest {\n amount: AmountString;\n type: TransactionAmountMode;\n depositPaytoUri: PaytoString;\n}\n\nexport const codecForConvertAmountRequest =\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForPaytoString())\n .property(\n \"type\",\n codecForEither(\n codecForConstString(TransactionAmountMode.Raw),\n codecForConstString(TransactionAmountMode.Effective),\n ),\n )\n .build(\"ConvertAmountRequest\");\n\nexport interface GetAmountRequest {\n currency: string;\n}\n\nexport const codecForGetAmountRequest = buildCodecForObject()\n .property(\"currency\", codecForString())\n .build(\"GetAmountRequest\");\n\ninterface GetPlanToCompleteOperation {\n instructedAmount: AmountString;\n}\n\nconst codecForGetPlanForWalletInitiatedOperation = <\n T extends GetPlanForWalletInitiatedOperation,\n>() =>\n buildCodecForObject()\n .property(\n \"mode\",\n codecForEither(\n codecForConstString(TransactionAmountMode.Raw),\n codecForConstString(TransactionAmountMode.Effective),\n ),\n )\n .property(\"instructedAmount\", codecForAmountString());\n\ninterface GetPlanForWithdrawRequest extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.Withdrawal;\n exchangeUrl?: string;\n}\ninterface GetPlanForDepositRequest extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.Deposit;\n account: string; //payto string\n}\ninterface GetPlanForPushDebitRequest\n extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.PeerPushDebit;\n}\n\ninterface GetPlanForPullCreditRequest\n extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.PeerPullCredit;\n exchangeUrl: string;\n}\n\nconst codecForGetPlanForWithdrawRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.Withdrawal))\n .property(\"exchangeUrl\", codecOptional(codecForString()))\n .build(\"GetPlanForWithdrawRequest\");\n\nconst codecForGetPlanForDepositRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.Deposit))\n .property(\"account\", codecForString())\n .build(\"GetPlanForDepositRequest\");\n\nconst codecForGetPlanForPushDebitRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.PeerPushDebit))\n .build(\"GetPlanForPushDebitRequest\");\n\nconst codecForGetPlanForPullCreditRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.PeerPullCredit))\n .property(\"exchangeUrl\", codecForString())\n .build(\"GetPlanForPullCreditRequest\");\n\ninterface GetPlanForPaymentRequest extends GetPlanToCompleteOperation {\n type: TransactionType.Payment;\n wireMethod: string;\n ageRestriction: number;\n maxDepositFee: AmountString;\n}\n\ninterface GetPlanForPullDebitRequest extends GetPlanToCompleteOperation {\n type: TransactionType.PeerPullDebit;\n}\n\ninterface GetPlanForPushCreditRequest extends GetPlanToCompleteOperation {\n type: TransactionType.PeerPushCredit;\n}\n\nconst codecForGetPlanForPaymentRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.Payment))\n .property(\"maxDepositFee\", codecForAmountString())\n .build(\"GetPlanForPaymentRequest\");\n\nconst codecForGetPlanForPullDebitRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.PeerPullDebit))\n .build(\"GetPlanForPullDebitRequest\");\n\nconst codecForGetPlanForPushCreditRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.PeerPushCredit))\n .build(\"GetPlanForPushCreditRequest\");\n\nexport const codecForGetPlanForOperationRequest =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n TransactionType.Withdrawal,\n codecForGetPlanForWithdrawRequest,\n )\n .alternative(TransactionType.Deposit, codecForGetPlanForDepositRequest)\n // .alternative(\n // TransactionType.PeerPushDebit,\n // codecForGetPlanForPushDebitRequest,\n // )\n // .alternative(\n // TransactionType.PeerPullCredit,\n // codecForGetPlanForPullCreditRequest,\n // )\n // .alternative(TransactionType.Payment, codecForGetPlanForPaymentRequest)\n // .alternative(\n // TransactionType.PeerPullDebit,\n // codecForGetPlanForPullDebitRequest,\n // )\n // .alternative(\n // TransactionType.PeerPushCredit,\n // codecForGetPlanForPushCreditRequest,\n // )\n .build(\"GetPlanForOperationRequest\");\n\nexport interface GetPlanForOperationResponse {\n effectiveAmount: AmountString;\n rawAmount: AmountString;\n counterPartyAmount?: AmountString;\n details: any;\n}\n\nexport const codecForGetPlanForOperationResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"effectiveAmount\", codecForAmountString())\n .property(\"rawAmount\", codecForAmountString())\n .property(\"details\", codecForAny())\n .property(\"counterPartyAmount\", codecOptional(codecForAmountString()))\n .build(\"GetPlanForOperationResponse\");\n\nexport interface AmountResponse {\n effectiveAmount: AmountString;\n rawAmount: AmountString;\n}\n\nexport const codecForAmountResponse = (): Codec =>\n buildCodecForObject()\n .property(\"effectiveAmount\", codecForAmountString())\n .property(\"rawAmount\", codecForAmountString())\n .build(\"AmountResponse\");\n\nexport enum BalanceFlag {\n IncomingKyc = \"incoming-kyc\",\n IncomingAml = \"incoming-aml\",\n IncomingConfirmation = \"incoming-confirmation\",\n OutgoingKyc = \"outgoing-kyc\",\n}\n\nexport interface WalletBalance {\n scopeInfo: ScopeInfo;\n available: AmountString;\n pendingIncoming: AmountString;\n pendingOutgoing: AmountString;\n\n /**\n * Does the balance for this currency have a pending\n * transaction?\n *\n * @deprecated use flags and pendingIncoming/pendingOutgoing instead\n */\n hasPendingTransactions: boolean;\n\n /**\n * Is there a transaction that requires user input?\n *\n * @deprecated use flags instead\n */\n requiresUserInput: boolean;\n\n flags: BalanceFlag[];\n}\n\nexport const codecForScopeInfoGlobal = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Global))\n .build(\"ScopeInfoGlobal\");\n\nexport const codecForScopeInfoExchange = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Exchange))\n .property(\"url\", codecForString())\n .build(\"ScopeInfoExchange\");\n\nexport const codecForScopeInfoAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Auditor))\n .property(\"url\", codecForString())\n .build(\"ScopeInfoAuditor\");\n\nexport const codecForScopeInfo = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(ScopeType.Global, codecForScopeInfoGlobal())\n .alternative(ScopeType.Exchange, codecForScopeInfoExchange())\n .alternative(ScopeType.Auditor, codecForScopeInfoAuditor())\n .build(\"ScopeInfo\");\n\nexport interface GetCurrencySpecificationRequest {\n scope: ScopeInfo;\n}\n\nexport const codecForGetCurrencyInfoRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"scope\", codecForScopeInfo())\n .build(\"GetCurrencySpecificationRequest\");\n\nexport interface ListExchangesForScopedCurrencyRequest {\n scope: ScopeInfo;\n}\n\nexport const codecForListExchangesForScopedCurrencyRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"scope\", codecForScopeInfo())\n .build(\"ListExchangesForScopedCurrencyRequest\");\n\nexport interface GetCurrencySpecificationResponse {\n currencySpecification: CurrencySpecification;\n}\n\nexport interface BuiltinExchange {\n exchangeBaseUrl: string;\n currencyHint: string;\n}\n\nexport interface PartialWalletRunConfig {\n builtin?: Partial;\n testing?: Partial;\n features?: Partial;\n lazyTaskLoop?: Partial;\n}\n\nexport interface WalletRunConfig {\n /**\n * Initialization values useful for a complete startup.\n *\n * These are values may be overridden by different wallets\n */\n builtin: {\n exchanges: BuiltinExchange[];\n };\n\n /**\n * Unsafe options which it should only be used to create\n * testing environment.\n */\n testing: {\n /**\n * Allow withdrawal of denominations even though they are about to expire.\n */\n denomselAllowLate: boolean;\n devModeActive: boolean;\n insecureTrustExchange: boolean;\n preventThrottling: boolean;\n skipDefaults: boolean;\n emitObservabilityEvents?: boolean;\n };\n\n /**\n * Configurations values that may be safe to show to the user\n */\n features: {\n allowHttp: boolean;\n };\n\n /**\n * Start processing tasks only when explicitly required, even after\n * init has been called.\n *\n * Useful when the wallet is started to make single read-only request,\n * as otherwise wallet-core starts making network request and process\n * unrelated pending tasks.\n */\n lazyTaskLoop: boolean;\n}\n\nexport interface InitRequest {\n config?: PartialWalletRunConfig;\n}\n\nexport const codecForInitRequest = (): Codec =>\n buildCodecForObject()\n .property(\"config\", codecForAny())\n .build(\"InitRequest\");\n\nexport interface InitResponse {\n versionInfo: WalletCoreVersion;\n}\n\nexport enum ScopeType {\n Global = \"global\",\n Exchange = \"exchange\",\n Auditor = \"auditor\",\n}\n\nexport type ScopeInfoGlobal = { type: ScopeType.Global; currency: string };\n\nexport type ScopeInfoExchange = {\n type: ScopeType.Exchange;\n currency: string;\n url: string;\n};\n\nexport type ScopeInfoAuditor = {\n type: ScopeType.Auditor;\n currency: string;\n url: string;\n};\n\nexport type ScopeInfo = ScopeInfoGlobal | ScopeInfoExchange | ScopeInfoAuditor;\n\n/**\n * Encode scope info as a string.\n *\n * Format must be stable as it's used in the database.\n */\nexport function stringifyScopeInfo(si: ScopeInfo): string {\n switch (si.type) {\n case ScopeType.Global:\n return `taler-si:global/${si.currency}}`;\n case ScopeType.Auditor:\n return `taler-si:auditor/${si.currency}/${encodeURIComponent(si.url)}`;\n case ScopeType.Exchange:\n return `taler-si:exchange/${si.currency}/${encodeURIComponent(si.url)}`;\n }\n}\n\nexport interface BalancesResponse {\n balances: WalletBalance[];\n}\n\nexport const codecForBalance = (): Codec =>\n buildCodecForObject()\n .property(\"scopeInfo\", codecForAny()) // FIXME\n .property(\"available\", codecForAmountString())\n .property(\"hasPendingTransactions\", codecForBoolean())\n .property(\"pendingIncoming\", codecForAmountString())\n .property(\"pendingOutgoing\", codecForAmountString())\n .property(\"requiresUserInput\", codecForBoolean())\n .property(\"flags\", codecForAny()) // FIXME\n .build(\"Balance\");\n\nexport const codecForBalancesResponse = (): Codec =>\n buildCodecForObject()\n .property(\"balances\", codecForList(codecForBalance()))\n .build(\"BalancesResponse\");\n\n/**\n * For terseness.\n */\nexport function mkAmount(\n value: number,\n fraction: number,\n currency: string,\n): AmountJson {\n return { value, fraction, currency };\n}\n\n/**\n * Status of a coin.\n */\nexport enum CoinStatus {\n /**\n * Withdrawn and never shown to anybody.\n */\n Fresh = \"fresh\",\n\n /**\n * Coin was lost as the denomination is not usable anymore.\n */\n DenomLoss = \"denom-loss\",\n\n /**\n * Fresh, but currently marked as \"suspended\", thus won't be used\n * for spending. Used for testing.\n */\n FreshSuspended = \"fresh-suspended\",\n\n /**\n * A coin that has been spent and refreshed.\n */\n Dormant = \"dormant\",\n}\n\nexport type WalletCoinHistoryItem =\n | {\n type: \"withdraw\";\n transactionId: TransactionIdStr;\n }\n | {\n type: \"spend\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"refresh\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"recoup\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"refund\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n };\n\n/**\n * Easy to process format for the public data of coins\n * managed by the wallet.\n */\nexport interface CoinDumpJson {\n coins: Array<{\n /**\n * The coin's denomination's public key.\n */\n denomPub: DenominationPubKey;\n /**\n * Hash of denom_pub.\n */\n denomPubHash: string;\n /**\n * Value of the denomination (without any fees).\n */\n denomValue: string;\n /**\n * Public key of the coin.\n */\n coinPub: string;\n /**\n * Base URL of the exchange for the coin.\n */\n exchangeBaseUrl: string;\n /**\n * Public key of the parent coin.\n * Only present if this coin was obtained via refreshing.\n */\n refreshParentCoinPub: string | undefined;\n /**\n * Public key of the reserve for this coin.\n * Only present if this coin was obtained via refreshing.\n */\n withdrawalReservePub: string | undefined;\n /**\n * Status of the coin.\n */\n coinStatus: CoinStatus;\n /**\n * Information about the age restriction\n */\n ageCommitmentProof: AgeCommitmentProof | undefined;\n history: WalletCoinHistoryItem[];\n }>;\n}\n\nexport enum ConfirmPayResultType {\n Done = \"done\",\n Pending = \"pending\",\n}\n\n/**\n * Result for confirmPay\n */\nexport interface ConfirmPayResultDone {\n type: ConfirmPayResultType.Done;\n contractTerms: MerchantContractTerms;\n transactionId: TransactionIdStr;\n}\n\nexport interface ConfirmPayResultPending {\n type: ConfirmPayResultType.Pending;\n transactionId: TransactionIdStr;\n lastError: TalerErrorDetail | undefined;\n}\n\nexport const codecForTalerErrorDetail = (): Codec =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"when\", codecOptional(codecForAbsoluteTime))\n .property(\"hint\", codecOptional(codecForString()))\n .build(\"TalerErrorDetail\");\n\nexport type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending;\n\nexport const codecForConfirmPayResultPending =\n (): Codec =>\n buildCodecForObject()\n .property(\"lastError\", codecOptional(codecForTalerErrorDetail()))\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"type\", codecForConstString(ConfirmPayResultType.Pending))\n .build(\"ConfirmPayResultPending\");\n\nexport const codecForConfirmPayResultDone = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(ConfirmPayResultType.Done))\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"contractTerms\", codecForMerchantContractTerms())\n .build(\"ConfirmPayResultDone\");\n\nexport const codecForConfirmPayResult = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n ConfirmPayResultType.Pending,\n codecForConfirmPayResultPending(),\n )\n .alternative(ConfirmPayResultType.Done, codecForConfirmPayResultDone())\n .build(\"ConfirmPayResult\");\n\n/**\n * Information about all sender wire details known to the wallet,\n * as well as exchanges that accept these wire types.\n */\nexport interface SenderWireInfos {\n /**\n * Mapping from exchange base url to list of accepted\n * wire types.\n */\n exchangeWireTypes: { [exchangeBaseUrl: string]: string[] };\n\n /**\n * Sender wire information stored in the wallet.\n */\n senderWires: string[];\n}\n\n/**\n * Request to mark a reserve as confirmed.\n */\nexport interface ConfirmReserveRequest {\n /**\n * Public key of then reserve that should be marked\n * as confirmed.\n */\n reservePub: string;\n}\n\nexport const codecForConfirmReserveRequest = (): Codec =>\n buildCodecForObject()\n .property(\"reservePub\", codecForString())\n .build(\"ConfirmReserveRequest\");\n\nexport interface PrepareRefundResult {\n proposalId: string;\n\n effectivePaid: AmountString;\n gone: AmountString;\n granted: AmountString;\n pending: boolean;\n awaiting: AmountString;\n\n info: OrderShortInfo;\n}\n\nexport interface BenchmarkResult {\n time: { [s: string]: number };\n repetitions: number;\n}\n\nexport enum PreparePayResultType {\n PaymentPossible = \"payment-possible\",\n InsufficientBalance = \"insufficient-balance\",\n AlreadyConfirmed = \"already-confirmed\",\n}\n\nexport const codecForPreparePayResultPaymentPossible =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountEffective\", codecForAmountString())\n .property(\"amountRaw\", codecForAmountString())\n .property(\"contractTerms\", codecForMerchantContractTerms())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"proposalId\", codecForString())\n .property(\"contractTermsHash\", codecForString())\n .property(\"talerUri\", codecForString())\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.PaymentPossible),\n )\n .build(\"PreparePayResultPaymentPossible\");\n\nexport interface BalanceDetails {}\n\n/**\n * Detailed reason for why the wallet's balance is insufficient.\n */\nexport interface PaymentInsufficientBalanceDetails {\n /**\n * Amount requested by the merchant.\n */\n amountRequested: AmountString;\n\n /**\n * Balance of type \"available\" (see balance.ts for definition).\n */\n balanceAvailable: AmountString;\n\n /**\n * Balance of type \"material\" (see balance.ts for definition).\n */\n balanceMaterial: AmountString;\n\n /**\n * Balance of type \"age-acceptable\" (see balance.ts for definition).\n */\n balanceAgeAcceptable: AmountString;\n\n /**\n * Balance of type \"merchant-acceptable\" (see balance.ts for definition).\n */\n balanceReceiverAcceptable: AmountString;\n\n /**\n * Balance of type \"merchant-depositable\" (see balance.ts for definition).\n */\n balanceReceiverDepositable: AmountString;\n\n balanceExchangeDepositable: AmountString;\n\n /**\n * Maximum effective amount that the wallet can spend,\n * when all fees are paid by the wallet.\n */\n maxEffectiveSpendAmount: AmountString;\n\n perExchange: {\n [url: string]: {\n balanceAvailable: AmountString;\n balanceMaterial: AmountString;\n balanceExchangeDepositable: AmountString;\n balanceAgeAcceptable: AmountString;\n balanceReceiverAcceptable: AmountString;\n balanceReceiverDepositable: AmountString;\n maxEffectiveSpendAmount: AmountString;\n /**\n * Exchange doesn't have global fees configured for the relevant year,\n * p2p payments aren't possible.\n */\n missingGlobalFees: boolean;\n };\n };\n}\n\nexport const codecForPayMerchantInsufficientBalanceDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountRequested\", codecForAmountString())\n .property(\"balanceAgeAcceptable\", codecForAmountString())\n .property(\"balanceAvailable\", codecForAmountString())\n .property(\"balanceMaterial\", codecForAmountString())\n .property(\"balanceReceiverAcceptable\", codecForAmountString())\n .property(\"balanceReceiverDepositable\", codecForAmountString())\n .property(\"balanceExchangeDepositable\", codecForAmountString())\n .property(\"perExchange\", codecForAny())\n .property(\"maxEffectiveSpendAmount\", codecForAmountString())\n .build(\"PayMerchantInsufficientBalanceDetails\");\n\nexport const codecForPreparePayResultInsufficientBalance =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountRaw\", codecForAmountString())\n .property(\"contractTerms\", codecForAny())\n .property(\"talerUri\", codecForString())\n .property(\"proposalId\", codecForString())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.InsufficientBalance),\n )\n .property(\n \"balanceDetails\",\n codecForPayMerchantInsufficientBalanceDetails(),\n )\n .build(\"PreparePayResultInsufficientBalance\");\n\nexport const codecForPreparePayResultAlreadyConfirmed =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.AlreadyConfirmed),\n )\n .property(\"amountEffective\", codecOptional(codecForAmountString()))\n .property(\"amountRaw\", codecForAmountString())\n .property(\"paid\", codecForBoolean())\n .property(\"talerUri\", codecForString())\n .property(\"contractTerms\", codecForAny())\n .property(\"contractTermsHash\", codecForString())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"proposalId\", codecForString())\n .build(\"PreparePayResultAlreadyConfirmed\");\n\nexport const codecForPreparePayResult = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"status\")\n .alternative(\n PreparePayResultType.AlreadyConfirmed,\n codecForPreparePayResultAlreadyConfirmed(),\n )\n .alternative(\n PreparePayResultType.InsufficientBalance,\n codecForPreparePayResultInsufficientBalance(),\n )\n .alternative(\n PreparePayResultType.PaymentPossible,\n codecForPreparePayResultPaymentPossible(),\n )\n .build(\"PreparePayResult\");\n\n/**\n * Result of a prepare pay operation.\n */\nexport type PreparePayResult =\n | PreparePayResultInsufficientBalance\n | PreparePayResultAlreadyConfirmed\n | PreparePayResultPaymentPossible;\n\n/**\n * Payment is possible.\n */\nexport interface PreparePayResultPaymentPossible {\n status: PreparePayResultType.PaymentPossible;\n transactionId: TransactionIdStr;\n /**\n * @deprecated use transactionId instead\n */\n proposalId: string;\n contractTerms: MerchantContractTerms;\n contractTermsHash: string;\n amountRaw: AmountString;\n amountEffective: AmountString;\n talerUri: string;\n}\n\nexport interface PreparePayResultInsufficientBalance {\n status: PreparePayResultType.InsufficientBalance;\n transactionId: TransactionIdStr;\n /**\n * @deprecated use transactionId\n */\n proposalId: string;\n contractTerms: MerchantContractTerms;\n amountRaw: AmountString;\n talerUri: string;\n balanceDetails: PaymentInsufficientBalanceDetails;\n}\n\nexport interface PreparePayResultAlreadyConfirmed {\n status: PreparePayResultType.AlreadyConfirmed;\n transactionId: TransactionIdStr;\n contractTerms: MerchantContractTerms;\n paid: boolean;\n amountRaw: AmountString;\n amountEffective: AmountString | undefined;\n contractTermsHash: string;\n /**\n * @deprecated use transactionId\n */\n proposalId: string;\n talerUri: string;\n}\n\nexport interface BankWithdrawDetails {\n status: WithdrawalOperationStatus;\n currency: string;\n amount: AmountJson | undefined;\n editableAmount: boolean;\n maxAmount: AmountJson | undefined;\n wireFee: AmountJson | undefined;\n senderWire?: string;\n exchange?: string;\n editableExchange: boolean;\n confirmTransferUrl?: string;\n wireTypes: string[];\n operationId: string;\n apiBaseUrl: string;\n}\n\nexport interface AcceptWithdrawalResponse {\n reservePub: string;\n confirmTransferUrl?: string;\n transactionId: TransactionIdStr;\n}\n\n/**\n * Details about a purchase, including refund status.\n */\nexport interface PurchaseDetails {\n contractTerms: Record;\n hasRefund: boolean;\n totalRefundAmount: AmountJson;\n totalRefundAndRefreshFees: AmountJson;\n}\n\nexport interface WalletDiagnostics {\n walletManifestVersion: string;\n walletManifestDisplayVersion: string;\n errors: string[];\n firefoxIdbProblem: boolean;\n dbOutdated: boolean;\n}\n\nexport interface TalerErrorDetail {\n code: TalerErrorCode;\n when?: AbsoluteTime;\n hint?: string;\n [x: string]: unknown;\n}\n\n/**\n * Minimal information needed about a planchet for unblinding a signature.\n *\n * Can be a withdrawal/refresh planchet.\n */\nexport interface PlanchetUnblindInfo {\n denomPub: DenominationPubKey;\n blindingKey: string;\n}\n\nexport interface WithdrawalPlanchet {\n coinPub: string;\n coinPriv: string;\n reservePub: string;\n denomPubHash: string;\n denomPub: DenominationPubKey;\n blindingKey: string;\n withdrawSig: string;\n coinEv: CoinEnvelope;\n coinValue: AmountJson;\n coinEvHash: string;\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\nexport interface PlanchetCreationRequest {\n secretSeed: string;\n coinIndex: number;\n value: AmountJson;\n feeWithdraw: AmountJson;\n denomPub: DenominationPubKey;\n reservePub: string;\n reservePriv: string;\n restrictAge?: number;\n}\n\n/**\n * Reasons for why a coin is being refreshed.\n */\nexport enum RefreshReason {\n Manual = \"manual\",\n PayMerchant = \"pay-merchant\",\n PayDeposit = \"pay-deposit\",\n PayPeerPush = \"pay-peer-push\",\n PayPeerPull = \"pay-peer-pull\",\n Refund = \"refund\",\n AbortPay = \"abort-pay\",\n AbortDeposit = \"abort-deposit\",\n AbortPeerPushDebit = \"abort-peer-push-debit\",\n AbortPeerPullDebit = \"abort-peer-pull-debit\",\n Recoup = \"recoup\",\n BackupRestored = \"backup-restored\",\n Scheduled = \"scheduled\",\n}\n\n/**\n * Request to refresh a single coin.\n */\nexport interface CoinRefreshRequest {\n readonly coinPub: string;\n readonly amount: AmountString;\n}\n\n/**\n * Private data required to make a deposit permission.\n */\nexport interface DepositInfo {\n exchangeBaseUrl: string;\n contractTermsHash: string;\n coinPub: string;\n coinPriv: string;\n spendAmount: AmountJson;\n timestamp: TalerProtocolTimestamp;\n refundDeadline: TalerProtocolTimestamp;\n merchantPub: string;\n feeDeposit: AmountJson;\n wireInfoHash: string;\n denomKeyType: DenomKeyType;\n denomPubHash: string;\n denomSig: UnblindedSignature;\n\n requiredMinimumAge?: number;\n\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\nexport interface ExchangesShortListResponse {\n exchanges: ShortExchangeListItem[];\n}\n\nexport interface ExchangesListResponse {\n exchanges: ExchangeListItem[];\n}\n\nexport interface ExchangeDetailedResponse {\n exchange: ExchangeFullDetails;\n}\n\nexport interface WalletCoreVersion {\n implementationSemver: string;\n implementationGitHash: string;\n\n /**\n * Wallet-core protocol version supported by this implementation\n * of the API (\"server\" version).\n */\n version: string;\n exchange: string;\n merchant: string;\n\n bankIntegrationApiRange: string;\n bankConversionApiRange: string;\n corebankApiRange: string;\n\n /**\n * @deprecated as bank was split into multiple APIs with separate versioning\n */\n bank: string;\n\n /**\n * @deprecated\n */\n hash: string | undefined;\n\n /**\n * @deprecated will be removed\n */\n devMode: boolean;\n}\n\nexport interface KnownBankAccountsInfo {\n uri: PaytoUri;\n kyc_completed: boolean;\n currency: string;\n alias: string;\n}\n\nexport interface KnownBankAccounts {\n accounts: KnownBankAccountsInfo[];\n}\n\n/**\n * Wire fee for one wire method\n */\nexport interface WireFee {\n /**\n * Fee for wire transfers.\n */\n wireFee: AmountString;\n\n /**\n * Fees to close and refund a reserve.\n */\n closingFee: AmountString;\n\n /**\n * Start date of the fee.\n */\n startStamp: TalerProtocolTimestamp;\n\n /**\n * End date of the fee.\n */\n endStamp: TalerProtocolTimestamp;\n\n /**\n * Signature made by the exchange master key.\n */\n sig: string;\n}\n\nexport type WireFeeMap = { [wireMethod: string]: WireFee[] };\n\nexport interface WireInfo {\n feesForType: WireFeeMap;\n accounts: ExchangeWireAccount[];\n}\n\nexport interface ExchangeGlobalFees {\n startDate: TalerProtocolTimestamp;\n endDate: TalerProtocolTimestamp;\n\n historyFee: AmountString;\n accountFee: AmountString;\n purseFee: AmountString;\n\n historyTimeout: TalerProtocolDuration;\n purseTimeout: TalerProtocolDuration;\n\n purseLimit: number;\n\n signature: string;\n}\n\nconst codecForWireFee = (): Codec =>\n buildCodecForObject()\n .property(\"sig\", codecForString())\n .property(\"wireFee\", codecForAmountString())\n .property(\"closingFee\", codecForAmountString())\n .property(\"startStamp\", codecForTimestamp)\n .property(\"endStamp\", codecForTimestamp)\n .build(\"codecForWireFee\");\n\nconst codecForWireInfo = (): Codec =>\n buildCodecForObject()\n .property(\"feesForType\", codecForMap(codecForList(codecForWireFee())))\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .build(\"codecForWireInfo\");\n\nexport interface DenominationInfo {\n /**\n * Value of one coin of the denomination.\n */\n value: AmountString;\n\n /**\n * Hash of the denomination public key.\n * Stored in the database for faster lookups.\n */\n denomPubHash: string;\n\n denomPub: DenominationPubKey;\n\n /**\n * Fee for withdrawing.\n */\n feeWithdraw: AmountString;\n\n /**\n * Fee for depositing.\n */\n feeDeposit: AmountString;\n\n /**\n * Fee for refreshing.\n */\n feeRefresh: AmountString;\n\n /**\n * Fee for refunding.\n */\n feeRefund: AmountString;\n\n /**\n * Validity start date of the denomination.\n */\n stampStart: TalerProtocolTimestamp;\n\n /**\n * Date after which the currency can't be withdrawn anymore.\n */\n stampExpireWithdraw: TalerProtocolTimestamp;\n\n /**\n * Date after the denomination officially doesn't exist anymore.\n */\n stampExpireLegal: TalerProtocolTimestamp;\n\n /**\n * Data after which coins of this denomination can't be deposited anymore.\n */\n stampExpireDeposit: TalerProtocolTimestamp;\n\n exchangeBaseUrl: string;\n}\n\nexport type DenomOperation = \"deposit\" | \"withdraw\" | \"refresh\" | \"refund\";\nexport type DenomOperationMap = { [op in DenomOperation]: T };\n\nexport interface FeeDescription {\n group: string;\n from: AbsoluteTime;\n until: AbsoluteTime;\n fee?: AmountString;\n}\n\nexport interface FeeDescriptionPair {\n group: string;\n from: AbsoluteTime;\n until: AbsoluteTime;\n left?: AmountString;\n right?: AmountString;\n}\n\nexport interface TimePoint {\n id: string;\n group: string;\n fee: AmountString;\n type: \"start\" | \"end\";\n moment: AbsoluteTime;\n denom: T;\n}\n\nexport interface ExchangeFullDetails {\n exchangeBaseUrl: string;\n currency: string;\n paytoUris: string[];\n auditors: ExchangeAuditor[];\n wireInfo: WireInfo;\n denomFees: DenomOperationMap;\n transferFees: Record;\n globalFees: FeeDescription[];\n}\n\nexport enum ExchangeTosStatus {\n Pending = \"pending\",\n Proposed = \"proposed\",\n Accepted = \"accepted\",\n MissingTos = \"missing-tos\",\n}\n\nexport enum ExchangeEntryStatus {\n Preset = \"preset\",\n Ephemeral = \"ephemeral\",\n Used = \"used\",\n}\n\nexport enum ExchangeUpdateStatus {\n Initial = \"initial\",\n InitialUpdate = \"initial-update\",\n Suspended = \"suspended\",\n UnavailableUpdate = \"unavailable-update\",\n Ready = \"ready\",\n ReadyUpdate = \"ready-update\",\n OutdatedUpdate = \"outdated-update\",\n}\n\nexport interface OperationErrorInfo {\n error: TalerErrorDetail;\n}\n\nexport interface ShortExchangeListItem {\n exchangeBaseUrl: string;\n}\n\n/**\n * Info about an exchange entry in the wallet.\n */\nexport interface ExchangeListItem {\n exchangeBaseUrl: string;\n masterPub: string | undefined;\n currency: string;\n paytoUris: string[];\n tosStatus: ExchangeTosStatus;\n exchangeEntryStatus: ExchangeEntryStatus;\n exchangeUpdateStatus: ExchangeUpdateStatus;\n ageRestrictionOptions: number[];\n\n /**\n * P2P payments are disabled with this exchange\n * (e.g. because no global fees are configured).\n */\n peerPaymentsDisabled: boolean;\n\n /**\n * Set to true if this exchange doesn't charge any fees.\n */\n noFees: boolean;\n\n scopeInfo: ScopeInfo;\n\n lastUpdateTimestamp: TalerPreciseTimestamp | undefined;\n\n /**\n * Information about the last error that occurred when trying\n * to update the exchange info.\n */\n lastUpdateErrorInfo?: OperationErrorInfo;\n\n unavailableReason?: TalerErrorDetail;\n}\n\nconst codecForAuditorDenomSig = (): Codec =>\n buildCodecForObject()\n .property(\"denom_pub_h\", codecForString())\n .property(\"auditor_sig\", codecForString())\n .build(\"AuditorDenomSig\");\n\nconst codecForExchangeAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"auditor_pub\", codecForString())\n .property(\"auditor_url\", codecForString())\n .property(\"denomination_keys\", codecForList(codecForAuditorDenomSig()))\n .build(\"codecForExchangeAuditor\");\n\nexport const codecForFeeDescriptionPair = (): Codec =>\n buildCodecForObject()\n .property(\"group\", codecForString())\n .property(\"from\", codecForAbsoluteTime)\n .property(\"until\", codecForAbsoluteTime)\n .property(\"left\", codecOptional(codecForAmountString()))\n .property(\"right\", codecOptional(codecForAmountString()))\n .build(\"FeeDescriptionPair\");\n\nexport const codecForFeeDescription = (): Codec =>\n buildCodecForObject()\n .property(\"group\", codecForString())\n .property(\"from\", codecForAbsoluteTime)\n .property(\"until\", codecForAbsoluteTime)\n .property(\"fee\", codecOptional(codecForAmountString()))\n .build(\"FeeDescription\");\n\nexport const codecForFeesByOperations = (): Codec<\n DenomOperationMap\n> =>\n buildCodecForObject>()\n .property(\"deposit\", codecForList(codecForFeeDescription()))\n .property(\"withdraw\", codecForList(codecForFeeDescription()))\n .property(\"refresh\", codecForList(codecForFeeDescription()))\n .property(\"refund\", codecForList(codecForFeeDescription()))\n .build(\"DenomOperationMap\");\n\nexport const codecForExchangeFullDetails = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"paytoUris\", codecForList(codecForString()))\n .property(\"auditors\", codecForList(codecForExchangeAuditor()))\n .property(\"wireInfo\", codecForWireInfo())\n .property(\"denomFees\", codecForFeesByOperations())\n .property(\n \"transferFees\",\n codecForMap(codecForList(codecForFeeDescription())),\n )\n .property(\"globalFees\", codecForList(codecForFeeDescription()))\n .build(\"ExchangeFullDetails\");\n\nexport const codecForExchangeListItem = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"masterPub\", codecOptional(codecForString()))\n .property(\"paytoUris\", codecForList(codecForString()))\n .property(\"tosStatus\", codecForAny())\n .property(\"exchangeEntryStatus\", codecForAny())\n .property(\"exchangeUpdateStatus\", codecForAny())\n .property(\"ageRestrictionOptions\", codecForList(codecForNumber()))\n .property(\"scopeInfo\", codecForScopeInfo())\n .property(\"lastUpdateErrorInfo\", codecForAny())\n .property(\"lastUpdateTimestamp\", codecOptional(codecForPreciseTimestamp))\n .property(\"noFees\", codecForBoolean())\n .property(\"peerPaymentsDisabled\", codecForBoolean())\n .build(\"ExchangeListItem\");\n\nexport const codecForExchangesListResponse = (): Codec =>\n buildCodecForObject()\n .property(\"exchanges\", codecForList(codecForExchangeListItem()))\n .build(\"ExchangesListResponse\");\n\nexport interface AcceptManualWithdrawalResult {\n /**\n * Payto URIs that can be used to fund the withdrawal.\n *\n * @deprecated in favor of withdrawalAccountsList\n */\n exchangePaytoUris: string[];\n\n /**\n * Public key of the newly created reserve.\n */\n reservePub: string;\n\n withdrawalAccountsList: WithdrawalExchangeAccountDetails[];\n\n transactionId: TransactionIdStr;\n}\n\nexport interface WithdrawalDetailsForAmount {\n /**\n * Did the user accept the current version of the exchange's\n * terms of service?\n *\n * @deprecated the client should query the exchange entry instead\n */\n tosAccepted: boolean;\n\n /**\n * Amount that the user will transfer to the exchange.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that will be added to the user's wallet balance.\n */\n amountEffective: AmountString;\n\n /**\n * Number of coins that would be used for withdrawal.\n *\n * The UIs should warn if this number is too high (roughly at >100).\n */\n numCoins: number;\n\n /**\n * Ways to pay the exchange.\n *\n * @deprecated in favor of withdrawalAccountsList\n */\n paytoUris: string[];\n\n /**\n * Ways to pay the exchange, including accounts that require currency conversion.\n */\n withdrawalAccountsList: WithdrawalExchangeAccountDetails[];\n\n /**\n * If the exchange supports age-restricted coins it will return\n * the array of ages.\n */\n ageRestrictionOptions?: number[];\n\n /**\n * Scope info of the currency withdrawn.\n */\n scopeInfo: ScopeInfo;\n}\n\nexport interface DenomSelItem {\n denomPubHash: string;\n count: number;\n /**\n * Number of denoms/planchets to skip, because\n * a re-denomination effectively deleted them.\n */\n skip?: number;\n}\n\n/**\n * Selected denominations withn some extra info.\n */\nexport interface DenomSelectionState {\n totalCoinValue: AmountString;\n totalWithdrawCost: AmountString;\n selectedDenoms: DenomSelItem[];\n earliestDepositExpiration: TalerProtocolTimestamp;\n hasDenomWithAgeRestriction: boolean;\n}\n\n/**\n * Information about what will happen doing a withdrawal.\n *\n * Sent to the wallet frontend to be rendered and shown to the user.\n */\nexport interface ExchangeWithdrawalDetails {\n exchangePaytoUris: string[];\n\n /**\n * Filtered wire info to send to the bank.\n */\n exchangeWireAccounts: string[];\n\n exchangeCreditAccountDetails: WithdrawalExchangeAccountDetails[];\n\n /**\n * Selected denominations for withdraw.\n */\n selectedDenoms: DenomSelectionState;\n\n /**\n * Did the user already accept the current terms of service for the exchange?\n */\n termsOfServiceAccepted: boolean;\n\n /**\n * The earliest deposit expiration of the selected coins.\n */\n earliestDepositExpiration: TalerProtocolTimestamp;\n\n /**\n * Result of checking the wallet's version\n * against the exchange's version.\n *\n * Older exchanges don't return version information.\n */\n versionMatch: VersionMatchResult | undefined;\n\n /**\n * Libtool-style version string for the exchange or \"unknown\"\n * for older exchanges.\n */\n exchangeVersion: string;\n\n /**\n * Libtool-style version string for the wallet.\n */\n walletVersion: string;\n\n /**\n * Amount that will be subtracted from the reserve's balance.\n */\n withdrawalAmountRaw: AmountString;\n\n /**\n * Amount that will actually be added to the wallet's balance.\n */\n withdrawalAmountEffective: AmountString;\n\n /**\n * If the exchange supports age-restricted coins it will return\n * the array of ages.\n *\n */\n ageRestrictionOptions?: number[];\n\n scopeInfo: ScopeInfo;\n}\n\nexport interface GetExchangeTosResult {\n /**\n * Markdown version of the current ToS.\n */\n content: string;\n\n /**\n * Version tag of the current ToS.\n */\n currentEtag: string;\n\n /**\n * Version tag of the last ToS that the user has accepted,\n * if any.\n */\n acceptedEtag: string | undefined;\n\n /**\n * Accepted content type\n */\n contentType: string;\n\n /**\n * Language of the returned content.\n *\n * If missing, language is unknown.\n */\n contentLanguage: string | undefined;\n\n /**\n * Available languages as advertised by the exchange.\n */\n tosAvailableLanguages: string[];\n\n tosStatus: ExchangeTosStatus;\n}\n\nexport interface TestPayArgs {\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n amount: AmountString;\n summary: string;\n forcedCoinSel?: ForcedCoinSel;\n}\n\nexport const codecForTestPayArgs = (): Codec =>\n buildCodecForObject()\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"amount\", codecForAmountString())\n .property(\"summary\", codecForString())\n .property(\"forcedCoinSel\", codecForAny())\n .build(\"TestPayArgs\");\n\nexport interface IntegrationTestArgs {\n exchangeBaseUrl: string;\n corebankApiBaseUrl: string;\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n amountToWithdraw: AmountString;\n amountToSpend: AmountString;\n}\n\nexport const codecForIntegrationTestArgs = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"amountToSpend\", codecForAmountString())\n .property(\"amountToWithdraw\", codecForAmountString())\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"IntegrationTestArgs\");\n\nexport interface IntegrationTestV2Args {\n exchangeBaseUrl: string;\n corebankApiBaseUrl: string;\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n}\n\nexport const codecForIntegrationTestV2Args = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"IntegrationTestV2Args\");\n\nexport interface GetExchangeEntryByUrlRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForGetExchangeEntryByUrlRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"GetExchangeEntryByUrlRequest\");\n\nexport type GetExchangeEntryByUrlResponse = ExchangeListItem;\n\nexport interface AddExchangeRequest {\n exchangeBaseUrl: string;\n\n /**\n * @deprecated use a separate API call to start a forced exchange update instead\n */\n forceUpdate?: boolean;\n}\n\nexport const codecForAddExchangeRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forceUpdate\", codecOptional(codecForBoolean()))\n .build(\"AddExchangeRequest\");\n\nexport interface UpdateExchangeEntryRequest {\n exchangeBaseUrl: string;\n force?: boolean;\n}\n\nexport const codecForUpdateExchangeEntryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"force\", codecOptional(codecForBoolean()))\n .build(\"UpdateExchangeEntryRequest\");\n\nexport interface GetExchangeResourcesRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForGetExchangeResourcesRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"GetExchangeResourcesRequest\");\n\nexport interface GetExchangeResourcesResponse {\n hasResources: boolean;\n}\n\nexport interface DeleteExchangeRequest {\n exchangeBaseUrl: string;\n purge?: boolean;\n}\n\nexport const codecForDeleteExchangeRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"purge\", codecOptional(codecForBoolean()))\n .build(\"DeleteExchangeRequest\");\n\nexport interface ForceExchangeUpdateRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForForceExchangeUpdateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"AddExchangeRequest\");\n\nexport interface GetExchangeTosRequest {\n exchangeBaseUrl: string;\n acceptedFormat?: string[];\n acceptLanguage?: string;\n}\n\nexport const codecForGetExchangeTosRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"acceptedFormat\", codecOptional(codecForList(codecForString())))\n .property(\"acceptLanguage\", codecOptional(codecForString()))\n .build(\"GetExchangeTosRequest\");\n\nexport interface AcceptManualWithdrawalRequest {\n exchangeBaseUrl: string;\n amount: AmountString;\n restrictAge?: number;\n\n /**\n * Instead of generating a fresh, random reserve key pair,\n * use the provided reserve private key.\n *\n * Use with caution. Usage of this field may be restricted\n * to developer mode.\n */\n forceReservePriv?: EddsaPrivateKeyString;\n}\n\nexport const codecForAcceptManualWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"amount\", codecForAmountString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .property(\"forceReservePriv\", codecOptional(codecForString()))\n .build(\"AcceptManualWithdrawalRequest\");\n\nexport interface GetWithdrawalDetailsForAmountRequest {\n exchangeBaseUrl: string;\n amount: AmountString;\n restrictAge?: number;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport interface PrepareBankIntegratedWithdrawalRequest {\n talerWithdrawUri: string;\n}\n\nexport const codecForPrepareBankIntegratedWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .build(\"PrepareBankIntegratedWithdrawalRequest\");\n\nexport interface PrepareBankIntegratedWithdrawalResponse {\n transactionId: TransactionIdStr;\n info: WithdrawUriInfoResponse;\n}\n\nexport interface ConfirmWithdrawalRequest {\n transactionId: string;\n exchangeBaseUrl: string;\n amount: AmountString;\n forcedDenomSel?: ForcedDenomSel;\n restrictAge?: number;\n}\n\nexport const codecForConfirmWithdrawalRequestRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"ConfirmWithdrawalRequest\");\n\nexport interface AcceptBankIntegratedWithdrawalRequest {\n talerWithdrawUri: string;\n exchangeBaseUrl: string;\n forcedDenomSel?: ForcedDenomSel;\n /**\n * Amount to withdraw.\n * If the bank's withdrawal operation uses a fixed amount,\n * this field must either be left undefined or its value must match\n * the amount from the withdrawal operation.\n */\n amount?: AmountString;\n restrictAge?: number;\n}\n\nexport const codecForAcceptBankIntegratedWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"talerWithdrawUri\", codecForString())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"AcceptBankIntegratedWithdrawalRequest\");\n\nexport const codecForGetWithdrawalDetailsForAmountRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"amount\", codecForAmountString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"GetWithdrawalDetailsForAmountRequest\");\n\nexport interface AcceptExchangeTosRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForAcceptExchangeTosRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"AcceptExchangeTosRequest\");\n\nexport interface ForgetExchangeTosRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForForgetExchangeTosRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"ForgetExchangeTosRequest\");\n\nexport interface AcceptRefundRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForApplyRefundRequest = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"AcceptRefundRequest\");\n\nexport interface ApplyRefundFromPurchaseIdRequest {\n purchaseId: string;\n}\n\nexport const codecForApplyRefundFromPurchaseIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"purchaseId\", codecForString())\n .build(\"ApplyRefundFromPurchaseIdRequest\");\n\nexport interface GetWithdrawalDetailsForUriRequest {\n talerWithdrawUri: string;\n /**\n * @deprecated not used\n */\n restrictAge?: number;\n}\n\nexport const codecForGetWithdrawalDetailsForUri =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"GetWithdrawalDetailsForUriRequest\");\n\nexport interface ListKnownBankAccountsRequest {\n currency?: string;\n}\n\nexport const codecForListKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecOptional(codecForString()))\n .build(\"ListKnownBankAccountsRequest\");\n\nexport interface AddKnownBankAccountsRequest {\n payto: string;\n alias: string;\n currency: string;\n}\nexport const codecForAddKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"payto\", codecForString())\n .property(\"alias\", codecForString())\n .property(\"currency\", codecForString())\n .build(\"AddKnownBankAccountsRequest\");\n\nexport interface ForgetKnownBankAccountsRequest {\n payto: string;\n}\n\nexport const codecForForgetKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"payto\", codecForString())\n .build(\"ForgetKnownBankAccountsRequest\");\n\nexport interface AbortProposalRequest {\n proposalId: string;\n}\n\nexport const codecForAbortProposalRequest = (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecForString())\n .build(\"AbortProposalRequest\");\n\nexport interface GetContractTermsDetailsRequest {\n // @deprecated use transaction id\n proposalId?: string;\n transactionId?: string;\n}\n\nexport const codecForGetContractTermsDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecOptional(codecForString()))\n .property(\"transactionId\", codecOptional(codecForString()))\n .build(\"GetContractTermsDetails\");\n\nexport interface PreparePayRequest {\n talerPayUri: string;\n}\n\nexport const codecForPreparePayRequest = (): Codec =>\n buildCodecForObject()\n .property(\"talerPayUri\", codecForString())\n .build(\"PreparePay\");\n\nexport interface SharePaymentRequest {\n merchantBaseUrl: string;\n orderId: string;\n}\nexport const codecForSharePaymentRequest = (): Codec =>\n buildCodecForObject()\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"orderId\", codecForString())\n .build(\"SharePaymentRequest\");\n\nexport interface SharePaymentResult {\n privatePayUri: string;\n}\nexport const codecForSharePaymentResult = (): Codec =>\n buildCodecForObject()\n .property(\"privatePayUri\", codecForString())\n .build(\"SharePaymentResult\");\n\nexport interface CheckPayTemplateRequest {\n talerPayTemplateUri: string;\n}\n\nexport type CheckPayTemplateReponse = {\n templateDetails: TalerMerchantApi.WalletTemplateDetails;\n supportedCurrencies: string[];\n};\n\nexport const codecForCheckPayTemplateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerPayTemplateUri\", codecForString())\n .build(\"CheckPayTemplateRequest\");\n\nexport interface PreparePayTemplateRequest {\n talerPayTemplateUri: string;\n templateParams?: TemplateParams;\n}\n\nexport const codecForPreparePayTemplateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerPayTemplateUri\", codecForString())\n .property(\"templateParams\", codecForAny())\n .build(\"PreparePayTemplate\");\n\nexport interface ConfirmPayRequest {\n /**\n * @deprecated use transactionId instead\n */\n proposalId?: string;\n transactionId?: TransactionIdStr;\n sessionId?: string;\n forcedCoinSel?: ForcedCoinSel;\n}\n\nexport const codecForConfirmPayRequest = (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecOptional(codecForString()))\n .property(\"transactionId\", codecOptional(codecForTransactionIdStr()))\n .property(\"sessionId\", codecOptional(codecForString()))\n .property(\"forcedCoinSel\", codecForAny())\n .build(\"ConfirmPay\");\n\nexport interface CoreApiRequestEnvelope {\n id: string;\n operation: string;\n args: unknown;\n}\n\nexport type CoreApiResponse = CoreApiResponseSuccess | CoreApiResponseError;\n\nexport type CoreApiMessageEnvelope = CoreApiResponse | CoreApiNotification;\n\nexport interface CoreApiNotification {\n type: \"notification\";\n payload: unknown;\n}\n\nexport interface CoreApiResponseSuccess {\n // To distinguish the message from notifications\n type: \"response\";\n operation: string;\n id: string;\n result: unknown;\n}\n\nexport interface CoreApiResponseError {\n // To distinguish the message from notifications\n type: \"error\";\n operation: string;\n id: string;\n error: TalerErrorDetail;\n}\n\nexport interface WithdrawTestBalanceRequest {\n amount: AmountString;\n /**\n * Corebank API base URL.\n */\n corebankApiBaseUrl: string;\n exchangeBaseUrl: string;\n forcedDenomSel?: ForcedDenomSel;\n}\n\n/**\n * Request to the crypto worker to make a sync signature.\n */\nexport interface MakeSyncSignatureRequest {\n accountPriv: string;\n oldHash: string | undefined;\n newHash: string;\n}\n\n/**\n * Planchet for a coin during refresh.\n */\nexport interface RefreshPlanchetInfo {\n /**\n * Public key for the coin.\n */\n coinPub: string;\n\n /**\n * Private key for the coin.\n */\n coinPriv: string;\n\n /**\n * Blinded public key.\n */\n coinEv: CoinEnvelope;\n\n coinEvHash: string;\n\n /**\n * Blinding key used.\n */\n blindingKey: string;\n\n maxAge: number;\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\n/**\n * Strategy for loading recovery information.\n */\nexport enum RecoveryMergeStrategy {\n /**\n * Keep the local wallet root key, import and take over providers.\n */\n Ours = \"ours\",\n\n /**\n * Migrate to the wallet root key from the recovery information.\n */\n Theirs = \"theirs\",\n}\n\n/**\n * Load recovery information into the wallet.\n */\nexport interface RecoveryLoadRequest {\n recovery: BackupRecovery;\n strategy?: RecoveryMergeStrategy;\n}\n\nexport const codecForWithdrawTestBalance =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"WithdrawTestBalanceRequest\");\n\nexport interface SetCoinSuspendedRequest {\n coinPub: string;\n suspended: boolean;\n}\n\nexport const codecForSetCoinSuspendedRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"coinPub\", codecForString())\n .property(\"suspended\", codecForBoolean())\n .build(\"SetCoinSuspendedRequest\");\n\nexport interface RefreshCoinSpec {\n coinPub: string;\n amount?: AmountString;\n}\n\nexport const codecForRefreshCoinSpec = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"coinPub\", codecForString())\n .build(\"ForceRefreshRequest\");\n\nexport interface ForceRefreshRequest {\n refreshCoinSpecs: RefreshCoinSpec[];\n}\n\nexport const codecForForceRefreshRequest = (): Codec =>\n buildCodecForObject()\n .property(\"refreshCoinSpecs\", codecForList(codecForRefreshCoinSpec()))\n .build(\"ForceRefreshRequest\");\n\nexport interface PrepareRefundRequest {\n talerRefundUri: string;\n}\n\nexport interface StartRefundQueryForUriResponse {\n /**\n * Transaction id of the *payment* where the refund query was started.\n */\n transactionId: TransactionIdStr;\n}\n\nexport const codecForPrepareRefundRequest = (): Codec =>\n buildCodecForObject()\n .property(\"talerRefundUri\", codecForString())\n .build(\"PrepareRefundRequest\");\n\nexport interface StartRefundQueryRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForStartRefundQueryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"StartRefundQueryRequest\");\n\nexport interface FailTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForFailTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"FailTransactionRequest\");\n\nexport interface SuspendTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForSuspendTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"SuspendTransactionRequest\");\n\nexport interface ResumeTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForResumeTransaction = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"ResumeTransactionRequest\");\n\nexport interface AbortTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface FailTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForAbortTransaction = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"AbortTransactionRequest\");\n\nexport interface DepositGroupFees {\n coin: AmountString;\n wire: AmountString;\n refresh: AmountString;\n}\n\nexport interface CreateDepositGroupRequest {\n /**\n * Pre-allocated transaction ID.\n * Allows clients to easily handle notifications\n * that occur while the operation has been created but\n * before the creation request has returned.\n */\n transactionId?: TransactionIdStr;\n depositPaytoUri: string;\n amount: AmountString;\n}\n\nexport interface PrepareDepositRequest {\n /**\n * Payto URI to identify the (bank) account that the exchange will wire\n * the money to.\n */\n depositPaytoUri: string;\n\n /**\n * Amount that should be deposited.\n *\n * Raw amount, fees will be added on top.\n */\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForPrepareDepositRequest = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForString())\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"PrepareDepositRequest\");\n\nexport interface PrepareDepositResponse {\n totalDepositCost: AmountString;\n effectiveDepositAmount: AmountString;\n fees: DepositGroupFees;\n}\n\nexport const codecForCreateDepositGroupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForString())\n .property(\"transactionId\", codecOptional(codecForTransactionIdStr()))\n .build(\"CreateDepositGroupRequest\");\n\nexport interface CreateDepositGroupResponse {\n depositGroupId: string;\n transactionId: TransactionIdStr;\n}\n\nexport interface TxIdResponse {\n transactionId: TransactionIdStr;\n}\n\nexport interface WithdrawUriInfoResponse {\n operationId: string;\n status: WithdrawalOperationStatus;\n confirmTransferUrl?: string;\n currency: string;\n amount: AmountString | undefined;\n editableAmount: boolean;\n maxAmount: AmountString | undefined;\n wireFee: AmountString | undefined;\n defaultExchangeBaseUrl?: string;\n editableExchange: boolean;\n possibleExchanges: ExchangeListItem[];\n}\n\nexport const codecForWithdrawUriInfoResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"operationId\", codecForString())\n .property(\"confirmTransferUrl\", codecOptional(codecForString()))\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"maxAmount\", codecOptional(codecForAmountString()))\n .property(\"wireFee\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecForString())\n .property(\"editableAmount\", codecForBoolean())\n .property(\"editableExchange\", codecForBoolean())\n .property(\"defaultExchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"possibleExchanges\", codecForList(codecForExchangeListItem()))\n .build(\"WithdrawUriInfoResponse\");\n\nexport interface WalletCurrencyInfo {\n trustedAuditors: {\n currency: string;\n auditorPub: string;\n auditorBaseUrl: string;\n }[];\n trustedExchanges: {\n currency: string;\n exchangeMasterPub: string;\n exchangeBaseUrl: string;\n }[];\n}\n\nexport interface TestingListTasksForTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface TestingListTasksForTransactionsResponse {\n taskIdList: string[];\n}\n\nexport const codecForTestingListTasksForTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"TestingListTasksForTransactionRequest\");\n\nexport interface DeleteTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface RetryTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForDeleteTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"DeleteTransactionRequest\");\n\nexport const codecForRetryTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"RetryTransactionRequest\");\n\nexport interface SetWalletDeviceIdRequest {\n /**\n * New wallet device ID to set.\n */\n walletDeviceId: string;\n}\n\nexport const codecForSetWalletDeviceIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"walletDeviceId\", codecForString())\n .build(\"SetWalletDeviceIdRequest\");\n\nexport interface WithdrawFakebankRequest {\n amount: AmountString;\n exchange: string;\n bank: string;\n}\n\nexport enum AttentionPriority {\n High = \"high\",\n Medium = \"medium\",\n Low = \"low\",\n}\n\nexport interface UserAttentionByIdRequest {\n entityId: string;\n type: AttentionType;\n}\n\nexport const codecForUserAttentionByIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForAny())\n .property(\"entityId\", codecForString())\n .build(\"UserAttentionByIdRequest\");\n\nexport const codecForUserAttentionsRequest = (): Codec =>\n buildCodecForObject()\n .property(\n \"priority\",\n codecOptional(\n codecForEither(\n codecForConstString(AttentionPriority.Low),\n codecForConstString(AttentionPriority.Medium),\n codecForConstString(AttentionPriority.High),\n ),\n ),\n )\n .build(\"UserAttentionsRequest\");\n\nexport interface UserAttentionsRequest {\n priority?: AttentionPriority;\n}\n\nexport type AttentionInfo =\n | AttentionKycWithdrawal\n | AttentionBackupUnpaid\n | AttentionBackupExpiresSoon\n | AttentionMerchantRefund\n | AttentionExchangeTosChanged\n | AttentionExchangeKeyExpired\n | AttentionExchangeDenominationExpired\n | AttentionAuditorTosChanged\n | AttentionAuditorKeyExpires\n | AttentionAuditorDenominationExpires\n | AttentionPullPaymentPaid\n | AttentionPushPaymentReceived;\n\nexport enum AttentionType {\n KycWithdrawal = \"kyc-withdrawal\",\n\n BackupUnpaid = \"backup-unpaid\",\n BackupExpiresSoon = \"backup-expires-soon\",\n MerchantRefund = \"merchant-refund\",\n\n ExchangeTosChanged = \"exchange-tos-changed\",\n ExchangeKeyExpired = \"exchange-key-expired\",\n ExchangeKeyExpiresSoon = \"exchange-key-expires-soon\",\n ExchangeDenominationsExpired = \"exchange-denominations-expired\",\n ExchangeDenominationsExpiresSoon = \"exchange-denominations-expires-soon\",\n\n AuditorTosChanged = \"auditor-tos-changed\",\n AuditorKeyExpires = \"auditor-key-expires\",\n AuditorDenominationsExpires = \"auditor-denominations-expires\",\n\n PullPaymentPaid = \"pull-payment-paid\",\n PushPaymentReceived = \"push-payment-withdrawn\",\n}\n\nexport const UserAttentionPriority: {\n [type in AttentionType]: AttentionPriority;\n} = {\n \"kyc-withdrawal\": AttentionPriority.Medium,\n\n \"backup-unpaid\": AttentionPriority.High,\n \"backup-expires-soon\": AttentionPriority.Medium,\n \"merchant-refund\": AttentionPriority.Medium,\n\n \"exchange-tos-changed\": AttentionPriority.Medium,\n\n \"exchange-key-expired\": AttentionPriority.High,\n \"exchange-key-expires-soon\": AttentionPriority.Medium,\n \"exchange-denominations-expired\": AttentionPriority.High,\n \"exchange-denominations-expires-soon\": AttentionPriority.Medium,\n\n \"auditor-tos-changed\": AttentionPriority.Medium,\n \"auditor-key-expires\": AttentionPriority.Medium,\n \"auditor-denominations-expires\": AttentionPriority.Medium,\n\n \"pull-payment-paid\": AttentionPriority.High,\n \"push-payment-withdrawn\": AttentionPriority.High,\n};\n\ninterface AttentionBackupExpiresSoon {\n type: AttentionType.BackupExpiresSoon;\n provider_base_url: string;\n}\ninterface AttentionBackupUnpaid {\n type: AttentionType.BackupUnpaid;\n provider_base_url: string;\n talerUri: string;\n}\n\ninterface AttentionMerchantRefund {\n type: AttentionType.MerchantRefund;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionKycWithdrawal {\n type: AttentionType.KycWithdrawal;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionExchangeTosChanged {\n type: AttentionType.ExchangeTosChanged;\n exchange_base_url: string;\n}\ninterface AttentionExchangeKeyExpired {\n type: AttentionType.ExchangeKeyExpired;\n exchange_base_url: string;\n}\ninterface AttentionExchangeDenominationExpired {\n type: AttentionType.ExchangeDenominationsExpired;\n exchange_base_url: string;\n}\ninterface AttentionAuditorTosChanged {\n type: AttentionType.AuditorTosChanged;\n auditor_base_url: string;\n}\n\ninterface AttentionAuditorKeyExpires {\n type: AttentionType.AuditorKeyExpires;\n auditor_base_url: string;\n}\ninterface AttentionAuditorDenominationExpires {\n type: AttentionType.AuditorDenominationsExpires;\n auditor_base_url: string;\n}\ninterface AttentionPullPaymentPaid {\n type: AttentionType.PullPaymentPaid;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionPushPaymentReceived {\n type: AttentionType.PushPaymentReceived;\n transactionId: TransactionIdStr;\n}\n\nexport type UserAttentionUnreadList = Array<{\n info: AttentionInfo;\n when: TalerPreciseTimestamp;\n read: boolean;\n}>;\n\nexport interface UserAttentionsResponse {\n pending: UserAttentionUnreadList;\n}\n\nexport interface UserAttentionsCountResponse {\n total: number;\n}\n\nexport const codecForWithdrawFakebankRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"bank\", codecForString())\n .property(\"exchange\", codecForString())\n .build(\"WithdrawFakebankRequest\");\n\nexport interface ActiveTask {\n taskId: string;\n transaction: TransactionIdStr | undefined;\n firstTry: AbsoluteTime | undefined;\n nextTry: AbsoluteTime | undefined;\n retryCounter: number | undefined;\n lastError: TalerErrorDetail | undefined;\n}\n\nexport interface GetActiveTasksResponse {\n tasks: ActiveTask[];\n}\n\nexport const codecForActiveTask = (): Codec =>\n buildCodecForObject()\n .property(\"taskId\", codecForString())\n .property(\"transaction\", codecOptional(codecForTransactionIdStr()))\n .property(\"retryCounter\", codecOptional(codecForNumber()))\n .property(\"firstTry\", codecOptional(codecForAbsoluteTime))\n .property(\"nextTry\", codecOptional(codecForAbsoluteTime))\n .property(\"lastError\", codecOptional(codecForTalerErrorDetail()))\n .build(\"ActiveTask\");\n\nexport const codecForGetActiveTasks = (): Codec =>\n buildCodecForObject()\n .property(\"tasks\", codecForList(codecForActiveTask()))\n .build(\"GetActiveTasks\");\n\nexport interface ImportDbRequest {\n dump: any;\n}\n\nexport const codecForImportDbRequest = (): Codec =>\n buildCodecForObject()\n .property(\"dump\", codecForAny())\n .build(\"ImportDbRequest\");\n\nexport interface ForcedDenomSel {\n denoms: {\n value: AmountString;\n count: number;\n }[];\n}\n\n/**\n * Forced coin selection for deposits/payments.\n */\nexport interface ForcedCoinSel {\n coins: {\n value: AmountString;\n contribution: AmountString;\n }[];\n}\n\nexport interface TestPayResult {\n /**\n * Number of coins used for the payment.\n */\n numCoins: number;\n}\n\nexport interface SelectedCoin {\n denomPubHash: string;\n coinPub: string;\n contribution: AmountString;\n exchangeBaseUrl: string;\n}\n\nexport interface SelectedProspectiveCoin {\n denomPubHash: string;\n contribution: AmountString;\n exchangeBaseUrl: string;\n}\n\n/**\n * Result of selecting coins, contains the exchange, and selected\n * coins with their denomination.\n */\nexport interface PayCoinSelection {\n coins: SelectedCoin[];\n\n /**\n * How much of the wire fees is the customer paying?\n */\n customerWireFees: AmountString;\n\n /**\n * How much of the deposit fees is the customer paying?\n */\n customerDepositFees: AmountString;\n}\n\nexport interface ProspectivePayCoinSelection {\n prospectiveCoins: SelectedProspectiveCoin[];\n\n /**\n * How much of the wire fees is the customer paying?\n */\n customerWireFees: AmountString;\n\n /**\n * How much of the deposit fees is the customer paying?\n */\n customerDepositFees: AmountString;\n}\n\nexport interface CheckPeerPushDebitRequest {\n /**\n * Preferred exchange to use for the p2p payment.\n */\n exchangeBaseUrl?: string;\n\n /**\n * Instructed amount.\n *\n * FIXME: Allow specifying the instructed amount type.\n */\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForCheckPeerPushDebitRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"amount\", codecForAmountString())\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"CheckPeerPushDebitRequest\");\n\nexport interface CheckPeerPushDebitResponse {\n amountRaw: AmountString;\n amountEffective: AmountString;\n exchangeBaseUrl: string;\n /**\n * Maximum expiration date, based on how close the coins\n * used for the payment are to expiry.\n *\n * The value is based on when the wallet would typically\n * automatically refresh the coins on its own, leaving enough\n * time to get a refund for the push payment and refresh the\n * coin.\n */\n maxExpirationDate: TalerProtocolTimestamp;\n}\n\nexport interface InitiatePeerPushDebitRequest {\n exchangeBaseUrl?: string;\n partialContractTerms: PeerContractTerms;\n}\n\nexport interface InitiatePeerPushDebitResponse {\n exchangeBaseUrl: string;\n pursePub: string;\n mergePriv: string;\n contractPriv: string;\n transactionId: TransactionIdStr;\n}\n\nexport const codecForInitiatePeerPushDebitRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"partialContractTerms\", codecForPeerContractTerms())\n .build(\"InitiatePeerPushDebitRequest\");\n\nexport interface PreparePeerPushCreditRequest {\n talerUri: string;\n}\n\nexport interface PreparePeerPullDebitRequest {\n talerUri: string;\n}\n\nexport interface PreparePeerPushCreditResponse {\n contractTerms: PeerContractTerms;\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n transactionId: TransactionIdStr;\n\n exchangeBaseUrl: string;\n\n /**\n * @deprecated use transaction ID instead.\n */\n peerPushCreditId: string;\n\n /**\n * @deprecated\n */\n amount: AmountString;\n}\n\nexport interface PreparePeerPullDebitResponse {\n contractTerms: PeerContractTerms;\n /**\n * @deprecated Redundant field with bad name, will be removed soon.\n */\n amount: AmountString;\n\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n peerPullDebitId: string;\n\n transactionId: TransactionIdStr;\n}\n\nexport const codecForPreparePeerPushCreditRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"CheckPeerPushPaymentRequest\");\n\nexport const codecForCheckPeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"PreparePeerPullDebitRequest\");\n\nexport interface ConfirmPeerPushCreditRequest {\n transactionId: string;\n}\nexport interface AcceptPeerPushPaymentResponse {\n transactionId: TransactionIdStr;\n}\n\nexport interface AcceptPeerPullPaymentResponse {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForConfirmPeerPushPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"ConfirmPeerPushCreditRequest\");\n\nexport interface ConfirmPeerPullDebitRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface ApplyDevExperimentRequest {\n devExperimentUri: string;\n}\n\nexport const codecForApplyDevExperiment =\n (): Codec =>\n buildCodecForObject()\n .property(\"devExperimentUri\", codecForString())\n .build(\"ApplyDevExperimentRequest\");\n\nexport const codecForAcceptPeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"ConfirmPeerPullDebitRequest\");\n\nexport interface CheckPeerPullCreditRequest {\n exchangeBaseUrl?: string;\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForPreparePeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"CheckPeerPullCreditRequest\");\n\nexport interface CheckPeerPullCreditResponse {\n exchangeBaseUrl: string;\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n /**\n * Number of coins that will be used,\n * can be used by the UI to warn if excessively large.\n */\n numCoins: number;\n}\n\nexport interface InitiatePeerPullCreditRequest {\n exchangeBaseUrl?: string;\n partialContractTerms: PeerContractTerms;\n}\n\nexport const codecForInitiatePeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"partialContractTerms\", codecForPeerContractTerms())\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .build(\"InitiatePeerPullCreditRequest\");\n\nexport interface InitiatePeerPullCreditResponse {\n /**\n * Taler URI for the other party to make the payment\n * that was requested.\n *\n * @deprecated since it's not necessarily valid yet until the tx is in the right state\n */\n talerUri: string;\n\n transactionId: TransactionIdStr;\n}\n\nexport interface CanonicalizeBaseUrlRequest {\n url: string;\n}\n\nexport const codecForCanonicalizeBaseUrlRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"url\", codecForString())\n .build(\"CanonicalizeBaseUrlRequest\");\n\nexport interface CanonicalizeBaseUrlResponse {\n url: string;\n}\n\nexport interface ValidateIbanRequest {\n iban: string;\n}\n\nexport const codecForValidateIbanRequest = (): Codec =>\n buildCodecForObject()\n .property(\"iban\", codecForString())\n .build(\"ValidateIbanRequest\");\n\nexport interface ValidateIbanResponse {\n valid: boolean;\n}\n\nexport const codecForValidateIbanResponse = (): Codec =>\n buildCodecForObject()\n .property(\"valid\", codecForBoolean())\n .build(\"ValidateIbanResponse\");\n\nexport type TransactionStateFilter = \"nonfinal\";\n\nexport interface TransactionRecordFilter {\n onlyState?: TransactionStateFilter;\n onlyCurrency?: string;\n}\n\nexport interface StoredBackupList {\n storedBackups: {\n name: string;\n }[];\n}\n\nexport interface CreateStoredBackupResponse {\n name: string;\n}\n\nexport interface RecoverStoredBackupRequest {\n name: string;\n}\n\nexport interface DeleteStoredBackupRequest {\n name: string;\n}\n\nexport const codecForDeleteStoredBackupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .build(\"DeleteStoredBackupRequest\");\n\nexport const codecForRecoverStoredBackupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .build(\"RecoverStoredBackupRequest\");\n\nexport interface TestingSetTimetravelRequest {\n offsetMs: number;\n}\n\nexport const codecForTestingSetTimetravelRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"offsetMs\", codecForNumber())\n .build(\"TestingSetTimetravelRequest\");\n\nexport interface AllowedAuditorInfo {\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport interface AllowedExchangeInfo {\n exchangeBaseUrl: string;\n exchangePub: string;\n}\n\n/**\n * Data extracted from the contract terms that is relevant for payment\n * processing in the wallet.\n */\nexport interface WalletContractData {\n /**\n * Fulfillment URL, or the empty string if the order has no fulfillment URL.\n *\n * Stored as a non-nullable string as we use this field for IndexedDB indexing.\n */\n fulfillmentUrl: string;\n\n contractTermsHash: string;\n fulfillmentMessage?: string;\n fulfillmentMessageI18n?: InternationalizedString;\n merchantSig: string;\n merchantPub: string;\n merchant: MerchantInfo;\n amount: AmountString;\n orderId: string;\n merchantBaseUrl: string;\n summary: string;\n summaryI18n: { [lang_tag: string]: string } | undefined;\n autoRefund: TalerProtocolDuration | undefined;\n payDeadline: TalerProtocolTimestamp;\n refundDeadline: TalerProtocolTimestamp;\n allowedExchanges: AllowedExchangeInfo[];\n timestamp: TalerProtocolTimestamp;\n wireMethod: string;\n wireInfoHash: string;\n maxDepositFee: AmountString;\n minimumAge?: number;\n}\n\nexport interface TestingWaitTransactionRequest {\n transactionId: TransactionIdStr;\n txState: TransactionState;\n}\n\nexport interface TestingGetReserveHistoryRequest {\n reservePub: string;\n exchangeBaseUrl: string;\n}\n\nexport const codecForTestingGetReserveHistoryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"reservePub\", codecForString())\n .property(\"exchangeBaseUrl\", codecForString())\n .build(\"TestingGetReserveHistoryRequest\");\n\nexport interface TestingGetDenomStatsRequest {\n exchangeBaseUrl: string;\n}\n\nexport interface TestingGetDenomStatsResponse {\n numKnown: number;\n numOffered: number;\n numLost: number;\n}\n\nexport const codecForTestingGetDenomStatsRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"TestingGetDenomStatsRequest\");\n\nexport interface WithdrawalExchangeAccountDetails {\n /**\n * Payto URI to credit the exchange.\n *\n * Depending on whether the (manual!) withdrawal is accepted or just\n * being checked, this already includes the subject with the\n * reserve public key.\n */\n paytoUri: string;\n\n /**\n * Status that indicates whether the account can be used\n * by the user to send funds for a withdrawal.\n *\n * ok: account should be shown to the user\n * error: account should not be shown to the user, UIs might render the error (in conversionError),\n * especially in dev mode.\n */\n status: \"ok\" | \"error\";\n\n /**\n * Transfer amount. Might be in a different currency than the requested\n * amount for withdrawal.\n *\n * Absent if this is a conversion account and the conversion failed.\n */\n transferAmount?: AmountString;\n\n /**\n * Currency specification for the external currency.\n *\n * Only included if this account requires a currency conversion.\n */\n currencySpecification?: CurrencySpecification;\n\n /**\n * Further restrictions for sending money to the\n * exchange.\n */\n creditRestrictions?: AccountRestriction[];\n\n /**\n * Label given to the account or the account's bank by the exchange.\n */\n bankLabel?: string;\n\n /*\n * Display priority assigned to this bank account by the exchange.\n */\n priority?: number;\n\n /**\n * Error that happened when attempting to request the conversion rate.\n */\n conversionError?: TalerErrorDetail;\n}\n\nexport interface PrepareWithdrawExchangeRequest {\n /**\n * A taler://withdraw-exchange URI.\n */\n talerUri: string;\n}\n\nexport const codecForPrepareWithdrawExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"PrepareWithdrawExchangeRequest\");\n\nexport interface PrepareWithdrawExchangeResponse {\n /**\n * Base URL of the exchange that already existed\n * or was ephemerally added as an exchange entry to\n * the wallet.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount from the taler://withdraw-exchange URI.\n * Only present if specified in the URI.\n */\n amount?: AmountString;\n}\n\nexport interface ExchangeEntryState {\n tosStatus: ExchangeTosStatus;\n exchangeEntryStatus: ExchangeEntryStatus;\n exchangeUpdateStatus: ExchangeUpdateStatus;\n}\n\nexport interface ListGlobalCurrencyAuditorsResponse {\n auditors: {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n }[];\n}\n\nexport interface ListGlobalCurrencyExchangesResponse {\n exchanges: {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n }[];\n}\n\nexport interface AddGlobalCurrencyExchangeRequest {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n}\n\nexport const codecForAddGlobalCurrencyExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"exchangeMasterPub\", codecForString())\n .build(\"AddGlobalCurrencyExchangeRequest\");\n\nexport interface RemoveGlobalCurrencyExchangeRequest {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n}\n\nexport const codecForRemoveGlobalCurrencyExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"exchangeMasterPub\", codecForString())\n .build(\"RemoveGlobalCurrencyExchangeRequest\");\n\nexport interface AddGlobalCurrencyAuditorRequest {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport const codecForAddGlobalCurrencyAuditorRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"auditorBaseUrl\", codecForCanonBaseUrl())\n .property(\"auditorPub\", codecForString())\n .build(\"AddGlobalCurrencyAuditorRequest\");\n\nexport interface RemoveGlobalCurrencyAuditorRequest {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport const codecForRemoveGlobalCurrencyAuditorRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"auditorBaseUrl\", codecForCanonBaseUrl())\n .property(\"auditorPub\", codecForString())\n .build(\"RemoveGlobalCurrencyAuditorRequest\");\n\n/**\n * Information about one provider.\n *\n * We don't store the account key here,\n * as that's derived from the wallet root key.\n */\nexport interface ProviderInfo {\n active: boolean;\n syncProviderBaseUrl: string;\n name: string;\n terms?: BackupProviderTerms;\n /**\n * Last communication issue with the provider.\n */\n lastError?: TalerErrorDetail;\n lastSuccessfulBackupTimestamp?: TalerPreciseTimestamp;\n lastAttemptedBackupTimestamp?: TalerPreciseTimestamp;\n paymentProposalIds: string[];\n backupProblem?: BackupProblem;\n paymentStatus: ProviderPaymentStatus;\n}\n\nexport interface BackupProviderTerms {\n supportedProtocolVersion: string;\n annualFee: AmountString;\n storageLimitInMegabytes: number;\n}\n\nexport type BackupProblem =\n | BackupUnreadableProblem\n | BackupConflictingDeviceProblem;\n\nexport interface BackupUnreadableProblem {\n type: \"backup-unreadable\";\n}\n\nexport interface BackupConflictingDeviceProblem {\n type: \"backup-conflicting-device\";\n otherDeviceId: string;\n myDeviceId: string;\n backupTimestamp: AbsoluteTime;\n}\n\nexport type ProviderPaymentStatus =\n | ProviderPaymentTermsChanged\n | ProviderPaymentPaid\n | ProviderPaymentInsufficientBalance\n | ProviderPaymentUnpaid\n | ProviderPaymentPending;\n\nexport enum ProviderPaymentType {\n Unpaid = \"unpaid\",\n Pending = \"pending\",\n InsufficientBalance = \"insufficient-balance\",\n Paid = \"paid\",\n TermsChanged = \"terms-changed\",\n}\n\nexport interface ProviderPaymentUnpaid {\n type: ProviderPaymentType.Unpaid;\n}\n\nexport interface ProviderPaymentInsufficientBalance {\n type: ProviderPaymentType.InsufficientBalance;\n amount: AmountString;\n}\n\nexport interface ProviderPaymentPending {\n type: ProviderPaymentType.Pending;\n talerUri?: string;\n}\n\nexport interface ProviderPaymentPaid {\n type: ProviderPaymentType.Paid;\n paidUntil: AbsoluteTime;\n}\n\nexport interface ProviderPaymentTermsChanged {\n type: ProviderPaymentType.TermsChanged;\n paidUntil: AbsoluteTime;\n oldTerms: BackupProviderTerms;\n newTerms: BackupProviderTerms;\n}\n\n// FIXME: Does not really belong here, move to sync API\nexport interface SyncTermsOfServiceResponse {\n // maximum backup size supported\n storage_limit_in_megabytes: number;\n\n // Fee for an account, per year.\n annual_fee: AmountString;\n\n // protocol version supported by the server,\n // for now always \"0.0\".\n version: string;\n}\n\n// FIXME: Does not really belong here, move to sync API\nexport const codecForSyncTermsOfServiceResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"storage_limit_in_megabytes\", codecForNumber())\n .property(\"annual_fee\", codecForAmountString())\n .property(\"version\", codecForString())\n .build(\"SyncTermsOfServiceResponse\");\n\nexport interface HintNetworkAvailabilityRequest {\n isNetworkAvailable: boolean;\n}\n\nexport const codecForHintNetworkAvailabilityRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"isNetworkAvailable\", codecForBoolean())\n .build(\"HintNetworkAvailabilityRequest\");\n\nexport interface GetDepositWireTypesForCurrencyRequest {\n currency: string;\n /**\n * Optional scope info to further restrict the result.\n * Currency must match the currency field.\n */\n scopeInfo?: ScopeInfo;\n}\n\nexport const codecForGetDepositWireTypesForCurrencyRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"scopeInfo\", codecOptional(codecForScopeInfo()))\n .build(\"GetDepositWireTypesForCurrencyRequest\");\n\n/**\n * Response with wire types that are supported for a deposit.\n *\n * In the future, we might surface more information here, such as debit restrictions\n * by the exchange, which then can be shown by UIs to the user before they\n * enter their payment information.\n */\nexport interface GetDepositWireTypesForCurrencyResponse {\n wireTypes: string[];\n}\n\nexport interface GetQrCodesForPaytoRequest {\n paytoUri: string;\n}\n\nexport const codecForGetQrCodesForPaytoRequest = () =>\n buildCodecForObject()\n .property(\"paytoUri\", codecForString())\n .build(\"GetQrCodesForPaytoRequest\");\n\nexport interface GetQrCodesForPaytoResponse {\n codes: QrCodeSpec[];\n}\n\nexport type EmptyObject = Record;\n\nexport const codecForEmptyObject = (): Codec =>\n buildCodecForObject().build(\"EmptyObject\");\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport { AmountJson, Amounts } from \"../amounts.js\";\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport {\n ConversionRate,\n codecForCashinConversionResponse,\n codecForCashoutConversionResponse,\n codecForConversionBankConfig,\n} from \"../types-taler-bank-conversion.js\";\nimport { AccessToken } from \"../types-taler-common.js\";\nimport { codecForTalerErrorDetail } from \"../types-taler-wallet.js\";\nimport {\n CacheEvictor,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type TalerBankConversionResultByMethod<\n prop extends keyof TalerBankConversionHttpClient,\n> = ResultByMethod;\nexport type TalerBankConversionErrorsByMethod<\n prop extends keyof TalerBankConversionHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerBankConversionCacheEviction {\n UPDATE_RATE,\n}\n\n/**\n * The API is used by the wallets.\n */\nexport class TalerBankConversionHttpClient {\n public readonly PROTOCOL_VERSION = \"0:0:0\";\n\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForConversionBankConfig());\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--cashin-rate\n *\n */\n async getCashinRate(conversion: { debit?: AmountJson; credit?: AmountJson }) {\n const url = new URL(`cashin-rate`, this.baseUrl);\n if (conversion.debit) {\n url.searchParams.set(\"amount_debit\", Amounts.stringify(conversion.debit));\n }\n if (conversion.credit) {\n url.searchParams.set(\n \"amount_credit\",\n Amounts.stringify(conversion.credit),\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashinConversionResponse());\n case HttpStatusCode.BadRequest: {\n const body = await resp.json();\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.GENERIC_PARAMETER_MISSING:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_PARAMETER_MALFORMED:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_CURRENCY_MISMATCH:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, body);\n }\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--cashout-rate\n *\n */\n async getCashoutRate(conversion: {\n debit?: AmountJson;\n credit?: AmountJson;\n }) {\n const url = new URL(`cashout-rate`, this.baseUrl);\n if (conversion.debit) {\n url.searchParams.set(\"amount_debit\", Amounts.stringify(conversion.debit));\n }\n if (conversion.credit) {\n url.searchParams.set(\n \"amount_credit\",\n Amounts.stringify(conversion.credit),\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutConversionResponse());\n case HttpStatusCode.BadRequest: {\n const body = await resp.json();\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.GENERIC_PARAMETER_MISSING:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_PARAMETER_MALFORMED:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_CURRENCY_MISMATCH:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, body);\n }\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#post--conversion-rate\n *\n */\n async updateConversionRate(auth: AccessToken, body: ConversionRate) {\n const url = new URL(`conversion-rate`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerBankConversionCacheEviction.UPDATE_RATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport {\n Codec,\n buildCodecForObject,\n codecForBoolean,\n codecForConstString,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport {\n buildCodecForUnion,\n codecForAmountString,\n codecForEither,\n codecForList,\n codecForNumber,\n codecForTalerUriString,\n codecForTimestamp,\n codecOptionalDefault,\n} from \"./index.js\";\nimport { PaytoString, codecForPaytoString } from \"./payto.js\";\nimport { TalerUriString } from \"./taleruri.js\";\nimport { WithdrawalOperationStatus } from \"./types-taler-bank-integration.js\";\nimport {\n AmountString,\n CurrencySpecification,\n DecimalNumber,\n Integer,\n ShortHashCode,\n Timestamp,\n codecForCurrencySpecificiation,\n codecForDecimalNumber,\n} from \"./types-taler-common.js\";\n\nexport interface IntegrationConfig {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification: CurrencySpecification;\n\n // Name of the API.\n name: \"taler-bank-integration\";\n}\n\nexport interface TalerCorebankConfigResponse {\n /**\n * Name of this API, always \"taler-corebank\".\n *\n * For legacy reasons, libeufin-bank will also be accepted for some time.\n */\n name: \"libeufin-bank\" | \"taler-corebank\";\n\n // API version in the form $n:$n:$n\n version: string;\n\n // Bank display name to be used in user interfaces.\n // For consistency use \"Taler Bank\" if missing.\n // @since v4, will become mandatory in the next version.\n bank_name?: string;\n\n // Advertised base URL to use when you sharing an URL with another\n // program.\n // @since v4.\n base_url?: string;\n\n // If 'true' the server provides local currency conversion support\n // If 'false' some parts of the API are not supported and return 501\n allow_conversion?: boolean;\n\n // If 'true' anyone can register\n // If 'false' only the admin can\n allow_registrations?: boolean;\n\n // If 'true' account can delete themselves\n // If 'false' only the admin can delete accounts\n allow_deletions?: boolean;\n\n // If 'true' anyone can edit their name\n // If 'false' only admin can\n allow_edit_name?: boolean;\n\n // If 'true' anyone can edit their cashout account\n // If 'false' only the admin\n allow_edit_cashout_payto_uri?: boolean;\n\n // Default debt limit for newly created accounts\n default_debit_threshold?: AmountString;\n\n // Currency used by this bank.\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification: CurrencySpecification;\n\n // TAN channels supported by the server\n supported_tan_channels?: TanChannel[];\n\n // Wire transfer type supported by the bank.\n // Default to 'iban' is missing\n // @since v4, may become mandatory in the future.\n wire_type?: string;\n\n // Wire transfer execution fees.\n // @since v4, will become mandatory in the next version.\n wire_transfer_fees?: AmountString;\n}\n\nexport interface BankAccountCreateWithdrawalRequest {\n // Amount to withdraw. If given, the wallet\n // cannot change the amount.\n // Optional since **vC2EC**.\n amount?: AmountString;\n\n // Suggested amount to withdraw. The wallet can\n // still change the suggestion.\n // @since **vC2EC**\n suggested_amount?: AmountString;\n}\n\nexport interface BankAccountCreateWithdrawalResponse {\n // ID of the withdrawal, can be used to view/modify the withdrawal operation.\n withdrawal_id: string;\n\n // URI that can be passed to the wallet to initiate the withdrawal.\n taler_withdraw_uri: TalerUriString;\n}\nexport interface WithdrawalPublicInfo {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: WithdrawalOperationStatus;\n\n // Amount that will be withdrawn with this operation\n // (raw amount without fee considerations).\n amount?: AmountString;\n\n // Suggestion for the amount to be withdrawn with this\n // operation. Given if a suggestion was made but the\n // user may still change the amount.\n // Optional since **vC2EC**.\n suggested_amount?: AmountString;\n\n // Account username\n username: string;\n\n // Reserve public key selected by the exchange,\n // only non-null if status is selected or confirmed.\n selected_reserve_pub?: string;\n\n // Exchange account selected by the wallet\n // only non-null if status is selected or confirmed.\n selected_exchange_account?: PaytoString;\n}\n\nexport interface BankAccountTransactionsResponse {\n transactions: BankAccountTransactionInfo[];\n}\n\nexport interface BankAccountTransactionInfo {\n creditor_payto_uri: PaytoString;\n debtor_payto_uri: PaytoString;\n\n amount: AmountString;\n direction: \"debit\" | \"credit\";\n\n subject: string;\n\n // Transaction unique ID. Matches\n // $transaction_id from the URI.\n row_id: number;\n date: Timestamp;\n}\n\nexport interface CreateTransactionRequest {\n // Address in the Payto format of the wire transfer receiver.\n // It needs at least the 'message' query string parameter.\n payto_uri: PaytoString;\n\n // Transaction amount (in the $currency:x.y format), optional.\n // However, when not given, its value must occupy the 'amount'\n // query string parameter of the 'payto' field. In case it\n // is given in both places, the paytoUri's takes the precedence.\n amount?: AmountString;\n\n // Nonce to make the request idempotent. Requests with the same\n // request_uid that differ in any of the other fields\n // are rejected.\n // @since v4, will become mandatory in the next version.\n request_uid?: ShortHashCode;\n}\n\nexport interface CreateTransactionResponse {\n // ID identifying the transaction being created\n row_id: Integer;\n}\n\nexport interface RegisterAccountResponse {\n // Internal payto URI of this bank account.\n internal_payto_uri: PaytoString;\n}\n\nexport interface RegisterAccountRequest {\n // Username\n username: string;\n\n // Password.\n password: string;\n\n // Legal name of the account owner\n name: string;\n\n // Defaults to false.\n is_public?: boolean;\n\n // Is this a taler exchange account?\n // If true:\n // - incoming transactions to the account that do not\n // have a valid reserve public key are automatically\n // - the account provides the taler-wire-gateway-api endpoints\n // Defaults to false.\n is_taler_exchange?: boolean;\n\n // Addresses where to send the TAN for transactions.\n contact_data?: ChallengeContactData;\n\n // 'payto' address of a fiat bank account.\n // Payments will be sent to this bank account\n // when the user wants to convert the regional currency\n // back to fiat currency outside bank.\n cashout_payto_uri?: PaytoString;\n\n // Internal payto URI of this bank account.\n // Used mostly for testing.\n payto_uri?: PaytoString;\n\n // If present, set the max debit allowed for this user\n // Only admin can set this property.\n debit_threshold?: AmountString;\n\n // If present, set a custom minimum cashout amount for this account.\n // Only admin can set this property\n // @since v4\n min_cashout?: AmountString;\n\n // If present, enables 2FA and set the TAN channel used for challenges\n // Only admin can set this property, other user can reconfig their account\n // after creation.\n tan_channel?: TanChannel;\n}\n\nexport type EmailAddress = string;\nexport type PhoneNumber = string;\n\nexport interface ChallengeContactData {\n // E-Mail address\n email?: EmailAddress;\n\n // Phone number.\n phone?: PhoneNumber;\n}\n\nexport interface AccountReconfiguration {\n // Addresses where to send the TAN for transactions.\n // Currently only used for cashouts.\n // If missing, cashouts will fail.\n // In the future, might be used for other transactions\n // as well.\n // Only admin can change this property.\n contact_data?: ChallengeContactData;\n\n // 'payto' URI of a fiat bank account.\n // Payments will be sent to this bank account\n // when the user wants to convert the regional currency\n // back to fiat currency outside bank.\n // Only admin can change this property if not allowed in config\n cashout_payto_uri?: PaytoString;\n\n // If present, change the legal name associated with $username.\n // Only admin can change this property if not allowed in config\n name?: string;\n\n // Make this account visible to anyone?\n is_public?: boolean;\n\n // If present, change the max debit allowed for this user\n // Only admin can change this property.\n debit_threshold?: AmountString;\n\n // If present, change the custom minimum cashout amount for this account.\n // Only admin can set this property\n // @since v4\n min_cashout?: AmountString;\n\n // If present, enables 2FA and set the TAN channel used for challenges\n tan_channel?: TanChannel | null;\n}\n\nexport interface AccountPasswordChange {\n // New password.\n new_password: string;\n // Old password. If present, check that the old password matches.\n // Optional for admin account.\n old_password?: string;\n}\n\nexport interface PublicAccountsResponse {\n public_accounts: PublicAccount[];\n}\nexport interface PublicAccount {\n // Username of the account\n username: string;\n\n // Internal payto URI of this bank account.\n payto_uri: string;\n\n // Current balance of the account\n balance: Balance;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Opaque unique ID used for pagination.\n // @since v4, will become mandatory in the future.\n row_id?: Integer;\n}\n\nexport interface ListBankAccountsResponse {\n accounts: AccountMinimalData[];\n}\nexport interface Balance {\n amount: AmountString;\n credit_debit_indicator: \"credit\" | \"debit\";\n}\nexport interface AccountMinimalData {\n // Username\n username: string;\n\n // Legal name of the account owner.\n name: string;\n\n // Internal payto URI of this bank account.\n payto_uri: PaytoString;\n\n // current balance of the account\n balance: Balance;\n\n // Number indicating the max debit allowed for the requesting user.\n debit_threshold: AmountString;\n\n // Custom minimum cashout amount for this account.\n // If null or absent, the global conversion fee is used.\n // @since v4\n min_cashout?: AmountString;\n\n // Is this account visible to anyone?\n is_public: boolean;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Opaque unique ID used for pagination.\n // @since v4, will become mandatory in the future.\n row_id?: Integer;\n\n // Current status of the account\n // active: the account can be used\n // deleted: the account has been deleted but is retained for compliance\n // reasons, only the administrator can access it\n // Default to 'active' is missing\n // @since v4, will become mandatory in the next version.\n status?: \"active\" | \"deleted\";\n}\n\nexport interface AccountData {\n // Legal name of the account owner.\n name: string;\n\n // Available balance on the account.\n balance: Balance;\n\n // payto://-URI of the account.\n payto_uri: PaytoString;\n\n // Number indicating the max debit allowed for the requesting user.\n debit_threshold: AmountString;\n\n // Custom minimum cashout amount for this account.\n // If null or absent, the global conversion fee is used.\n // @since v4\n min_cashout?: AmountString;\n\n contact_data?: ChallengeContactData;\n\n // 'payto' address pointing the bank account\n // where to send cashouts. This field is optional\n // because not all the accounts are required to participate\n // in the merchants' circuit. One example is the exchange:\n // that never cashouts. Registering these accounts can\n // be done via the access API.\n cashout_payto_uri?: PaytoString;\n\n // Is this account visible to anyone?\n is_public: boolean;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Is 2FA enabled and what channel is used for challenges?\n tan_channel?: TanChannel;\n\n // Current status of the account\n // active: the account can be used\n // deleted: the account has been deleted but is retained for compliance\n // reasons, only the administrator can access it\n // Default to 'active' is missing\n // @since v4, will become mandatory in the next version.\n status?: \"active\" | \"deleted\";\n}\n\nexport interface CashoutRequest {\n // Nonce to make the request idempotent. Requests with the same\n // request_uid that differ in any of the other fields\n // are rejected.\n request_uid: ShortHashCode;\n\n // Optional subject to associate to the\n // cashout operation. This data will appear\n // as the incoming wire transfer subject in\n // the user's fiat bank account.\n subject?: string;\n\n // That is the plain amount that the user specified\n // to cashout. Its $currency is the (regional) currency of the\n // bank instance.\n amount_debit: AmountString;\n\n // That is the amount that will effectively be\n // transferred by the bank to the user's bank\n // account, that is external to the regional currency.\n // It is expressed in the fiat currency and\n // is calculated after the cashout fee and the\n // exchange rate. See the /cashout-rates call.\n // The client needs to calculate this amount\n // correctly based on the amount_debit and the cashout rate,\n // otherwise the request will fail.\n amount_credit: AmountString;\n}\n\nexport interface CashoutResponse {\n // ID identifying the operation being created\n cashout_id: number;\n}\n\n/**\n * @deprecated since 4, use 2fa\n */\nexport interface CashoutConfirmRequest {\n // the TAN that confirms $CASHOUT_ID.\n tan: string;\n}\n\nexport interface Cashouts {\n // Every string represents a cash-out operation ID.\n cashouts: CashoutInfo[];\n}\n\nexport interface CashoutInfo {\n cashout_id: number;\n}\nexport interface GlobalCashouts {\n // Every string represents a cash-out operation ID.\n cashouts: GlobalCashoutInfo[];\n}\nexport interface GlobalCashoutInfo {\n cashout_id: number;\n username: string;\n}\n\nexport interface CashoutStatusResponse {\n // Amount debited to the internal\n // regional currency bank account.\n amount_debit: AmountString;\n\n // Amount credited to the external bank account.\n amount_credit: AmountString;\n\n // Transaction subject.\n subject: string;\n\n // Time when the cashout was created.\n creation_time: Timestamp;\n}\n\nexport interface ConversionRatesResponse {\n // Exchange rate to buy the local currency from the external one\n buy_at_ratio: DecimalNumber;\n\n // Exchange rate to sell the local currency for the external one\n sell_at_ratio: DecimalNumber;\n\n // Fee to subtract after applying the buy ratio.\n buy_in_fee: DecimalNumber;\n\n // Fee to subtract after applying the sell ratio.\n sell_out_fee: DecimalNumber;\n}\n\nexport enum MonitorTimeframeParam {\n hour,\n day,\n month,\n year,\n decade,\n}\n\nexport type MonitorResponse = MonitorNoConversion | MonitorWithConversion;\n\n// Monitoring stats when conversion is not supported\nexport interface MonitorNoConversion {\n type: \"no-conversions\";\n\n // How many payments were made to a Taler exchange by another\n // bank account.\n talerInCount: number;\n\n // Overall volume that has been paid to a Taler\n // exchange by another bank account.\n talerInVolume: AmountString;\n\n // How many payments were made by a Taler exchange to another\n // bank account.\n talerOutCount: number;\n\n // Overall volume that has been paid by a Taler\n // exchange to another bank account.\n talerOutVolume: AmountString;\n}\n// Monitoring stats when conversion is supported\nexport interface MonitorWithConversion {\n type: \"with-conversions\";\n\n // How many cashin operations were confirmed by a\n // wallet owner. Note: wallet owners\n // are NOT required to be customers of the libeufin-bank.\n cashinCount: number;\n\n // Overall regional currency that has been paid by the regional admin account\n // to regional bank accounts to fulfill all the confirmed cashin operations.\n cashinRegionalVolume: AmountString;\n\n // Overall fiat currency that has been paid to the fiat admin account\n // by fiat bank accounts to fulfill all the confirmed cashin operations.\n cashinFiatVolume: AmountString;\n\n // How many cashout operations were confirmed.\n cashoutCount: number;\n\n // Overall regional currency that has been paid to the regional admin account\n // by fiat bank accounts to fulfill all the confirmed cashout operations.\n cashoutRegionalVolume: AmountString;\n\n // Overall fiat currency that has been paid by the fiat admin account\n // to fiat bank accounts to fulfill all the confirmed cashout operations.\n cashoutFiatVolume: AmountString;\n\n // How many payments were made to a Taler exchange by another\n // bank account.\n talerInCount: number;\n\n // Overall volume that has been paid to a Taler\n // exchange by another bank account.\n talerInVolume: AmountString;\n\n // How many payments were made by a Taler exchange to another\n // bank account.\n talerOutCount: number;\n\n // Overall volume that has been paid by a Taler\n // exchange to another bank account.\n talerOutVolume: AmountString;\n}\nexport interface TanTransmission {\n // Channel of the last successful transmission of the TAN challenge.\n tan_channel: TanChannel;\n\n // Info of the last successful transmission of the TAN challenge.\n tan_info: string;\n}\n\nexport interface Challenge {\n // Unique identifier of the challenge to solve to run this protected\n // operation.\n challenge_id: number;\n}\n\nexport interface ChallengeSolve {\n // The TAN code that solves $CHALLENGE_ID\n tan: string;\n}\n\nexport enum TanChannel {\n SMS = \"sms\",\n EMAIL = \"email\",\n}\n\nexport const codecForIntegrationBankConfig = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-bank-integration\"))\n .property(\"version\", codecForString())\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .build(\"TalerCorebankApi.IntegrationConfig\");\n\nexport const codecForCoreBankConfig = (): Codec =>\n buildCodecForObject()\n .property(\n \"name\",\n codecForEither(\n codecForConstString(\"taler-corebank\"),\n codecForConstString(\"libeufin-bank\"),\n ),\n )\n .property(\"version\", codecForString())\n .property(\"bank_name\", codecOptional(codecForString()))\n .property(\"base_url\", codecOptional(codecForString()))\n .property(\"allow_conversion\", codecOptional(codecForBoolean()))\n .property(\"allow_registrations\", codecOptional(codecForBoolean()))\n .property(\"allow_deletions\", codecOptional(codecForBoolean()))\n .property(\"allow_edit_name\", codecOptional(codecForBoolean()))\n .property(\"allow_edit_cashout_payto_uri\", codecOptional(codecForBoolean()))\n .property(\"default_debit_threshold\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\n \"supported_tan_channels\",\n codecOptional(\n codecForList(\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n ),\n ),\n )\n .property(\"wire_type\", codecOptionalDefault(codecForString(), \"iban\"))\n .property(\"wire_transfer_fees\", codecOptional(codecForAmountString()))\n .build(\"TalerCorebankApi.Config\");\n\nconst codecForBalance = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\n \"credit_debit_indicator\",\n codecForEither(\n codecForConstString(\"credit\"),\n codecForConstString(\"debit\"),\n ),\n )\n .build(\"TalerCorebankApi.Balance\");\n\nconst codecForPublicAccount = (): Codec =>\n buildCodecForObject()\n .property(\"username\", codecForString())\n .property(\"balance\", codecForBalance())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\"row_id\", codecOptional(codecForNumber()))\n .build(\"TalerCorebankApi.PublicAccount\");\n\nexport const codecForPublicAccountsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"public_accounts\", codecForList(codecForPublicAccount()))\n .build(\"TalerCorebankApi.PublicAccountsResponse\");\n\nexport const codecForAccountMinimalData = (): Codec =>\n buildCodecForObject()\n .property(\"username\", codecForString())\n .property(\"name\", codecForString())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"balance\", codecForBalance())\n .property(\"row_id\", codecForNumber())\n .property(\"debit_threshold\", codecForAmountString())\n .property(\"min_cashout\", codecOptional(codecForAmountString()))\n .property(\"is_public\", codecForBoolean())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\n \"status\",\n codecOptional(\n codecForEither(\n codecForConstString(\"active\"),\n codecForConstString(\"deleted\"),\n ),\n ),\n )\n .build(\"TalerCorebankApi.AccountMinimalData\");\n\nexport const codecForListBankAccountsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForAccountMinimalData()))\n .build(\"TalerCorebankApi.ListBankAccountsResponse\");\n\nexport const codecForAccountData = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"balance\", codecForBalance())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"debit_threshold\", codecForAmountString())\n .property(\"min_cashout\", codecOptional(codecForAmountString()))\n .property(\"contact_data\", codecOptional(codecForChallengeContactData()))\n .property(\"cashout_payto_uri\", codecOptional(codecForPaytoString()))\n .property(\"is_public\", codecForBoolean())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\n \"tan_channel\",\n codecOptional(\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n ),\n )\n .property(\n \"status\",\n codecOptional(\n codecForEither(\n codecForConstString(\"active\"),\n codecForConstString(\"deleted\"),\n ),\n ),\n )\n .build(\"TalerCorebankApi.AccountData\");\n\nexport const codecForChallengeContactData = (): Codec =>\n buildCodecForObject()\n .property(\"email\", codecOptional(codecForString()))\n .property(\"phone\", codecOptional(codecForString()))\n .build(\"TalerCorebankApi.ChallengeContactData\");\n\nexport const codecForWithdrawalPublicInfo = (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"username\", codecForString())\n .property(\"selected_reserve_pub\", codecOptional(codecForString()))\n .property(\"selected_exchange_account\", codecOptional(codecForPaytoString()))\n .build(\"TalerCorebankApi.WithdrawalPublicInfo\");\n\nexport const codecForBankAccountTransactionsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"transactions\",\n codecForList(codecForBankAccountTransactionInfo()),\n )\n .build(\"TalerCorebankApi.BankAccountTransactionsResponse\");\n\nexport const codecForBankAccountTransactionInfo =\n (): Codec =>\n buildCodecForObject()\n .property(\"creditor_payto_uri\", codecForPaytoString())\n .property(\"debtor_payto_uri\", codecForPaytoString())\n .property(\"amount\", codecForAmountString())\n .property(\n \"direction\",\n codecForEither(\n codecForConstString(\"debit\"),\n codecForConstString(\"credit\"),\n ),\n )\n .property(\"subject\", codecForString())\n .property(\"row_id\", codecForNumber())\n .property(\"date\", codecForTimestamp)\n .build(\"TalerCorebankApi.BankAccountTransactionInfo\");\n\nexport const codecForCreateTransactionResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"row_id\", codecForNumber())\n .build(\"TalerCorebankApi.CreateTransactionResponse\");\n\nexport const codecForRegisterAccountResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"internal_payto_uri\", codecForPaytoString())\n .build(\"TalerCorebankApi.RegisterAccountResponse\");\n\nexport const codecForBankAccountCreateWithdrawalResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_withdraw_uri\", codecForTalerUriString())\n .property(\"withdrawal_id\", codecForString())\n .build(\"TalerCorebankApi.BankAccountCreateWithdrawalResponse\");\n\nexport const codecForCashoutPending = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .build(\"TalerCorebankApi.CashoutPending\");\n\nexport const codecForCashouts = (): Codec =>\n buildCodecForObject()\n .property(\"cashouts\", codecForList(codecForCashoutInfo()))\n .build(\"TalerCorebankApi.Cashouts\");\n\nexport const codecForCashoutInfo = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .build(\"TalerCorebankApi.CashoutInfo\");\n\nexport const codecForGlobalCashouts = (): Codec =>\n buildCodecForObject()\n .property(\"cashouts\", codecForList(codecForGlobalCashoutInfo()))\n .build(\"TalerCorebankApi.GlobalCashouts\");\n\nexport const codecForGlobalCashoutInfo = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .property(\"username\", codecForString())\n .build(\"TalerCorebankApi.GlobalCashoutInfo\");\n\nexport const codecForCashoutStatusResponse = (): Codec =>\n buildCodecForObject()\n .property(\"amount_debit\", codecForAmountString())\n .property(\"amount_credit\", codecForAmountString())\n .property(\"subject\", codecForString())\n .property(\"creation_time\", codecForTimestamp)\n .build(\"TalerCorebankApi.CashoutStatusResponse\");\n\nexport const codecForConversionRatesResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"buy_at_ratio\", codecForDecimalNumber())\n .property(\"buy_in_fee\", codecForDecimalNumber())\n .property(\"sell_at_ratio\", codecForDecimalNumber())\n .property(\"sell_out_fee\", codecForDecimalNumber())\n .build(\"TalerCorebankApi.ConversionRatesResponse\");\n\nexport const codecForMonitorResponse = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"no-conversions\", codecForMonitorNoConversion())\n .alternative(\"with-conversions\", codecForMonitorWithCashout())\n .build(\"TalerWireGatewayApi.IncomingBankTransaction\");\n\nexport const codecForMonitorNoConversion = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"no-conversions\"))\n .property(\"talerInCount\", codecForNumber())\n .property(\"talerInVolume\", codecForAmountString())\n .property(\"talerOutCount\", codecForNumber())\n .property(\"talerOutVolume\", codecForAmountString())\n .build(\"TalerCorebankApi.MonitorJustPayouts\");\n\nexport const codecForMonitorWithCashout = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"with-conversions\"))\n .property(\"cashinCount\", codecForNumber())\n .property(\"cashinFiatVolume\", codecForAmountString())\n .property(\"cashinRegionalVolume\", codecForAmountString())\n .property(\"cashoutCount\", codecForNumber())\n .property(\"cashoutFiatVolume\", codecForAmountString())\n .property(\"cashoutRegionalVolume\", codecForAmountString())\n .property(\"talerInCount\", codecForNumber())\n .property(\"talerInVolume\", codecForAmountString())\n .property(\"talerOutCount\", codecForNumber())\n .property(\"talerOutVolume\", codecForAmountString())\n .build(\"TalerCorebankApi.MonitorWithCashout\");\n\nexport const codecForChallenge = (): Codec =>\n buildCodecForObject()\n .property(\"challenge_id\", codecForNumber())\n .build(\"TalerCorebankApi.Challenge\");\n\nexport const codecForTanTransmission = (): Codec =>\n buildCodecForObject()\n .property(\n \"tan_channel\",\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n )\n .property(\"tan_info\", codecForString())\n .build(\"TalerCorebankApi.TanTransmission\");\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n AccessToken,\n HttpStatusCode,\n LibtoolVersion,\n LongPollParams,\n OperationAlternative,\n OperationFail,\n OperationOk,\n PaginationParams,\n TalerError,\n TalerErrorCode,\n UserAndToken,\n codecForTalerCommonConfigResponse,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n opKnownTalerFailure,\n} from \"@gnu-taler/taler-util\";\nimport {\n HttpRequestLibrary,\n createPlatformHttpLib,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opFixedSuccess,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { WithdrawalOperationStatus } from \"../types-taler-bank-integration.js\";\nimport {\n codecForAccountData,\n codecForBankAccountCreateWithdrawalResponse,\n codecForBankAccountTransactionInfo,\n codecForBankAccountTransactionsResponse,\n codecForCashoutPending,\n codecForCashoutStatusResponse,\n codecForCashouts,\n codecForChallenge,\n codecForCoreBankConfig,\n codecForCreateTransactionResponse,\n codecForGlobalCashouts,\n codecForListBankAccountsResponse,\n codecForMonitorResponse,\n codecForPublicAccountsResponse,\n codecForRegisterAccountResponse,\n codecForTanTransmission,\n codecForWithdrawalPublicInfo,\n} from \"../types-taler-corebank.js\";\nimport {\n CacheEvictor,\n IdempotencyRetry,\n addLongPollingParam,\n addPaginationParams,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nimport * as TalerCorebankApi from \"../types-taler-corebank.js\";\n\nexport type TalerCoreBankResultByMethod<\n prop extends keyof TalerCoreBankHttpClient,\n> = ResultByMethod;\nexport type TalerCoreBankErrorsByMethod<\n prop extends keyof TalerCoreBankHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerCoreBankCacheEviction {\n DELETE_ACCOUNT,\n CREATE_ACCOUNT,\n UPDATE_ACCOUNT,\n UPDATE_PASSWORD,\n CREATE_TRANSACTION,\n CONFIRM_WITHDRAWAL,\n ABORT_WITHDRAWAL,\n CREATE_WITHDRAWAL,\n CREATE_CASHOUT,\n}\n\n/**\n * Protocol version spoken with the core bank.\n *\n * Endpoint must be ordered in the same way that in the docs\n * Response code (http and taler) must have the same order that in the docs\n * That way is easier to see changes\n *\n * Uses libtool's current:revision:age versioning.\n */\nexport class TalerCoreBankHttpClient {\n public readonly PROTOCOL_VERSION = \"4:0:0\";\n\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#config\n *\n */\n async getConfig(): Promise<\n OperationFail | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n // FIXME: Re-enable the check once fakebank and libeufin-bank return the name.\n // const expectedName = \"taler-corebank\";\n // if (minBody.name !== expectedName) {\n // throw TalerError.fromUncheckedDetail({\n // code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n // requestUrl: resp.requestUrl,\n // httpStatusCode: resp.status,\n // detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n // });\n // }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForCoreBankConfig(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // ACCOUNTS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts\n *\n */\n async createAccount(\n auth: AccessToken | undefined,\n body: TalerCorebankApi.RegisterAccountRequest,\n ) {\n const url = new URL(`accounts`, this.baseUrl);\n const headers: Record = {};\n if (auth) {\n headers.Authorization = makeBearerTokenAuthHeader(auth);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers: headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n TalerCoreBankCacheEviction.CREATE_ACCOUNT,\n );\n return opSuccessFromHttp(resp, codecForRegisterAccountResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_REGISTER_USERNAME_REUSE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_REGISTER_PAYTO_URI_REUSE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_TAN_CHANNEL:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHANNEL_NOT_SUPPORTED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_MISSING_TAN_INFO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-corebank.html#delete--accounts-$USERNAME\n *\n */\n async deleteAccount(auth: UserAndToken, cid?: string) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_ACCOUNT_BALANCE_NOT_ZERO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#patch--accounts-$USERNAME\n *\n */\n async updateAccount(\n auth: UserAndToken,\n body: TalerCorebankApi.AccountReconfiguration,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_LEGAL_NAME:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHANNEL_NOT_SUPPORTED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_MISSING_TAN_INFO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#patch--accounts-$USERNAME-auth\n *\n */\n async updatePassword(\n auth: UserAndToken,\n body: TalerCorebankApi.AccountPasswordChange,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}/auth`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_PATCH_BAD_OLD_PASSWORD:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--public-accounts\n *\n */\n async getPublicAccounts(\n filter: { account?: string } = {},\n pagination?: PaginationParams,\n ) {\n const url = new URL(`public-accounts`, this.baseUrl);\n addPaginationParams(url, pagination);\n if (filter.account !== undefined) {\n url.searchParams.set(\"filter_name\", filter.account);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForPublicAccountsResponse());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ public_accounts: [] });\n case HttpStatusCode.NotFound:\n return opFixedSuccess({ public_accounts: [] });\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts\n *\n */\n async getAccounts(\n auth: AccessToken,\n filter: { account?: string } = {},\n pagination?: PaginationParams,\n ) {\n const url = new URL(`accounts`, this.baseUrl);\n addPaginationParams(url, pagination);\n if (filter.account !== undefined) {\n url.searchParams.set(\"filter_name\", filter.account);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForListBankAccountsResponse());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ accounts: [] });\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME\n *\n */\n async getAccount(auth: UserAndToken) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAccountData());\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // TRANSACTIONS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-transactions\n *\n */\n async getTransactions(\n auth: UserAndToken,\n params?: PaginationParams & LongPollParams,\n ) {\n const url = new URL(`accounts/${auth.username}/transactions`, this.baseUrl);\n addPaginationParams(url, params);\n addLongPollingParam(url, params);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankAccountTransactionsResponse(),\n );\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ transactions: [] });\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-transactions-$TRANSACTION_ID\n *\n */\n async getTransactionById(auth: UserAndToken, txid: number) {\n const url = new URL(\n `accounts/${auth.username}/transactions/${String(txid)}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankAccountTransactionInfo());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-transactions\n *\n */\n async createTransaction(\n auth: UserAndToken,\n body: TalerCorebankApi.CreateTransactionRequest,\n idempotencyCheck: IdempotencyRetry | undefined,\n cid?: string,\n ): Promise<\n //manually definition all return types because of recursion\n | OperationOk\n | OperationAlternative\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n > {\n const url = new URL(`accounts/${auth.username}/transactions`, this.baseUrl);\n if (idempotencyCheck) {\n body.request_uid = idempotencyCheck.uid;\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCreateTransactionResponse());\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_ADMIN_CREDITOR:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_SAME_ACCOUNT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNKNOWN_CREDITOR:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED:\n if (!idempotencyCheck) {\n return opKnownTalerFailure(details.code, details);\n }\n const nextRetry = idempotencyCheck.next();\n return this.createTransaction(auth, body, nextRetry, cid);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // WITHDRAWALS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals\n *\n */\n async createWithdrawal(\n auth: UserAndToken,\n body: TalerCorebankApi.BankAccountCreateWithdrawalRequest,\n ) {\n const url = new URL(`accounts/${auth.username}/withdrawals`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankAccountCreateWithdrawalResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n //FIXME: missing in docs\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals-$WITHDRAWAL_ID-confirm\n *\n */\n async confirmWithdrawalById(auth: UserAndToken, wid: string, cid?: string) {\n const url = new URL(\n `accounts/${auth.username}/withdrawals/${wid}/confirm`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_CONFIRM_ABORT_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONFIRM_INCOMPLETE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals-$WITHDRAWAL_ID-abort\n *\n */\n async abortWithdrawalById(auth: UserAndToken, wid: string) {\n const url = new URL(\n `accounts/${auth.username}/withdrawals/${wid}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--withdrawals-$WITHDRAWAL_ID\n *\n */\n async getWithdrawalById(\n wid: string,\n params?: {\n old_state?: WithdrawalOperationStatus;\n } & LongPollParams,\n ) {\n const url = new URL(`withdrawals/${wid}`, this.baseUrl);\n addLongPollingParam(url, params);\n if (params) {\n url.searchParams.set(\n \"old_state\",\n !params.old_state ? \"pending\" : params.old_state,\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWithdrawalPublicInfo());\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // CASHOUTS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-cashouts\n *\n */\n async createCashout(\n auth: UserAndToken,\n body: TalerCorebankApi.CashoutRequest,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}/cashouts`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutPending());\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONVERSION_AMOUNT_TO_SMALL:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_BAD_CONVERSION:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONFIRM_INCOMPLETE:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.BadGateway: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHANNEL_SCRIPT_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-cashouts-$CASHOUT_ID\n *\n */\n async getCashoutById(auth: UserAndToken, cid: number) {\n const url = new URL(\n `accounts/${auth.username}/cashouts/${cid}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutStatusResponse());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-cashouts\n *\n */\n async getAccountCashouts(auth: UserAndToken, pagination?: PaginationParams) {\n const url = new URL(`accounts/${auth.username}/cashouts`, this.baseUrl);\n addPaginationParams(url, pagination);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashouts());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ cashouts: [] });\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--cashouts\n *\n */\n async getGlobalCashouts(auth: AccessToken, pagination?: PaginationParams) {\n const url = new URL(`cashouts`, this.baseUrl);\n addPaginationParams(url, pagination);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForGlobalCashouts());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ cashouts: [] });\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // 2FA\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-challenge-$CHALLENGE_ID\n *\n */\n async sendChallenge(auth: UserAndToken, cid: string) {\n const url = new URL(\n `accounts/${auth.username}/challenge/${cid}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTanTransmission());\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHANNEL_SCRIPT_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-challenge-$CHALLENGE_ID-confirm\n *\n */\n async confirmChallenge(\n auth: UserAndToken,\n cid: string,\n body: TalerCorebankApi.ChallengeSolve,\n ) {\n const url = new URL(\n `accounts/${auth.username}/challenge/${cid}/confirm`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHALLENGE_EXPIRED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHALLENGE_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // MONITOR\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--monitor\n *\n */\n async getMonitor(\n auth: AccessToken,\n params: {\n timeframe?: TalerCorebankApi.MonitorTimeframeParam;\n date?: AbsoluteTime;\n } = {},\n ) {\n const url = new URL(`monitor`, this.baseUrl);\n if (params.timeframe) {\n url.searchParams.set(\n \"timeframe\",\n TalerCorebankApi.MonitorTimeframeParam[params.timeframe],\n );\n }\n if (params.date) {\n const { t_s: seconds } = AbsoluteTime.toProtocolTimestamp(params.date);\n if (seconds !== \"never\") {\n url.searchParams.set(\"date_s\", String(seconds));\n }\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForMonitorResponse());\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Others API\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getIntegrationAPI(): URL {\n return new URL(`taler-integration/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getWireGatewayAPI(username: string): URL {\n return new URL(`accounts/${username}/taler-wire-gateway/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getRevenueAPI(username: string): URL {\n return new URL(`accounts/${username}/taler-revenue/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token\n *\n */\n getAuthenticationAPI(username: string): URL {\n return new URL(`accounts/${username}/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token\n *\n */\n getConversionInfoAPI(): URL {\n return new URL(`conversion-info/`, this.baseUrl);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { Codec, buildCodecForObject, codecForConstString, codecForEither, codecOptional } from \"./codec.js\";\nimport { codecForAmountString, codecForList, codecForString } from \"./index.js\";\nimport { PaytoString, codecForPaytoString } from \"./payto.js\";\nimport { AmountString, CurrencySpecification, codecForCurrencyName, codecForCurrencySpecificiation, codecForLibtoolVersion, codecForURLString } from \"./types-taler-common.js\";\n\nexport type WithdrawalOperationStatus =\n | \"pending\"\n | \"selected\"\n | \"aborted\"\n | \"confirmed\";\n\nexport interface BankVersion {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Currency used by this bank.\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification?: CurrencySpecification;\n\n // Name of the API.\n name: \"taler-bank-integration\";\n}\n\nexport interface BankWithdrawalOperationStatus {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: WithdrawalOperationStatus;\n\n // Currency used for the withdrawal.\n // MUST be present when amount is absent.\n // @since v2, may become mandatory in the future.\n currency?: string;\n\n // Amount that will be withdrawn with this operation\n // (raw amount without fee considerations). Only\n // given once the amount is fixed and cannot be changed.\n // Optional since **vC2EC**.\n amount?: AmountString | undefined;\n\n // Suggestion for the amount to be withdrawn with this\n // operation. Given if a suggestion was made but the\n // user may still change the amount.\n // Optional since **vC2EC**.\n suggested_amount?: AmountString | undefined;\n\n // Maximum amount that the wallet can choose to withdraw.\n // Only applicable when the amount is not fixed.\n // @since **vC2EC**.\n max_amount?: AmountString | undefined;\n\n // The non-Taler card fees the customer will have\n // to pay to the bank / payment service provider\n // they are using to make the withdrawal.\n // @since **vC2EC**\n card_fees?: AmountString | undefined;\n\n // Bank account of the customer that is debiting, as an\n // RFC 8905 payto URI.\n sender_wire?: PaytoString;\n\n // Base URL of the suggested exchange. The bank may have\n // neither a suggestion nor a requirement for the exchange.\n // This value is typically set in the bank's configuration.\n suggested_exchange?: string;\n\n // Base URL of an exchange that must be used. Optional,\n // not given *unless* a particular exchange is mandatory.\n // This value is typically set in the bank's configuration.\n // @since **vC2EC**\n required_exchange?: string;\n\n // URL that the user needs to navigate to in order to\n // complete some final confirmation (e.g. 2FA).\n // Only applicable when status is selected or pending.\n // It may contain the withdrawal operation id.\n confirm_transfer_url?: string;\n\n // Wire transfer types supported by the bank.\n wire_types: string[];\n\n // Reserve public key selected by the exchange,\n // only non-null if status is selected or confirmed.\n selected_reserve_pub?: string;\n\n // Exchange account selected by the wallet;\n // only non-null if status is selected or confirmed.\n // @since **v1**\n selected_exchange_account?: string;\n}\n\nexport interface BankWithdrawalOperationPostRequest {\n // Reserve public key that should become the wire transfer\n // subject to fund the withdrawal.\n reserve_pub: string;\n\n // Payto address of the exchange selected for the withdrawal.\n selected_exchange: PaytoString;\n\n // Selected amount to be transferred. Optional if the\n // backend already knows the amount.\n // @since **vC2EC**\n amount?: AmountString | undefined;\n}\n\nexport interface BankWithdrawalOperationPostResponse {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: Omit<\"pending\", WithdrawalOperationStatus>;\n\n // URL that the user needs to navigate to in order to\n // complete some final confirmation (e.g. 2FA).\n //\n // Only applicable when status is selected or pending.\n // It may contain withdrawal operation id\n confirm_transfer_url?: string;\n}\n\n\nexport const codecForBankVersion =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForCurrencyName())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\"name\", codecForConstString(\"taler-bank-integration\"))\n .property(\"version\", codecForLibtoolVersion())\n .build(\"TalerBankIntegrationApi.BankVersion\");\n\nexport const codecForBankWithdrawalOperationStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecOptional(codecForCurrencyName()))\n .property(\"suggested_amount\", codecOptional(codecForAmountString()))\n .property(\"card_fees\", codecOptional(codecForAmountString()))\n .property(\"sender_wire\", codecOptional(codecForPaytoString()))\n .property(\"suggested_exchange\", codecOptional(codecForURLString()))\n .property(\"confirm_transfer_url\", codecOptional(codecForURLString()))\n .property(\"wire_types\", codecForList(codecForString()))\n .property(\"selected_reserve_pub\", codecOptional(codecForString()))\n .property(\"selected_exchange_account\", codecOptional(codecForString()))\n .property(\"max_amount\", codecOptional(codecForAmountString()))\n .build(\"TalerBankIntegrationApi.BankWithdrawalOperationStatus\");\n\nexport const codecForBankWithdrawalOperationPostResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"confirm_transfer_url\", codecOptional(codecForURLString()))\n .build(\"TalerBankIntegrationApi.BankWithdrawalOperationPostResponse\");", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport { Logger } from \"../logging.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opKnownTalerFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport {\n BankWithdrawalOperationPostRequest,\n WithdrawalOperationStatus,\n codecForBankWithdrawalOperationPostResponse,\n codecForBankWithdrawalOperationStatus,\n} from \"../types-taler-bank-integration.js\";\nimport { LongPollParams } from \"../types-taler-common.js\";\nimport { codecForIntegrationBankConfig } from \"../types-taler-corebank.js\";\nimport { codecForTalerErrorDetail } from \"../types-taler-wallet.js\";\nimport { addLongPollingParam } from \"./utils.js\";\n\nexport type TalerBankIntegrationResultByMethod<\n prop extends keyof TalerBankIntegrationHttpClient,\n> = ResultByMethod;\nexport type TalerBankIntegrationErrorsByMethod<\n prop extends keyof TalerBankIntegrationHttpClient,\n> = FailCasesByMethod;\n\nconst logger = new Logger(\"bank-integration.ts\");\n\n/**\n * The API is used by the wallets.\n */\nexport class TalerBankIntegrationHttpClient {\n public static readonly PROTOCOL_VERSION = \"2:0:1\";\n public readonly PROTOCOL_VERSION =\n TalerBankIntegrationHttpClient.PROTOCOL_VERSION;\n\n httpLib: HttpRequestLibrary;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForIntegrationBankConfig());\n default:\n logger.warn(`config request failed, status ${resp.status}`);\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#get--withdrawal-operation-$WITHDRAWAL_ID\n *\n */\n async getWithdrawalOperationById(\n woid: string,\n params?: {\n old_state?: WithdrawalOperationStatus;\n } & LongPollParams,\n ) {\n const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);\n addLongPollingParam(url, params);\n if (params) {\n url.searchParams.set(\n \"old_state\",\n !params.old_state ? \"pending\" : params.old_state,\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankWithdrawalOperationStatus());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid\n *\n */\n async completeWithdrawalOperationById(\n woid: string,\n body: BankWithdrawalOperationPostRequest,\n ) {\n const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankWithdrawalOperationPostResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const body = await readTalerErrorResponse(resp);\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_DUPLICATE_RESERVE_PUB_SUBJECT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNKNOWN_ACCOUNT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_ACCOUNT_IS_NOT_EXCHANGE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_AMOUNT_DIFFERS:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_AMOUNT_REQUIRED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid\n *\n */\n async abortWithdrawalOperationById(woid: string) {\n const url = new URL(`withdrawal-operation/${woid}/abort`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Imports.\n */\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport {\n codecForChallengeInvalidPinResponse,\n codecForChallengeResponse,\n codecForChallengeSetupResponse,\n codecForChallengeSolveResponse,\n codecForChallengeStatus,\n codecForChallengerAuthResponse,\n codecForChallengerInfoResponse,\n codecForChallengerTermsOfServiceResponse,\n} from \"../types-taler-challenger.js\";\nimport { AccessToken } from \"../types-taler-common.js\";\nimport {\n CacheEvictor,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type ChallengerResultByMethod =\n ResultByMethod;\nexport type ChallengerErrorsByMethod =\n FailCasesByMethod;\n\nexport enum ChallengerCacheEviction {\n CREATE_CHALLENGE,\n SOLVE_CHALLENGE,\n}\n\n/**\n */\nexport class ChallengerHttpClient {\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n public readonly PROTOCOL_VERSION = \"1:0:0\";\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-challenger.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForChallengerTermsOfServiceResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-challenger.html#post--setup-$CLIENT_ID\n *\n */\n async setup(clientId: string, token: AccessToken) {\n const url = new URL(`setup/${clientId}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengeSetupResponse());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // LOGIN\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--authorize-$NONCE\n *\n */\n async login(\n nonce: string,\n clientId: string,\n redirectUri: string,\n state: string | undefined,\n ) {\n const url = new URL(`authorize/${nonce}`, this.baseUrl);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"client_id\", clientId);\n url.searchParams.set(\"redirect_uri\", redirectUri);\n if (state) {\n url.searchParams.set(\"state\", state);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengeStatus());\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // CHALLENGE\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--challenge-$NONCE\n *\n */\n async challenge(nonce: string, body: Record) {\n const url = new URL(`challenge/${nonce}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: new URLSearchParams(Object.entries(body)).toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n redirect: \"manual\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n ChallengerCacheEviction.CREATE_CHALLENGE,\n );\n return opSuccessFromHttp(resp, codecForChallengeResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // SOLVE\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--solve-$NONCE\n *\n */\n async solve(nonce: string, body: Record) {\n const url = new URL(`solve/${nonce}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: new URLSearchParams(Object.entries(body)).toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n redirect: \"manual\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n ChallengerCacheEviction.SOLVE_CHALLENGE,\n );\n return opSuccessFromHttp(resp, codecForChallengeSolveResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownAlternativeFailure(\n resp,\n HttpStatusCode.Forbidden,\n codecForChallengeInvalidPinResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // AUTH\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--token\n *\n */\n async token(\n client_id: string,\n redirect_uri: string,\n client_secret: AccessToken,\n code: string,\n ) {\n const url = new URL(`token`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams(\n Object.entries({\n client_id,\n redirect_uri,\n client_secret,\n code,\n grant_type: \"authorization_code\",\n }),\n ).toString(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengerAuthResponse());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // INFO\n\n /**\n * https://docs.taler.net/core/api-challenger.html#get--info\n *\n */\n async info(token: AccessToken) {\n const url = new URL(`info`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengerInfoResponse());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "import {\n HttpRequestLibrary,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport { hash } from \"../nacl-fast.js\";\nimport {\n FailCasesByMethod,\n OperationFail,\n OperationOk,\n ResultByMethod,\n opEmptySuccess,\n opFixedSuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport {\n TalerSignaturePurpose,\n amountToBuffer,\n bufferForUint32,\n buildSigPS,\n decodeCrock,\n eddsaSign,\n encodeCrock,\n stringToBytes,\n timestampRoundedToBuffer,\n} from \"../taler-crypto.js\";\nimport {\n OfficerAccount,\n PaginationParams,\n SigningKey,\n codecForTalerCommonConfigResponse,\n} from \"../types-taler-common.js\";\nimport {\n codecForAmlDecisionDetails,\n codecForAmlRecords,\n codecForExchangeConfig,\n codecForExchangeKeys,\n} from \"../types-taler-exchange.js\";\nimport { CacheEvictor, addPaginationParams, nullEvictor } from \"./utils.js\";\n\nimport { TalerError } from \"../errors.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport * as TalerExchangeApi from \"../types-taler-exchange.js\";\n\nexport type TalerExchangeResultByMethod<\n prop extends keyof TalerExchangeHttpClient,\n> = ResultByMethod;\nexport type TalerExchangeErrorsByMethod<\n prop extends keyof TalerExchangeHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerExchangeCacheEviction {\n CREATE_DESCISION,\n}\n\n/**\n */\nexport class TalerExchangeHttpClient {\n httpLib: HttpRequestLibrary;\n public readonly PROTOCOL_VERSION = \"18:0:1\";\n cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-exchange.html#get--seed\n *\n */\n async getSeed() {\n const url = new URL(`seed`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n const buffer = await resp.bytes();\n const uintar = new Uint8Array(buffer);\n\n return opFixedSuccess(uintar);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-exchange.html#get--config\n *\n */\n async getConfig(): Promise<\n | OperationFail\n | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n const expectedName = \"taler-exchange\";\n if (minBody.name !== expectedName) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n });\n }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForExchangeConfig(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n *\n * PARTIALLY IMPLEMENTED!!\n */\n async getKeys() {\n const url = new URL(`keys`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForExchangeKeys());\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // TERMS\n\n //\n // AML operations\n //\n\n /**\n * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decisions-$STATE\n *\n */\n async getDecisionsByState(\n auth: OfficerAccount,\n state: TalerExchangeApi.AmlState,\n pagination?: PaginationParams,\n ) {\n const url = new URL(\n `aml/${auth.id}/decisions/${TalerExchangeApi.AmlState[state]}`,\n this.baseUrl,\n );\n addPaginationParams(url, pagination);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n \"Taler-AML-Officer-Signature\": buildQuerySignature(auth.signingKey),\n },\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAmlRecords());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ records: [] });\n //this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decision-$H_PAYTO\n *\n */\n async getDecisionDetails(auth: OfficerAccount, account: string) {\n const url = new URL(`aml/${auth.id}/decision/${account}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n \"Taler-AML-Officer-Signature\": buildQuerySignature(auth.signingKey),\n },\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAmlDecisionDetails());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ aml_history: [], kyc_attributes: [] });\n //this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-exchange.html#post--aml-$OFFICER_PUB-decision\n *\n */\n async addDecisionDetails(\n auth: OfficerAccount,\n decision: Omit,\n ) {\n const url = new URL(`aml/${auth.id}/decision`, this.baseUrl);\n\n const body = buildDecisionSignature(auth.signingKey, decision);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n //FIXME: this two need to be split by error code\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n\nfunction buildQuerySignature(key: SigningKey): string {\n const sigBlob = buildSigPS(\n TalerSignaturePurpose.TALER_SIGNATURE_AML_QUERY,\n ).build();\n\n return encodeCrock(eddsaSign(sigBlob, key));\n}\n\nfunction buildDecisionSignature(\n key: SigningKey,\n decision: Omit,\n): TalerExchangeApi.AmlDecision {\n const zero = new Uint8Array(new ArrayBuffer(64));\n\n const sigBlob = buildSigPS(TalerSignaturePurpose.TALER_SIGNATURE_AML_DECISION)\n //TODO: new need the null terminator, also in the exchange\n .put(hash(stringToBytes(decision.justification))) //check null\n .put(timestampRoundedToBuffer(decision.decision_time))\n .put(amountToBuffer(decision.new_threshold))\n .put(decodeCrock(decision.h_payto))\n .put(zero) //kyc_requirement\n .put(bufferForUint32(decision.new_state))\n .build();\n\n const officer_sig = encodeCrock(eddsaSign(sigBlob, key));\n return {\n ...decision,\n officer_sig,\n };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AccessToken,\n FailCasesByMethod,\n HttpStatusCode,\n LibtoolVersion,\n OperationFail,\n OperationOk,\n PaginationParams,\n ResultByMethod,\n TalerError,\n TalerErrorCode,\n TalerMerchantApi,\n TalerMerchantConfigResponse,\n codecForAbortResponse,\n codecForAccountAddResponse,\n codecForAccountKycRedirects,\n codecForAccountsSummaryResponse,\n codecForBankAccountDetail,\n codecForClaimResponse,\n codecForInstancesResponse,\n codecForInventorySummaryResponse,\n codecForMerchantOrderPrivateStatusResponse,\n codecForMerchantPosProductDetail,\n codecForMerchantRefundResponse,\n codecForOrderHistory,\n codecForOtpDeviceDetails,\n codecForOtpDeviceSummaryResponse,\n codecForOutOfStockResponse,\n codecForPaidRefundStatusResponse,\n codecForPaymentResponse,\n codecForPostOrderResponse,\n codecForProductDetail,\n codecForQueryInstancesResponse,\n codecForStatusGoto,\n codecForStatusPaid,\n codecForStatusStatusUnpaid,\n codecForTalerCommonConfigResponse,\n codecForTalerMerchantConfigResponse,\n codecForTansferList,\n codecForTemplateDetails,\n codecForTemplateSummaryResponse,\n codecForTokenFamiliesList,\n codecForTokenFamilyDetails,\n codecForWalletRefundResponse,\n codecForWalletTemplateDetails,\n codecForWebhookDetails,\n codecForWebhookSummaryResponse,\n opEmptySuccess,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n} from \"@gnu-taler/taler-util\";\nimport {\n HttpRequestLibrary,\n HttpResponse,\n createPlatformHttpLib,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\nimport { opSuccessFromHttp, opUnknownFailure } from \"../operation.js\";\nimport {\n CacheEvictor,\n addMerchantPaginationParams,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type TalerMerchantInstanceResultByMethod<\n prop extends keyof TalerMerchantInstanceHttpClient,\n> = ResultByMethod;\nexport type TalerMerchantInstanceErrorsByMethod<\n prop extends keyof TalerMerchantInstanceHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerMerchantInstanceCacheEviction {\n CREATE_ORDER,\n UPDATE_ORDER,\n DELETE_ORDER,\n UPDATE_CURRENT_INSTANCE,\n DELETE_CURRENT_INSTANCE,\n CREATE_BANK_ACCOUNT,\n UPDATE_BANK_ACCOUNT,\n DELETE_BANK_ACCOUNT,\n CREATE_PRODUCT,\n UPDATE_PRODUCT,\n DELETE_PRODUCT,\n CREATE_TRANSFER,\n DELETE_TRANSFER,\n CREATE_DEVICE,\n UPDATE_DEVICE,\n DELETE_DEVICE,\n CREATE_TEMPLATE,\n UPDATE_TEMPLATE,\n DELETE_TEMPLATE,\n CREATE_WEBHOOK,\n UPDATE_WEBHOOK,\n DELETE_WEBHOOK,\n CREATE_TOKENFAMILY,\n UPDATE_TOKENFAMILY,\n DELETE_TOKENFAMILY,\n LAST,\n}\n\nexport enum TalerMerchantManagementCacheEviction {\n CREATE_INSTANCE = TalerMerchantInstanceCacheEviction.LAST + 1,\n UPDATE_INSTANCE,\n DELETE_INSTANCE,\n}\n\n/**\n * Protocol version spoken with the core bank.\n *\n * Endpoint must be ordered in the same way that in the docs\n * Response code (http and taler) must have the same order that in the docs\n * That way is easier to see changes\n *\n * Uses libtool's current:revision:age versioning.\n */\nexport class TalerMerchantInstanceHttpClient {\n public readonly PROTOCOL_VERSION = \"15:0:0\";\n\n readonly httpLib: HttpRequestLibrary;\n readonly cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n */\n async getConfig(): Promise<\n | OperationFail\n | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n const expectedName = \"taler-merchant\";\n if (minBody.name !== expectedName) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n });\n }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerMerchantConfigResponse(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Wallet API\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-claim\n */\n async claimOrder(orderId: string, body: TalerMerchantApi.ClaimRequest) {\n const url = new URL(`orders/${orderId}/claim`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForClaimResponse());\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-pay\n */\n async makePayment(orderId: string, body: TalerMerchantApi.PayRequest) {\n const url = new URL(`orders/${orderId}/pay`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPaymentResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.PaymentRequired:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.RequestTimeout:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.PreconditionFailed:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-orders-$ORDER_ID\n */\n\n async getPaymentStatus(\n orderId: string,\n params: TalerMerchantApi.PaymentStatusRequestParams = {},\n ) {\n const url = new URL(`orders/${orderId}`, this.baseUrl);\n\n if (params.allowRefundedForRepurchase !== undefined) {\n url.searchParams.set(\n \"allow_refunded_for_repurchase\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.awaitRefundObtained !== undefined) {\n url.searchParams.set(\n \"await_refund_obtained\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.claimToken !== undefined) {\n url.searchParams.set(\"token\", params.claimToken);\n }\n if (params.contractTermHash !== undefined) {\n url.searchParams.set(\"h_contract\", params.contractTermHash);\n }\n if (params.refund !== undefined) {\n url.searchParams.set(\"refund\", params.refund);\n }\n if (params.sessionId !== undefined) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout !== undefined) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n // body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForStatusPaid());\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForStatusGoto());\n // case HttpStatusCode.Found: not possible since content is not HTML\n case HttpStatusCode.PaymentRequired:\n return opSuccessFromHttp(resp, codecForStatusStatusUnpaid());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#demonstrating-payment\n */\n async demostratePayment(orderId: string, body: TalerMerchantApi.PaidRequest) {\n const url = new URL(`orders/${orderId}/paid`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPaidRefundStatusResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#aborting-incomplete-payments\n */\n async abortIncompletePayment(\n orderId: string,\n body: TalerMerchantApi.AbortRequest,\n ) {\n const url = new URL(`orders/${orderId}/abort`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForAbortResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#obtaining-refunds\n */\n async obtainRefund(\n orderId: string,\n body: TalerMerchantApi.WalletRefundRequest,\n ) {\n const url = new URL(`orders/${orderId}/refund`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForWalletRefundResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-auth\n */\n async updateCurrentInstanceAuthentication(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceAuthConfigurationMessage,\n ) {\n const url = new URL(`private/auth`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: // FIXME: missing in docs\n return opEmptySuccess(resp);\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private\n */\n async updateCurrentInstance(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceReconfigurationMessage,\n ) {\n const url = new URL(`private`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_CURRENT_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private\n *\n */\n async getCurrentInstanceDetails(token: AccessToken) {\n const url = new URL(`private`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForQueryInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private\n */\n async deleteCurrentInstance(\n token: AccessToken | undefined,\n params: { purge?: boolean } = {},\n ) {\n const url = new URL(`private`, this.baseUrl);\n\n if (params.purge !== undefined) {\n url.searchParams.set(\"purge\", params.purge ? \"YES\" : \"NO\");\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_CURRENT_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--instances-$INSTANCE-private-kyc\n */\n async getCurrentIntanceKycStatus(\n token: AccessToken | undefined,\n params: TalerMerchantApi.GetKycStatusRequestParams = {},\n ) {\n const url = new URL(`private/kyc`, this.baseUrl);\n\n if (params.wireHash) {\n url.searchParams.set(\"h_wire\", params.wireHash);\n }\n if (params.exchangeURL) {\n url.searchParams.set(\"exchange_url\", params.exchangeURL);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForAccountKycRedirects());\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForAccountKycRedirects(),\n );\n case HttpStatusCode.ServiceUnavailable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Bank Accounts\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-accounts\n */\n async addBankAccount(\n token: AccessToken | undefined,\n body: TalerMerchantApi.AccountAddDetails,\n ) {\n const url = new URL(`private/accounts`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_BANK_ACCOUNT,\n );\n return opSuccessFromHttp(resp, codecForAccountAddResponse());\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async updateBankAccount(\n token: AccessToken | undefined,\n wireAccount: string,\n body: TalerMerchantApi.AccountPatchDetails,\n ) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_BANK_ACCOUNT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts\n */\n async listBankAccounts(token: AccessToken, params?: PaginationParams) {\n const url = new URL(`private/accounts`, this.baseUrl);\n\n // addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAccountsSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async getBankAccountDetails(\n token: AccessToken | undefined,\n wireAccount: string,\n ) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankAccountDetail());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async deleteBankAccount(token: AccessToken | undefined, wireAccount: string) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_BANK_ACCOUNT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Inventory Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-products\n */\n async addProduct(\n token: AccessToken | undefined,\n body: TalerMerchantApi.ProductAddDetail,\n ) {\n const url = new URL(`private/products`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-products-$PRODUCT_ID\n */\n async updateProduct(\n token: AccessToken | undefined,\n productId: string,\n body: TalerMerchantApi.ProductPatchDetail,\n ) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products\n */\n async listProducts(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/products`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForInventorySummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: not in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-pos\n */\n async getPointOfSaleInventory(token: AccessToken | undefined) {\n const url = new URL(`private/pos`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForMerchantPosProductDetail());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products-$PRODUCT_ID\n */\n async getProductDetails(token: AccessToken | undefined, productId: string) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForProductDetail());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#reserving-inventory\n */\n async lockProduct(\n token: AccessToken | undefined,\n productId: string,\n body: TalerMerchantApi.LockRequest,\n ) {\n const url = new URL(`private/products/${productId}/lock`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#removing-products-from-inventory\n */\n async deleteProduct(token: AccessToken | undefined, productId: string) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Payment processing\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders\n */\n async createOrder(\n token: AccessToken | undefined,\n body: TalerMerchantApi.PostOrderRequest,\n ) {\n const url = new URL(`private/orders`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n return this.procesOrderCreationResponse(resp);\n }\n\n private async procesOrderCreationResponse(resp: HttpResponse) {\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPostOrderResponse());\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForOutOfStockResponse(),\n );\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#inspecting-orders\n */\n async listOrders(\n token: AccessToken | undefined,\n params: TalerMerchantApi.ListOrdersRequestParams = {},\n ) {\n const url = new URL(`private/orders`, this.baseUrl);\n\n if (params.date) {\n url.searchParams.set(\"date_s\", String(params.date));\n }\n if (params.fulfillmentUrl) {\n url.searchParams.set(\"fulfillment_url\", params.fulfillmentUrl);\n }\n if (params.paid !== undefined) {\n url.searchParams.set(\"paid\", params.paid ? \"YES\" : \"NO\");\n }\n if (params.refunded !== undefined) {\n url.searchParams.set(\"refunded\", params.refunded ? \"YES\" : \"NO\");\n }\n if (params.sessionId) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout\", String(params.timeout));\n }\n if (params.wired !== undefined) {\n url.searchParams.set(\"wired\", params.wired ? \"YES\" : \"NO\");\n }\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOrderHistory());\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-orders-$ORDER_ID\n */\n async getOrderDetails(\n token: AccessToken | undefined,\n orderId: string,\n params: TalerMerchantApi.GetOrderRequestParams = {},\n ) {\n const url = new URL(`private/orders/${orderId}`, this.baseUrl);\n\n if (params.allowRefundedForRepurchase !== undefined) {\n url.searchParams.set(\n \"allow_refunded_for_repurchase\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.sessionId) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForMerchantOrderPrivateStatusResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForOutOfStockResponse(),\n );\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#private-order-data-cleanup\n */\n async forgetOrder(\n token: AccessToken | undefined,\n orderId: string,\n body: TalerMerchantApi.ForgetRequest,\n ) {\n const url = new URL(`private/orders/${orderId}/forget`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-orders-$ORDER_ID\n */\n async deleteOrder(token: AccessToken | undefined, orderId: string) {\n const url = new URL(`private/orders/${orderId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_ORDER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Refunds\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders-$ORDER_ID-refund\n */\n async addRefund(\n token: AccessToken | undefined,\n orderId: string,\n body: TalerMerchantApi.RefundRequest,\n ) {\n const url = new URL(`private/orders/${orderId}/refund`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForMerchantRefundResponse());\n }\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Wire Transfer\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-transfers\n */\n async informWireTransfer(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TransferInformation,\n ) {\n const url = new URL(`private/transfers`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TRANSFER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-transfers\n */\n async listWireTransfers(\n token: AccessToken | undefined,\n params: TalerMerchantApi.ListWireTransferRequestParams = {},\n ) {\n const url = new URL(`private/transfers`, this.baseUrl);\n\n if (params.after) {\n url.searchParams.set(\"after\", String(params.after));\n }\n if (params.before) {\n url.searchParams.set(\"before\", String(params.before));\n }\n if (params.paytoURI) {\n url.searchParams.set(\"payto_uri\", params.paytoURI);\n }\n if (params.verified !== undefined) {\n url.searchParams.set(\"verified\", params.verified ? \"YES\" : \"NO\");\n }\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTansferList());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-transfers-$TID\n */\n async deleteWireTransfer(token: AccessToken | undefined, transferId: string) {\n const url = new URL(`private/transfers/${transferId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TRANSFER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // OTP Devices\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-otp-devices\n */\n async addOtpDevice(\n token: AccessToken | undefined,\n body: TalerMerchantApi.OtpDeviceAddDetails,\n ) {\n const url = new URL(`private/otp-devices`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async updateOtpDevice(\n token: AccessToken | undefined,\n deviceId: string,\n body: TalerMerchantApi.OtpDevicePatchDetails,\n ) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices\n */\n async listOtpDevices(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/otp-devices`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOtpDeviceSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async getOtpDeviceDetails(\n token: AccessToken | undefined,\n deviceId: string,\n params: TalerMerchantApi.GetOtpDeviceRequestParams = {},\n ) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n if (params.faketime) {\n url.searchParams.set(\"faketime\", String(params.faketime));\n }\n if (params.price) {\n url.searchParams.set(\"price\", params.price);\n }\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOtpDeviceDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async deleteOtpDevice(token: AccessToken | undefined, deviceId: string) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Templates\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-templates\n */\n async addTemplate(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TemplateAddDetails,\n ) {\n const url = new URL(`private/templates`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async updateTemplate(\n token: AccessToken | undefined,\n templateId: string,\n body: TalerMerchantApi.TemplatePatchDetails,\n ) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#inspecting-template\n */\n async listTemplates(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/templates`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTemplateSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async getTemplateDetails(token: AccessToken | undefined, templateId: string) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTemplateDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async deleteTemplate(token: AccessToken | undefined, templateId: string) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-templates-$TEMPLATE_ID\n */\n async useTemplateGetInfo(templateId: string) {\n const url = new URL(`templates/${templateId}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWalletTemplateDetails());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-templates-$TEMPLATE_ID\n */\n async useTemplateCreateOrder(\n templateId: string,\n body: TalerMerchantApi.UsingTemplateDetails,\n ) {\n const url = new URL(`templates/${templateId}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n return this.procesOrderCreationResponse(resp);\n }\n\n //\n // Webhooks\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-webhooks\n */\n async addWebhook(\n token: AccessToken | undefined,\n body: TalerMerchantApi.WebhookAddDetails,\n ) {\n const url = new URL(`private/webhooks`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async updateWebhook(\n token: AccessToken | undefined,\n webhookId: string,\n body: TalerMerchantApi.WebhookPatchDetails,\n ) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks\n */\n async listWebhooks(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/webhooks`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWebhookSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async getWebhookDetails(token: AccessToken | undefined, webhookId: string) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opSuccessFromHttp(resp, codecForWebhookDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async deleteWebhook(token: AccessToken | undefined, webhookId: string) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // token families\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-tokenfamilies\n */\n async createTokenFamily(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TokenFamilyCreateRequest,\n ) {\n const url = new URL(`private/tokenfamilies`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TOKENFAMILY,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async updateTokenFamily(\n token: AccessToken | undefined,\n tokenSlug: string,\n body: TalerMerchantApi.TokenFamilyUpdateRequest,\n ) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_TOKENFAMILY,\n );\n return opSuccessFromHttp(resp, codecForTokenFamilyDetails());\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies\n */\n async listTokenFamilies(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/tokenfamilies`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTokenFamiliesList());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async getTokenFamilyDetails(\n token: AccessToken | undefined,\n tokenSlug: string,\n ) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTokenFamilyDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async deleteTokenFamily(token: AccessToken | undefined, tokenSlug: string) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TOKENFAMILY,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * Get the auth api against the current instance\n *\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-token\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-token\n */\n getAuthenticationAPI(): URL {\n return new URL(`private/`, this.baseUrl);\n }\n}\n\nexport type TalerMerchantManagementResultByMethod<\n prop extends keyof TalerMerchantManagementHttpClient,\n> = ResultByMethod;\nexport type TalerMerchantManagementErrorsByMethod<\n prop extends keyof TalerMerchantManagementHttpClient,\n> = FailCasesByMethod;\n\nexport class TalerMerchantManagementHttpClient extends TalerMerchantInstanceHttpClient {\n readonly cacheManagementEvictor: CacheEvictor<\n TalerMerchantInstanceCacheEviction | TalerMerchantManagementCacheEviction\n >;\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n // cacheManagementEvictor?: CacheEvictor,\n cacheEvictor?: CacheEvictor<\n TalerMerchantInstanceCacheEviction | TalerMerchantManagementCacheEviction\n >,\n ) {\n super(baseUrl, httpClient, cacheEvictor);\n this.cacheManagementEvictor = cacheEvictor ?? nullEvictor;\n }\n\n getSubInstanceAPI(instanceId: string) {\n return new URL(`instances/${instanceId}/`, this.baseUrl);\n }\n\n //\n // Instance Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post--management-instances\n */\n async createInstance(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceConfigurationMessage,\n ) {\n const url = new URL(`management/instances`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.CREATE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post--management-instances-$INSTANCE-auth\n */\n async updateInstanceAuthentication(\n token: AccessToken | undefined,\n instanceId: string,\n body: TalerMerchantApi.InstanceAuthConfigurationMessage,\n ) {\n const url = new URL(\n `management/instances/${instanceId}/auth`,\n this.baseUrl,\n );\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch--management-instances-$INSTANCE\n */\n async updateInstance(\n token: AccessToken | undefined,\n instanceId: string,\n body: TalerMerchantApi.InstanceReconfigurationMessage,\n ) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.UPDATE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances\n */\n async listInstances(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`management/instances`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE\n *\n */\n async getInstanceDetails(token: AccessToken | undefined, instanceId: string) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForQueryInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete--management-instances-$INSTANCE\n */\n async deleteInstance(\n token: AccessToken | undefined,\n instanceId: string,\n params: { purge?: boolean } = {},\n ) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n if (params.purge !== undefined) {\n url.searchParams.set(\"purge\", params.purge ? \"YES\" : \"NO\");\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.DELETE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE-kyc\n */\n async getIntanceKycStatus(\n token: AccessToken | undefined,\n instanceId: string,\n params: TalerMerchantApi.GetKycStatusRequestParams,\n ) {\n const url = new URL(`management/instances/${instanceId}/kyc`, this.baseUrl);\n\n if (params.wireHash) {\n url.searchParams.set(\"h_wire\", params.wireHash);\n }\n if (params.exchangeURL) {\n url.searchParams.set(\"exchange_url\", params.exchangeURL);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForAccountKycRedirects());\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.ServiceUnavailable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "// @ts-ignore: no type decl for this library\nimport * as jedLib from \"jed\";\nimport { Logger } from \"./logging.js\";\n\nconst logger = new Logger(\"i18n/index.ts\");\n\nexport let jed: any = undefined;\n\n/**\n * Set up jed library for internationalization,\n * based on browser language settings.\n */\nexport function setupI18n(lang: string, strings: { [s: string]: any }): void {\n lang = lang.replace(\"_\", \"-\");\n\n if (!strings[lang]) {\n strings[lang] = {};\n // logger.warn(`language ${lang} not found, defaulting to source strings`);\n }\n jed = new jedLib.Jed(strings[lang]);\n}\n\n/**\n * Use different translations for testing. Should not be used outside\n * of test cases.\n */\nexport function internalSetStrings(langStrings: any): void {\n jed = new jedLib.Jed(langStrings);\n}\n\ndeclare const __translated: unique symbol;\nexport type TranslatedString = string & { [__translated]: true };\n\n/**\n * Convert template strings to a msgid\n */\nfunction toI18nString(stringSeq: ReadonlyArray): TranslatedString {\n let s = \"\";\n for (let i = 0; i < stringSeq.length; i++) {\n s += stringSeq[i];\n if (i < stringSeq.length - 1) {\n s += `%${i + 1}$s`;\n }\n }\n return s as TranslatedString;\n}\n\n/**\n * Internationalize a string template with arbitrary serialized values.\n */\nexport function singular(\n stringSeq: TemplateStringsArray,\n ...values: any[]\n): TranslatedString {\n const s = toI18nString(stringSeq);\n const tr = jed\n .translate(s)\n .ifPlural(1, s)\n .fetch(...values);\n return tr;\n}\n\n/**\n * Internationalize a string template without serializing\n */\nexport function translate(\n stringSeq: TemplateStringsArray,\n ...values: any[]\n): TranslatedString[] {\n const s = toI18nString(stringSeq);\n if (!s) return [];\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n return replacePlaceholderWithValues(translation, values);\n}\n\n/**\n * Internationalize a string template without serializing\n */\nexport function Translate({\n children,\n debug,\n}: {\n children: any;\n debug?: boolean;\n}): any {\n const c = [].concat(children);\n const s = stringifyArray(c);\n if (!s) return [];\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n if (debug) {\n console.log(\"looking for \", s, \"got\", translation);\n }\n return replacePlaceholderWithValues(translation, c);\n}\n\n/**\n * Get an internationalized string (based on the globally set, current language)\n * from a JSON object. Fall back to the default language of the JSON object\n * if no match exists.\n */\nexport function getJsonI18n(\n obj: Record,\n key: K,\n): string {\n return obj[key];\n}\n\nexport function getTranslatedArray(array: Array) {\n const s = stringifyArray(array);\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n return replacePlaceholderWithValues(translation, array);\n}\n\nfunction replacePlaceholderWithValues(\n translation: TranslatedString,\n childArray: Array,\n): Array {\n const tr = translation.split(/%(\\d+)\\$s/);\n // const childArray = toChildArray(children);\n // Merge consecutive string children.\n const placeholderChildren = [];\n for (let i = 0; i < childArray.length; i++) {\n const x = childArray[i];\n if (x === undefined) {\n continue;\n } else if (typeof x === \"string\") {\n continue;\n } else {\n placeholderChildren.push(x);\n }\n }\n const result = [];\n for (let i = 0; i < tr.length; i++) {\n if (i % 2 == 0) {\n // Text\n result.push(tr[i]);\n } else {\n const childIdx = Number.parseInt(tr[i]) - 1;\n result.push(placeholderChildren[childIdx]);\n }\n }\n return result;\n}\n\nfunction stringifyArray(children: Array): string {\n let n = 1;\n const ss = children.map((c) => {\n if (typeof c === \"string\") {\n return c;\n }\n return `%${n++}$s`;\n });\n const s = ss.join(\"\").replace(/ +/g, \" \").trim();\n return s;\n}\n\nexport const i18n = {\n str: singular,\n singular,\n Translate,\n translate,\n};\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * IBAN validation.\n *\n * Currently only validates the checksum.\n *\n * It does not validate:\n * - Country-specific length\n * - Country-specific checksums\n *\n * The country list is also not complete.\n *\n * @author Florian Dold \n */\n\nexport type IbanValidationResult =\n | { type: \"invalid\" }\n | {\n type: \"valid\";\n normalizedIban: string;\n };\n\nexport interface IbanCountryInfo {\n name: string;\n isSepa?: boolean;\n length?: number;\n}\n\n/**\n * Incomplete list, see https://www.swift.com/resource/iban-registry-pdf\n */\nexport const ibanCountryInfoTable: Record = {\n AE: { name: \"U.A.E.\" },\n AF: { name: \"Afghanistan\" },\n AL: { name: \"Albania\" },\n AM: { name: \"Armenia\" },\n AN: { name: \"Netherlands Antilles\" },\n AR: { name: \"Argentina\" },\n AT: { name: \"Austria\" },\n AU: { name: \"Australia\" },\n AZ: { name: \"Azerbaijan\" },\n BA: { name: \"Bosnia and Herzegovina\" },\n BD: { name: \"Bangladesh\" },\n BE: { name: \"Belgium\" },\n BG: { name: \"Bulgaria\" },\n BH: { name: \"Bahrain\" },\n BN: { name: \"Brunei Darussalam\" },\n BO: { name: \"Bolivia\" },\n BR: { name: \"Brazil\" },\n BT: { name: \"Bhutan\" },\n BY: { name: \"Belarus\" },\n BZ: { name: \"Belize\" },\n CA: { name: \"Canada\" },\n CG: { name: \"Congo\" },\n CH: { name: \"Switzerland\" },\n CI: { name: \"Cote d'Ivoire\" },\n CL: { name: \"Chile\" },\n CM: { name: \"Cameroon\" },\n CN: { name: \"People's Republic of China\" },\n CO: { name: \"Colombia\" },\n CR: { name: \"Costa Rica\" },\n CS: { name: \"Serbia and Montenegro\" },\n CZ: { name: \"Czech Republic\" },\n DE: { name: \"Germany\" },\n DK: { name: \"Denmark\" },\n DO: { name: \"Dominican Republic\" },\n DZ: { name: \"Algeria\" },\n EC: { name: \"Ecuador\" },\n EE: { name: \"Estonia\" },\n EG: { name: \"Egypt\" },\n ER: { name: \"Eritrea\" },\n ES: { name: \"Spain\" },\n ET: { name: \"Ethiopia\" },\n FI: { name: \"Finland\" },\n FO: { name: \"Faroe Islands\" },\n FR: { name: \"France\" },\n GB: { name: \"United Kingdom\" },\n GD: { name: \"Caribbean\" },\n GE: { name: \"Georgia\" },\n GL: { name: \"Greenland\" },\n GR: { name: \"Greece\" },\n GT: { name: \"Guatemala\" },\n HK: { name: \"Hong Kong S.A.R.\" },\n HN: { name: \"Honduras\" },\n HR: { name: \"Croatia\" },\n HT: { name: \"Haiti\" },\n HU: { name: \"Hungary\" },\n ID: { name: \"Indonesia\" },\n IE: { name: \"Ireland\" },\n IL: { name: \"Israel\" },\n IN: { name: \"India\" },\n IQ: { name: \"Iraq\" },\n IR: { name: \"Iran\" },\n IS: { name: \"Iceland\" },\n IT: { name: \"Italy\" },\n JM: { name: \"Jamaica\" },\n JO: { name: \"Jordan\" },\n JP: { name: \"Japan\" },\n KE: { name: \"Kenya\" },\n KG: { name: \"Kyrgyzstan\" },\n KH: { name: \"Cambodia\" },\n KR: { name: \"South Korea\" },\n KW: { name: \"Kuwait\" },\n KZ: { name: \"Kazakhstan\" },\n LA: { name: \"Laos\" },\n LB: { name: \"Lebanon\" },\n LI: { name: \"Liechtenstein\" },\n LK: { name: \"Sri Lanka\" },\n LT: { name: \"Lithuania\" },\n LU: { name: \"Luxembourg\" },\n LV: { name: \"Latvia\" },\n LY: { name: \"Libya\" },\n MA: { name: \"Morocco\" },\n MC: { name: \"Principality of Monaco\" },\n MD: { name: \"Moldava\" },\n ME: { name: \"Montenegro\" },\n MK: { name: \"Former Yugoslav Republic of Macedonia\" },\n ML: { name: \"Mali\" },\n MM: { name: \"Myanmar\" },\n MN: { name: \"Mongolia\" },\n MO: { name: \"Macau S.A.R.\" },\n MT: { name: \"Malta\" },\n MV: { name: \"Maldives\" },\n MX: { name: \"Mexico\" },\n MY: { name: \"Malaysia\" },\n NG: { name: \"Nigeria\" },\n NI: { name: \"Nicaragua\" },\n NL: { name: \"Netherlands\" },\n NO: { name: \"Norway\" },\n NP: { name: \"Nepal\" },\n NZ: { name: \"New Zealand\" },\n OM: { name: \"Oman\" },\n PA: { name: \"Panama\" },\n PE: { name: \"Peru\" },\n PH: { name: \"Philippines\" },\n PK: { name: \"Islamic Republic of Pakistan\" },\n PL: { name: \"Poland\" },\n PR: { name: \"Puerto Rico\" },\n PT: { name: \"Portugal\" },\n PY: { name: \"Paraguay\" },\n QA: { name: \"Qatar\" },\n RE: { name: \"Reunion\" },\n RO: { name: \"Romania\" },\n RS: { name: \"Serbia\" },\n RU: { name: \"Russia\" },\n RW: { name: \"Rwanda\" },\n SA: { name: \"Saudi Arabia\" },\n SE: { name: \"Sweden\" },\n SG: { name: \"Singapore\" },\n SI: { name: \"Slovenia\" },\n SK: { name: \"Slovak\" },\n SN: { name: \"Senegal\" },\n SO: { name: \"Somalia\" },\n SR: { name: \"Suriname\" },\n SV: { name: \"El Salvador\" },\n SY: { name: \"Syria\" },\n TH: { name: \"Thailand\" },\n TJ: { name: \"Tajikistan\" },\n TM: { name: \"Turkmenistan\" },\n TN: { name: \"Tunisia\" },\n TR: { name: \"Turkey\" },\n TT: { name: \"Trinidad and Tobago\" },\n TW: { name: \"Taiwan\" },\n TZ: { name: \"Tanzania\" },\n UA: { name: \"Ukraine\" },\n US: { name: \"United States\" },\n UY: { name: \"Uruguay\" },\n VA: { name: \"Vatican\" },\n VE: { name: \"Venezuela\" },\n VN: { name: \"Viet Nam\" },\n YE: { name: \"Yemen\" },\n ZA: { name: \"South Africa\" },\n ZW: { name: \"Zimbabwe\" },\n};\n\nlet ccZero = \"0\".charCodeAt(0);\nlet ccNine = \"9\".charCodeAt(0);\nlet ccA = \"A\".charCodeAt(0);\nlet ccZ = \"Z\".charCodeAt(0);\n\n/**\n * Append a IBAN digit(s) based on a char code.\n */\nfunction appendDigit(digits: number[], cc: number): boolean {\n if (cc >= ccZero && cc <= ccNine) {\n digits.push(cc - ccZero);\n } else if (cc >= ccA && cc <= ccZ) {\n const n = cc - ccA + 10;\n digits.push(Math.floor(n / 10) % 10);\n digits.push(n % 10);\n } else {\n return false;\n }\n return true;\n}\n\n/**\n * Compute MOD-97-10 as per ISO/IEC 7064:2003.\n */\nfunction mod97(digits: number[]): number {\n let i = 0;\n let modAccum = 0;\n while (i < digits.length) {\n let n = 0;\n while (n < 9 && i < digits.length) {\n modAccum = modAccum * 10 + digits[i];\n i++;\n n++;\n }\n modAccum = modAccum % 97;\n }\n return modAccum;\n}\n\nexport function validateIban(ibanString: string): IbanValidationResult {\n let myIban = ibanString.toLocaleUpperCase().replace(\" \", \"\");\n let countryCode = myIban.substring(0, 2);\n let countryInfo = ibanCountryInfoTable[countryCode];\n\n if (!countryInfo) {\n return {\n type: \"invalid\",\n };\n }\n\n let digits: number[] = [];\n\n for (let i = 4; i < myIban.length; i++) {\n const cc = myIban.charCodeAt(i);\n if (!appendDigit(digits, cc)) {\n return {\n type: \"invalid\",\n };\n }\n }\n\n for (let i = 0; i < 4; i++) {\n if (!appendDigit(digits, ibanString.charCodeAt(i))) {\n return {\n type: \"invalid\",\n };\n }\n }\n\n const rem = mod97(digits);\n if (rem === 1) {\n return {\n type: \"valid\",\n normalizedIban: myIban,\n };\n } else {\n return {\n type: \"invalid\",\n };\n }\n}\n\nexport function generateIban(countryCode: string, length: number): string {\n let ibanSuffix = \"\";\n let digits: number[] = [];\n\n for (let i = 0; i < length; i++) {\n const cc = ccZero + (Math.floor(Math.random() * 100) % 10);\n appendDigit(digits, cc);\n ibanSuffix += String.fromCharCode(cc);\n }\n\n appendDigit(digits, countryCode.charCodeAt(0));\n appendDigit(digits, countryCode.charCodeAt(1));\n\n // Try using \"00\" as check digits\n appendDigit(digits, ccZero);\n appendDigit(digits, ccZero);\n\n const requiredChecksum = 98 - mod97(digits);\n\n const checkDigit1 = Math.floor(requiredChecksum / 10) % 10;\n const checkDigit2 = requiredChecksum % 10;\n\n return countryCode + checkDigit1 + checkDigit2 + ibanSuffix;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type and schema definitions for notifications from the wallet to clients\n * of the wallet.\n */\n\n/**\n * Imports.\n */\nimport { AbsoluteTime } from \"./time.js\";\nimport { TransactionState } from \"./types-taler-wallet-transactions.js\";\nimport {\n ExchangeEntryState,\n TalerErrorDetail,\n TransactionIdStr,\n} from \"./types-taler-wallet.js\";\n\nexport enum NotificationType {\n BalanceChange = \"balance-change\",\n BackupOperationError = \"backup-error\",\n TransactionStateTransition = \"transaction-state-transition\",\n /**\n * @deprecated\n */\n WithdrawalOperationTransition = \"withdrawal-operation-transition\",\n ExchangeStateTransition = \"exchange-state-transition\",\n Idle = \"idle\",\n TaskObservabilityEvent = \"task-observability-event\",\n RequestObservabilityEvent = \"request-observability-event\",\n}\n\nexport interface ErrorInfoSummary {\n code: number;\n hint?: string;\n message?: string;\n}\n\nexport interface TransactionStateTransitionNotification {\n type: NotificationType.TransactionStateTransition;\n transactionId: string;\n oldTxState: TransactionState;\n newTxState: TransactionState;\n errorInfo?: ErrorInfoSummary;\n\n /**\n * Additional \"user data\" that is dependent on the\n * state transition.\n *\n * Usage should be avoided.\n *\n * Currently used to notify the iOS app about\n * the KYC URL.\n */\n experimentalUserData?: any;\n}\n\nexport interface ExchangeStateTransitionNotification {\n type: NotificationType.ExchangeStateTransition;\n /**\n * Identification of the exchange entry that this\n * notification is about.\n */\n exchangeBaseUrl: string;\n\n /**\n * If missing, the notification means that\n * the exchange entry is newly created.\n */\n oldExchangeState?: ExchangeEntryState;\n\n /**\n * New state of the exchange.\n */\n newExchangeState: ExchangeEntryState;\n\n /**\n * Summary of the error that occurred when trying to update the exchange entry,\n * if applicable.\n */\n errorInfo?: ErrorInfoSummary;\n}\n\nexport interface BalanceChangeNotification {\n type: NotificationType.BalanceChange;\n\n /**\n * Transaction ID of the transaction that caused the balance update.\n *\n * Only used as a hint for debugging, should not be relied upon by clients.\n */\n hintTransactionId: string;\n}\n\nexport interface TaskProgressNotification {\n type: NotificationType.TaskObservabilityEvent;\n taskId: string;\n event: ObservabilityEvent;\n}\n\nexport interface RequestProgressNotification {\n type: NotificationType.RequestObservabilityEvent;\n requestId: string;\n operation: string;\n event: ObservabilityEvent;\n}\n\nexport enum ObservabilityEventType {\n HttpFetchStart = \"http-fetch-start\",\n HttpFetchFinishError = \"http-fetch-finish-error\",\n HttpFetchFinishSuccess = \"http-fetch-finish-success\",\n DbQueryStart = \"db-query-start\",\n DbQueryFinishSuccess = \"db-query-finish-success\",\n DbQueryFinishError = \"db-query-finish-error\",\n RequestStart = \"request-start\",\n RequestFinishSuccess = \"request-finish-success\",\n RequestFinishError = \"request-finish-error\",\n TaskStart = \"task-start\",\n TaskStop = \"task-stop\",\n TaskReset = \"task-reset\",\n ShepherdTaskResult = \"shepherd-task-result\",\n DeclareTaskDependency = \"declare-task-dependency\",\n CryptoStart = \"crypto-start\",\n CryptoFinishSuccess = \"crypto-finish-success\",\n CryptoFinishError = \"crypto-finish-error\",\n Message = \"message\",\n /**\n * Declare that an observability event is relevant to a particular transaction.\n * If emitted from a request/task, all past/future events for that request/task\n * should be shown for the transaction as well.\n */\n DeclareConcernsTransaction = \"declare-concerns-transaction\",\n}\n\nexport type ObservabilityEvent =\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchStart;\n url: string;\n }\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchFinishSuccess;\n url: string;\n status: number;\n }\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchFinishError;\n url: string;\n error: TalerErrorDetail;\n }\n | {\n type: ObservabilityEventType.DbQueryStart;\n name: string;\n location: string;\n }\n | {\n type: ObservabilityEventType.DbQueryFinishSuccess;\n name: string;\n location: string;\n }\n | {\n type: ObservabilityEventType.DbQueryFinishError;\n name: string;\n location: string;\n error: TalerErrorDetail;\n }\n | {\n type: ObservabilityEventType.RequestStart;\n }\n | {\n type: ObservabilityEventType.RequestFinishSuccess;\n durationMs: number;\n }\n | {\n type: ObservabilityEventType.RequestFinishError;\n }\n | {\n type: ObservabilityEventType.TaskStart;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.TaskStop;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.TaskReset;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.DeclareTaskDependency;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.CryptoStart;\n operation: string;\n }\n | {\n type: ObservabilityEventType.CryptoFinishSuccess;\n operation: string;\n }\n | {\n type: ObservabilityEventType.CryptoFinishError;\n operation: string;\n }\n | {\n type: ObservabilityEventType.ShepherdTaskResult;\n resultType: string;\n }\n | {\n type: ObservabilityEventType.Message;\n contents: string;\n }\n | {\n type: ObservabilityEventType.DeclareConcernsTransaction;\n transactionId: TransactionIdStr;\n };\n\nexport interface BackupOperationErrorNotification {\n type: NotificationType.BackupOperationError;\n error: TalerErrorDetail;\n}\n/**\n * This notification is required to signal UI that\n * the withdrawal operation changed the state.\n *\n * https://bugs.gnunet.org/view.php?id=8099\n */\nexport interface WithdrawalOperationTransitionNotification {\n type: NotificationType.WithdrawalOperationTransition;\n uri: string;\n}\n\nexport interface IdleNotification {\n type: NotificationType.Idle;\n}\n\nexport type WalletNotification =\n | BalanceChangeNotification\n | WithdrawalOperationTransitionNotification\n | BackupOperationErrorNotification\n | ExchangeStateTransitionNotification\n | TransactionStateTransitionNotification\n | TaskProgressNotification\n | RequestProgressNotification\n | IdleNotification;\n", "/*\n This file is part of GNU Taler\n (C) 2019-2020 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * @fileoverview\n * Construction and parsing of taler:// URIs.\n * Specification: https://lsd.gnunet.org/lsd0006/\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, DecodingError, renderContext } from \"./codec.js\";\nimport { canonicalizeBaseUrl } from \"./helpers.js\";\nimport { opFixedSuccess, opKnownTalerFailure } from \"./operation.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport { AmountString } from \"./types-taler-common.js\";\nimport { URL, URLSearchParams } from \"./url.js\";\n\n/**\n * A parsed taler URI.\n */\nexport type TalerUri =\n | PayUriResult\n | PayTemplateUriResult\n | DevExperimentUri\n | PayPullUriResult\n | PayPushUriResult\n | BackupRestoreUri\n | RefundUriResult\n | WithdrawUriResult\n | WithdrawExchangeUri\n | AddExchangeUri;\n\ndeclare const __action_str: unique symbol;\nexport type TalerUriString = string & { [__action_str]: true };\n\nexport function codecForTalerUriString(): Codec {\n return {\n decode(x: any, c?: Context): TalerUriString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (parseTalerUri(x) === undefined) {\n throw new DecodingError(\n `invalid taler URI at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n return x as TalerUriString;\n },\n };\n}\n\nexport interface PayUriResult {\n type: TalerUriAction.Pay;\n merchantBaseUrl: string;\n orderId: string;\n sessionId: string;\n claimToken?: string;\n noncePriv?: string;\n}\n\nexport type TemplateParams = {\n amount?: string;\n summary?: string;\n};\n\nexport interface PayTemplateUriResult {\n type: TalerUriAction.PayTemplate;\n merchantBaseUrl: string;\n templateId: string;\n}\n\nexport interface WithdrawUriResult {\n type: TalerUriAction.Withdraw;\n bankIntegrationApiBaseUrl: string;\n withdrawalOperationId: string;\n externalConfirmation?: boolean;\n}\n\nexport interface RefundUriResult {\n type: TalerUriAction.Refund;\n merchantBaseUrl: string;\n orderId: string;\n}\n\nexport interface PayPushUriResult {\n type: TalerUriAction.PayPush;\n exchangeBaseUrl: string;\n contractPriv: string;\n}\n\nexport interface PayPullUriResult {\n type: TalerUriAction.PayPull;\n exchangeBaseUrl: string;\n contractPriv: string;\n}\n\nexport interface DevExperimentUri {\n type: TalerUriAction.DevExperiment;\n devExperimentId: string;\n}\n\nexport interface BackupRestoreUri {\n type: TalerUriAction.Restore;\n walletRootPriv: string;\n providers: Array;\n}\n\nexport interface WithdrawExchangeUri {\n type: TalerUriAction.WithdrawExchange;\n exchangeBaseUrl: string;\n amount?: AmountString;\n}\n\nexport interface AddExchangeUri {\n type: TalerUriAction.AddExchange;\n exchangeBaseUrl: string;\n}\n\n/**\n * Parse a taler[+http]://withdraw URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseWithdrawUriWithError(s: string) {\n const pi = parseProtoInfoWithError(s, \"withdraw\");\n if (pi.type === \"fail\") {\n return pi;\n }\n\n const c = pi.body.rest.split(\"?\", 2);\n const path = c[0];\n const q = new URLSearchParams(c[1] ?? \"\");\n\n const parts = path.split(\"/\");\n\n if (parts.length < 2) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n\n const host = parts[0].toLowerCase();\n const pathSegments = parts.slice(1, parts.length - 1);\n /**\n * The statement below does not tolerate a slash-ended URI.\n * This results in (1) the withdrawalId being passed as the\n * empty string, and (2) the bankIntegrationApi ending with the\n * actual withdrawal operation ID. That can be fixed by\n * trimming the parts-list. FIXME\n */\n const withdrawId = parts[parts.length - 1];\n const p = [host, ...pathSegments].join(\"/\");\n\n const result: WithdrawUriResult = {\n type: TalerUriAction.Withdraw,\n bankIntegrationApiBaseUrl: canonicalizeBaseUrl(\n `${pi.body.innerProto}://${p}/`,\n ),\n withdrawalOperationId: withdrawId,\n externalConfirmation: q.get(\"external-confirmation\") == \"1\",\n };\n return opFixedSuccess(result);\n}\n\n/**\n *\n * @deprecated use parseWithdrawUriWithError\n */\nexport function parseWithdrawUri(s: string): WithdrawUriResult | undefined {\n const r = parseWithdrawUriWithError(s);\n if (r.type === \"fail\") return undefined;\n return r.body;\n}\n\n/**\n * Parse a taler[+http]://withdraw URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseAddExchangeUriWithError(s: string) {\n const pi = parseProtoInfoWithError(s, \"add-exchange\");\n if (pi.type === \"fail\") {\n return pi;\n }\n const parts = pi.body.rest.split(\"/\");\n\n if (parts.length < 2) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n\n const host = parts[0].toLowerCase();\n const pathSegments = parts.slice(1, parts.length - 1);\n /**\n * The statement below does not tolerate a slash-ended URI.\n * This results in (1) the withdrawalId being passed as the\n * empty string, and (2) the bankIntegrationApi ending with the\n * actual withdrawal operation ID. That can be fixed by\n * trimming the parts-list. FIXME\n */\n const p = [host, ...pathSegments].join(\"/\");\n\n const result: AddExchangeUri = {\n type: TalerUriAction.AddExchange,\n exchangeBaseUrl: canonicalizeBaseUrl(`${pi.body.innerProto}://${p}/`),\n };\n return opFixedSuccess(result);\n}\n\n/**\n *\n * @deprecated use parseWithdrawUriWithError\n */\nexport function parseAddExchangeUri(s: string): AddExchangeUri | undefined {\n const r = parseAddExchangeUriWithError(s);\n if (r.type === \"fail\") return undefined;\n return r.body;\n}\n\n/**\n * @deprecated use TalerUriAction\n */\nexport enum TalerUriType {\n TalerPay = \"taler-pay\",\n TalerTemplate = \"taler-template\",\n TalerPayTemplate = \"taler-pay-template\",\n TalerWithdraw = \"taler-withdraw\",\n TalerTip = \"taler-tip\",\n TalerRefund = \"taler-refund\",\n TalerPayPush = \"taler-pay-push\",\n TalerPayPull = \"taler-pay-pull\",\n TalerRecovery = \"taler-recovery\",\n TalerDevExperiment = \"taler-dev-experiment\",\n Unknown = \"unknown\",\n}\n\nexport enum TalerUriAction {\n Pay = \"pay\",\n Withdraw = \"withdraw\",\n Refund = \"refund\",\n PayPull = \"pay-pull\",\n PayPush = \"pay-push\",\n PayTemplate = \"pay-template\",\n Restore = \"restore\",\n DevExperiment = \"dev-experiment\",\n WithdrawExchange = \"withdraw-exchange\",\n AddExchange = \"add-exchange\",\n}\n\ninterface TalerUriProtoInfo {\n innerProto: \"http\" | \"https\";\n rest: string;\n}\n\nfunction parseProtoInfo(\n s: string,\n action: string,\n): TalerUriProtoInfo | undefined {\n const pfxPlain = `taler://${action}/`;\n const pfxHttp = `taler+http://${action}/`;\n if (s.toLowerCase().startsWith(pfxPlain)) {\n return {\n innerProto: \"https\",\n rest: s.substring(pfxPlain.length),\n };\n } else if (s.toLowerCase().startsWith(pfxHttp)) {\n return {\n innerProto: \"http\",\n rest: s.substring(pfxHttp.length),\n };\n } else {\n return undefined;\n }\n}\n\nfunction parseProtoInfoWithError(s: string, action: string) {\n if (\n !s.toLowerCase().startsWith(\"taler://\") &&\n !s.toLowerCase().startsWith(\"taler+http://\")\n ) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n const pfxPlain = `taler://${action}/`;\n const pfxHttp = `taler+http://${action}/`;\n if (s.toLowerCase().startsWith(pfxPlain)) {\n return opFixedSuccess({\n innerProto: \"https\",\n rest: s.substring(pfxPlain.length),\n });\n } else if (s.toLowerCase().startsWith(pfxHttp)) {\n return opFixedSuccess({\n innerProto: \"http\",\n rest: s.substring(pfxHttp.length),\n });\n } else {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n}\n\ntype Parser = (s: string) => TalerUri | undefined;\nconst parsers: { [A in TalerUriAction]: Parser } = {\n [TalerUriAction.Pay]: parsePayUri,\n [TalerUriAction.PayPull]: parsePayPullUri,\n [TalerUriAction.PayPush]: parsePayPushUri,\n [TalerUriAction.PayTemplate]: parsePayTemplateUri,\n [TalerUriAction.Restore]: parseRestoreUri,\n [TalerUriAction.Refund]: parseRefundUri,\n [TalerUriAction.Withdraw]: parseWithdrawUri,\n [TalerUriAction.DevExperiment]: parseDevExperimentUri,\n [TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri,\n [TalerUriAction.AddExchange]: parseAddExchangeUri,\n};\n\nexport function parseTalerUri(string: string): TalerUri | undefined {\n const https = string.startsWith(\"taler://\");\n const http = string.startsWith(\"taler+http://\");\n if (!https && !http) return undefined;\n const actionStart = https ? 8 : 13;\n const actionEnd = string.indexOf(\"/\", actionStart + 1);\n const action = string.substring(actionStart, actionEnd);\n const found = Object.values(TalerUriAction).find((x) => x === action);\n if (!found) return undefined;\n return parsers[found](string);\n}\n\nexport function stringifyTalerUri(uri: TalerUri): string {\n switch (uri.type) {\n case TalerUriAction.DevExperiment: {\n return stringifyDevExperimentUri(uri);\n }\n case TalerUriAction.Pay: {\n return stringifyPayUri(uri);\n }\n case TalerUriAction.PayPull: {\n return stringifyPayPullUri(uri);\n }\n case TalerUriAction.PayPush: {\n return stringifyPayPushUri(uri);\n }\n case TalerUriAction.PayTemplate: {\n return stringifyPayTemplateUri(uri);\n }\n case TalerUriAction.Restore: {\n return stringifyRestoreUri(uri);\n }\n case TalerUriAction.Refund: {\n return stringifyRefundUri(uri);\n }\n case TalerUriAction.Withdraw: {\n return stringifyWithdrawUri(uri);\n }\n case TalerUriAction.WithdrawExchange: {\n return stringifyWithdrawExchange(uri);\n }\n case TalerUriAction.AddExchange: {\n return stringifyAddExchange(uri);\n }\n }\n}\n\n/**\n * Parse a taler[+http]://pay URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parsePayUri(s: string): PayUriResult | undefined {\n const pi = parseProtoInfo(s, \"pay\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const q = new URLSearchParams(c[1] ?? \"\");\n const claimToken = q.get(\"c\") ?? undefined;\n const noncePriv = q.get(\"n\") ?? undefined;\n const parts = c[0].split(\"/\");\n if (parts.length < 3) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const sessionId = parts[parts.length - 1];\n const orderId = parts[parts.length - 2];\n const pathSegments = parts.slice(1, parts.length - 2);\n const p = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${p}/`);\n\n return {\n type: TalerUriAction.Pay,\n merchantBaseUrl,\n orderId,\n sessionId,\n claimToken,\n noncePriv,\n };\n}\n\nexport function parsePayTemplateUri(\n uriString: string,\n): PayTemplateUriResult | undefined {\n const pi = parseProtoInfo(uriString, TalerUriAction.PayTemplate);\n if (!pi) {\n return undefined;\n }\n const c = pi.rest.split(\"?\");\n\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n\n const q = new URLSearchParams(c[1] ?? \"\");\n const params: Record = {};\n q.forEach((v, k) => {\n params[k] = v;\n });\n\n const host = parts[0].toLowerCase();\n const templateId = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayTemplate,\n merchantBaseUrl,\n templateId,\n };\n}\n\nexport function parsePayPushUri(s: string): PayPushUriResult | undefined {\n const pi = parseProtoInfo(s, TalerUriAction.PayPush);\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const contractPriv = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayPush,\n exchangeBaseUrl,\n contractPriv,\n };\n}\n\nexport function parsePayPullUri(s: string): PayPullUriResult | undefined {\n const pi = parseProtoInfo(s, TalerUriAction.PayPull);\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const contractPriv = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayPull,\n exchangeBaseUrl,\n contractPriv,\n };\n}\n\nexport function parseWithdrawExchangeUri(\n s: string,\n): WithdrawExchangeUri | undefined {\n const pi = parseProtoInfo(s, \"withdraw-exchange\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 1) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n // Used to be the reserve public key, now it's empty!\n const lastPathComponent =\n parts.length > 1 ? parts[parts.length - 1] : undefined;\n\n if (lastPathComponent) {\n // invalid taler://withdraw-exchange URI, must end with a slash\n return undefined;\n }\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n const q = new URLSearchParams(c[1] ?? \"\");\n const amount = (q.get(\"a\") ?? undefined) as AmountString | undefined;\n\n return {\n type: TalerUriAction.WithdrawExchange,\n exchangeBaseUrl,\n amount,\n };\n}\n\n/**\n * Parse a taler[+http]://refund URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseRefundUri(s: string): RefundUriResult | undefined {\n const pi = parseProtoInfo(s, \"refund\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 3) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const sessionId = parts[parts.length - 1];\n const orderId = parts[parts.length - 2];\n const pathSegments = parts.slice(1, parts.length - 2);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.Refund,\n merchantBaseUrl,\n orderId,\n };\n}\n\nexport function parseDevExperimentUri(s: string): DevExperimentUri | undefined {\n const pi = parseProtoInfo(s, \"dev-experiment\");\n const c = pi?.rest.split(\"?\");\n if (!c) {\n return undefined;\n }\n const parts = c[0].split(\"/\");\n return {\n type: TalerUriAction.DevExperiment,\n devExperimentId: parts[0],\n };\n}\n\nexport function parseRestoreUri(uri: string): BackupRestoreUri | undefined {\n const pi = parseProtoInfo(uri, \"restore\");\n if (!pi) {\n return undefined;\n }\n const c = pi.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n\n const walletRootPriv = parts[0];\n if (!walletRootPriv) return undefined;\n const providers = new Array();\n parts[1].split(\",\").map((name) => {\n const url = canonicalizeBaseUrl(\n `${pi.innerProto}://${decodeURIComponent(name)}/`,\n );\n providers.push(url);\n });\n return {\n type: TalerUriAction.Restore,\n walletRootPriv,\n providers,\n };\n}\n\n// ================================================\n// To string functions\n// ================================================\n\nexport function stringifyPayUri({\n merchantBaseUrl,\n orderId,\n sessionId,\n claimToken,\n noncePriv,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(merchantBaseUrl, {\n c: claimToken,\n n: noncePriv,\n });\n return `${proto}://pay/${path}${orderId}/${sessionId}${query}`;\n}\n\nexport function stringifyPayPullUri({\n contractPriv,\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n return `${proto}://pay-pull/${path}${contractPriv}`;\n}\n\nexport function stringifyPayPushUri({\n contractPriv,\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n\n return `${proto}://pay-push/${path}${contractPriv}`;\n}\n\nexport function stringifyRestoreUri({\n providers,\n walletRootPriv,\n}: Omit): string {\n const list = providers\n .map((url) => `${encodeURIComponent(new URL(url).href)}`)\n .join(\",\");\n return `taler://restore/${walletRootPriv}/${list}`;\n}\n\nexport function stringifyWithdrawExchange({\n exchangeBaseUrl,\n amount,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(exchangeBaseUrl, {\n a: amount,\n });\n return `${proto}://withdraw-exchange/${path}${query}`;\n}\n\nexport function stringifyAddExchange({\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n return `${proto}://add-exchange/${path}`;\n}\n\nexport function stringifyDevExperimentUri({\n devExperimentId,\n}: Omit): string {\n return `taler://dev-experiment/${devExperimentId}`;\n}\n\nexport function stringifyPayTemplateUri({\n merchantBaseUrl,\n templateId,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(merchantBaseUrl);\n return `${proto}://pay-template/${path}${templateId}${query}`;\n}\n\nexport function stringifyRefundUri({\n merchantBaseUrl,\n orderId,\n}: Omit): string {\n const { proto, path } = getUrlInfo(merchantBaseUrl);\n return `${proto}://refund/${path}${orderId}/`;\n}\n\nexport function stringifyWithdrawUri({\n bankIntegrationApiBaseUrl,\n withdrawalOperationId,\n}: Omit): string {\n const { proto, path } = getUrlInfo(bankIntegrationApiBaseUrl);\n return `${proto}://withdraw/${path}${withdrawalOperationId}`;\n}\n\n/**\n * Use baseUrl to defined http or https\n * create path using host+port+pathname\n * use params to create a query parameter string or empty\n */\nfunction getUrlInfo(\n baseUrl: string,\n params: Record = {},\n): { proto: string; path: string; query: string } {\n const url = new URL(baseUrl);\n let proto: string;\n if (url.protocol === \"https:\") {\n proto = \"taler\";\n } else if (url.protocol === \"http:\") {\n proto = \"taler+http\";\n } else {\n throw Error(`Unsupported URL protocol in ${baseUrl}`);\n }\n let path = url.hostname;\n if (url.port) {\n path = path + \":\" + url.port;\n }\n if (url.pathname) {\n path = path + url.pathname;\n }\n if (!path.endsWith(\"/\")) {\n path = path + \"/\";\n }\n\n const qp = new URLSearchParams();\n let withParams = false;\n Object.entries(params).forEach(([name, value]) => {\n if (value !== undefined) {\n withParams = true;\n qp.append(name, value);\n }\n });\n const query = withParams ? \"?\" + qp.toString() : \"\";\n\n return { proto, path, query };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Cross-platform timers.\n *\n * NodeJS and the browser use slightly different timer API,\n * this abstracts over these differences.\n */\n\n/**\n * Imports.\n */\nimport { Logger, Duration } from \"@gnu-taler/taler-util\";\n\nconst logger = new Logger(\"timer.ts\");\n\n/**\n * Cancelable timer.\n */\nexport interface TimerHandle {\n clear(): void;\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void;\n}\n\nclass IntervalHandle {\n constructor(public h: any) {}\n\n clear(): void {\n clearInterval(this.h);\n }\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void {\n if (typeof this.h === \"object\" && \"unref\" in this.h) {\n this.h.unref();\n }\n }\n}\n\nclass TimeoutHandle {\n constructor(public h: any) {}\n\n clear(): void {\n clearTimeout(this.h);\n }\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void {\n if (typeof this.h === \"object\" && \"unref\" in this.h) {\n this.h.unref();\n }\n }\n}\n\n/**\n * Get a performance counter in nanoseconds.\n */\nexport const performanceNow: () => bigint = (() => {\n // @ts-ignore\n if (typeof process !== \"undefined\" && process.hrtime) {\n return () => {\n return process.hrtime.bigint();\n };\n }\n\n // @ts-ignore\n if (typeof performance !== \"undefined\") {\n // @ts-ignore\n return () => BigInt(Math.floor(performance.now() * 1000)) * BigInt(1000);\n }\n\n return () => BigInt(new Date().getTime()) * BigInt(1000) * BigInt(1000);\n})();\n\nconst nullTimerHandle = {\n clear() {\n // do nothing\n return;\n },\n unref() {\n // do nothing\n return;\n },\n};\n\n/**\n * Group of timers that can be destroyed at once.\n */\nexport interface TimerAPI {\n after(delayMs: number, callback: () => void): TimerHandle;\n every(delayMs: number, callback: () => void): TimerHandle;\n}\n\nexport class SetTimeoutTimerAPI implements TimerAPI {\n /**\n * Call a function every time the delay given in milliseconds passes.\n */\n every(delayMs: number, callback: () => void): TimerHandle {\n return new IntervalHandle(setInterval(callback, delayMs));\n }\n\n /**\n * Call a function after the delay given in milliseconds passes.\n */\n after(delayMs: number, callback: () => void): TimerHandle {\n return new TimeoutHandle(setTimeout(callback, delayMs));\n }\n}\n\nexport const timer = new SetTimeoutTimerAPI();\n\n/**\n * Implementation of [[TimerGroup]] using setTimeout\n */\nexport class TimerGroup {\n private stopped = false;\n\n private readonly timerMap: { [index: number]: TimerHandle } = {};\n\n private idGen = 1;\n\n constructor(public readonly timerApi: TimerAPI) {}\n\n stopCurrentAndFutureTimers(): void {\n this.stopped = true;\n for (const x in this.timerMap) {\n if (!this.timerMap.hasOwnProperty(x)) {\n continue;\n }\n this.timerMap[x].clear();\n delete this.timerMap[x];\n }\n }\n\n resolveAfter(delayMs: Duration): Promise {\n return new Promise((resolve, reject) => {\n if (delayMs.d_ms !== \"forever\") {\n this.after(delayMs.d_ms, () => {\n resolve();\n });\n }\n });\n }\n\n after(delayMs: number, callback: () => void): TimerHandle {\n if (this.stopped) {\n logger.warn(\"dropping timer since timer group is stopped\");\n return nullTimerHandle;\n }\n const h = this.timerApi.after(delayMs, callback);\n const myId = this.idGen++;\n this.timerMap[myId] = h;\n\n const tm = this.timerMap;\n\n return {\n clear() {\n h.clear();\n delete tm[myId];\n },\n unref() {\n h.unref();\n },\n };\n }\n\n every(delayMs: number, callback: () => void): TimerHandle {\n if (this.stopped) {\n logger.warn(\"dropping timer since timer group is stopped\");\n return nullTimerHandle;\n }\n const h = this.timerApi.every(delayMs, callback);\n const myId = this.idGen++;\n this.timerMap[myId] = h;\n\n const tm = this.timerMap;\n\n return {\n clear() {\n h.clear();\n delete tm[myId];\n },\n unref() {\n h.unref();\n },\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n TransactionType,\n PaymentStatus,\n TransactionMajorState,\n} from \"./types-taler-wallet-transactions.js\";\nimport { RefreshReason } from \"./types-taler-wallet.js\";\n\n/**\n * Sample transaction list entries.\n */\nexport const sampleWalletCoreTransactions = [\n {\n type: TransactionType.Payment,\n txState: {\n major: TransactionMajorState.Done,\n },\n amountRaw: \"KUDOS:10\",\n amountEffective: \"KUDOS:10\",\n totalRefundRaw: \"KUDOS:0\",\n totalRefundEffective: \"KUDOS:0\",\n status: PaymentStatus.Paid,\n refundPending: undefined,\n posConfirmation: undefined,\n pending: false,\n refunds: [],\n timestamp: {\n t_s: 1677166045,\n },\n transactionId:\n \"txn:payment:NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0\",\n proposalId: \"NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0\",\n info: {\n merchant: {\n name: \"woocommerce\",\n website: \"woocommerce.demo.taler.net\",\n email: \"foo@example.com\",\n address: {},\n jurisdiction: {},\n },\n orderId: \"wc_order_KQCRldghIgDRB-100\",\n products: [\n {\n description: \"Using GCC\",\n quantity: 1,\n price: \"KUDOS:10\",\n product_id: \"28\",\n },\n ],\n summary: \"WooTalerShop #100\",\n contractTermsHash:\n \"A02E1M6ARWKBJ87K2TV4S6WQ4X5YH7BRVR6MYCHCTVAED8MBXTFD6PZ5Q50Y7Z5K18PYBTDA14NQ56XPC1VCQW1EVRWTSB7ZYT65B5G\",\n fulfillmentUrl:\n \"https://woocommerce.demo.taler.net/?wc-api=wc_gnutaler_gateway&order_id=wc_order_KQCRldghIgDRB-100\",\n },\n refundQueryActive: false,\n frozen: false,\n },\n {\n type: TransactionType.Refresh,\n txState: {\n major: TransactionMajorState.Pending,\n },\n refreshReason: RefreshReason.PayMerchant,\n amountEffective: \"KUDOS:0\",\n amountRaw: \"KUDOS:0\",\n refreshInputAmount: \"KUDOS:1.5\",\n refreshOutputAmount: \"KUDOS:1.4\",\n originatingTransactionId:\n \"txn:proposal:ZCGBZFE8KZ1CBYYGSC3ZC8E40KVJWV16VYCTHGC8FFSVZ5HD24BG\",\n pending: true,\n timestamp: {\n t_s: 1681376214,\n },\n transactionId:\n \"txn:refresh:QQSWHHXCRQ269G0E3RW14JMC6F7NFDYDW26NSFHRTXSKDS6CMCZ0\",\n frozen: false,\n error: {\n code: 7029,\n when: {\n t_ms: 1681376473665,\n },\n hint: \"Error (WALLET_REFRESH_GROUP_INCOMPLETE)\",\n numErrors: 1,\n errors: [\n {\n code: 7001,\n when: {\n t_ms: 1681376473189,\n },\n hint: \"unexpected exception (message: exchange wire fee signature invalid)\",\n stack:\n \" at validateWireInfo (../taler-wallet-core-qjs.mjs:23166)\\n\",\n },\n ],\n },\n },\n];\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n// Entry point for the browser.\n\nimport { loadBrowserPrng } from \"./prng-browser.js\";\nloadBrowserPrng();\nexport * from \"./index.js\";\n\n// The web stuff doesn't support package.json export declarations yet,\n// so we export more stuff here than we should.\nexport * from \"./http-common.js\";\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { AbsoluteTime, Codec, codecForString } from \"@gnu-taler/taler-util\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport {\n ObservableMap,\n browserStorageMap,\n localStorageMap,\n memoryMap,\n} from \"../utils/observable.js\";\n\ndeclare const opaque_StorageKey: unique symbol;\n\nexport type StorageKey = {\n id: string;\n [opaque_StorageKey]: true;\n codec: Codec;\n};\n\nexport function buildStorageKey(\n name: string,\n codec: Codec,\n): StorageKey;\nexport function buildStorageKey(name: string): StorageKey;\nexport function buildStorageKey(\n name: string,\n codec?: Codec,\n): StorageKey {\n return {\n id: name,\n codec: codec ?? (codecForString() as Codec),\n } as StorageKey;\n}\n\nexport interface StorageState {\n value?: Type;\n update: (s: Type) => void;\n reset: () => void;\n}\n\nconst supportLocalStorage = typeof window !== \"undefined\";\nconst supportBrowserStorage =\n typeof chrome !== \"undefined\" && typeof chrome.storage !== \"undefined\";\n\n/**\n * Build setting storage\n */\nconst storage: ObservableMap = (function buildStorage() {\n if (supportBrowserStorage) {\n //browser storage is like local storage but\n //with app sync.\n //Works for almost every browser\n if (supportLocalStorage) {\n return browserStorageMap(localStorageMap());\n } else {\n // service worker doesn't have local storage\n return browserStorageMap(memoryMap());\n }\n } else if (supportLocalStorage) {\n // fallback if browser is too old\n return localStorageMap();\n } else {\n // new need to save settings somewhere\n return memoryMap();\n }\n})();\n//with initial value\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue: Type,\n): Required>;\n//without initial value\nexport function useLocalStorage(\n key: StorageKey,\n): StorageState;\n// impl\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue?: Type,\n): StorageState {\n const current = convert(storage.get(key.id), key, defaultValue);\n\n const [_, setStoredValue] = useState(AbsoluteTime.now().t_ms);\n\n useEffect(() => {\n return storage.onUpdate(key.id, () => {\n // const newValue = storage.get(key.id);\n setStoredValue(AbsoluteTime.now().t_ms);\n });\n }, [key.id]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n storage.delete(key.id);\n } else {\n storage.set(\n key.id,\n key.codec ? JSON.stringify(value) : (value as string),\n );\n }\n };\n\n return {\n value: current,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n\nfunction convert(updated: string | undefined, key: StorageKey, defaultValue?: Type): Type | undefined {\n if (updated === undefined) return defaultValue; //optional\n try {\n return key.codec.decode(JSON.parse(updated));\n } catch (e) {\n //decode error\n return defaultValue;\n }\n}\n", "import { isArrayBufferView } from \"util/types\";\n\nexport type ObservableMap = Map & {\n onAnyUpdate: (callback: () => void) => () => void;\n onUpdate: (key: string, callback: () => void) => () => void;\n};\n\n//FIXME: allow different type for different properties\nexport function memoryMap(\n backend: Map = new Map(),\n): ObservableMap {\n const obs = new EventTarget();\n const theMemoryMap: ObservableMap = {\n onAnyUpdate: (handler) => {\n obs.addEventListener(`update`, handler);\n obs.addEventListener(`clear`, handler);\n return () => {\n obs.removeEventListener(`update`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n onUpdate: (key, handler) => {\n obs.addEventListener(`update-${key}`, handler);\n obs.addEventListener(`clear`, handler);\n return () => {\n obs.removeEventListener(`update-${key}`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n delete: (key: string) => {\n const result = backend.delete(key);\n //@ts-ignore\n theMemoryMap.size = backend.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return result;\n },\n set: (key: string, value: T) => {\n backend.set(key, value);\n //@ts-ignore\n theMemoryMap.size = backend.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return theMemoryMap;\n },\n clear: () => {\n backend.clear();\n obs.dispatchEvent(new Event(`clear`));\n },\n entries: backend.entries.bind(backend),\n forEach: backend.forEach.bind(backend),\n get: backend.get.bind(backend),\n has: backend.has.bind(backend),\n keys: backend.keys.bind(backend),\n size: backend.size,\n values: backend.values.bind(backend),\n [Symbol.iterator]: backend[Symbol.iterator],\n [Symbol.toStringTag]: \"theMemoryMap\",\n };\n return theMemoryMap;\n}\n\n//FIXME: change this implementation to match the\n// browser storage. instead of creating a sync implementation\n// of observable map it should reuse the memoryMap and\n// sync the state with local storage\nexport function localStorageMap(): ObservableMap {\n const obs = new EventTarget();\n const theLocalStorageMap: ObservableMap = {\n onAnyUpdate: (handler) => {\n obs.addEventListener(`update`, handler);\n obs.addEventListener(`clear`, handler);\n window.addEventListener(\"storage\", handler);\n return () => {\n window.removeEventListener(\"storage\", handler);\n obs.removeEventListener(`update`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n onUpdate: (key, handler) => {\n obs.addEventListener(`update-${key}`, handler);\n obs.addEventListener(`clear`, handler);\n function handleStorageEvent(ev: StorageEvent) {\n if (ev.key === null || ev.key === key) {\n handler();\n }\n }\n window.addEventListener(\"storage\", handleStorageEvent);\n return () => {\n window.removeEventListener(\"storage\", handleStorageEvent);\n obs.removeEventListener(`update-${key}`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n delete: (key: string) => {\n const exists = localStorage.getItem(key) !== null;\n localStorage.removeItem(key);\n //@ts-ignore\n theLocalStorageMap.size = localStorage.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return exists;\n },\n set: (key: string, v: string) => {\n localStorage.setItem(key, v);\n //@ts-ignore\n theLocalStorageMap.size = localStorage.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return theLocalStorageMap;\n },\n clear: () => {\n localStorage.clear();\n obs.dispatchEvent(new Event(`clear`));\n },\n entries: (): IterableIterator<[string, string]> => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n index = index + 1;\n return { done: false, value: [key, item] };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n forEach: (cb) => {\n for (let index = 0; index < localStorage.length; index++) {\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n cb(key, item, theLocalStorageMap);\n }\n },\n get: (key: string) => {\n const item = localStorage.getItem(key);\n if (item === null) return undefined;\n return item;\n },\n has: (key: string) => {\n return localStorage.getItem(key) === null;\n },\n keys: () => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n index = index + 1;\n return { done: false, value: key };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n size: localStorage.length,\n values: () => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n index = index + 1;\n return { done: false, value: item };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n [Symbol.iterator]: function (): IterableIterator<[string, string]> {\n return theLocalStorageMap.entries();\n },\n [Symbol.toStringTag]: \"theLocalStorageMap\",\n };\n return theLocalStorageMap;\n}\n\nconst isFirefox =\n typeof (window as any) !== \"undefined\" &&\n typeof (window as any)[\"InstallTrigger\"] !== \"undefined\";\n\nasync function getAllContent() {\n //Firefox and Chrome has different storage api\n if (isFirefox) {\n // @ts-ignore\n return browser.storage.local.get();\n } else {\n return chrome.storage.local.get();\n }\n}\n\nasync function updateContent(obj: Record) {\n if (isFirefox) {\n // @ts-ignore\n return browser.storage.local.set(obj);\n } else {\n return chrome.storage.local.set(obj);\n }\n}\ntype Changes = { [key: string]: { oldValue?: any; newValue?: any } };\nfunction onBrowserStorageUpdate(cb: (changes: Changes) => void): void {\n if (isFirefox) {\n // @ts-ignore\n browser.storage.local.onChanged.addListener(cb);\n } else {\n chrome.storage.local.onChanged.addListener(cb);\n }\n}\n\nexport function browserStorageMap(\n backend: ObservableMap,\n): ObservableMap {\n getAllContent().then(content => {\n Object.entries(content ?? {}).forEach(([k, v]) => {\n backend.set(k, v as string);\n });\n })\n\n backend.onAnyUpdate(async () => {\n const result: Record = {};\n for (const [key, value] of backend.entries()) {\n result[key] = value;\n }\n await updateContent(result);\n });\n\n onBrowserStorageUpdate((changes) => {\n //another chrome instance made the change\n const changedItems = Object.keys(changes);\n if (changedItems.length === 0) {\n backend.clear();\n } else {\n for (const key of changedItems) {\n if (!changes[key].newValue) {\n backend.delete(key);\n } else {\n if (changes[key].newValue !== changes[key].oldValue) {\n backend.set(key, changes[key].newValue);\n }\n }\n }\n }\n });\n\n return backend;\n}\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\nimport {\n StorageState,\n buildStorageKey,\n useLocalStorage,\n} from \"./useLocalStorage.js\";\n\nconst MIN_LANG_COVERAGE_THRESHOLD = 90;\n/**\n * choose the best from the browser config based on the completeness\n * on the translation\n */\nfunction getBrowserLang(completeness: Record): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n\n if (window.navigator.language) {\n if (completeness[window.navigator.language] >= MIN_LANG_COVERAGE_THRESHOLD) {\n return window.navigator.language\n }\n }\n if (window.navigator.languages) {\n const match = Object.entries(completeness).filter(([code, value]) => {\n if (value < MIN_LANG_COVERAGE_THRESHOLD) return false; //do not consider langs below 90%\n return window.navigator.languages.findIndex(l => l.startsWith(code)) !== -1\n }).map(([code, value]) => ({ code, value }))\n\n if (match.length > 0) {\n let max = match[0]\n match.forEach(v => {\n if (v.value > max.value) {\n max = v\n }\n })\n return max.code\n }\n };\n\n return undefined;\n}\n\nconst langPreferenceKey = buildStorageKey(\"lang-preference\");\n\nexport function useLang(initial: string | undefined, completeness: Record): Required {\n const defaultValue = (getBrowserLang(completeness) || initial || \"en\").substring(0, 2);\n return useLocalStorage(langPreferenceKey, defaultValue);\n}\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { useEffect, useState } from \"preact/hooks\";\nimport { ObservableMap, memoryMap } from \"../utils/observable.js\";\nimport { StorageKey, StorageState } from \"./useLocalStorage.js\";\n\nconst storage: ObservableMap = memoryMap();\n\n//with initial value\nexport function useMemoryStorage(\n key: string,\n defaultValue: Type,\n): Required>;\n//with initial value\nexport function useMemoryStorage(\n key: string,\n): StorageState;\n// impl\nexport function useMemoryStorage(\n key: string,\n defaultValue?: Type,\n): StorageState {\n const [storedValue, setStoredValue] = useState(\n (): Type | undefined => {\n const prev = storage.get(key);\n return prev === undefined ? defaultValue : prev;\n },\n );\n\n useEffect(() => {\n return storage.onUpdate(key, () => {\n const newValue = storage.get(key);\n setStoredValue(newValue === undefined ? defaultValue : newValue);\n });\n }, [key]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n storage.delete(key);\n } else {\n storage.set(key, value);\n }\n };\n\n return {\n value: storedValue,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n", "import {\n AbsoluteTime,\n Duration,\n OperationAlternative,\n OperationFail,\n OperationOk,\n OperationResult,\n TalerError,\n TalerErrorCode,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { ButtonHandler, OnOperationFailReturnType, OnOperationSuccesReturnType } from \"../components/Button.js\";\nimport {\n InternationalizationAPI,\n memoryMap,\n useTranslationContext,\n} from \"../index.browser.js\";\n\nexport type NotificationMessage = ErrorNotification | InfoNotification;\n\nexport interface ErrorNotification {\n type: \"error\";\n title: TranslatedString;\n ack?: boolean;\n timeout?: boolean;\n description?: TranslatedString;\n debug?: any;\n when: AbsoluteTime;\n}\nexport interface InfoNotification {\n type: \"info\";\n title: TranslatedString;\n ack?: boolean;\n timeout?: boolean;\n when: AbsoluteTime;\n}\n\nconst storage = memoryMap>();\nconst NOTIFICATION_KEY = \"notification\";\n\nexport const GLOBAL_NOTIFICATION_TIMEOUT = Duration.fromSpec({\n seconds: 5,\n});\n\nfunction updateInStorage(n: NotificationMessage) {\n const h = hash(n);\n const mem = storage.get(NOTIFICATION_KEY) ?? new Map();\n const newState = new Map(mem);\n newState.set(h, n);\n storage.set(NOTIFICATION_KEY, newState);\n}\n\nexport function notify(notif: NotificationMessage): void {\n const currentState: Map =\n storage.get(NOTIFICATION_KEY) ?? new Map();\n const newState = currentState.set(hash(notif), notif);\n\n if (GLOBAL_NOTIFICATION_TIMEOUT.d_ms !== \"forever\") {\n setTimeout(() => {\n notif.timeout = true;\n updateInStorage(notif);\n }, GLOBAL_NOTIFICATION_TIMEOUT.d_ms);\n }\n\n storage.set(NOTIFICATION_KEY, newState);\n}\nexport function notifyError(\n title: TranslatedString,\n description: TranslatedString | undefined,\n debug?: any,\n) {\n notify({\n type: \"error\" as const,\n title,\n description,\n debug,\n when: AbsoluteTime.now(),\n });\n}\nexport function notifyException(title: TranslatedString, ex: Error) {\n notify({\n type: \"error\" as const,\n title,\n description: ex.message as TranslatedString,\n debug: ex.stack,\n when: AbsoluteTime.now(),\n });\n}\nexport function notifyInfo(title: TranslatedString) {\n notify({\n type: \"info\" as const,\n title,\n when: AbsoluteTime.now(),\n });\n}\n\nexport type Notification = {\n message: NotificationMessage;\n acknowledge: () => void;\n};\n\nexport function useNotifications(): Notification[] {\n const [, setLastUpdate] = useState();\n const value = storage.get(NOTIFICATION_KEY) ?? new Map();\n\n useEffect(() => {\n return storage.onUpdate(NOTIFICATION_KEY, () => {\n setLastUpdate(Date.now())\n // const mem = storage.get(NOTIFICATION_KEY) ?? new Map();\n // setter(structuredClone(mem));\n });\n });\n\n return Array.from(value.values()).map((message, idx) => {\n return {\n message,\n acknowledge: () => {\n message.ack = true;\n updateInStorage(message);\n },\n };\n });\n}\n\nfunction hashCode(str: string): string {\n if (str.length === 0) return \"0\";\n let hash = 0;\n let chr;\n for (let i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash.toString(16);\n}\n\nfunction hash(msg: NotificationMessage): string {\n let str = (msg.type + \":\" + msg.title) as string;\n if (msg.type === \"error\") {\n if (msg.description) {\n str += \":\" + msg.description;\n }\n if (msg.debug) {\n str += \":\" + msg.debug;\n }\n }\n return hashCode(str);\n}\n\nfunction errorMap>(\n resp: T,\n map: (d: T[\"case\"]) => TranslatedString,\n): void {\n notify({\n type: \"error\",\n title: map(resp.case),\n description: resp.detail.hint as TranslatedString,\n debug: resp.detail,\n when: AbsoluteTime.now(),\n });\n}\n\nexport type ErrorNotificationHandler = (\n cb: (notify: typeof errorMap) => Promise,\n) => Promise;\n\n/**\n * @deprecated use useLocalNotificationHandler\n *\n * @returns\n */\nexport function useLocalNotification(): [\n Notification | undefined,\n (n: NotificationMessage) => void,\n ErrorNotificationHandler,\n] {\n const { i18n } = useTranslationContext();\n\n const [value, setter] = useState();\n const notif = !value\n ? undefined\n : {\n message: value,\n acknowledge: () => {\n setter(undefined);\n },\n };\n\n async function errorHandling(cb: (notify: typeof errorMap) => Promise) {\n try {\n return await cb(errorMap);\n } catch (error: unknown) {\n if (error instanceof TalerError) {\n notify(buildUnifiedRequestErrorMessage(i18n, error));\n } else {\n notifyError(\n i18n.str`Operation failed, please report`,\n (error instanceof Error\n ? error.message\n : JSON.stringify(error)) as TranslatedString,\n );\n }\n }\n }\n return [notif, setter, errorHandling];\n}\n\ntype HandlerMaker = , A, B>(\n onClick: () => Promise,\n onOperationSuccess: OnOperationSuccesReturnType,\n onOperationFail?: OnOperationFailReturnType,\n onOperationComplete?: () => void,\n) => ButtonHandler;\n\nexport function useLocalNotificationHandler(): [\n Notification | undefined,\n HandlerMaker,\n (n: NotificationMessage) => void,\n] {\n const [value, setter] = useState();\n const notif = !value\n ? undefined\n : {\n message: value,\n acknowledge: () => {\n setter(undefined);\n },\n };\n\n function makeHandler, A, B>(\n onClick: () => Promise,\n onOperationSuccess:OnOperationSuccesReturnType,\n onOperationFail?: OnOperationFailReturnType,\n onOperationComplete?: () => void,\n ): ButtonHandler {\n return {\n onClick,\n onNotification: setter,\n onOperationFail,\n onOperationSuccess,\n onOperationComplete,\n };\n }\n\n return [notif, makeHandler, setter];\n}\n\nexport function buildUnifiedRequestErrorMessage(\n i18n: InternationalizationAPI,\n cause: TalerError,\n): ErrorNotification {\n let result: ErrorNotification;\n switch (cause.errorDetail.code) {\n case TalerErrorCode.GENERIC_TIMEOUT: {\n result = {\n type: \"error\",\n title: i18n.str`Request timeout`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Request cancelled`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT: {\n result = {\n type: \"error\",\n title: i18n.str`Request timeout`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED: {\n result = {\n type: \"error\",\n title: i18n.str`Request throttled`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE: {\n result = {\n type: \"error\",\n title: i18n.str`Malformed response`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_NETWORK_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Network error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Unexpected request error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n default: {\n result = {\n type: \"error\",\n title: i18n.str`Unexpected error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n }\n return result;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nimport { TalerErrorDetail } from \"@gnu-taler/taler-util\";\n// import { TalerError } from \"@gnu-taler/taler-wallet-core\";\nimport { useEffect, useMemo, useState } from \"preact/hooks\";\n\nexport interface HookOk {\n hasError: false;\n response: T;\n}\n\nexport type HookError = HookGenericError | HookOperationalError;\n\nexport interface HookGenericError {\n hasError: true;\n operational: false;\n message: string;\n}\n\nexport interface HookOperationalError {\n hasError: true;\n operational: true;\n details: TalerErrorDetail;\n}\n\ninterface WithRetry {\n retry: () => void;\n}\n\nexport type HookResponse = HookOk | HookError | undefined;\nexport type HookResponseWithRetry =\n | ((HookOk | HookError) & WithRetry)\n | undefined;\n\nexport function useAsyncAsHook(\n fn: () => Promise,\n deps?: any[],\n): HookResponseWithRetry {\n const [result, setHookResponse] = useState>(undefined);\n\n const args = useMemo(\n () => ({\n fn,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }),\n deps || [],\n );\n\n async function doAsync(): Promise {\n try {\n const response = await args.fn();\n if (response === false) return;\n setHookResponse({ hasError: false, response });\n } catch (e) {\n // if (e instanceof TalerError) {\n // setHookResponse({\n // hasError: true,\n // operational: true,\n // details: e.errorDetail,\n // });\n // } else\n if (e instanceof Error) {\n setHookResponse({\n hasError: true,\n operational: false,\n message: e.message,\n });\n }\n }\n }\n\n useEffect(() => {\n doAsync();\n }, [args]);\n\n if (!result) return undefined;\n return { ...result, retry: doAsync };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n\nexport function base64encode(str: string): string {\n return base64EncArr(strToUTF8Arr(str))\n}\n\nexport function base64decode(str: string): string {\n return UTF8ArrToStr(base64DecToArr(str))\n}\n\n// from https://developer.mozilla.org/en-US/docs/Glossary/Base64\n\n// Array of bytes to Base64 string decoding\nfunction b64ToUint6(nChr: number): number {\n return nChr > 64 && nChr < 91\n ? nChr - 65\n : nChr > 96 && nChr < 123\n ? nChr - 71\n : nChr > 47 && nChr < 58\n ? nChr + 4\n : nChr === 43\n ? 62\n : nChr === 47\n ? 63\n : 0;\n}\n\nfunction base64DecToArr(sBase64: string, nBlocksSize?: number): Uint8Array {\n const sB64Enc = sBase64.replace(/[^A-Za-z0-9+/]/g, \"\"); // Only necessary if the base64 includes whitespace such as line breaks.\n const nInLen = sB64Enc.length;\n const nOutLen = nBlocksSize\n ? Math.ceil(((nInLen * 3 + 1) >> 2) / nBlocksSize) * nBlocksSize\n : (nInLen * 3 + 1) >> 2;\n const taBytes = new Uint8Array(nOutLen);\n\n let nMod3;\n let nMod4;\n let nUint24 = 0;\n let nOutIdx = 0;\n for (let nInIdx = 0; nInIdx < nInLen; nInIdx++) {\n nMod4 = nInIdx & 3;\n nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << (6 * (3 - nMod4));\n if (nMod4 === 3 || nInLen - nInIdx === 1) {\n nMod3 = 0;\n while (nMod3 < 3 && nOutIdx < nOutLen) {\n taBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255;\n nMod3++;\n nOutIdx++;\n }\n nUint24 = 0;\n }\n }\n\n return taBytes;\n}\n\n/* Base64 string to array encoding */\nfunction uint6ToB64(nUint6: number): number {\n return nUint6 < 26\n ? nUint6 + 65\n : nUint6 < 52\n ? nUint6 + 71\n : nUint6 < 62\n ? nUint6 - 4\n : nUint6 === 62\n ? 43\n : nUint6 === 63\n ? 47\n : 65;\n}\n\nfunction base64EncArr(aBytes: Uint8Array): string {\n let nMod3 = 2;\n let sB64Enc = \"\";\n\n const nLen = aBytes.length;\n let nUint24 = 0;\n for (let nIdx = 0; nIdx < nLen; nIdx++) {\n nMod3 = nIdx % 3;\n // To break your base64 into several 80-character lines, add:\n // if (nIdx > 0 && ((nIdx * 4) / 3) % 76 === 0) {\n // sB64Enc += \"\\r\\n\";\n // }\n\n nUint24 |= aBytes[nIdx] << ((16 >>> nMod3) & 24);\n if (nMod3 === 2 || aBytes.length - nIdx === 1) {\n sB64Enc += String.fromCodePoint(\n uint6ToB64((nUint24 >>> 18) & 63),\n uint6ToB64((nUint24 >>> 12) & 63),\n uint6ToB64((nUint24 >>> 6) & 63),\n uint6ToB64(nUint24 & 63)\n );\n nUint24 = 0;\n }\n }\n return (\n sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) +\n (nMod3 === 2 ? \"\" : nMod3 === 1 ? \"=\" : \"==\")\n );\n}\n\n/* UTF-8 array to JS string and vice versa */\n\nfunction UTF8ArrToStr(aBytes: Uint8Array): string {\n let sView = \"\";\n let nPart;\n const nLen = aBytes.length;\n for (let nIdx = 0; nIdx < nLen; nIdx++) {\n nPart = aBytes[nIdx];\n sView += String.fromCodePoint(\n nPart > 251 && nPart < 254 && nIdx + 5 < nLen /* six bytes */\n ? /* (nPart - 252 << 30) may be not so safe in ECMAScript! So\u2026: */\n (nPart - 252) * 1073741824 +\n ((aBytes[++nIdx] - 128) << 24) +\n ((aBytes[++nIdx] - 128) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 247 && nPart < 252 && nIdx + 4 < nLen /* five bytes */\n ? ((nPart - 248) << 24) +\n ((aBytes[++nIdx] - 128) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 239 && nPart < 248 && nIdx + 3 < nLen /* four bytes */\n ? ((nPart - 240) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 223 && nPart < 240 && nIdx + 2 < nLen /* three bytes */\n ? ((nPart - 224) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 191 && nPart < 224 && nIdx + 1 < nLen /* two bytes */\n ? ((nPart - 192) << 6) + aBytes[++nIdx] - 128\n : /* nPart < 127 ? */ /* one byte */\n nPart\n );\n }\n return sView;\n}\n\nfunction strToUTF8Arr(sDOMStr: string): Uint8Array {\n let nChr;\n const nStrLen = sDOMStr.length;\n let nArrLen = 0;\n\n /* mapping\u2026 */\n for (let nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {\n nChr = sDOMStr.codePointAt(nMapIdx);\n if (nChr === undefined) {\n throw Error(`No char at ${nMapIdx} on string with length: ${sDOMStr.length}`)\n }\n\n if (nChr >= 0x10000) {\n nMapIdx++;\n }\n\n nArrLen +=\n nChr < 0x80\n ? 1\n : nChr < 0x800\n ? 2\n : nChr < 0x10000\n ? 3\n : nChr < 0x200000\n ? 4\n : nChr < 0x4000000\n ? 5\n : 6;\n }\n\n const aBytes = new Uint8Array(nArrLen);\n\n /* transcription\u2026 */\n let nIdx = 0;\n let nChrIdx = 0;\n while (nIdx < nArrLen) {\n nChr = sDOMStr.codePointAt(nChrIdx);\n if (nChr === undefined) {\n throw Error(`No char at ${nChrIdx} on string with length: ${sDOMStr.length}`)\n }\n if (nChr < 128) {\n /* one byte */\n aBytes[nIdx++] = nChr;\n } else if (nChr < 0x800) {\n /* two bytes */\n aBytes[nIdx++] = 192 + (nChr >>> 6);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x10000) {\n /* three bytes */\n aBytes[nIdx++] = 224 + (nChr >>> 12);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x200000) {\n /* four bytes */\n aBytes[nIdx++] = 240 + (nChr >>> 18);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n } else if (nChr < 0x4000000) {\n /* five bytes */\n aBytes[nIdx++] = 248 + (nChr >>> 24);\n aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n } /* if (nChr <= 0x7fffffff) */ else {\n /* six bytes */\n aBytes[nIdx++] = 252 + (nChr >>> 30);\n aBytes[nIdx++] = 128 + ((nChr >>> 24) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n }\n nChrIdx++;\n }\n\n return aBytes;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { HttpStatusCode } from \"@gnu-taler/taler-util\";\nimport { base64encode } from \"./base64.js\";\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport enum ErrorType {\n CLIENT,\n SERVER,\n UNREADABLE,\n TIMEOUT,\n UNEXPECTED,\n}\n\n\n\n/**\n *\n * @param baseUrl URL where the service is located\n * @param endpoint endpoint of the service to be called\n * @param options auth, method and params\n * @deprecated do not use it, it will be removed\n * @returns\n */\nexport async function defaultRequestHandler(\n baseUrl: string,\n endpoint: string,\n options: RequestOptions = {},\n): Promise> {\n const requestHeaders: Record = {};\n if (options.token) {\n requestHeaders.Authorization = `Bearer secret-token:${options.token}`;\n } else if (options.basicAuth) {\n requestHeaders.Authorization = `Basic ${base64encode(\n `${options.basicAuth.username}:${options.basicAuth.password}`,\n )}`;\n }\n\n requestHeaders[\"Content-Type\"] =\n !options.contentType || options.contentType === \"json\" ? \"application/json\" : \"text/plain\";\n\n if (options.talerAmlOfficerSignature) {\n requestHeaders[\"Taler-AML-Officer-Signature\"] =\n options.talerAmlOfficerSignature;\n }\n\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.data;\n const requestTimeout = options?.timeout ?? 5 * 1000;\n const requestParams = options.params ?? {};\n const requestPreventCache = options.preventCache ?? false;\n const requestPreventCors = options.preventCors ?? false;\n\n const validURL = validateURL(baseUrl, endpoint);\n\n if (!validURL) {\n const error: HttpResponseUnexpectedError = {\n info: {\n url: `${baseUrl}${endpoint}`,\n payload: {},\n hasToken: !!options.token,\n status: 0,\n options,\n },\n type: ErrorType.UNEXPECTED,\n exception: undefined,\n loading: false,\n message: `invalid URL: \"${baseUrl}${endpoint}\"`,\n };\n throw new RequestError(error)\n }\n\n Object.entries(requestParams).forEach(([key, value]) => {\n validURL.searchParams.set(key, String(value));\n });\n\n let payload: BodyInit | undefined = undefined;\n if (requestBody != null) {\n if (typeof requestBody === \"string\") {\n payload = requestBody;\n } else if (requestBody instanceof ArrayBuffer) {\n payload = requestBody;\n } else if (ArrayBuffer.isView(requestBody)) {\n payload = requestBody;\n } else if (typeof requestBody === \"object\") {\n payload = JSON.stringify(requestBody);\n } else {\n const error: HttpResponseUnexpectedError = {\n info: {\n url: validURL.href,\n payload: {},\n hasToken: !!options.token,\n status: 0,\n options,\n },\n type: ErrorType.UNEXPECTED,\n exception: undefined,\n loading: false,\n message: `unsupported request body type: \"${typeof requestBody}\"`,\n };\n throw new RequestError(error)\n }\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => {\n controller.abort(\"HTTP_REQUEST_TIMEOUT\");\n }, requestTimeout);\n\n let response;\n try {\n response = await fetch(validURL.href, {\n headers: requestHeaders,\n method: requestMethod,\n credentials: \"omit\",\n mode: requestPreventCors ? \"no-cors\" : \"cors\",\n cache: requestPreventCache ? \"no-cache\" : \"default\",\n body: payload,\n signal: controller.signal,\n });\n } catch (ex) {\n const info: RequestInfo = {\n payload,\n url: validURL.href,\n hasToken: !!options.token,\n status: 0,\n options,\n };\n\n if (ex instanceof Error) {\n if (ex.message === \"HTTP_REQUEST_TIMEOUT\") {\n const error: HttpRequestTimeoutError = {\n info,\n type: ErrorType.TIMEOUT,\n message: \"request timeout\",\n };\n throw new RequestError(error);\n }\n }\n\n const error: HttpResponseUnexpectedError = {\n info,\n type: ErrorType.UNEXPECTED,\n exception: ex,\n loading: false,\n message: (ex instanceof Error ? ex.message : \"\"),\n };\n throw new RequestError(error);\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n const headerMap = new Headers();\n response.headers.forEach((value, key) => {\n headerMap.set(key, value);\n });\n\n if (response.ok) {\n const result = await buildRequestOk(\n response,\n validURL.href,\n payload,\n !!options.token,\n options,\n );\n return result;\n } else {\n const dataTxt = await response.text();\n const error = buildRequestFailed(\n validURL.href,\n dataTxt,\n response.status,\n payload,\n options,\n );\n throw new RequestError(error);\n }\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponse =\n | HttpResponseOk\n | HttpResponseLoading\n | HttpError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponsePaginated =\n | HttpResponseOkPaginated\n | HttpResponseLoading\n | HttpError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface RequestInfo {\n url: string;\n hasToken: boolean;\n payload: any;\n status: number;\n options: RequestOptions;\n}\n\ninterface HttpResponseLoading {\n ok?: false;\n loading: true;\n clientError?: false;\n serverError?: false;\n\n data?: T;\n}\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface HttpResponseOk {\n ok: true;\n loading?: false;\n clientError?: false;\n serverError?: false;\n\n data: T;\n info?: RequestInfo;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponseOkPaginated = HttpResponseOk & WithPagination;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface WithPagination {\n loadMore: () => void;\n loadMorePrev: () => void;\n isReachingEnd?: boolean;\n isReachingStart?: boolean;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpError =\n | HttpRequestTimeoutError\n | HttpResponseClientError\n | HttpResponseServerError\n | HttpResponseUnreadableError\n | HttpResponseUnexpectedError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface HttpResponseServerError {\n ok?: false;\n loading?: false;\n type: ErrorType.SERVER;\n payload: ErrorDetail;\n status: HttpStatusCode;\n message: string;\n info: RequestInfo;\n}\ninterface HttpRequestTimeoutError {\n ok?: false;\n loading?: false;\n type: ErrorType.TIMEOUT;\n\n info: RequestInfo;\n\n message: string;\n}\ninterface HttpResponseClientError {\n ok?: false;\n loading?: false;\n type: ErrorType.CLIENT;\n\n info: RequestInfo;\n status: HttpStatusCode;\n payload: ErrorDetail;\n message: string;\n}\n\ninterface HttpResponseUnexpectedError {\n ok?: false;\n loading: false;\n type: ErrorType.UNEXPECTED;\n\n info: RequestInfo;\n status?: HttpStatusCode;\n exception: unknown;\n message: string;\n}\n\ninterface HttpResponseUnreadableError {\n ok?: false;\n loading: false;\n type: ErrorType.UNREADABLE;\n\n info: RequestInfo;\n status: HttpStatusCode;\n exception: unknown;\n body: string;\n message: string;\n}\n/**\n * @deprecated do not use it, it will be removed\n */\nexport class RequestError extends Error {\n /**\n * @deprecated use cause\n */\n info: HttpError;\n cause: HttpError;\n constructor(d: HttpError) {\n super(d.message);\n this.info = d;\n this.cause = d;\n }\n}\n\ntype Methods = \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface RequestOptions {\n method?: Methods;\n token?: string;\n basicAuth?: {\n username: string;\n password: string;\n };\n preventCache?: boolean;\n preventCors?: boolean;\n data?: any;\n params?: unknown;\n timeout?: number;\n contentType?: \"text\" | \"json\";\n talerAmlOfficerSignature?: string;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nasync function buildRequestOk(\n response: Response,\n url: string,\n payload: any,\n hasToken: boolean,\n options: RequestOptions,\n): Promise> {\n const dataTxt = await response.text();\n const data = dataTxt ? JSON.parse(dataTxt) : undefined;\n return {\n ok: true,\n data,\n info: {\n payload,\n url,\n hasToken,\n options,\n status: response.status,\n },\n };\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport function buildRequestFailed(\n url: string,\n dataTxt: string,\n status: number,\n payload: any,\n maybeOptions?: RequestOptions,\n):\n | HttpResponseClientError\n | HttpResponseServerError\n | HttpResponseUnreadableError\n | HttpResponseUnexpectedError {\n const options = maybeOptions ?? {};\n const info: RequestInfo = {\n payload,\n url,\n hasToken: !!options.token,\n options,\n status: status || 0,\n };\n\n // const dataTxt = await response.text();\n try {\n const data = dataTxt ? JSON.parse(dataTxt) : undefined;\n const errorCode = !data || !data.code ? \"\" : `(code: ${data.code})`;\n const errorHint =\n !data || !data.hint ? \"Not hint.\" : `${data.hint} ${errorCode}`;\n\n if (status && status >= 400 && status < 500) {\n const message =\n data === undefined\n ? `Client error (${status}) without data.`\n : errorHint;\n\n const error: HttpResponseClientError = {\n type: ErrorType.CLIENT,\n status,\n info,\n message,\n payload: data,\n };\n return error;\n }\n if (status && status >= 500 && status < 600) {\n const message =\n data === undefined\n ? `Server error (${status}) without data.`\n : errorHint;\n const error: HttpResponseServerError = {\n type: ErrorType.SERVER,\n status,\n info,\n message,\n payload: data,\n };\n return error;\n }\n return {\n info,\n loading: false,\n type: ErrorType.UNEXPECTED,\n status,\n exception: undefined,\n message: `http status code not handled: ${status}`,\n };\n } catch (ex) {\n const error: HttpResponseUnreadableError = {\n info,\n loading: false,\n status,\n type: ErrorType.UNREADABLE,\n exception: ex,\n body: dataTxt,\n message: \"Could not parse body as json\",\n };\n\n return error;\n }\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nfunction validateURL(baseUrl: string, endpoint: string): URL | undefined {\n try {\n return new URL(`${baseUrl}${endpoint}`)\n } catch (ex) {\n return undefined\n }\n\n}", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n Logger,\n RequestThrottler,\n TalerErrorCode,\n TalerError,\n Duration,\n} from \"@gnu-taler/taler-util\";\n\nimport {\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n Headers,\n getDefaultHeaders,\n encodeBody,\n DEFAULT_REQUEST_TIMEOUT_MS,\n HttpLibArgs,\n} from \"@gnu-taler/taler-util/http\";\n\nconst logger = new Logger(\"browserHttpLib\");\n\n/**\n * An implementation of the [[HttpRequestLibrary]] using the\n * browser's XMLHttpRequest.\n * \n * @deprecated use BrowserFetchHttpLib\n */\nexport class BrowserHttpLibDepreacted implements HttpRequestLibrary {\n private throttle = new RequestThrottler();\n private throttlingEnabled = true;\n private requireTls = false;\n\n constructor(args?: HttpLibArgs) {\n this.throttlingEnabled = args?.enableThrottling ?? true;\n this.requireTls = args?.requireTls ?? false;\n }\n\n fetch(\n requestUrl: string,\n options?: HttpRequestOptions,\n ): Promise {\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.body;\n const requestHeader = options?.headers;\n const requestTimeout =\n options?.timeout ?? Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);\n\n const parsedUrl = new URL(requestUrl);\n if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED,\n {\n requestMethod,\n requestUrl,\n throttleStats: this.throttle.getThrottleStats(requestUrl),\n },\n `request to origin ${parsedUrl.origin} was throttled`,\n );\n }\n if (this.requireTls && parsedUrl.protocol !== \"https:\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestMethod: requestMethod,\n requestUrl: requestUrl,\n },\n `request to ${parsedUrl.origin} is not possible with protocol ${parsedUrl.protocol}`,\n );\n }\n\n let myBody: ArrayBuffer | undefined =\n requestMethod === \"POST\" || requestMethod === \"PUT\" || requestMethod === \"PATCH\"\n ? encodeBody(requestBody)\n : undefined;\n\n const requestHeadersMap = getDefaultHeaders(requestMethod);\n if (requestHeader) {\n Object.entries(requestHeader).forEach(([key, value]) => {\n if (value === undefined) return;\n requestHeadersMap[key] = value\n })\n }\n\n return new Promise((resolve, reject) => {\n const myRequest = new XMLHttpRequest();\n\n myRequest.onerror = (e) => {\n logger.error(\"http request error\");\n reject(\n TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestUrl,\n requestMethod,\n },\n \"Could not make request\",\n ),\n );\n };\n\n myRequest.open(requestMethod, requestUrl);\n\n let timeoutId: any | undefined;\n if (requestTimeout.d_ms !== \"forever\") {\n timeoutId = setTimeout(() => {\n myRequest.abort();\n reject(\n TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT,\n {\n requestUrl,\n requestMethod,\n timeoutMs: requestTimeout.d_ms === \"forever\" ? 0 : requestTimeout.d_ms\n },\n `request to ${requestUrl} timed out`,\n ),\n );\n }, requestTimeout.d_ms);\n }\n\n Object.keys(requestHeadersMap).forEach((headerName) => {\n myRequest.setRequestHeader(headerName, requestHeadersMap[headerName]);\n });\n\n myRequest.responseType = \"arraybuffer\";\n myRequest.send(myBody);\n\n myRequest.addEventListener(\"readystatechange\", (e) => {\n if (myRequest.readyState === XMLHttpRequest.DONE) {\n if (myRequest.status === 0) {\n const exc = TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestUrl,\n requestMethod,\n },\n \"HTTP request failed (status 0, maybe URI scheme was wrong?)\",\n );\n reject(exc);\n return;\n }\n const makeText = async (): Promise => {\n const td = new TextDecoder();\n return td.decode(myRequest.response);\n };\n let responseJson: unknown = undefined;\n const makeJson = async (): Promise => {\n if (responseJson === undefined) {\n try {\n const td = new TextDecoder();\n const responseString = td.decode(myRequest.response);\n responseJson = JSON.parse(responseString);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: myRequest.status,\n },\n \"Invalid JSON from HTTP response\",\n );\n }\n }\n if (responseJson === null || typeof responseJson !== \"object\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: myRequest.status,\n },\n \"Invalid JSON from HTTP response\",\n );\n }\n return responseJson;\n };\n\n const headers = myRequest.getAllResponseHeaders();\n const arr = headers.trim().split(/[\\r\\n]+/);\n\n // Create a map of header names to values\n const headerMap: Headers = new Headers();\n arr.forEach(function (line) {\n const parts = line.split(\": \");\n const headerName = parts.shift();\n if (!headerName) {\n logger.warn(\"skipping invalid header\");\n return;\n }\n const value = parts.join(\": \");\n headerMap.set(headerName, value);\n });\n const resp: HttpResponse = {\n requestUrl: requestUrl,\n status: myRequest.status,\n headers: headerMap,\n requestMethod: requestMethod,\n json: makeJson,\n text: makeText,\n bytes: async () => myRequest.response,\n };\n resolve(resp);\n }\n });\n });\n }\n\n get(url: string, opt?: HttpRequestOptions): Promise {\n return this.fetch(url, {\n method: \"GET\",\n ...opt,\n });\n }\n\n postJson(\n url: string,\n body: any,\n opt?: HttpRequestOptions,\n ): Promise {\n return this.fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n ...opt,\n });\n }\n\n stop(): void {\n // Nothing to do\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n Duration,\n RequestThrottler,\n TalerError,\n TalerErrorCode,\n} from \"@gnu-taler/taler-util\";\n\nimport {\n DEFAULT_REQUEST_TIMEOUT_MS,\n Headers,\n HttpLibArgs,\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n encodeBody,\n getDefaultHeaders,\n} from \"@gnu-taler/taler-util/http\";\n\n/**\n * An implementation of the [[HttpRequestLibrary]] using the\n * browser's XMLHttpRequest.\n */\nexport class BrowserFetchHttpLib implements HttpRequestLibrary {\n private throttle = new RequestThrottler();\n private throttlingEnabled = true;\n private requireTls = false;\n\n public constructor(args?: HttpLibArgs) {\n this.throttlingEnabled = args?.enableThrottling ?? true;\n this.requireTls = args?.requireTls ?? false;\n }\n\n async fetch(\n requestUrl: string,\n options?: HttpRequestOptions,\n ): Promise {\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.body;\n const requestHeader = options?.headers;\n const requestTimeout =\n options?.timeout ?? Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);\n const requestCancel = options?.cancellationToken;\n const requestRedirect = options?.redirect;\n\n const parsedUrl = new URL(requestUrl);\n if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED,\n {\n requestMethod,\n requestUrl,\n throttleStats: this.throttle.getThrottleStats(requestUrl),\n },\n `request to origin ${parsedUrl.origin} was throttled`,\n );\n }\n if (this.requireTls && parsedUrl.protocol !== \"https:\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestMethod: requestMethod,\n requestUrl: requestUrl,\n },\n `request to ${parsedUrl.origin} is not possible with protocol ${parsedUrl.protocol}`,\n );\n }\n\n const myBody: ArrayBuffer | undefined =\n requestMethod === \"POST\" ||\n requestMethod === \"PUT\" ||\n requestMethod === \"PATCH\"\n ? encodeBody(requestBody)\n : undefined;\n\n const requestHeadersMap = getDefaultHeaders(requestMethod);\n if (requestHeader) {\n Object.entries(requestHeader).forEach(([key, value]) => {\n if (value === undefined) return;\n requestHeadersMap[key] = value;\n });\n }\n\n const controller = new AbortController();\n let timeoutId: ReturnType | undefined;\n if (requestTimeout.d_ms !== \"forever\") {\n timeoutId = setTimeout(() => {\n controller.abort(TalerErrorCode.GENERIC_TIMEOUT);\n }, requestTimeout.d_ms);\n }\n if (requestCancel) {\n requestCancel.onCancelled(() => {\n controller.abort(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR);\n });\n }\n\n try {\n const response = await fetch(requestUrl, {\n headers: requestHeadersMap,\n body: myBody,\n method: requestMethod,\n signal: controller.signal,\n redirect: requestRedirect,\n });\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n const headerMap = new Headers();\n response.headers.forEach((value, key) => {\n headerMap.set(key, value);\n });\n const text = makeTextHandler(response, requestUrl, requestMethod);\n const json = makeJsonHandler(response, requestUrl, requestMethod, text);\n return {\n headers: headerMap,\n status: response.status,\n requestMethod,\n requestUrl,\n json,\n text,\n bytes: async () => (await response.blob()).arrayBuffer(),\n };\n } catch (e) {\n if (controller.signal) {\n throw TalerError.fromDetail(\n controller.signal.reason,\n {\n requestUrl,\n requestMethod,\n timeoutMs:\n requestTimeout.d_ms === \"forever\" ? 0 : requestTimeout.d_ms,\n },\n `HTTP request failed.`,\n );\n }\n throw e;\n }\n }\n}\n\nfunction makeTextHandler(\n response: Response,\n requestUrl: string,\n requestMethod: string,\n) {\n let firstTime = true;\n let respText: string;\n let error: TalerError | undefined;\n return async function getTextFromResponse(): Promise {\n if (firstTime) {\n firstTime = false;\n try {\n respText = await response.text();\n } catch (e) {\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Invalid text from HTTP response\",\n );\n }\n }\n if (error !== undefined) {\n throw error;\n }\n return respText;\n };\n}\n\nfunction makeJsonHandler(\n response: Response,\n requestUrl: string,\n requestMethod: string,\n readTextHandler: () => Promise,\n) {\n let firstTime = true;\n let responseJson: string | undefined = undefined;\n let error: TalerError | undefined;\n return async function getJsonFromResponse(): Promise {\n if (firstTime) {\n let responseText: string;\n try {\n responseText = await readTextHandler();\n } catch (e) {\n const message =\n e instanceof Error\n ? `Couldn't read HTTP response: ${e.message}`\n : \"Couldn't read HTTP response\";\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n message,\n );\n }\n if (!error) {\n try {\n // @ts-expect-error no error then text is initialized\n responseJson = JSON.parse(responseText);\n } catch (e) {\n const message =\n e instanceof Error\n ? `Invalid JSON from HTTP response: ${e.message}`\n : \"Invalid JSON from HTTP response\";\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n // @ts-expect-error no error then text is initialized\n response: responseText,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n message,\n );\n }\n if (responseJson === null || typeof responseJson !== \"object\") {\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n response: JSON.stringify(responseJson),\n httpStatusCode: response.status,\n },\n \"Invalid JSON from HTTP response: null or not object\",\n );\n }\n }\n }\n if (error !== undefined) {\n throw error;\n }\n return responseJson;\n };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\ndeclare const __location: unique symbol;\n/**\n * special string that defined a location in the application\n *\n * this help to prevent wrong path\n */\nexport type AppLocation = string & {\n [__location]: true;\n};\n\nexport type EmptyObject = Record;\n\nexport function urlPattern<\n T extends Record = EmptyObject,\n>(pattern: RegExp, reverse: (p: T) => string): RouteDefinition {\n const url = reverse as (p: T) => AppLocation;\n return {\n pattern: new RegExp(pattern),\n url,\n };\n}\n\n/**\n * defines a location in the app\n *\n * pattern: how a string will trigger this location\n * url(): how a state serialize to a location\n */\n\nexport type ObjectOf = Record | EmptyObject;\n\nexport type RouteDefinition<\n T extends ObjectOf = EmptyObject,\n> = {\n pattern: RegExp;\n url: (p: T) => AppLocation;\n};\n\nconst nullRountDef = {\n pattern: new RegExp(/.*/),\n url: () => \"\" as AppLocation,\n};\nexport function buildNullRoutDefinition<\n T extends ObjectOf,\n>(): RouteDefinition {\n return nullRountDef;\n}\n\n/**\n * Search path in the pageList\n * get the values from the path found\n * add params from searchParams\n *\n * @param path\n * @param params\n */\nexport function findMatch>(\n pagesMap: T,\n pageList: Array,\n path: string,\n params: Record,\n): Location | LocationNotFound {\n for (let idx = 0; idx < pageList.length; idx++) {\n const name = pageList[idx];\n const found = pagesMap[name].pattern.exec(path);\n if (found !== null) {\n const values = {} as Record;\n\n if (found.groups !== undefined) {\n Object.entries(found.groups).forEach(([key, value]) => {\n values[key] = value;\n });\n }\n\n // @ts-expect-error values is a map string which is equivalent to the RouteParamsType\n return { name, parent: pagesMap, values, params };\n }\n }\n // @ts-expect-error values is a map string which is equivalent to the RouteParamsType\n return { name: undefined, parent: pagesMap, values: {}, params };\n}\n\n/**\n * get the type of the params of a location\n *\n */\ntype RouteParamsType<\n RouteType,\n Key extends keyof RouteType,\n> = RouteType[Key] extends RouteDefinition ? ParamType : never;\n\n/**\n * Helps to create a map of a type with the key\n */\ntype MapKeyValue = {\n [Key in keyof Type]: Key extends string\n ? {\n parent: Type;\n name: Key;\n values: RouteParamsType;\n params: Record;\n }\n : never;\n};\n\n/**\n * create a enumeration of value of a mapped type\n */\ntype EnumerationOf = T[keyof T];\n\nexport type Location = EnumerationOf>;\nexport type LocationNotFound = {\n parent: Type;\n name: undefined;\n values: RouteParamsType;\n params: Record;\n};\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { TalerBankIntegrationHttpClient, TalerCoreBankHttpClient, TalerRevenueHttpClient, TalerWireGatewayHttpClient } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\nimport { defaultRequestHandler } from \"../utils/request.js\";\n\ninterface Type {\n /**\n * @deprecated this show not be used\n */\n request: typeof defaultRequestHandler;\n bankCore: TalerCoreBankHttpClient,\n bankIntegration: TalerBankIntegrationHttpClient,\n bankWire: TalerWireGatewayHttpClient,\n bankRevenue: TalerRevenueHttpClient,\n}\n\nconst Context = createContext({ request: defaultRequestHandler } as any);\n\nexport const useApiContext = (): Type => useContext(Context);\nexport const ApiContextProvider = ({\n children,\n value,\n}: {\n value: Type;\n children: ComponentChildren;\n}): VNode => {\n return h(Context.Provider, { value, children });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { i18n, setupI18n } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext, useEffect } from \"preact/hooks\";\nimport { useLang } from \"../hooks/index.js\";\nimport { Locale } from \"date-fns\";\nimport {\n es as esLocale,\n enGB as enLocale,\n fr as frLocale,\n de as deLocale\n} from \"date-fns/locale\"\n\nexport type InternationalizationAPI = typeof i18n;\n\ninterface Type {\n lang: string;\n supportedLang: { [id in keyof typeof supportedLang]: string };\n changeLanguage: (l: string) => void;\n i18n: InternationalizationAPI;\n dateLocale: Locale,\n completeness: { [id in keyof typeof supportedLang]: number }\n}\n\nconst supportedLang = {\n es: \"Espanol [es]\",\n en: \"English [en]\",\n fr: \"Francais [fr]\",\n de: \"Deutsch [de]\",\n sv: \"Svenska [sv]\",\n it: \"Italiane [it]\",\n};\n\nconst initial: Type = {\n lang: \"en\",\n supportedLang,\n changeLanguage: () => {\n // do not change anything\n },\n i18n,\n dateLocale: enLocale,\n completeness: {\n de: 0,\n en: 0,\n es: 0,\n fr: 0,\n it: 0,\n sv: 0,\n }\n};\nconst Context = createContext(initial);\n\ninterface Props {\n initial?: string;\n children: ComponentChildren;\n forceLang?: string;\n source: Record;\n completeness?: Record;\n}\n\n// Outmost UI wrapper.\nexport const TranslationProvider = ({\n initial,\n children,\n forceLang,\n source,\n completeness: completenessProp\n}: Props): VNode => {\n const completeness = {\n en: 100,\n de: !completenessProp || !completenessProp[\"de\"] ? 0 : completenessProp[\"de\"],\n es: !completenessProp || !completenessProp[\"es\"] ? 0 : completenessProp[\"es\"],\n fr: !completenessProp || !completenessProp[\"fr\"] ? 0 : completenessProp[\"fr\"],\n it: !completenessProp || !completenessProp[\"it\"] ? 0 : completenessProp[\"it\"],\n sv: !completenessProp || !completenessProp[\"sv\"] ? 0 : completenessProp[\"sv\"],\n }\n const { value: lang, update: changeLanguage } = useLang(initial, completeness);\n\n useEffect(() => {\n if (forceLang) {\n changeLanguage(forceLang);\n }\n },[forceLang]);\n useEffect(() => {\n setupI18n(lang, source);\n }, [lang]);\n if (forceLang) {\n setupI18n(forceLang, source);\n } else {\n setupI18n(lang, source);\n }\n\n const dateLocale = lang === \"es\" ? esLocale :\n lang === \"fr\" ? frLocale :\n lang === \"de\" ? deLocale :\n enLocale;\n\n return h(Context.Provider, {\n value: { lang, changeLanguage, supportedLang, i18n, dateLocale, completeness },\n children,\n });\n};\n\nexport const useTranslationContext = (): Type => useContext(Context);\n", "export default function buildFormatLongFn(args) {\n return function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // TODO: Remove String()\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}", "export default function buildLocalizeFn(args) {\n return function (dirtyIndex, options) {\n var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';\n var valuesArray;\n\n if (context === 'formatting' && args.formattingValues) {\n var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;\n valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n var _defaultWidth = args.defaultWidth;\n\n var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[_width] || args.values[_defaultWidth];\n }\n\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n\n return valuesArray[index];\n };\n}", "export default function buildMatchFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n }) : findKey(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n });\n var value;\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\n\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (var key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n\n return undefined;\n}", "export default function buildMatchPatternFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}", "export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n\n var number = Number(dirtyNumber);\n\n if (isNaN(number)) {\n return number;\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}", "export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\n\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument); // Clone the date\n\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\"); // eslint-disable-next-line no-console\n\n console.warn(new Error().stack);\n }\n\n return new Date(NaN);\n }\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\n\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n date.setDate(date.getDate() + amount);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\n\nexport default function addMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n\n var endOfDesiredMonth = new Date(date.getTime());\n endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);\n var daysInMonth = endOfDesiredMonth.getDate();\n\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);\n return date;\n }\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport addDays from \"../addDays/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n\n/**\n * @name add\n * @category Common Helpers\n * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @description\n * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n *\n * | Key | Description |\n * |----------------|------------------------------------|\n * | years | Amount of years to be added |\n * | months | Amount of months to be added |\n * | weeks | Amount of weeks to be added |\n * | days | Amount of days to be added |\n * | hours | Amount of hours to be added |\n * | minutes | Amount of minutes to be added |\n * | seconds | Amount of seconds to be added |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add the following duration to 1 September 2014, 10:19:50\n * const result = add(new Date(2014, 8, 1, 10, 19, 50), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30,\n * })\n * //=> Thu Jun 15 2017 15:29:20\n */\nexport default function add(dirtyDate, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Add years and months\n\n var date = toDate(dirtyDate);\n var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date; // Add weeks and days\n\n var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths; // Add days, hours, minutes and seconds\n\n var minutesToAdd = minutes + hours * 60;\n var secondsToAdd = seconds + minutesToAdd * 60;\n var msToAdd = secondsToAdd * 1000;\n var finalDate = new Date(dateWithDays.getTime() + msToAdd);\n return finalDate;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\n\nexport default function addMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var timestamp = toDate(dirtyDate).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}", "var defaultOptions = {};\nexport function getDefaultOptions() {\n return defaultOptions;\n}\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}", "import toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the start of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setDate(date.getDate() - diff);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\n\nexport default function startOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\n\nexport default function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var startOfDayLeft = startOfDay(dirtyDateLeft);\n var startOfDayRight = startOfDay(dirtyDateRight);\n var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);\n var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); // Round the number of days to the nearest integer\n // because the number of milliseconds in a day is not constant\n // (e.g. it's different in the day of the daylight saving time clock shift)\n\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\n\nexport default function compareAsc(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var diff = dateLeft.getTime() - dateRight.getTime();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "/**\n * Days in 1 week.\n *\n * @name daysInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInWeek = 7;\n/**\n * Days in 1 year\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n *\n * @name daysInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var daysInYear = 365.2425;\n/**\n * Maximum allowed time.\n *\n * @name maxTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n/**\n * Milliseconds in 1 minute\n *\n * @name millisecondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInMinute = 60000;\n/**\n * Milliseconds in 1 hour\n *\n * @name millisecondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInHour = 3600000;\n/**\n * Milliseconds in 1 second\n *\n * @name millisecondsInSecond\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInSecond = 1000;\n/**\n * Minimum allowed time.\n *\n * @name minTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minTime = -maxTime;\n/**\n * Minutes in 1 hour\n *\n * @name minutesInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minutesInHour = 60;\n/**\n * Months in 1 quarter\n *\n * @name monthsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInQuarter = 3;\n/**\n * Months in 1 year\n *\n * @name monthsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInYear = 12;\n/**\n * Quarters in 1 year\n *\n * @name quartersInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var quartersInYear = 4;\n/**\n * Seconds in 1 hour\n *\n * @name secondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInHour = 3600;\n/**\n * Seconds in 1 minute\n *\n * @name secondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMinute = 60;\n/**\n * Seconds in 1 day\n *\n * @name secondsInDay\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInDay = secondsInHour * 24;\n/**\n * Seconds in 1 week\n *\n * @name secondsInWeek\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInWeek = secondsInDay * 7;\n/**\n * Seconds in 1 year\n *\n * @name secondsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInYear = secondsInDay * daysInYear;\n/**\n * Seconds in 1 month\n *\n * @name secondsInMonth\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMonth = secondsInYear / 12;\n/**\n * Seconds in 1 quarter\n *\n * @name secondsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInQuarter = secondsInMonth * 3;", "import startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameDay\n * @category Day Helpers\n * @summary Are the given dates in the same day (and year and month)?\n *\n * @description\n * Are the given dates in the same day (and year and month)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same day (and year and month)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))\n * //=> true\n *\n * @example\n * // Are 4 September and 4 October in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))\n * //=> false\n *\n * @example\n * // Are 4 September, 2014 and 4 September, 2015 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))\n * //=> false\n */\n\nexport default function isSameDay(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeftStartOfDay = startOfDay(dirtyDateLeft);\n var dateRightStartOfDay = startOfDay(dirtyDateRight);\n return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\n\nexport default function isDate(value) {\n requiredArgs(1, arguments);\n return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';\n}", "import isDate from \"../isDate/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\n\nexport default function isValid(dirtyDate) {\n requiredArgs(1, arguments);\n\n if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {\n return false;\n }\n\n var date = toDate(dirtyDate);\n return !isNaN(Number(date));\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\n\nexport default function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();\n var monthDiff = dateLeft.getMonth() - dateRight.getMonth();\n return yearDiff * 12 + monthDiff;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\n\nexport default function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() - dateRight.getFullYear();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarDays from \"../differenceInCalendarDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\"; // Like `compareAsc` but uses local time not UTC, which is needed\n// for accurate equality comparisons of UTC timestamps that end up\n// having the same representation in local time, e.g. one hour before\n// DST ends vs. the instant that DST ends.\n\nfunction compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}\n/**\n * @name differenceInDays\n * @category Day Helpers\n * @summary Get the number of full days between the given dates.\n *\n * @description\n * Get the number of full day periods between two dates. Fractional days are\n * truncated towards zero.\n *\n * One \"full day\" is the distance between a local time in one day to the same\n * local time on the next or previous day. A full day can sometimes be less than\n * or more than 24 hours if a daylight savings change happens between two dates.\n *\n * To ignore DST and only measure exact 24-hour periods, use this instead:\n * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.\n *\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full days according to the local timezone\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 365\n * // How many full days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 0\n * // How many full days are between\n * // 1 March 2020 0:00 and 1 June 2020 0:00 ?\n * // Note: because local time is used, the\n * // result will always be 92 days, even in\n * // time zones where DST starts and the\n * // period has only 92*24-1 hours.\n * const result = differenceInDays(\n * new Date(2020, 5, 1),\n * new Date(2020, 2, 1)\n * )\n//=> 92\n */\n\n\nexport default function differenceInDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareLocalAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));\n dateLeft.setDate(dateLeft.getDate() - sign * difference); // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);\n var result = sign * (difference - isLastDayNotFull); // Prevent negative zero\n\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\n\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}", "var roundingMap = {\n ceil: Math.ceil,\n round: Math.round,\n floor: Math.floor,\n trunc: function trunc(value) {\n return value < 0 ? Math.ceil(value) : Math.floor(value);\n } // Math.trunc is not supported by IE\n\n};\nvar defaultRoundingMethod = 'trunc';\nexport function getRoundingMethod(method) {\n return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];\n}", "import { millisecondsInHour } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInHours\n * @category Hour Helpers\n * @summary Get the number of hours between the given dates.\n *\n * @description\n * Get the number of hours between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of hours\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?\n * const result = differenceInHours(\n * new Date(2014, 6, 2, 19, 0),\n * new Date(2014, 6, 2, 6, 50)\n * )\n * //=> 12\n */\n\nexport default function differenceInHours(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import { millisecondsInMinute } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInMinutes\n * @category Minute Helpers\n * @summary Get the number of minutes between the given dates.\n *\n * @description\n * Get the signed number of full (rounded towards 0) minutes between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of minutes\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?\n * const result = differenceInMinutes(\n * new Date(2014, 6, 2, 12, 20, 0),\n * new Date(2014, 6, 2, 12, 7, 59)\n * )\n * //=> 12\n *\n * @example\n * // How many minutes are between 10:01:59 and 10:00:00\n * const result = differenceInMinutes(\n * new Date(2000, 0, 1, 10, 0, 0),\n * new Date(2000, 0, 1, 10, 1, 59)\n * )\n * //=> -1\n */\n\nexport default function differenceInMinutes(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\n\nexport default function endOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\n\nexport default function endOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n date.setFullYear(date.getFullYear(), month + 1, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport endOfDay from \"../endOfDay/index.js\";\nimport endOfMonth from \"../endOfMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isLastDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the last day of a month?\n *\n * @description\n * Is the given date the last day of a month?\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is the last day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 28 February 2014 the last day of a month?\n * const result = isLastDayOfMonth(new Date(2014, 1, 28))\n * //=> true\n */\n\nexport default function isLastDayOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n return endOfDay(date).getTime() === endOfMonth(date).getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarMonths from \"../differenceInCalendarMonths/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport isLastDayOfMonth from \"../isLastDayOfMonth/index.js\";\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\n\nexport default function differenceInMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));\n var result; // Check for the difference of less than month\n\n if (difference < 1) {\n result = 0;\n } else {\n if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {\n // This will check if the date is end of Feb and assign a higher end of month date\n // to compare it with Jan\n dateLeft.setDate(30);\n }\n\n dateLeft.setMonth(dateLeft.getMonth() - sign * difference); // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign; // Check for cases of one full calendar month\n\n if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {\n isLastMonthNotFull = false;\n }\n\n result = sign * (difference - Number(isLastMonthNotFull));\n } // Prevent negative zero\n\n\n return result === 0 ? 0 : result;\n}", "import differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\n\nexport default function differenceInSeconds(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarYears from \"../differenceInCalendarYears/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInYears\n * @category Year Helpers\n * @summary Get the number of full years between the given dates.\n *\n * @description\n * Get the number of full years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))\n * //=> 1\n */\n\nexport default function differenceInYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight)); // Set both dates to a valid leap year for accurate comparison when dealing\n // with leap days\n\n dateLeft.setFullYear(1584);\n dateRight.setFullYear(1584); // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;\n var result = sign * (difference - Number(isLastYearNotFull)); // Prevent negative zero\n\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name eachDayOfInterval\n * @category Interval Helpers\n * @summary Return the array of dates within the specified time interval.\n *\n * @description\n * Return the array of dates within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.\n * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.step` must be a number greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each day between 6 October 2014 and 10 October 2014:\n * const result = eachDayOfInterval({\n * start: new Date(2014, 9, 6),\n * end: new Date(2014, 9, 10)\n * })\n * //=> [\n * // Mon Oct 06 2014 00:00:00,\n * // Tue Oct 07 2014 00:00:00,\n * // Wed Oct 08 2014 00:00:00,\n * // Thu Oct 09 2014 00:00:00,\n * // Fri Oct 10 2014 00:00:00\n * // ]\n */\n\nexport default function eachDayOfInterval(dirtyInterval, options) {\n var _options$step;\n\n requiredArgs(1, arguments);\n var interval = dirtyInterval || {};\n var startDate = toDate(interval.start);\n var endDate = toDate(interval.end);\n var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`\n\n if (!(startDate.getTime() <= endTime)) {\n throw new RangeError('Invalid interval');\n }\n\n var dates = [];\n var currentDate = startDate;\n currentDate.setHours(0, 0, 0, 0);\n var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');\n\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate.setDate(currentDate.getDate() + step);\n currentDate.setHours(0, 0, 0, 0);\n }\n\n return dates;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name endOfWeek\n * @category Week Helpers\n * @summary Return the end of a week for the given date.\n *\n * @description\n * Return the end of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the end of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The end of a week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 23:59:59.999\n *\n * @example\n * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport default function endOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);\n date.setDate(date.getDate() + diff);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\n\nexport default function subMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount);\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\nexport default function getUTCDayOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nexport default function getUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCISOWeekYear from \"../getUTCISOWeekYear/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var year = getUTCISOWeekYear(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport startOfUTCISOWeekYear from \"../startOfUTCISOWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function getUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCWeekYear from \"../getUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n var year = getUTCWeekYear(dirtyDate, options);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, options);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport startOfUTCWeekYear from \"../startOfUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCWeek(dirtyDate, options) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n\n while (output.length < targetLength) {\n output = '0' + output;\n }\n\n return sign + output;\n}", "import addLeadingZeros from \"../../addLeadingZeros/index.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nvar formatters = {\n // Year\n y: function y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);\n },\n // Month\n M: function M(date, token) {\n var month = date.getUTCMonth();\n return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n // Day of the month\n d: function d(date, token) {\n return addLeadingZeros(date.getUTCDate(), token.length);\n },\n // AM or PM\n a: function a(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return dayPeriodEnumValue.toUpperCase();\n\n case 'aaa':\n return dayPeriodEnumValue;\n\n case 'aaaaa':\n return dayPeriodEnumValue[0];\n\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';\n }\n },\n // Hour [1-12]\n h: function h(date, token) {\n return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);\n },\n // Hour [0-23]\n H: function H(date, token) {\n return addLeadingZeros(date.getUTCHours(), token.length);\n },\n // Minute\n m: function m(date, token) {\n return addLeadingZeros(date.getUTCMinutes(), token.length);\n },\n // Second\n s: function s(date, token) {\n return addLeadingZeros(date.getUTCSeconds(), token.length);\n },\n // Fraction of second\n S: function S(date, token) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, token.length);\n }\n};\nexport default formatters;", "import getUTCDayOfYear from \"../../../_lib/getUTCDayOfYear/index.js\";\nimport getUTCISOWeek from \"../../../_lib/getUTCISOWeek/index.js\";\nimport getUTCISOWeekYear from \"../../../_lib/getUTCISOWeekYear/index.js\";\nimport getUTCWeek from \"../../../_lib/getUTCWeek/index.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport addLeadingZeros from \"../../addLeadingZeros/index.js\";\nimport lightFormatters from \"../lightFormatters/index.js\";\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n }\n\n return lightFormatters.y(date, token);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year\n\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n } // Ordinal number\n\n\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n } // Padding\n\n\n return addLeadingZeros(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token) {\n var isoWeekYear = getUTCISOWeekYear(date); // Padding\n\n return addLeadingZeros(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'QQ':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'qq':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n case 'M':\n case 'MM':\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n\n case 'LL':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = getUTCWeek(date, options);\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize) {\n var isoWeek = getUTCISOWeek(date);\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), {\n unit: 'date'\n });\n }\n\n return lightFormatters.d(date, token);\n },\n // Day of year\n D: function D(date, token, localize) {\n var dayOfYear = getUTCDayOfYear(date);\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return lightFormatters.h(date, token);\n },\n // Hour [0-23]\n H: function H(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), {\n unit: 'hour'\n });\n }\n\n return lightFormatters.H(date, token);\n },\n // Hour [0-11]\n K: function K(date, token, localize) {\n var hours = date.getUTCHours() % 12;\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize) {\n var hours = date.getUTCHours();\n if (hours === 0) hours = 24;\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), {\n unit: 'minute'\n });\n }\n\n return lightFormatters.m(date, token);\n },\n // Second\n s: function s(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), {\n unit: 'second'\n });\n }\n\n return lightFormatters.s(date, token);\n },\n // Fraction of second\n S: function S(date, token) {\n return lightFormatters.S(date, token);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return 'Z';\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length);\n }\n};\n\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n\n if (minutes === 0) {\n return sign + String(hours);\n }\n\n var delimiter = dirtyDelimiter || '';\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n\n return formatTimezone(offset, dirtyDelimiter);\n}\n\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n\nexport default formatters;", "var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n};\n\nvar timeLongFormatter = function timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n};\n\nvar dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/) || [];\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n var dateTimeFormat;\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n};\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\nexport default longFormatters;", "var protectedDayOfYearTokens = ['D', 'DD'];\nvar protectedWeekYearTokens = ['YY', 'YYYY'];\nexport function isProtectedDayOfYearToken(token) {\n return protectedDayOfYearTokens.indexOf(token) !== -1;\n}\nexport function isProtectedWeekYearToken(token) {\n return protectedWeekYearTokens.indexOf(token) !== -1;\n}\nexport function throwProtectedError(token, format, input) {\n if (token === 'YYYY') {\n throw new RangeError(\"Use `yyyy` instead of `YYYY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'YY') {\n throw new RangeError(\"Use `yy` instead of `YY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'D') {\n throw new RangeError(\"Use `d` instead of `D` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'DD') {\n throw new RangeError(\"Use `dd` instead of `DD` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n }\n}", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXWeeks: {\n one: 'about 1 week',\n other: 'about {{count}} weeks'\n },\n xWeeks: {\n one: '1 week',\n other: '{{count}} weeks'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n}; // Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n var rem100 = number % 100;\n\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n\n case 2:\n return number + 'nd';\n\n case 3:\n return number + 'rd';\n }\n }\n\n return number + 'th';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n code: 'en-US',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0\n /* Sunday */\n ,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;", "import defaultLocale from \"../../locale/en-US/index.js\";\nexport default defaultLocale;", "import isValid from \"../isValid/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport formatters from \"../_lib/format/formatters/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\n\nexport default function format(dirtyDate, dirtyFormatStr, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(2, arguments);\n var formatStr = String(dirtyFormatStr);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n\n var originalDate = toDate(dirtyDate);\n\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value');\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n\n\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n\n var firstCharacter = substring[0];\n\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n\n var formatter = formatters[firstCharacter];\n\n if (formatter) {\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n\n return substring;\n }).join('');\n return result;\n}\n\nfunction cleanEscapedString(input) {\n var matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}", "export default function assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n\n return target;\n}", "import { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nvar defaultFormat = ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'];\n/**\n * @name formatDuration\n * @category Common Helpers\n * @summary Formats a duration in human-readable format\n *\n * @description\n * Return human-readable duration string i.e. \"9 months 2 days\"\n *\n * @param {Duration} duration - the duration to format\n * @param {Object} [options] - an object with options.\n * @param {string[]} [options.format=['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']] - the array of units to format\n * @param {boolean} [options.zero=false] - should zeros be included in the output?\n * @param {string} [options.delimiter=' '] - delimiter string\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {string} the formatted date string\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Format full duration\n * formatDuration({\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> '2 years 9 months 1 week 7 days 5 hours 9 minutes 30 seconds'\n *\n * @example\n * // Format partial duration\n * formatDuration({ months: 9, days: 2 })\n * //=> '9 months 2 days'\n *\n * @example\n * // Customize the format\n * formatDuration(\n * {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * },\n * { format: ['months', 'weeks'] }\n * ) === '9 months 1 week'\n *\n * @example\n * // Customize the zeros presence\n * formatDuration({ years: 0, months: 9 })\n * //=> '9 months'\n * formatDuration({ years: 0, months: 9 }, { zero: true })\n * //=> '0 years 9 months'\n *\n * @example\n * // Customize the delimiter\n * formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' })\n * //=> '2 years, 9 months, 3 weeks'\n */\n\nexport default function formatDuration(duration, options) {\n var _ref, _options$locale, _options$format, _options$zero, _options$delimiter;\n\n if (arguments.length < 1) {\n throw new TypeError(\"1 argument required, but only \".concat(arguments.length, \" present\"));\n }\n\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var format = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat;\n var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false;\n var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : ' ';\n\n if (!locale.formatDistance) {\n return '';\n }\n\n var result = format.reduce(function (acc, unit) {\n var token = \"x\".concat(unit.replace(/(^.)/, function (m) {\n return m.toUpperCase();\n }));\n var value = duration[unit];\n\n if (typeof value === 'number' && (zero || duration[unit])) {\n return acc.concat(locale.formatDistance(token, value));\n }\n\n return acc;\n }, []).join(delimiter);\n return result;\n}", "import toDate from \"../toDate/index.js\";\nimport addLeadingZeros from \"../_lib/addLeadingZeros/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatISO\n * @category Common Helpers\n * @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).\n *\n * @description\n * Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {'extended'|'basic'} [options.format='extended'] - if 'basic', hide delimiters between date and time values.\n * @param {'complete'|'date'|'time'} [options.representation='complete'] - format date, time with local time zone, or both.\n * @returns {String} the formatted date string (in local time zone)\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.format` must be 'extended' or 'basic'\n * @throws {RangeError} `options.representation` must be 'date', 'time' or 'complete'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))\n * //=> '2019-09-18T19:00:52Z'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })\n * //=> '20190918T190052'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, date only:\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })\n * //=> '2019-09-18'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })\n * //=> '19:00:52Z'\n */\n\nexport default function formatISO(date, options) {\n var _options$format, _options$representati;\n\n requiredArgs(1, arguments);\n var originalDate = toDate(date);\n\n if (isNaN(originalDate.getTime())) {\n throw new RangeError('Invalid time value');\n }\n\n var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : 'extended');\n var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : 'complete');\n\n if (format !== 'extended' && format !== 'basic') {\n throw new RangeError(\"format must be 'extended' or 'basic'\");\n }\n\n if (representation !== 'date' && representation !== 'time' && representation !== 'complete') {\n throw new RangeError(\"representation must be 'date', 'time', or 'complete'\");\n }\n\n var result = '';\n var tzOffset = '';\n var dateDelimiter = format === 'extended' ? '-' : '';\n var timeDelimiter = format === 'extended' ? ':' : ''; // Representation is either 'date' or 'complete'\n\n if (representation !== 'time') {\n var day = addLeadingZeros(originalDate.getDate(), 2);\n var month = addLeadingZeros(originalDate.getMonth() + 1, 2);\n var year = addLeadingZeros(originalDate.getFullYear(), 4); // yyyyMMdd or yyyy-MM-dd.\n\n result = \"\".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);\n } // Representation is either 'time' or 'complete'\n\n\n if (representation !== 'date') {\n // Add the timezone.\n var offset = originalDate.getTimezoneOffset();\n\n if (offset !== 0) {\n var absoluteOffset = Math.abs(offset);\n var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2);\n var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2); // If less than 0, the sign is +, because it is ahead of time.\n\n var sign = offset < 0 ? '+' : '-';\n tzOffset = \"\".concat(sign).concat(hourOffset, \":\").concat(minuteOffset);\n } else {\n tzOffset = 'Z';\n }\n\n var hour = addLeadingZeros(originalDate.getHours(), 2);\n var minute = addLeadingZeros(originalDate.getMinutes(), 2);\n var second = addLeadingZeros(originalDate.getSeconds(), 2); // If there's also date, separate it with time with 'T'\n\n var separator = result === '' ? '' : 'T'; // Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.\n\n var time = [hour, minute, second].join(timeDelimiter); // HHmmss or HH:mm:ss.\n\n result = \"\".concat(result).concat(separator).concat(time).concat(tzOffset);\n }\n\n return result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getHours\n * @category Hour Helpers\n * @summary Get the hours of the given date.\n *\n * @description\n * Get the hours of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the hours\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the hours of 29 February 2012 11:45:00:\n * const result = getHours(new Date(2012, 1, 29, 11, 45))\n * //=> 11\n */\n\nexport default function getHours(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var hours = date.getHours();\n return hours;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMinutes\n * @category Minute Helpers\n * @summary Get the minutes of the given date.\n *\n * @description\n * Get the minutes of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the minutes\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the minutes of 29 February 2012 11:45:05:\n * const result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 45\n */\n\nexport default function getMinutes(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var minutes = date.getMinutes();\n return minutes;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMonth\n * @category Month Helpers\n * @summary Get the month of the given date.\n *\n * @description\n * Get the month of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which month is 29 February 2012?\n * const result = getMonth(new Date(2012, 1, 29))\n * //=> 1\n */\n\nexport default function getMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n return month;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getSeconds\n * @category Second Helpers\n * @summary Get the seconds of the given date.\n *\n * @description\n * Get the seconds of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the seconds\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the seconds of 29 February 2012 11:45:05.123:\n * const result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 5\n */\n\nexport default function getSeconds(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var seconds = date.getSeconds();\n return seconds;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getYear\n * @category Year Helpers\n * @summary Get the year of the given date.\n *\n * @description\n * Get the year of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which year is 2 July 2014?\n * const result = getYear(new Date(2014, 6, 2))\n * //=> 2014\n */\n\nexport default function getYear(dirtyDate) {\n requiredArgs(1, arguments);\n return toDate(dirtyDate).getFullYear();\n}", "import compareAsc from \"../compareAsc/index.js\";\nimport add from \"../add/index.js\";\nimport differenceInDays from \"../differenceInDays/index.js\";\nimport differenceInHours from \"../differenceInHours/index.js\";\nimport differenceInMinutes from \"../differenceInMinutes/index.js\";\nimport differenceInMonths from \"../differenceInMonths/index.js\";\nimport differenceInSeconds from \"../differenceInSeconds/index.js\";\nimport differenceInYears from \"../differenceInYears/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name intervalToDuration\n * @category Common Helpers\n * @summary Convert interval to duration\n *\n * @description\n * Convert a interval object to a duration object.\n *\n * @param {Interval} interval - the interval to convert to duration\n *\n * @returns {Duration} The duration Object\n * @throws {TypeError} Requires 2 arguments\n * @throws {RangeError} `start` must not be Invalid Date\n * @throws {RangeError} `end` must not be Invalid Date\n *\n * @example\n * // Get the duration between January 15, 1929 and April 4, 1968.\n * intervalToDuration({\n * start: new Date(1929, 0, 15, 12, 0, 0),\n * end: new Date(1968, 3, 4, 19, 5, 0)\n * })\n * // => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }\n */\n\nexport default function intervalToDuration(interval) {\n requiredArgs(1, arguments);\n var start = toDate(interval.start);\n var end = toDate(interval.end);\n if (isNaN(start.getTime())) throw new RangeError('Start Date is invalid');\n if (isNaN(end.getTime())) throw new RangeError('End Date is invalid');\n var duration = {};\n duration.years = Math.abs(differenceInYears(end, start));\n var sign = compareAsc(end, start);\n var remainingMonths = add(start, {\n years: sign * duration.years\n });\n duration.months = Math.abs(differenceInMonths(end, remainingMonths));\n var remainingDays = add(remainingMonths, {\n months: sign * duration.months\n });\n duration.days = Math.abs(differenceInDays(end, remainingDays));\n var remainingHours = add(remainingDays, {\n days: sign * duration.days\n });\n duration.hours = Math.abs(differenceInHours(end, remainingHours));\n var remainingMinutes = add(remainingHours, {\n hours: sign * duration.hours\n });\n duration.minutes = Math.abs(differenceInMinutes(end, remainingMinutes));\n var remainingSeconds = add(remainingMinutes, {\n minutes: sign * duration.minutes\n });\n duration.seconds = Math.abs(differenceInSeconds(end, remainingSeconds));\n return duration;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar TIMEZONE_UNIT_PRIORITY = 10;\nexport var Setter = /*#__PURE__*/function () {\n function Setter() {\n _classCallCheck(this, Setter);\n\n _defineProperty(this, \"subPriority\", 0);\n }\n\n _createClass(Setter, [{\n key: \"validate\",\n value: function validate(_utcDate, _options) {\n return true;\n }\n }]);\n\n return Setter;\n}();\nexport var ValueSetter = /*#__PURE__*/function (_Setter) {\n _inherits(ValueSetter, _Setter);\n\n var _super = _createSuper(ValueSetter);\n\n function ValueSetter(value, validateValue, setValue, priority, subPriority) {\n var _this;\n\n _classCallCheck(this, ValueSetter);\n\n _this = _super.call(this);\n _this.value = value;\n _this.validateValue = validateValue;\n _this.setValue = setValue;\n _this.priority = priority;\n\n if (subPriority) {\n _this.subPriority = subPriority;\n }\n\n return _this;\n }\n\n _createClass(ValueSetter, [{\n key: \"validate\",\n value: function validate(utcDate, options) {\n return this.validateValue(utcDate, this.value, options);\n }\n }, {\n key: \"set\",\n value: function set(utcDate, flags, options) {\n return this.setValue(utcDate, flags, this.value, options);\n }\n }]);\n\n return ValueSetter;\n}(Setter);\nexport var DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter2) {\n _inherits(DateToSystemTimezoneSetter, _Setter2);\n\n var _super2 = _createSuper(DateToSystemTimezoneSetter);\n\n function DateToSystemTimezoneSetter() {\n var _this2;\n\n _classCallCheck(this, DateToSystemTimezoneSetter);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this2 = _super2.call.apply(_super2, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this2), \"priority\", TIMEZONE_UNIT_PRIORITY);\n\n _defineProperty(_assertThisInitialized(_this2), \"subPriority\", -1);\n\n return _this2;\n }\n\n _createClass(DateToSystemTimezoneSetter, [{\n key: \"set\",\n value: function set(date, flags) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n }\n }]);\n\n return DateToSystemTimezoneSetter;\n}(Setter);", "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { ValueSetter } from \"./Setter.js\";\nexport var Parser = /*#__PURE__*/function () {\n function Parser() {\n _classCallCheck(this, Parser);\n }\n\n _createClass(Parser, [{\n key: \"run\",\n value: function run(dateString, token, match, options) {\n var result = this.parse(dateString, token, match, options);\n\n if (!result) {\n return null;\n }\n\n return {\n setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),\n rest: result.rest\n };\n }\n }, {\n key: \"validate\",\n value: function validate(_utcDate, _value, _options) {\n return true;\n }\n }]);\n\n return Parser;\n}();", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nexport var EraParser = /*#__PURE__*/function (_Parser) {\n _inherits(EraParser, _Parser);\n\n var _super = _createSuper(EraParser);\n\n function EraParser() {\n var _this;\n\n _classCallCheck(this, EraParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 140);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['R', 'u', 't', 'T']);\n\n return _this;\n }\n\n _createClass(EraParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n // A, B\n\n case 'GGGGG':\n return match.era(dateString, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return match.era(dateString, {\n width: 'wide'\n }) || match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n flags.era = value;\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return EraParser;\n}(Parser);", "export var numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n\n};\nexport var timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};", "import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n if (!parseFnResult) {\n return parseFnResult;\n }\n\n return {\n value: mapFn(parseFnResult.value),\n rest: parseFnResult.rest\n };\n}\nexport function parseNumericPattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n }\n\n return {\n value: parseInt(matchResult[0], 10),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n } // Input is 'Z'\n\n\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: dateString.slice(1)\n };\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseAnyDigitsSigned(dateString) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function parseNDigitsSigned(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n switch (dayPeriod) {\n case 'morning':\n return 4;\n\n case 'evening':\n return 17;\n\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0; // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, normalizeTwoDigitYear, parseNDigits } from \"../utils.js\";\n// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n// | Year | y | yy | yyy | yyyy | yyyyy |\n// |----------|-------|----|-------|-------|-------|\n// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\nexport var YearParser = /*#__PURE__*/function (_Parser) {\n _inherits(YearParser, _Parser);\n\n var _super = _createSuper(YearParser);\n\n function YearParser() {\n var _this;\n\n _classCallCheck(this, YearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(YearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n\n switch (token) {\n case 'y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return YearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits, normalizeTwoDigitYear, mapValue } from \"../utils.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\";\n// Local week-numbering year\nexport var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekYearParser, _Parser);\n\n var _super = _createSuper(LocalWeekYearParser);\n\n function LocalWeekYearParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n\n switch (token) {\n case 'Y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'Yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n }]);\n\n return LocalWeekYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week-numbering year\n\nexport var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekYearParser, _Parser);\n\n var _super = _createSuper(ISOWeekYearParser);\n\n function ISOWeekYearParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'R') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n }\n }]);\n\n return ISOWeekYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nexport var ExtendedYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ExtendedYearParser, _Parser);\n\n var _super = _createSuper(ExtendedYearParser);\n\n function ExtendedYearParser() {\n var _this;\n\n _classCallCheck(this, ExtendedYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ExtendedYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'u') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ExtendedYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var QuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(QuarterParser, _Parser);\n\n var _super = _createSuper(QuarterParser);\n\n function QuarterParser() {\n var _this;\n\n _classCallCheck(this, QuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(QuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return QuarterParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneQuarterParser, _Parser);\n\n var _super = _createSuper(StandAloneQuarterParser);\n\n function StandAloneQuarterParser() {\n var _this;\n\n _classCallCheck(this, StandAloneQuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneQuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneQuarterParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { mapValue, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nexport var MonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(MonthParser, _Parser);\n\n var _super = _createSuper(MonthParser);\n\n function MonthParser() {\n var _this;\n\n _classCallCheck(this, MonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n return _this;\n }\n\n _createClass(MonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'MM':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return MonthParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, mapValue } from \"../utils.js\";\nexport var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneMonthParser, _Parser);\n\n var _super = _createSuper(StandAloneMonthParser);\n\n function StandAloneMonthParser() {\n var _this;\n\n _classCallCheck(this, StandAloneMonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneMonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'LL':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneMonthParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCWeek from \"../getUTCWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, options) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCWeek from \"../../../_lib/setUTCWeek/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\"; // Local week of year\n\nexport var LocalWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekParser, _Parser);\n\n var _super = _createSuper(LocalWeekParser);\n\n function LocalWeekParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'wo':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n }\n }]);\n\n return LocalWeekParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCISOWeek from \"../getUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCISOWeek from \"../../../_lib/setUTCISOWeek/index.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week of year\n\nexport var ISOWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekParser, _Parser);\n\n var _super = _createSuper(ISOWeekParser);\n\n function ISOWeekParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'Io':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value));\n }\n }]);\n\n return ISOWeekParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { isLeapYearIndex, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Day of the month\n\nexport var DateParser = /*#__PURE__*/function (_Parser) {\n _inherits(DateParser, _Parser);\n\n var _super = _createSuper(DateParser);\n\n function DateParser() {\n var _this;\n\n _classCallCheck(this, DateParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subPriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DateParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, dateString);\n\n case 'do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n var month = date.getUTCMonth();\n\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month];\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DateParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, isLeapYearIndex } from \"../utils.js\";\nexport var DayOfYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayOfYearParser, _Parser);\n\n var _super = _createSuper(DayOfYearParser);\n\n function DayOfYearParser() {\n var _this;\n\n _classCallCheck(this, DayOfYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subpriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayOfYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, dateString);\n\n case 'Do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayOfYearParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function setUTCDay(dirtyDate, dirtyDay, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(2, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Day of week\n\nexport var DayParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayParser, _Parser);\n\n var _super = _createSuper(DayParser);\n\n function DayParser() {\n var _this;\n\n _classCallCheck(this, DayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Local day of week\n\nexport var LocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalDayParser, _Parser);\n\n var _super = _createSuper(LocalDayParser);\n\n function LocalDayParser() {\n var _this;\n\n _classCallCheck(this, LocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'eo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'eee':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return LocalDayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Stand-alone local day of week\n\nexport var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneLocalDayParser, _Parser);\n\n var _super = _createSuper(StandAloneLocalDayParser);\n\n function StandAloneLocalDayParser() {\n var _this;\n\n _classCallCheck(this, StandAloneLocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneLocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'co':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'ccc':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneLocalDayParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n requiredArgs(2, arguments);\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCISODay from \"../../../_lib/setUTCISODay/index.js\"; // ISO day of week\n\nexport var ISODayParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISODayParser, _Parser);\n\n var _super = _createSuper(ISODayParser);\n\n function ISODayParser() {\n var _this;\n\n _classCallCheck(this, ISODayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISODayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n if (value === 0) {\n return 7;\n }\n\n return value;\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, dateString);\n // 2nd\n\n case 'io':\n return match.ordinalNumber(dateString, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return mapValue(match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // T\n\n case 'iiiii':\n return mapValue(match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tu\n\n case 'iiiiii':\n return mapValue(match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tuesday\n\n case 'iiii':\n default:\n return mapValue(match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 7;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date = setUTCISODay(date, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ISODayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMParser, _Parser);\n\n var _super = _createSuper(AMPMParser);\n\n function AMPMParser() {\n var _this;\n\n _classCallCheck(this, AMPMParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['b', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMMidnightParser, _Parser);\n\n var _super = _createSuper(AMPMMidnightParser);\n\n function AMPMMidnightParser() {\n var _this;\n\n _classCallCheck(this, AMPMMidnightParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMMidnightParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMMidnightParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\"; // in the morning, in the afternoon, in the evening, at night\n\nexport var DayPeriodParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayPeriodParser, _Parser);\n\n var _super = _createSuper(DayPeriodParser);\n\n function DayPeriodParser() {\n var _this;\n\n _classCallCheck(this, DayPeriodParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayPeriodParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return DayPeriodParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1to12Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1to12Parser, _Parser);\n\n var _super = _createSuper(Hour1to12Parser);\n\n function Hour1to12Parser() {\n var _this;\n\n _classCallCheck(this, Hour1to12Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['H', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1to12Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, dateString);\n\n case 'ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 12;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour1to12Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0to23Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0to23Parser, _Parser);\n\n var _super = _createSuper(Hour0to23Parser);\n\n function Hour0to23Parser() {\n var _this;\n\n _classCallCheck(this, Hour0to23Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0to23Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, dateString);\n\n case 'Ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 23;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour0to23Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0To11Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0To11Parser, _Parser);\n\n var _super = _createSuper(Hour0To11Parser);\n\n function Hour0To11Parser() {\n var _this;\n\n _classCallCheck(this, Hour0To11Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['h', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0To11Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, dateString);\n\n case 'Ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour0To11Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1To24Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1To24Parser, _Parser);\n\n var _super = _createSuper(Hour1To24Parser);\n\n function Hour1To24Parser() {\n var _this;\n\n _classCallCheck(this, Hour1To24Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'H', 'K', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1To24Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, dateString);\n\n case 'ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 24;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour1To24Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var MinuteParser = /*#__PURE__*/function (_Parser) {\n _inherits(MinuteParser, _Parser);\n\n var _super = _createSuper(MinuteParser);\n\n function MinuteParser() {\n var _this;\n\n _classCallCheck(this, MinuteParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 60);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(MinuteParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, dateString);\n\n case 'mo':\n return match.ordinalNumber(dateString, {\n unit: 'minute'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n }\n }]);\n\n return MinuteParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var SecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(SecondParser, _Parser);\n\n var _super = _createSuper(SecondParser);\n\n function SecondParser() {\n var _this;\n\n _classCallCheck(this, SecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 50);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(SecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, dateString);\n\n case 'so':\n return match.ordinalNumber(dateString, {\n unit: 'second'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCSeconds(value, 0);\n return date;\n }\n }]);\n\n return SecondParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nexport var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(FractionOfSecondParser, _Parser);\n\n var _super = _createSuper(FractionOfSecondParser);\n\n function FractionOfSecondParser() {\n var _this;\n\n _classCallCheck(this, FractionOfSecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 30);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(FractionOfSecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n var valueCallback = function valueCallback(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMilliseconds(value);\n return date;\n }\n }]);\n\n return FractionOfSecondParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601. +00:00 is `'Z'`)\n\nexport var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneWithZParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneWithZParser);\n\n function ISOTimezoneWithZParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneWithZParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'x']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneWithZParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneWithZParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601)\n\nexport var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneParser);\n\n function ISOTimezoneParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'X']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampSecondsParser, _Parser);\n\n var _super = _createSuper(TimestampSecondsParser);\n\n function TimestampSecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampSecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 40);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampSecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value * 1000), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampSecondsParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampMillisecondsParser, _Parser);\n\n var _super = _createSuper(TimestampMillisecondsParser);\n\n function TimestampMillisecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampMillisecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 20);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampMillisecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampMillisecondsParser;\n}(Parser);", "import { EraParser } from \"./EraParser.js\";\nimport { YearParser } from \"./YearParser.js\";\nimport { LocalWeekYearParser } from \"./LocalWeekYearParser.js\";\nimport { ISOWeekYearParser } from \"./ISOWeekYearParser.js\";\nimport { ExtendedYearParser } from \"./ExtendedYearParser.js\";\nimport { QuarterParser } from \"./QuarterParser.js\";\nimport { StandAloneQuarterParser } from \"./StandAloneQuarterParser.js\";\nimport { MonthParser } from \"./MonthParser.js\";\nimport { StandAloneMonthParser } from \"./StandAloneMonthParser.js\";\nimport { LocalWeekParser } from \"./LocalWeekParser.js\";\nimport { ISOWeekParser } from \"./ISOWeekParser.js\";\nimport { DateParser } from \"./DateParser.js\";\nimport { DayOfYearParser } from \"./DayOfYearParser.js\";\nimport { DayParser } from \"./DayParser.js\";\nimport { LocalDayParser } from \"./LocalDayParser.js\";\nimport { StandAloneLocalDayParser } from \"./StandAloneLocalDayParser.js\";\nimport { ISODayParser } from \"./ISODayParser.js\";\nimport { AMPMParser } from \"./AMPMParser.js\";\nimport { AMPMMidnightParser } from \"./AMPMMidnightParser.js\";\nimport { DayPeriodParser } from \"./DayPeriodParser.js\";\nimport { Hour1to12Parser } from \"./Hour1to12Parser.js\";\nimport { Hour0to23Parser } from \"./Hour0to23Parser.js\";\nimport { Hour0To11Parser } from \"./Hour0To11Parser.js\";\nimport { Hour1To24Parser } from \"./Hour1To24Parser.js\";\nimport { MinuteParser } from \"./MinuteParser.js\";\nimport { SecondParser } from \"./SecondParser.js\";\nimport { FractionOfSecondParser } from \"./FractionOfSecondParser.js\";\nimport { ISOTimezoneWithZParser } from \"./ISOTimezoneWithZParser.js\";\nimport { ISOTimezoneParser } from \"./ISOTimezoneParser.js\";\nimport { TimestampSecondsParser } from \"./TimestampSecondsParser.js\";\nimport { TimestampMillisecondsParser } from \"./TimestampMillisecondsParser.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\n\nexport var parsers = {\n G: new EraParser(),\n y: new YearParser(),\n Y: new LocalWeekYearParser(),\n R: new ISOWeekYearParser(),\n u: new ExtendedYearParser(),\n Q: new QuarterParser(),\n q: new StandAloneQuarterParser(),\n M: new MonthParser(),\n L: new StandAloneMonthParser(),\n w: new LocalWeekParser(),\n I: new ISOWeekParser(),\n d: new DateParser(),\n D: new DayOfYearParser(),\n E: new DayParser(),\n e: new LocalDayParser(),\n c: new StandAloneLocalDayParser(),\n i: new ISODayParser(),\n a: new AMPMParser(),\n b: new AMPMMidnightParser(),\n B: new DayPeriodParser(),\n h: new Hour1to12Parser(),\n H: new Hour0to23Parser(),\n K: new Hour0To11Parser(),\n k: new Hour1To24Parser(),\n m: new MinuteParser(),\n s: new SecondParser(),\n S: new FractionOfSecondParser(),\n X: new ISOTimezoneWithZParser(),\n x: new ISOTimezoneParser(),\n t: new TimestampSecondsParser(),\n T: new TimestampMillisecondsParser()\n};", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(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(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(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; }\n\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport assign from \"../_lib/assign/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { DateToSystemTimezoneSetter } from \"./_lib/Setter.js\";\nimport { parsers } from \"./_lib/parsers/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar notWhitespaceRegExp = /\\S/;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited\n * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:\n *\n * ```javascript\n * parse('23 AM', 'HH a', new Date())\n * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time\n * ```\n *\n * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 7 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Long localized date | NA | P | 05/29/1453 | 5,8 |\n * | | | PP | May 29, 1453 | |\n * | | | PPP | May 29th, 1453 | |\n * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |\n * | Long localized time | NA | p | 12:00 AM | 5,8 |\n * | | | pp | 12:00:00 AM | |\n * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |\n * | | | PPpp | May 29, 1453, 12:00:00 AM | |\n * | | | PPPpp | May 29th, 1453 at ... | |\n * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based\n * on the given locale.\n *\n * using `en-US` locale: `P` => `MM/dd/yyyy`\n * using `en-US` locale: `p` => `hh:mm a`\n * using `pt-BR` locale: `P` => `dd/MM/yyyy`\n * using `pt-BR` locale: `p` => `HH:mm`\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.\n *\n * `referenceDate` must be passed for correct work of the function.\n * If you're not sure which `referenceDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} referenceDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\n\nexport default function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(3, arguments);\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyReferenceDate);\n } else {\n return new Date(NaN);\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }; // If timezone isn't specified, it will be set to the system timezone\n\n var setters = [new DateToSystemTimezoneSetter()];\n var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter in longFormatters) {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp);\n var usedTokens = [];\n\n var _iterator = _createForOfIteratorHelper(tokens),\n _step;\n\n try {\n var _loop = function _loop() {\n var token = _step.value;\n\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n\n if (parser) {\n var incompatibleTokens = parser.incompatibleTokens;\n\n if (Array.isArray(incompatibleTokens)) {\n var incompatibleToken = usedTokens.find(function (usedToken) {\n return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;\n });\n\n if (incompatibleToken) {\n throw new RangeError(\"The format string mustn't contain `\".concat(incompatibleToken.fullToken, \"` and `\").concat(token, \"` at the same time\"));\n }\n } else if (parser.incompatibleTokens === '*' && usedTokens.length > 0) {\n throw new RangeError(\"The format string mustn't contain `\".concat(token, \"` and any other token at the same time\"));\n }\n\n usedTokens.push({\n token: firstCharacter,\n fullToken: token\n });\n var parseResult = parser.run(dateString, token, locale.match, subFnOptions);\n\n if (!parseResult) {\n return {\n v: new Date(NaN)\n };\n }\n\n setters.push(parseResult.setter);\n dateString = parseResult.rest;\n } else {\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n } // Replace two single quote characters with one single quote character\n\n\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token);\n } // Cut token from string, or, if string doesn't match the token, return Invalid Date\n\n\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return {\n v: new Date(NaN)\n };\n }\n }\n };\n\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n } // Check if the remaining input contains something other than whitespace\n\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).sort(function (a, b) {\n return b.subPriority - a.subPriority;\n });\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyReferenceDate);\n\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n var flags = {};\n\n var _iterator2 = _createForOfIteratorHelper(uniquePrioritySetters),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var setter = _step2.value;\n\n if (!setter.validate(utcDate, subFnOptions)) {\n return new Date(NaN);\n }\n\n var result = setter.set(utcDate, flags, subFnOptions); // Result is tuple (date, flags)\n\n if (Array.isArray(result)) {\n utcDate = result[0];\n assign(flags, result[1]); // Result is date\n } else {\n utcDate = result;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return utcDate;\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameMonth\n * @category Month Helpers\n * @summary Are the given dates in the same month (and year)?\n *\n * @description\n * Are the given dates in the same month (and year)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same month (and year)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n *\n * @example\n * // Are 2 September 2014 and 25 September 2015 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))\n * //=> false\n */\n\nexport default function isSameMonth(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();\n}", "import addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @description\n * Subtract the specified number of days from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the days subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * const result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\n\nexport default function subDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addDays(dirtyDate, -amount);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} hours - the hours of the new date\n * @returns {Date} the new date with the hours set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\n\nexport default function setHours(dirtyDate, dirtyHours) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var hours = toInteger(dirtyHours);\n date.setHours(hours);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function subMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, -amount);\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport subDays from \"../subDays/index.js\";\nimport subMonths from \"../subMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name sub\n * @category Common Helpers\n * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @description\n * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be subtracted\n *\n * | Key | Description |\n * |---------|------------------------------------|\n * | years | Amount of years to be subtracted |\n * | months | Amount of months to be subtracted |\n * | weeks | Amount of weeks to be subtracted |\n * | days | Amount of days to be subtracted |\n * | hours | Amount of hours to be subtracted |\n * | minutes | Amount of minutes to be subtracted |\n * | seconds | Amount of seconds to be subtracted |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract the following duration from 15 June 2017 15:29:20\n * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> Mon Sep 1 2014 10:19:50\n */\n\nexport default function sub(date, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Subtract years and months\n\n var dateWithoutMonths = subMonths(date, months + years * 12); // Subtract weeks and days\n\n var dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7); // Subtract hours, minutes and seconds\n\n var minutestoSub = minutes + hours * 60;\n var secondstoSub = seconds + minutestoSub * 60;\n var mstoSub = secondstoSub * 1000;\n var finalDate = new Date(dateWithoutDays.getTime() - mstoSub);\n return finalDate;\n}", "var formatDistanceLocale = {\n lessThanXSeconds: {\n standalone: {\n one: 'weniger als 1 Sekunde',\n other: 'weniger als {{count}} Sekunden'\n },\n withPreposition: {\n one: 'weniger als 1 Sekunde',\n other: 'weniger als {{count}} Sekunden'\n }\n },\n xSeconds: {\n standalone: {\n one: '1 Sekunde',\n other: '{{count}} Sekunden'\n },\n withPreposition: {\n one: '1 Sekunde',\n other: '{{count}} Sekunden'\n }\n },\n halfAMinute: {\n standalone: 'halbe Minute',\n withPreposition: 'halben Minute'\n },\n lessThanXMinutes: {\n standalone: {\n one: 'weniger als 1 Minute',\n other: 'weniger als {{count}} Minuten'\n },\n withPreposition: {\n one: 'weniger als 1 Minute',\n other: 'weniger als {{count}} Minuten'\n }\n },\n xMinutes: {\n standalone: {\n one: '1 Minute',\n other: '{{count}} Minuten'\n },\n withPreposition: {\n one: '1 Minute',\n other: '{{count}} Minuten'\n }\n },\n aboutXHours: {\n standalone: {\n one: 'etwa 1 Stunde',\n other: 'etwa {{count}} Stunden'\n },\n withPreposition: {\n one: 'etwa 1 Stunde',\n other: 'etwa {{count}} Stunden'\n }\n },\n xHours: {\n standalone: {\n one: '1 Stunde',\n other: '{{count}} Stunden'\n },\n withPreposition: {\n one: '1 Stunde',\n other: '{{count}} Stunden'\n }\n },\n xDays: {\n standalone: {\n one: '1 Tag',\n other: '{{count}} Tage'\n },\n withPreposition: {\n one: '1 Tag',\n other: '{{count}} Tagen'\n }\n },\n aboutXWeeks: {\n standalone: {\n one: 'etwa 1 Woche',\n other: 'etwa {{count}} Wochen'\n },\n withPreposition: {\n one: 'etwa 1 Woche',\n other: 'etwa {{count}} Wochen'\n }\n },\n xWeeks: {\n standalone: {\n one: '1 Woche',\n other: '{{count}} Wochen'\n },\n withPreposition: {\n one: '1 Woche',\n other: '{{count}} Wochen'\n }\n },\n aboutXMonths: {\n standalone: {\n one: 'etwa 1 Monat',\n other: 'etwa {{count}} Monate'\n },\n withPreposition: {\n one: 'etwa 1 Monat',\n other: 'etwa {{count}} Monaten'\n }\n },\n xMonths: {\n standalone: {\n one: '1 Monat',\n other: '{{count}} Monate'\n },\n withPreposition: {\n one: '1 Monat',\n other: '{{count}} Monaten'\n }\n },\n aboutXYears: {\n standalone: {\n one: 'etwa 1 Jahr',\n other: 'etwa {{count}} Jahre'\n },\n withPreposition: {\n one: 'etwa 1 Jahr',\n other: 'etwa {{count}} Jahren'\n }\n },\n xYears: {\n standalone: {\n one: '1 Jahr',\n other: '{{count}} Jahre'\n },\n withPreposition: {\n one: '1 Jahr',\n other: '{{count}} Jahren'\n }\n },\n overXYears: {\n standalone: {\n one: 'mehr als 1 Jahr',\n other: 'mehr als {{count}} Jahre'\n },\n withPreposition: {\n one: 'mehr als 1 Jahr',\n other: 'mehr als {{count}} Jahren'\n }\n },\n almostXYears: {\n standalone: {\n one: 'fast 1 Jahr',\n other: 'fast {{count}} Jahre'\n },\n withPreposition: {\n one: 'fast 1 Jahr',\n other: 'fast {{count}} Jahren'\n }\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = options !== null && options !== void 0 && options.addSuffix ? formatDistanceLocale[token].withPreposition : formatDistanceLocale[token].standalone;\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', String(count));\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return 'vor ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\n// DIN 5008: https://de.wikipedia.org/wiki/Datumsformat#DIN_5008\nvar dateFormats = {\n full: 'EEEE, do MMMM y',\n // Montag, 7. Januar 2018\n long: 'do MMMM y',\n // 7. Januar 2018\n medium: 'do MMM y',\n // 7. Jan. 2018\n short: 'dd.MM.y' // 07.01.2018\n\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'um' {{time}}\",\n long: \"{{date}} 'um' {{time}}\",\n medium: '{{date}} {{time}}',\n short: '{{date}} {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'letzten' eeee 'um' p\",\n yesterday: \"'gestern um' p\",\n today: \"'heute um' p\",\n tomorrow: \"'morgen um' p\",\n nextWeek: \"eeee 'um' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['v.Chr.', 'n.Chr.'],\n abbreviated: ['v.Chr.', 'n.Chr.'],\n wide: ['vor Christus', 'nach Christus']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1. Quartal', '2. Quartal', '3. Quartal', '4. Quartal']\n}; // Note: in German, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'M\u00E4r', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],\n wide: ['Januar', 'Februar', 'M\u00E4rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']\n}; // https://st.unicode.org/cldr-apps/v#/de/Gregorian/\n\nvar formattingMonthValues = {\n narrow: monthValues.narrow,\n abbreviated: ['Jan.', 'Feb.', 'M\u00E4rz', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Dez.'],\n wide: monthValues.wide\n};\nvar dayValues = {\n narrow: ['S', 'M', 'D', 'M', 'D', 'F', 'S'],\n short: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],\n abbreviated: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],\n wide: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']\n}; // https://www.unicode.org/cldr/charts/32/summary/de.html#1881\n\nvar dayPeriodValues = {\n narrow: {\n am: 'vm.',\n pm: 'nm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachm.',\n evening: 'Abend',\n night: 'Nacht'\n },\n abbreviated: {\n am: 'vorm.',\n pm: 'nachm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachmittag',\n evening: 'Abend',\n night: 'Nacht'\n },\n wide: {\n am: 'vormittags',\n pm: 'nachmittags',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachmittag',\n evening: 'Abend',\n night: 'Nacht'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'vm.',\n pm: 'nm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachm.',\n evening: 'abends',\n night: 'nachts'\n },\n abbreviated: {\n am: 'vorm.',\n pm: 'nachm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachmittags',\n evening: 'abends',\n night: 'nachts'\n },\n wide: {\n am: 'vormittags',\n pm: 'nachmittags',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachmittags',\n evening: 'abends',\n night: 'nachts'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber) {\n var number = Number(dirtyNumber);\n return number + '.';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n formattingValues: formattingMonthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(\\.)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,\n abbreviated: /^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,\n wide: /^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i\n};\nvar parseEraPatterns = {\n any: [/^v/i, /^n/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](\\.)? Quartal/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(j[a\u00E4]n|feb|m\u00E4r[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\\.?/i,\n wide: /^(januar|februar|m\u00E4rz|april|mai|juni|juli|august|september|oktober|november|dezember)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^j[a\u00E4]/i, /^f/i, /^m\u00E4r/i, /^ap/i, /^mai/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smdmf]/i,\n short: /^(so|mo|di|mi|do|fr|sa)/i,\n abbreviated: /^(son?|mon?|die?|mit?|don?|fre?|sam?)\\.?/i,\n wide: /^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i\n};\nvar parseDayPatterns = {\n any: [/^so/i, /^mo/i, /^di/i, /^mi/i, /^do/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(vm\\.?|nm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,\n abbreviated: /^(vorm\\.?|nachm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,\n wide: /^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^v/i,\n pm: /^n/i,\n midnight: /^Mitte/i,\n noon: /^Mitta/i,\n morning: /morgens/i,\n afternoon: /nachmittags/i,\n // will never be matched. Afternoon is matched by `pm`\n evening: /abends/i,\n night: /nachts/i // will never be matched. Night is matched by `pm`\n\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary German locale.\n * @language German\n * @iso-639-2 deu\n * @author Thomas Eilmsteiner [@DeMuu]{@link https://github.com/DeMuu}\n * @author Asia [@asia-t]{@link https://github.com/asia-t}\n * @author Van Vuong Ngo [@vanvuongngo]{@link https://github.com/vanvuongngo}\n * @author RomanErnst [@pex]{@link https://github.com/pex}\n * @author Philipp Keck [@Philipp91]{@link https://github.com/Philipp91}\n */\nvar locale = {\n code: 'de',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, d MMMM yyyy',\n long: 'd MMMM yyyy',\n medium: 'd MMM yyyy',\n short: 'dd/MM/yyyy'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "import formatDistance from \"../en-US/_lib/formatDistance/index.js\";\nimport formatRelative from \"../en-US/_lib/formatRelative/index.js\";\nimport localize from \"../en-US/_lib/localize/index.js\";\nimport match from \"../en-US/_lib/match/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United Kingdom).\n * @language English\n * @iso-639-2 eng\n * @author Alex [@glintik]{@link https://github.com/glintik}\n */\n\nvar locale = {\n code: 'en-GB',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'menos de un segundo',\n other: 'menos de {{count}} segundos'\n },\n xSeconds: {\n one: '1 segundo',\n other: '{{count}} segundos'\n },\n halfAMinute: 'medio minuto',\n lessThanXMinutes: {\n one: 'menos de un minuto',\n other: 'menos de {{count}} minutos'\n },\n xMinutes: {\n one: '1 minuto',\n other: '{{count}} minutos'\n },\n aboutXHours: {\n one: 'alrededor de 1 hora',\n other: 'alrededor de {{count}} horas'\n },\n xHours: {\n one: '1 hora',\n other: '{{count}} horas'\n },\n xDays: {\n one: '1 d\u00EDa',\n other: '{{count}} d\u00EDas'\n },\n aboutXWeeks: {\n one: 'alrededor de 1 semana',\n other: 'alrededor de {{count}} semanas'\n },\n xWeeks: {\n one: '1 semana',\n other: '{{count}} semanas'\n },\n aboutXMonths: {\n one: 'alrededor de 1 mes',\n other: 'alrededor de {{count}} meses'\n },\n xMonths: {\n one: '1 mes',\n other: '{{count}} meses'\n },\n aboutXYears: {\n one: 'alrededor de 1 a\u00F1o',\n other: 'alrededor de {{count}} a\u00F1os'\n },\n xYears: {\n one: '1 a\u00F1o',\n other: '{{count}} a\u00F1os'\n },\n overXYears: {\n one: 'm\u00E1s de 1 a\u00F1o',\n other: 'm\u00E1s de {{count}} a\u00F1os'\n },\n almostXYears: {\n one: 'casi 1 a\u00F1o',\n other: 'casi {{count}} a\u00F1os'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'en ' + result;\n } else {\n return 'hace ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: \"EEEE, d 'de' MMMM 'de' y\",\n long: \"d 'de' MMMM 'de' y\",\n medium: 'd MMM y',\n short: 'dd/MM/y'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'a las' {{time}}\",\n long: \"{{date}} 'a las' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'el' eeee 'pasado a la' p\",\n yesterday: \"'ayer a la' p\",\n today: \"'hoy a la' p\",\n tomorrow: \"'ma\u00F1ana a la' p\",\n nextWeek: \"eeee 'a la' p\",\n other: 'P'\n};\nvar formatRelativeLocalePlural = {\n lastWeek: \"'el' eeee 'pasado a las' p\",\n yesterday: \"'ayer a las' p\",\n today: \"'hoy a las' p\",\n tomorrow: \"'ma\u00F1ana a las' p\",\n nextWeek: \"eeee 'a las' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, date, _baseDate, _options) {\n if (date.getUTCHours() !== 1) {\n return formatRelativeLocalePlural[token];\n } else {\n return formatRelativeLocale[token];\n }\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['AC', 'DC'],\n abbreviated: ['AC', 'DC'],\n wide: ['antes de cristo', 'despu\u00E9s de cristo']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['T1', 'T2', 'T3', 'T4'],\n wide: ['1\u00BA trimestre', '2\u00BA trimestre', '3\u00BA trimestre', '4\u00BA trimestre']\n};\nvar monthValues = {\n narrow: ['e', 'f', 'm', 'a', 'm', 'j', 'j', 'a', 's', 'o', 'n', 'd'],\n abbreviated: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],\n wide: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']\n};\nvar dayValues = {\n narrow: ['d', 'l', 'm', 'm', 'j', 'v', 's'],\n short: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 's\u00E1'],\n abbreviated: ['dom', 'lun', 'mar', 'mi\u00E9', 'jue', 'vie', 's\u00E1b'],\n wide: ['domingo', 'lunes', 'martes', 'mi\u00E9rcoles', 'jueves', 'viernes', 's\u00E1bado']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mn',\n noon: 'md',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mn',\n noon: 'md',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber);\n return number + '\u00BA';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return Number(quarter) - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nimport buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(\u00BA)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(ac|dc|a|d)/i,\n abbreviated: /^(a\\.?\\s?c\\.?|a\\.?\\s?e\\.?\\s?c\\.?|d\\.?\\s?c\\.?|e\\.?\\s?c\\.?)/i,\n wide: /^(antes de cristo|antes de la era com[u\u00FA]n|despu[e\u00E9]s de cristo|era com[u\u00FA]n)/i\n};\nvar parseEraPatterns = {\n any: [/^ac/i, /^dc/i],\n wide: [/^(antes de cristo|antes de la era com[u\u00FA]n)/i, /^(despu[e\u00E9]s de cristo|era com[u\u00FA]n)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^T[1234]/i,\n wide: /^[1234](\u00BA)? trimestre/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[efmajsond]/i,\n abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,\n wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^e/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^en/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]\n};\nvar matchDayPatterns = {\n narrow: /^[dlmjvs]/i,\n short: /^(do|lu|ma|mi|ju|vi|s[\u00E1a])/i,\n abbreviated: /^(dom|lun|mar|mi[\u00E9e]|jue|vie|s[\u00E1a]b)/i,\n wide: /^(domingo|lunes|martes|mi[\u00E9e]rcoles|jueves|viernes|s[\u00E1a]bado)/i\n};\nvar parseDayPatterns = {\n narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],\n any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mn|md|(de la|a las) (ma\u00F1ana|tarde|noche))/i,\n any: /^([ap]\\.?\\s?m\\.?|medianoche|mediodia|(de la|a las) (ma\u00F1ana|tarde|noche))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mn/i,\n noon: /^md/i,\n morning: /ma\u00F1ana/i,\n afternoon: /tarde/i,\n evening: /tarde/i,\n night: /noche/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary Spanish locale.\n * @language Spanish\n * @iso-639-2 spa\n * @author Juan Angosto [@juanangosto]{@link https://github.com/juanangosto}\n * @author Guillermo Grau [@guigrpa]{@link https://github.com/guigrpa}\n * @author Fernando Ag\u00FCero [@fjaguero]{@link https://github.com/fjaguero}\n * @author Gast\u00F3n Haro [@harogaston]{@link https://github.com/harogaston}\n * @author Yago Carballo [@YagoCarballo]{@link https://github.com/YagoCarballo}\n */\nvar locale = {\n code: 'es',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'moins d\u2019une seconde',\n other: 'moins de {{count}} secondes'\n },\n xSeconds: {\n one: '1 seconde',\n other: '{{count}} secondes'\n },\n halfAMinute: '30 secondes',\n lessThanXMinutes: {\n one: 'moins d\u2019une minute',\n other: 'moins de {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'environ 1 heure',\n other: 'environ {{count}} heures'\n },\n xHours: {\n one: '1 heure',\n other: '{{count}} heures'\n },\n xDays: {\n one: '1 jour',\n other: '{{count}} jours'\n },\n aboutXWeeks: {\n one: 'environ 1 semaine',\n other: 'environ {{count}} semaines'\n },\n xWeeks: {\n one: '1 semaine',\n other: '{{count}} semaines'\n },\n aboutXMonths: {\n one: 'environ 1 mois',\n other: 'environ {{count}} mois'\n },\n xMonths: {\n one: '1 mois',\n other: '{{count}} mois'\n },\n aboutXYears: {\n one: 'environ 1 an',\n other: 'environ {{count}} ans'\n },\n xYears: {\n one: '1 an',\n other: '{{count}} ans'\n },\n overXYears: {\n one: 'plus d\u2019un an',\n other: 'plus de {{count}} ans'\n },\n almostXYears: {\n one: 'presqu\u2019un an',\n other: 'presque {{count}} ans'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var form = formatDistanceLocale[token];\n\n if (typeof form === 'string') {\n result = form;\n } else if (count === 1) {\n result = form.one;\n } else {\n result = form.other.replace('{{count}}', String(count));\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'dans ' + result;\n } else {\n return 'il y a ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE d MMMM y',\n long: 'd MMMM y',\n medium: 'd MMM y',\n short: 'dd/MM/y'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} '\u00E0' {{time}}\",\n long: \"{{date}} '\u00E0' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"eeee 'dernier \u00E0' p\",\n yesterday: \"'hier \u00E0' p\",\n today: \"'aujourd\u2019hui \u00E0' p\",\n tomorrow: \"'demain \u00E0' p'\",\n nextWeek: \"eeee 'prochain \u00E0' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['av. J.-C', 'ap. J.-C'],\n abbreviated: ['av. J.-C', 'ap. J.-C'],\n wide: ['avant J\u00E9sus-Christ', 'apr\u00E8s J\u00E9sus-Christ']\n};\nvar quarterValues = {\n narrow: ['T1', 'T2', 'T3', 'T4'],\n abbreviated: ['1er trim.', '2\u00E8me trim.', '3\u00E8me trim.', '4\u00E8me trim.'],\n wide: ['1er trimestre', '2\u00E8me trimestre', '3\u00E8me trimestre', '4\u00E8me trimestre']\n};\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['janv.', 'f\u00E9vr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'ao\u00FBt', 'sept.', 'oct.', 'nov.', 'd\u00E9c.'],\n wide: ['janvier', 'f\u00E9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao\u00FBt', 'septembre', 'octobre', 'novembre', 'd\u00E9cembre']\n};\nvar dayValues = {\n narrow: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],\n short: ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'],\n abbreviated: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],\n wide: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'mat.',\n afternoon: 'ap.m.',\n evening: 'soir',\n night: 'mat.'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'matin',\n afternoon: 'apr\u00E8s-midi',\n evening: 'soir',\n night: 'matin'\n },\n wide: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'du matin',\n afternoon: 'de l\u2019apr\u00E8s-midi',\n evening: 'du soir',\n night: 'du matin'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, options) {\n var number = Number(dirtyNumber);\n var unit = options === null || options === void 0 ? void 0 : options.unit;\n if (number === 0) return '0';\n var feminineUnits = ['year', 'week', 'hour', 'minute', 'second'];\n var suffix;\n\n if (number === 1) {\n suffix = unit && feminineUnits.includes(unit) ? '\u00E8re' : 'er';\n } else {\n suffix = '\u00E8me';\n }\n\n return number + suffix;\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(i\u00E8me|\u00E8re|\u00E8me|er|e)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(av\\.J\\.C|ap\\.J\\.C|ap\\.J\\.-C)/i,\n abbreviated: /^(av\\.J\\.-C|av\\.J-C|apr\\.J\\.-C|apr\\.J-C|ap\\.J-C)/i,\n wide: /^(avant J\u00E9sus-Christ|apr\u00E8s J\u00E9sus-Christ)/i\n};\nvar parseEraPatterns = {\n any: [/^av/i, /^ap/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^T?[1234]/i,\n abbreviated: /^[1234](er|\u00E8me|e)? trim\\.?/i,\n wide: /^[1234](er|\u00E8me|e)? trimestre/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(janv|f\u00E9vr|mars|avr|mai|juin|juill|juil|ao\u00FBt|sept|oct|nov|d\u00E9c)\\.?/i,\n wide: /^(janvier|f\u00E9vrier|mars|avril|mai|juin|juillet|ao\u00FBt|septembre|octobre|novembre|d\u00E9cembre)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^av/i, /^ma/i, /^juin/i, /^juil/i, /^ao/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[lmjvsd]/i,\n short: /^(di|lu|ma|me|je|ve|sa)/i,\n abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\\.?/i,\n wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i\n};\nvar parseDayPatterns = {\n narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],\n any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|minuit|midi|mat\\.?|ap\\.?m\\.?|soir|nuit)/i,\n any: /^([ap]\\.?\\s?m\\.?|du matin|de l'apr\u00E8s[-\\s]midi|du soir|de la nuit)/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^min/i,\n noon: /^mid/i,\n morning: /mat/i,\n afternoon: /ap/i,\n evening: /soir/i,\n night: /nuit/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n/**\n * @type {Locale}\n * @category Locales\n * @summary French locale.\n * @language French\n * @iso-639-2 fra\n * @author Jean Dupouy [@izeau]{@link https://github.com/izeau}\n * @author Fran\u00E7ois B [@fbonzon]{@link https://github.com/fbonzon}\n */\n\nvar locale = {\n code: 'fr',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n TalerCorebankConfigResponse,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerAuthenticationHttpClient,\n TalerBankConversionCacheEviction,\n TalerBankConversionHttpClient,\n TalerCoreBankCacheEviction,\n TalerCoreBankHttpClient,\n TalerError,\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading } from \"../index.browser.js\";\nimport { APIClient, ActiviyTracker, BankLib, Subscriber } from \"./activity.js\";\nimport { useTranslationContext } from \"./translation.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type BankContextType = {\n url: URL;\n config: TalerCorebankConfigResponse;\n lib: BankLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst BankContext = createContext(undefined);\n\nexport const useBankCoreApiContext = (): BankContextType =>\n useContext(BankContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n conversion?: CacheEvictor;\n bank?: CacheEvictor;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const BankApiProvider = ({\n baseUrl,\n children,\n frameOnError,\n evictors = {},\n}: {\n baseUrl: URL;\n children: ComponentChildren;\n evictors?: Evictors;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildBankApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: BankContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(BankContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildBankApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const bank = new TalerCoreBankHttpClient(url.href, httpLib, evictors.bank);\n const conversion = new TalerBankConversionHttpClient(\n bank.getConversionInfoAPI().href,\n httpLib,\n evictors.conversion,\n );\n const auth = (user: string) =>\n new TalerAuthenticationHttpClient(\n bank.getAuthenticationAPI(user).href,\n httpLib,\n );\n\n async function getRemoteConfig(): Promise {\n const resp = await bank.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: bank.PROTOCOL_VERSION,\n lib: {\n bank,\n conversion,\n auth,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const BankApiProviderTesting = ({\n children,\n value,\n}: {\n value: BankContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(BankContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ChallengerHttpClient, ObservabilityEvent, TalerAuthenticationHttpClient, TalerBankConversionHttpClient, TalerCoreBankHttpClient, TalerExchangeHttpClient, TalerMerchantInstanceHttpClient, TalerMerchantManagementHttpClient } from \"@gnu-taler/taler-util\";\n\ntype Listener = (e: Event) => void;\ntype Unsuscriber = () => void;\nexport type Subscriber = (fn: Listener) => Unsuscriber;\n\nexport class ActiviyTracker {\n private observers = new Array>();\n constructor() {\n this.notify = this.notify.bind(this)\n this.subscribe = this.subscribe.bind(this)\n }\n notify(data: Event): void {\n this.observers.forEach((observer) => observer(data))\n }\n subscribe(func: Listener): Unsuscriber {\n this.observers.push(func);\n return () => {\n this.observers.forEach((observer, index) => {\n if (observer === func) {\n this.observers.splice(index, 1);\n }\n });\n };\n }\n}\n\n/**\n * build http client with cache breaker due to SWR\n * @param url\n * @returns\n */\nexport interface APIClient {\n getRemoteConfig(): Promise;\n VERSION: string;\n lib: T,\n onActivity: Subscriber;\n cancelRequest(id: string): void;\n}\n\nexport interface MerchantLib {\n instance: TalerMerchantManagementHttpClient;\n authenticate: TalerAuthenticationHttpClient;\n subInstanceApi: (instanceId: string) => MerchantLib;\n}\n\nexport interface ExchangeLib {\n exchange: TalerExchangeHttpClient;\n}\n\nexport interface BankLib {\n bank: TalerCoreBankHttpClient;\n conversion: TalerBankConversionHttpClient;\n auth: (user: string) => TalerAuthenticationHttpClient;\n}\n\nexport interface ChallengerLib {\n challenger: ChallengerHttpClient;\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n ChallengerApi,\n ChallengerCacheEviction,\n ChallengerHttpClient,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerError\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n ChallengerLib,\n Subscriber\n} from \"./activity.js\";\nimport { useTranslationContext } from \"./translation.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type ChallengerContextType = {\n url: URL;\n config: ChallengerApi.ChallengerTermsOfServiceResponse;\n lib: ChallengerLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst ChallengerContext = createContext(undefined);\n\nexport const useChallengerApiContext = (): ChallengerContextType =>\n useContext(ChallengerContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n challenger?: CacheEvictor;\n}\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const ChallengerApiProvider = ({\n baseUrl,\n children,\n frameOnError,\n evictors = {},\n}: {\n baseUrl: URL;\n children: ComponentChildren;\n evictors?: Evictors;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildChallengerApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: ChallengerContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(ChallengerContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildChallengerApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const challenger = new ChallengerHttpClient(url.href, httpLib, evictors.challenger);\n\n async function getRemoteConfig(): Promise {\n const resp = await challenger.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: challenger.PROTOCOL_VERSION,\n lib: {\n challenger,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const ChallengerApiProviderTesting = ({\n children,\n value,\n}: {\n value: ChallengerContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(ChallengerContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerAuthenticationHttpClient,\n TalerError,\n TalerMerchantApi,\n TalerMerchantInstanceCacheEviction,\n TalerMerchantManagementCacheEviction,\n TalerMerchantManagementHttpClient,\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n MerchantLib,\n Subscriber,\n} from \"./activity.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type MerchantContextType = {\n url: URL;\n config: TalerMerchantApi.TalerMerchantConfigResponse;\n lib: MerchantLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n changeBackend: (url: URL) => void;\n};\n\n// FIXME: below\n// @ts-expect-error default value to undefined, should it be another thing?\nconst MerchantContext = createContext(undefined);\n\nexport const useMerchantApiContext = (): MerchantContextType =>\n useContext(MerchantContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n management?: CacheEvictor<\n TalerMerchantManagementCacheEviction | TalerMerchantInstanceCacheEviction\n >;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | ConfigResultFail;\n\nexport type ConfigResultFail =\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const MerchantApiProvider = ({\n baseUrl,\n children,\n evictors = {},\n frameOnError,\n}: {\n baseUrl: URL;\n evictors?: Evictors;\n children: ComponentChildren;\n frameOnError: FunctionComponent<{\n state:\n | ConfigResultFail\n | undefined;\n }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n\n const [merchantEndpoint, changeMerchantEndpoint] = useState(baseUrl);\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildMerchantApiClient(merchantEndpoint, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (!checked || checked.type !== \"ok\") {\n return h(frameOnError, { state: checked }, []);\n }\n\n const value: MerchantContextType = {\n url: merchantEndpoint,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n changeBackend: changeMerchantEndpoint,\n hints: checked.hints,\n };\n return h(MerchantContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildMerchantApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const instance = new TalerMerchantManagementHttpClient(\n url.href,\n httpLib,\n evictors.management,\n );\n const authenticate = new TalerAuthenticationHttpClient(\n instance.getAuthenticationAPI().href,\n httpLib,\n );\n\n function getSubInstanceAPI(instanceId: string): MerchantLib {\n const api = buildMerchantApiClient(\n instance.getSubInstanceAPI(instanceId) as URL,\n evictors,\n );\n return api.lib;\n }\n\n async function getRemoteConfig(): Promise {\n const resp = await instance.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: instance.PROTOCOL_VERSION,\n lib: {\n instance,\n authenticate,\n subInstanceApi: getSubInstanceAPI,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const MerchantApiProviderTesting = ({\n children,\n value,\n}: {\n value: MerchantContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(MerchantContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerError,\n TalerExchangeApi,\n TalerExchangeCacheEviction,\n TalerExchangeHttpClient\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading, useTranslationContext } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n ExchangeLib,\n Subscriber,\n} from \"./activity.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type ExchangeContextType = {\n url: URL;\n config: TalerExchangeApi.ExchangeVersionResponse;\n lib: ExchangeLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// FIXME: below\n// @ts-expect-error default value to undefined, should it be another thing?\nconst ExchangeContext = createContext(undefined);\n\nexport const useExchangeApiContext = (): ExchangeContextType =>\n useContext(ExchangeContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n exchange?: CacheEvictor;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | ConfigResultFail;\n\ntype ConfigResultFail =\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const ExchangeApiProvider = ({\n baseUrl,\n children,\n evictors = {},\n frameOnError,\n}: {\n baseUrl: URL;\n evictors?: Evictors;\n children: ComponentChildren;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildExchangeApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: ExchangeContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(ExchangeContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildExchangeApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const ex = new TalerExchangeHttpClient(url.href, httpLib, evictors.exchange);\n\n async function getRemoteConfig(): Promise {\n const resp = await ex.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: ex.PROTOCOL_VERSION,\n lib: {\n exchange: ex,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const ExchangeApiProviderTesting = ({\n children,\n value,\n}: {\n value: ExchangeContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(ExchangeContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport {\n AppLocation,\n ObjectOf,\n Location,\n findMatch,\n RouteDefinition,\n LocationNotFound,\n} from \"../utils/route.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type Type = {\n path: string;\n params: Record;\n navigateTo: (path: AppLocation) => void;\n // addNavigationListener: (listener: (path: string, params: Record) => void) => (() => void);\n};\n\n// @ts-expect-error should not be used without provider\nconst Context = createContext(undefined);\n\nexport const useNavigationContext = (): Type => useContext(Context);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCurrentLocation>>(\n pagesMap: T,\n): Location | LocationNotFound {\n const pageList = Object.keys(pagesMap as object) as Array;\n const { path, params } = useNavigationContext();\n\n return findMatch(pagesMap, pageList, path, params);\n}\n\nfunction getPathAndParamsFromWindow(): {\n path: string;\n params: Record;\n} {\n const path =\n typeof window !== \"undefined\" ? window.location.hash.substring(1) : \"/\";\n const params: Record = {};\n if (typeof window !== \"undefined\") {\n for (const [key, value] of new URLSearchParams(window.location.search)) {\n if (!params[key]) {\n params[key] = [];\n }\n params[key].push(value);\n }\n }\n return { path, params };\n}\n\nconst { path: initialPath, params: initialParams } =\n getPathAndParamsFromWindow();\n\n// there is a possibility that if the browser does a redirection\n// (which doesn't go through navigatTo function) and that executed\n// too early (before addEventListener runs) it won't be taking\n// into account\nconst PopStateEventType = \"popstate\";\n\nexport const BrowserHashNavigationProvider = ({\n children,\n}: {\n children: ComponentChildren;\n}): VNode => {\n const [{ path, params }, setState] = useState({\n path: initialPath,\n params: initialParams,\n });\n if (typeof window === \"undefined\") {\n throw Error(\n \"Can't use BrowserHashNavigationProvider if there is no window object\",\n );\n }\n function navigateTo(path: string): void {\n const { params } = getPathAndParamsFromWindow();\n setState({ path, params });\n window.location.href = path;\n }\n\n useEffect(() => {\n function eventListener(): void {\n setState(getPathAndParamsFromWindow());\n }\n window.addEventListener(PopStateEventType, eventListener);\n return () => {\n window.removeEventListener(PopStateEventType, eventListener);\n };\n }, []);\n return h(Context.Provider, {\n value: { path, params, navigateTo },\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { stringifyTalerUri, TalerUri } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\n\n/**\n * https://docs.taler.net/design-documents/039-taler-browser-integration.html\n *\n * @param uri\n */\nfunction createHeadMetaTag(uri: TalerUri, onNotFound?: () => void) {\n const meta = document.createElement(\"meta\");\n meta.setAttribute(\"name\", \"taler-uri\");\n meta.setAttribute(\"content\", stringifyTalerUri(uri));\n\n document.head.appendChild(meta);\n\n let walletFound = false;\n window.addEventListener(\"beforeunload\", () => {\n walletFound = true;\n });\n setTimeout(() => {\n if (!walletFound && onNotFound) {\n onNotFound();\n }\n }, 10); //very short timeout\n}\ninterface Type {\n /**\n * Tell the active wallet that an action is found\n *\n * @param uri\n * @returns\n */\n publishTalerAction: (uri: TalerUri, onNotFound?: () => void) => void;\n}\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst Context = createContext(undefined);\n\nexport const useTalerWalletIntegrationAPI = (): Type => useContext(Context);\n\nexport const TalerWalletIntegrationBrowserProvider = ({\n children,\n}: {\n children: ComponentChildren;\n}): VNode => {\n const value: Type = {\n publishTalerAction: createHeadMetaTag,\n };\n return h(Context.Provider, {\n value,\n children,\n });\n};\n\nexport const TalerWalletIntegrationTestingProvider = ({\n children,\n value,\n}: {\n children: ComponentChildren;\n value: Type;\n}): VNode => {\n return h(Context.Provider, {\n value,\n children,\n });\n};\n", "import { createElement, VNode } from \"preact\";\n\nexport type StateFunc = (p: S) => VNode;\n\nexport type StateViewMap = {\n [S in StateType as S[\"status\"]]: StateFunc;\n};\n\nexport type RecursiveState = S | (() => RecursiveState);\n\nexport function compose(\n hook: (p: PType) => RecursiveState,\n viewMap: StateViewMap,\n): (p: PType) => VNode {\n\n function withHook(stateHook: () => RecursiveState): () => VNode {\n function ComposedComponent(): VNode {\n const state = stateHook();\n\n if (typeof state === \"function\") {\n const subComponent = withHook(state);\n return createElement(subComponent, {});\n }\n\n const statusName = state.status as unknown as SType[\"status\"];\n const viewComponent = viewMap[statusName] as unknown as StateFunc;\n return createElement(viewComponent, state);\n }\n\n return ComposedComponent;\n }\n\n return (p: PType) => {\n const h = withHook(() => hook(p));\n return h();\n };\n}\n\nexport function recursive(\n hook: (p: PType) => RecursiveState,\n): (p: PType) => VNode {\n\n function withHook(stateHook: () => RecursiveState): () => VNode {\n function ComposedComponent(): VNode {\n const state = stateHook();\n\n if (typeof state === \"function\") {\n const subComponent = withHook(state);\n return createElement(subComponent, {});\n }\n\n return state;\n }\n\n return ComposedComponent;\n }\n\n return (p: PType) => {\n const h = withHook(() => hook(p));\n return h();\n };\n}\n\n\n\n/**\n *\n * @param obj VNode\n * @returns\n */\nexport function saveVNodeForInspection(obj: T): T {\n // @ts-ignore\n window[\"showVNodeInfo\"] = function showVNodeInfo() {\n inspect(obj);\n };\n return obj;\n}\nfunction inspect(obj: any) {\n if (!obj) return;\n if (obj.__c && obj.__c.__H) {\n const componentName = obj.__c.constructor.name;\n const hookState = obj.__c.__H;\n const stateList = hookState.__ as Array;\n console.log(\"==============\", componentName);\n stateList.forEach((hook) => {\n const { __: value, c: context, __h: factory, __H: args } = hook;\n if (typeof context !== \"undefined\") {\n const { __c: contextId } = context;\n console.log(\"context:\", contextId, hook);\n } else if (typeof factory === \"function\") {\n console.log(\"memo:\", value, \"deps:\", args);\n } else if (typeof value === \"function\") {\n const effectName = value.name;\n console.log(\"effect:\", effectName, \"deps:\", args);\n } else if (typeof value.current !== \"undefined\") {\n const ref = value.current;\n console.log(\"ref:\", ref instanceof Element ? ref.outerHTML : ref);\n } else if (value instanceof Array) {\n console.log(\"state:\", value[0]);\n } else {\n console.log(hook);\n }\n });\n }\n const children = obj.__k;\n if (children instanceof Array) {\n children.forEach((e) => inspect(e));\n } else {\n inspect(children);\n }\n}\n", "import { Duration, TranslatedString, assertUnreachable } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\n\ninterface Props {\n type?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"low\",\n onClose?: () => void,\n title: TranslatedString,\n children?: ComponentChildren,\n timeout?: Duration,\n}\nexport function Attention({ type = \"info\", title, children, onClose, timeout = Duration.getForever() }: Props): VNode {\n\n return
\n {timeout.d_ms === \"forever\" ? undefined : \n }\n\n
\n
\n
\n {type === \"low\" ? undefined :\n \n {(() => {\n switch (type) {\n case \"info\":\n return \n case \"warning\":\n return \n case \"danger\":\n return \n case \"success\":\n return \n default:\n assertUnreachable(type)\n }\n })()}\n \n }\n
\n
\n

\n {title}\n

\n
\n {children}\n
\n
\n {onClose &&\n
\n \n
\n }\n
\n
\n {timeout.d_ms === \"forever\" ? undefined :\n
\n \n
\n }\n\n
\n}\n", "import { ComponentChildren, h, VNode } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\n\nexport function CopyIcon(): VNode {\n return (\n \n \n \n )\n};\n\nexport function CopiedIcon(): VNode {\n return (\n \n \n \n )\n};\n\nexport function CopyButton({ class: clazz, children, getContent }: { children?: ComponentChildren, class: string, getContent: () => string }): VNode {\n const [copied, setCopied] = useState(false);\n function copyText(): void {\n if (!navigator.clipboard && !window.isSecureContext) {\n prompt(\"Clipboard is not available on insecure context (http).\", getContent());\n }\n if (navigator.clipboard) {\n navigator.clipboard.writeText(getContent() || \"\");\n setCopied(true);\n }\n }\n useEffect(() => {\n if (copied) {\n setTimeout(() => {\n setCopied(false);\n }, 1000);\n }\n }, [copied]);\n\n if (!copied) {\n return (\n \n );\n }\n return (\n \n );\n}\n", "/*\n/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { TalerError, TalerErrorCode, assertUnreachable } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { Attention } from \"./Attention.js\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\nexport function ErrorLoading({ error, showDetail }: { error: TalerError, showDetail?: boolean }): VNode {\n const { i18n } = useTranslationContext()\n switch (error.errorDetail.code) {\n //////////////////\n // Every error that can be produce in a Http Request\n //////////////////\n case TalerErrorCode.GENERIC_TIMEOUT: {\n if (error.hasErrorCode(TalerErrorCode.GENERIC_TIMEOUT)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED)) {\n const { requestMethod, requestUrl, throttleStats } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, throttleStats }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE)) {\n const { requestMethod, requestUrl, httpStatusCode, validationError } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, httpStatusCode, validationError }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_NETWORK_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_NETWORK_ERROR)) {\n const { requestMethod, requestUrl } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR)) {\n const { requestMethod, requestUrl, httpStatusCode, errorResponse } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
\n              {JSON.stringify({ requestMethod, requestUrl, httpStatusCode, errorResponse }, undefined, 2)}\n            
\n }\n
\n }\n assertUnreachable(1 as never)\n }\n //////////////////\n // Every other error \n //////////////////\n // case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n // return \n // \n // }\n //////////////////\n // Default message for unhandled case\n //////////////////\n default: return \n {error.message}\n {showDetail &&\n
\n          {JSON.stringify(error.errorDetail, undefined, 2)}\n        
\n }\n
\n }\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { Fragment, h, VNode } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\n// import { strings as messages } from \"../i18n/strings.js\";\nimport langIcon from \"../assets/lang.svg\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\ntype LangsNames = {\n [P: string]: string;\n};\n\nconst names: LangsNames = {\n es: \"Espa\u00F1ol [es]\",\n en: \"English [en]\",\n fr: \"Fran\u00E7ais [fr]\",\n de: \"Deutsch [de]\",\n sv: \"Svenska [sv]\",\n it: \"Italiano [it]\",\n};\n\nfunction getLangName(s: keyof LangsNames | string): string {\n if (names[s]) return names[s];\n return String(s);\n}\n\nexport function LangSelector({ }: {}): VNode {\n const [updatingLang, setUpdatingLang] = useState(false);\n const { lang, changeLanguage, completeness, supportedLang } = useTranslationContext();\n const [hidden, setHidden] = useState(true);\n\n useEffect(() => {\n function bodyKeyPress(event: KeyboardEvent) {\n if (event.code === \"Escape\") setHidden(true);\n }\n function bodyOnClick(event: Event) {\n setHidden(true);\n }\n document.body.addEventListener(\"click\", bodyOnClick);\n document.body.addEventListener(\"keydown\", bodyKeyPress as any);\n return () => {\n document.body.removeEventListener(\"keydown\", bodyKeyPress as any);\n document.body.removeEventListener(\"click\", bodyOnClick);\n };\n }, []);\n return (\n
\n
\n \n\n {!hidden &&\n
    \n {Object.keys(supportedLang)\n .filter((l) => l !== lang)\n .map((lang) => (\n
  • {\n changeLanguage(lang);\n setUpdatingLang(false);\n setHidden(true)\n }}\n >\n \n {getLangName(lang)}\n {(completeness as any)[lang]}%\n \n\n \n {/* \n \n */}\n \n
  • \n ))}\n\n
\n }\n\n
\n
\n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { h, VNode } from \"preact\";\n\nexport function Loading(): VNode {\n return (\n \n \n
\n );\n}\n\nfunction Spinner(): VNode {\n return (\n
\n
\n
\n
\n
\n
\n );\n}\n", "import { useState } from \"preact/hooks\";\nimport { LangSelector, useNotifications, useTranslationContext } from \"../index.browser.js\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\nimport logo from \"../assets/logo-2021.svg\";\n\ninterface Props {\n title: string;\n iconLinkURL: string;\n profileURL?: string;\n notificationURL?: string;\n children?: ComponentChildren;\n onLogout: (() => void) | undefined;\n sites: Array>;\n supportedLangs: string[]\n}\n\nexport function Header({ title, profileURL, notificationURL, iconLinkURL, sites, onLogout, children }: Props): VNode {\n const { i18n } = useTranslationContext();\n const [open, setOpen] = useState(false)\n const ns = useNotifications();\n\n return \n
\n
\n
\n
\n \n \n \n
\n \n {title}\n \n
\n
\n
\n {sites.map((site) => {\n if (site.length !== 2) return;\n const [name, url] = site\n return {name}\n })}\n
\n
\n
\n {!notificationURL ? undefined :\n \n \n Show notifications\n {ns.length > 0 ?\n \n \n \n \n :\n \n \n \n }\n \n }\n {!profileURL ? undefined :\n \n \n Open profile\n \n \n \n \n }\n \n
\n
\n
\n\n {\n open &&\n
{\n setOpen(false)\n }}>\n
\n\n
\n
\n
\n
\n
{\n //do not trigger close if clicking inside the sidebar\n e.stopPropagation();\n }}>\n
\n
\n

\n Menu\n

\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n }\n
\n}\n", "import { useTranslationContext } from \"../index.browser.js\";\nimport { h } from \"preact\";\n\nexport function Footer({ testingUrlKey, VERSION, GIT_HASH }: { VERSION?: string, GIT_HASH?: string, testingUrlKey?: string }) {\n const { i18n } = useTranslationContext()\n\n const testingUrl = (testingUrlKey && typeof localStorage !== \"undefined\") && localStorage.getItem(testingUrlKey) ?\n localStorage.getItem(testingUrlKey) ?? undefined :\n undefined\n const versionText = VERSION\n ? GIT_HASH\n ? \n Version {VERSION} ({GIT_HASH.substring(0, 8)})\n \n : VERSION\n : \"\";\n return (\n
\n
\n

\n \n Learn more about GNU Taler\n \n

\n
\n
\n

\n Copyright © 2014—2023 Taler Systems SA. {versionText}{\" \"}\n

\n {testingUrlKey && testingUrl &&\n\n

\n Testing with {testingUrl}{\" \"}\n {\n e.preventDefault();\n localStorage.removeItem(testingUrlKey);\n window.location.reload();\n }}\n >\n stop testing\n \n

\n }\n
\n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n OperationAlternative,\n OperationFail,\n OperationOk,\n OperationResult,\n TalerError,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\n// import { NotificationMessage, notifyInfo } from \"@gnu-taler/web-util/browser\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { HTMLAttributes, useState } from \"preact/compat\";\nimport {\n NotificationMessage,\n buildUnifiedRequestErrorMessage,\n notifyInfo,\n useTranslationContext,\n} from \"../index.browser.js\";\n// import { useBankCoreApiContext } from \"../context/config.js\";\n\n// function errorMap>(resp: T, map: (d: T[\"case\"]) => TranslatedString): void {\n\nexport type OnOperationSuccesReturnType = (\n result: T extends OperationOk ? T : never,\n) => TranslatedString | void;\nexport type OnOperationFailReturnType = (\n (d: (T extends OperationFail ? T : never) | (T extends OperationAlternative ? T : never)) => TranslatedString)\n\nexport interface ButtonHandler, A, B> {\n onClick: () => Promise;\n onNotification: (n: NotificationMessage) => void;\n onOperationSuccess: OnOperationSuccesReturnType;\n onOperationFail?: OnOperationFailReturnType;\n onOperationComplete?: () => void;\n}\n\ninterface Props, A, B>\n extends HTMLAttributes {\n handler: ButtonHandler | undefined;\n}\n\n/**\n * This button accept an async function and report a notification\n * on error or success.\n *\n * When the async function is running the inner text will change into\n * a \"loading\" animation.\n *\n * @param param0\n * @returns\n */\nexport function Button, A, B>({\n handler,\n children,\n disabled,\n onClick: clickEvent,\n ...rest\n}: Props): VNode {\n const { i18n } = useTranslationContext();\n const [running, setRunning] = useState(false);\n return (\n {\n e.preventDefault();\n if (!handler) {\n return;\n }\n setRunning(true);\n handler\n .onClick()\n .then((resp) => {\n if (resp) {\n if (resp.type === \"ok\") {\n const result: OperationOk = resp;\n // @ts-expect-error this is an operationOk\n const msg = handler.onOperationSuccess(result);\n if (msg) {\n notifyInfo(msg);\n }\n }\n if (resp.type === \"fail\") {\n const d = 'detail' in resp ? resp.detail : undefined\n \n const title = !handler.onOperationFail ? \"Unexpected error.\" as TranslatedString : handler.onOperationFail(resp as any);\n handler.onNotification({\n title,\n type: \"error\",\n description: d && d.hint ? d.hint as TranslatedString : undefined,\n debug: d,\n when: AbsoluteTime.now(),\n });\n }\n }\n if (handler.onOperationComplete) {\n handler.onOperationComplete();\n }\n setRunning(false);\n })\n .catch((error) => {\n console.error(error);\n\n if (error instanceof TalerError) {\n handler.onNotification(\n buildUnifiedRequestErrorMessage(i18n, error),\n );\n } else {\n const description = (\n error instanceof Error ? error.message : String(error)\n ) as TranslatedString;\n\n handler.onNotification({\n title: i18n.str`Operation failed`,\n type: \"error\",\n description,\n when: AbsoluteTime.now(),\n });\n }\n\n if (handler.onOperationComplete) {\n handler.onOperationComplete();\n }\n setRunning(false);\n });\n }}\n >\n {running ? : children}\n \n );\n}\n\nfunction Wait(): VNode {\n return (\n \n \n
\n \n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Fragment, h, VNode } from \"preact\";\n\nexport function ShowInputErrorLabel({\n isDirty,\n message,\n}: {\n message: string | undefined;\n isDirty: boolean;\n}): VNode {\n if (message && isDirty)\n return
{message}
;\n return
;\n}\n", "import { h, Fragment, VNode } from \"preact\";\nimport { Attention } from \"./Attention.js\";\nimport { Notification } from \"../index.browser.js\";\n\nexport function LocalNotificationBanner({ notification, showDebug }: { notification?: Notification, showDebug?: boolean }): VNode {\n if (!notification) return \n switch (notification.message.type) {\n case \"error\":\n return
\n
\n {\n notification.acknowledge()\n }}>\n {notification.message.description &&\n
\n {notification.message.description}\n
\n }\n {showDebug &&
\n              {notification.message.debug}\n            
}\n
\n
\n
\n case \"info\":\n return
\n
\n {\n notification.acknowledge();\n }} />
\n }\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nimport { Fragment, VNode, h } from \"preact\"\nimport { Attention, GLOBAL_NOTIFICATION_TIMEOUT as GLOBAL_TOAST_TIMEOUT, Notification, useNotifications } from \"../index.browser.js\"\n\n/**\n * Toasts should be considered when displaying these types of information to the user:\n * \n * Low attention messages that do not require user action\n * Singular status updates\n * Confirmations\n * Information that does not need to be followed up\n * \n * Do not use toasts if the information contains the following:\n * \n * High attention and crtitical information\n * Time-sensitive information\n * Requires user action or input\n * Batch updates\n * \n * @returns \n */\nexport function ToastBanner(): VNode {\n const notifs = useNotifications()\n if (notifs.length === 0) return \n const show = notifs.filter(e => !e.message.ack && !e.message.timeout)\n if (show.length === 0) return \n return \n}\n\nfunction AttentionByType({ msg }: { msg: Notification }) {\n switch (msg.message.type) {\n case \"error\":\n return {\n msg.acknowledge()\n }} timeout={GLOBAL_TOAST_TIMEOUT}>\n {msg.message.description &&\n
\n {msg.message.description}\n
\n }\n
\n case \"info\":\n return {\n msg.acknowledge();\n }} timeout={GLOBAL_TOAST_TIMEOUT} />\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { AbsoluteTime, Duration } from \"@gnu-taler/taler-util\";\nimport {\n formatISO,\n format,\n formatDuration,\n intervalToDuration,\n} from \"date-fns\";\nimport { Fragment, h, VNode } from \"preact\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\n/**\n *\n * @param timestamp time to be formatted\n * @param relative duration threshold, if the difference is lower\n * the timestamp will be formatted as relative time from \"now\"\n *\n * @returns\n */\nexport function Time({\n timestamp,\n relative,\n format: formatString,\n}: {\n timestamp: AbsoluteTime | undefined;\n relative?: Duration;\n format: string;\n}): VNode {\n const { i18n, dateLocale } = useTranslationContext();\n if (!timestamp) return ;\n\n if (timestamp.t_ms === \"never\") {\n return ;\n }\n\n const now = AbsoluteTime.now();\n const diff = AbsoluteTime.difference(now, timestamp);\n if (relative && now.t_ms !== \"never\" && Duration.cmp(diff, relative) === -1) {\n const d = intervalToDuration({\n start: now.t_ms,\n end: timestamp.t_ms,\n });\n d.seconds = 0;\n const duration = formatDuration(d, { locale: dateLocale });\n const isFuture = AbsoluteTime.cmp(now, timestamp) < 0;\n if (isFuture) {\n return (\n \n );\n } else {\n return (\n \n );\n }\n }\n return (\n \n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\";\nimport {\n add as dateAdd,\n sub as dateSub,\n eachDayOfInterval,\n endOfMonth,\n endOfWeek,\n format,\n getMonth,\n getYear,\n isSameDay,\n isSameMonth,\n startOfDay,\n startOfMonth,\n startOfWeek,\n} from \"date-fns\";\nimport { VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\nexport function Calendar({\n value,\n onChange,\n}: {\n value: AbsoluteTime | undefined;\n onChange: (v: AbsoluteTime) => void;\n}): VNode {\n const today = startOfDay(new Date());\n const selected = !value ? today : new Date(AbsoluteTime.toStampMs(value));\n const [showingDate, setShowingDate] = useState(selected);\n const month = getMonth(showingDate);\n const year = getYear(showingDate);\n\n const start = startOfWeek(startOfMonth(showingDate));\n const end = endOfWeek(endOfMonth(showingDate));\n const daysInMonth = eachDayOfInterval({ start, end });\n const { i18n } = useTranslationContext();\n const monthNames = [\n i18n.str`January`,\n i18n.str`February`,\n i18n.str`March`,\n i18n.str`April`,\n i18n.str`May`,\n i18n.str`June`,\n i18n.str`July`,\n i18n.str`August`,\n i18n.str`September`,\n i18n.str`October`,\n i18n.str`November`,\n i18n.str`December`,\n ];\n return (\n
\n
\n {\n setShowingDate(dateSub(showingDate, { years: 1 }));\n }}\n >\n {i18n.str`Previous year`}\n \n \n \n \n
{year}
\n {\n setShowingDate(dateAdd(showingDate, { years: 1 }));\n }}\n >\n {i18n.str`Next year`}\n \n \n \n \n
\n
\n {\n setShowingDate(dateSub(showingDate, { months: 1 }));\n }}\n >\n {i18n.str`Previous month`}\n \n \n \n \n
{monthNames[month]}
\n {\n setShowingDate(dateAdd(showingDate, { months: 1 }));\n }}\n >\n {i18n.str`Next month`}\n \n \n \n \n
\n
\n
M
\n
T
\n
W
\n
T
\n
F
\n
S
\n
S
\n
\n
\n
\n {daysInMonth.map((current, idx) => (\n {\n onChange(AbsoluteTime.fromStampMs(current.getTime()));\n }}\n class=\"text-gray-400 hover:bg-gray-700 focus:z-10 py-1.5 \n data-[month=false]:bg-gray-100 data-[month=true]:bg-white \n data-[today=true]:font-semibold \n data-[month=true]:text-gray-900\n data-[today=true]:bg-red-300 data-[today=true]:hover:bg-red-200\n data-[month=true]:hover:bg-gray-200\n data-[selected=true]:!bg-blue-400 data-[selected=true]:hover:!bg-blue-300 \"\n >\n \n {format(current, \"dd\")}\n \n \n ))}\n
\n {daysInMonth.length < 40 ?
: undefined}\n
\n
\n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { LabelWithTooltipMaybeRequired, RenderAddon } from \"./InputLine.js\";\nimport { Addon } from \"./FormProvider.js\";\n\ninterface Props {\n label: TranslatedString;\n tooltip?: TranslatedString;\n help?: TranslatedString;\n before?: Addon;\n after?: Addon;\n}\n\nexport function Caption({ before, after, label, tooltip, help }: Props): VNode {\n return (\n
\n {before !== undefined && }\n \n {after !== undefined && }\n {help && (\n

\n {help}\n

\n )}\n
\n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\nimport { Addon, UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { useField } from \"./useField.js\";\n\n//@ts-ignore\nconst TooltipIcon = (\n \n \n \n);\n\nexport function LabelWithTooltipMaybeRequired({\n label,\n required,\n tooltip,\n}: {\n label: TranslatedString;\n required?: boolean;\n tooltip?: TranslatedString;\n}): VNode {\n const Label = (\n \n
\n \n {label}\n \n
\n
\n );\n const WithTooltip = tooltip ? (\n
\n {Label}\n \n {TooltipIcon}\n \n \n
\n ) : (\n Label\n );\n if (required) {\n return (\n
\n {WithTooltip}\n *\n
\n );\n }\n return WithTooltip;\n}\n\nexport function RenderAddon({ disabled, addon }: { disabled?: boolean, addon: Addon }): VNode {\n switch (addon.type) {\n case \"text\": {\n return (\n \n {addon.text}\n \n );\n }\n case \"icon\": {\n return (\n
\n {addon.icon}\n
\n );\n }\n case \"button\": {\n return (\n \n {addon.children}\n \n );\n }\n }\n}\n\nfunction InputWrapper({\n children,\n label,\n tooltip,\n before,\n after,\n help,\n error,\n disabled,\n required,\n}: {\n error?: string;\n disabled: boolean;\n children: ComponentChildren;\n} & UIFormProps): VNode {\n return (\n
\n \n
\n {before && }\n\n {children}\n\n {after && }\n
\n {error && (\n

\n {error}\n

\n )}\n {help && (\n

\n {help}\n

\n )}\n
\n );\n}\n\nfunction defaultToString(v: unknown) {\n return v === undefined ? \"\" : typeof v !== \"object\" ? String(v) : \"\";\n}\nfunction defaultFromString(v: string) {\n return v;\n}\n\ntype InputType = \"text\" | \"text-area\" | \"password\" | \"email\" | \"number\";\n\nexport function InputLine(\n props: { type: InputType } & UIFormProps,\n): VNode {\n const { name, placeholder, before, after, converter, type } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state, error } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n // const [text, setText] = useState(\"\");\n const fromString: (s: string) => any =\n converter?.fromStringUI ?? defaultFromString;\n const toString: (s: any) => string = converter?.toStringUI ?? defaultToString;\n\n // useEffect(() => {\n // const newValue = toString(value);\n // if (newValue) {\n // setText(newValue);\n // }\n // }, [value]);\n\n if (state.hidden) return
;\n\n let clazz =\n \"block w-full rounded-md border-0 py-1.5 shadow-sm ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200\";\n if (before) {\n switch (before.type) {\n case \"icon\": {\n clazz += \" pl-10\";\n break;\n }\n case \"button\": {\n clazz += \" rounded-none rounded-r-md \";\n break;\n }\n case \"text\": {\n clazz += \" min-w-0 flex-1 rounded-r-md rounded-none \";\n break;\n }\n }\n }\n if (after) {\n switch (after.type) {\n case \"icon\": {\n clazz += \" pr-10\";\n break;\n }\n case \"button\": {\n clazz += \" rounded-none rounded-l-md\";\n break;\n }\n case \"text\": {\n clazz += \" min-w-0 flex-1 rounded-l-md rounded-none \";\n break;\n }\n }\n }\n const showError = value !== undefined && error;\n if (showError) {\n clazz +=\n \" text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500\";\n } else {\n clazz +=\n \" text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-indigo-600\";\n }\n\n if (type === \"text-area\") {\n return (\n \n {...props}\n help={props.help ?? state.help}\n disabled={state.disabled ?? false}\n error={showError ? error : undefined}\n >\n {\n onChange(fromString(e.currentTarget.value));\n }}\n placeholder={placeholder ? placeholder : undefined}\n value={toString(value) ?? \"\"}\n // defaultValue={toString(value)}\n disabled={state.disabled}\n aria-invalid={showError}\n // aria-describedby=\"email-error\"\n class={clazz}\n />\n \n );\n }\n\n return (\n \n {...props}\n help={props.help ?? state.help}\n disabled={state.disabled ?? false}\n error={showError ? error : undefined}\n >\n {\n onChange(fromString(e.currentTarget.value));\n }}\n placeholder={placeholder ? placeholder : undefined}\n value={toString(value) ?? \"\"}\n // onBlur={() => {\n // onChange(fromString(value as any));\n // }}\n // defaultValue={toString(value)}\n disabled={state.disabled}\n aria-invalid={showError}\n // aria-describedby=\"email-error\"\n class={clazz}\n />\n \n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { FormProvider, UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField } from \"./forms.js\";\nimport { useField } from \"./useField.js\";\n\nfunction Option({\n label,\n disabled,\n isFirst,\n isLast,\n isSelected,\n onClick,\n}: {\n label: TranslatedString;\n isFirst?: boolean;\n isLast?: boolean;\n isSelected?: boolean;\n disabled?: boolean;\n onClick: () => void;\n}): VNode {\n let clazz = \"relative flex border p-4 focus:outline-none disabled:text-grey\";\n if (isFirst) {\n clazz += \" rounded-tl-md rounded-tr-md \";\n }\n if (isLast) {\n clazz += \" rounded-bl-md rounded-br-md \";\n }\n if (isSelected) {\n clazz += \" z-10 border-indigo-200 bg-indigo-50 \";\n } else {\n clazz += \" border-gray-200\";\n }\n if (disabled) {\n clazz +=\n \" cursor-not-allowed bg-gray-50 text-gray-500 ring-gray-200 text-gray\";\n } else {\n clazz += \" cursor-pointer\";\n }\n return (\n \n );\n}\n\nexport function noHandlerPropsAndNoContextForField(\n field: string | number | symbol,\n): never {\n throw Error(\n `Field ${field.toString()} doesn't have handler and is not in a form provider context.`,\n );\n}\n\nexport function InputArray(\n props: {\n fields: UIFormField[];\n labelField: string;\n } & UIFormProps,\n): VNode {\n const { fields, labelField, name, label, required, tooltip } = props;\n // const { value, onChange, state } = useField(name);\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n if (!props.handler && !fieldCtx) {\n throw Error(\"\");\n }\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const list = (value ?? []) as Array>;\n const [selectedIndex, setSelected] = useState(undefined);\n const selected =\n selectedIndex === undefined ? undefined : list[selectedIndex];\n \n return (\n
\n \n\n
\n {list.map((v, idx) => {\n const label = getValueDeeper(v, labelField.split(\".\"))\n return (\n {\n setSelected(selectedIndex === idx ? undefined : idx);\n }}\n />\n );\n })}\n {!state.disabled && (\n
\n {\n setSelected(\n selectedIndex === list.length ? undefined : list.length,\n );\n }}\n />\n
\n )}\n
\n {selectedIndex !== undefined && (\n /**\n * This form provider act as a substate of the parent form\n * Consider creating an InnerFormProvider since not every feature is expected\n */\n {\n // current state is ignored\n // the state is defined by the parent form\n\n // elements should be present in the state object since this is expected to be an array\n //@ts-ignore\n // return state.elements[selectedIndex];\n return {};\n }}\n onSubmit={(v) => {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1, v);\n onChange(newValue as any);\n setSelected(undefined);\n }}\n onUpdate={(v) => {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1, v);\n onChange(newValue as any);\n }}\n >\n
\n
\n \n
\n
\n \n )}\n {selectedIndex !== undefined && (\n
\n
\n {selected !== undefined && (\n {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1);\n onChange(newValue as any);\n setSelected(undefined);\n }}\n class=\"block rounded-md bg-red-600 px-3 py-2 text-center text-sm text-white shadow-sm hover:bg-red-500 \"\n >\n Remove\n \n )}\n
\n
\n )}\n
\n );\n}\n\n\n\nexport function getValueDeeper(\n object: Record,\n names: string[],\n): string {\n if (names.length === 0) {\n return object as any as string;\n }\n const [head, ...rest] = names;\n if (!head) {\n return getValueDeeper(object, rest);\n }\n if (object === undefined) {\n return \"\"\n }\n return getValueDeeper(object[head], rest);\n}\n\n\n", "import {\n AbsoluteTime,\n AmountJson,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, VNode, createContext, h } from \"preact\";\nimport { MutableRef, useState } from \"preact/hooks\";\n\nexport interface FormType {\n value: MutableRef>;\n initial?: Partial;\n readOnly?: boolean;\n onUpdate?: (v: Partial) => void;\n computeFormState?: (v: Partial) => FormState;\n}\n\nexport const FormContext = createContext| undefined>(undefined);\n\n/**\n * Map of {[field]:FieldUIOptions}\n * for every field of type\n * - any native (string, number, etc...)\n * - absoluteTime\n * - amountJson\n *\n * except for:\n * - object => recurse into\n * - array => behavior result and element field\n */\nexport type FormState = {\n [field in keyof T]?: T[field] extends AbsoluteTime\n ? FieldUIOptions\n : T[field] extends AmountJson\n ? FieldUIOptions\n : T[field] extends Array\n ? InputArrayFieldState

\n : T[field] extends object | undefined\n ? FormState\n : FieldUIOptions;\n};\n\n/**\n * Properties that can be defined by design or by computing state\n */\nexport type FieldUIOptions = {\n /* instruction to be shown in the field */\n placeholder?: TranslatedString;\n /* long text help to be shown on demand */\n tooltip?: TranslatedString;\n /* short text to be shown next to the field*/\n\n help?: TranslatedString;\n /* should show as disabled and readonly */\n disabled?: boolean;\n /* should not show */\n hidden?: boolean;\n\n /* show a mark as required*/\n required?: boolean;\n};\n\n/**\n * properties only to be defined on design time\n */\nexport interface UIFormProps\n extends FieldUIOptions {\n // property name of the object\n name: K;\n\n // label if the field\n label: TranslatedString;\n before?: Addon;\n after?: Addon;\n\n // converter to string and back\n converter?: StringConverter;\n\n handler?: UIFieldHandler;\n}\n\nexport type UIFieldHandler = {\n value: string | undefined;\n onChange: (s: string) => void;\n state: FieldUIOptions;\n error?: TranslatedString;\n};\n\nexport interface IconAddon {\n type: \"icon\";\n icon: VNode;\n}\nexport interface ButtonAddon {\n type: \"button\";\n onClick: () => void;\n children: ComponentChildren;\n}\nexport interface TextAddon {\n type: \"text\";\n text: TranslatedString;\n}\nexport type Addon = IconAddon | ButtonAddon | TextAddon;\n\nexport interface StringConverter {\n toStringUI: (v?: T) => string;\n fromStringUI: (v?: string) => T;\n}\n\nexport interface InputArrayFieldState

extends FieldUIOptions {\n elements?: FormState

[];\n}\n\nexport type FormProviderProps = Omit, \"value\"> & {\n onSubmit?: (v: Partial, s: FormState | undefined) => void;\n children?: ComponentChildren;\n};\n\nexport function FormProvider({\n children,\n initial,\n onUpdate: notify,\n onSubmit,\n computeFormState,\n readOnly,\n}: FormProviderProps): VNode {\n const [state, setState] = useState>(initial ?? {});\n const value = { current: state };\n const onUpdate = (v: typeof state) => {\n setState(v);\n if (notify) notify(v);\n };\n return (\n \n {\n e.preventDefault();\n //@ts-ignore\n if (onSubmit)\n onSubmit(\n value.current,\n !computeFormState ? undefined : computeFormState(value.current),\n );\n }}\n >\n {children}\n \n \n );\n}\n", "import { h as create, Fragment, VNode } from \"preact\";\nimport { Caption } from \"./Caption.js\";\nimport { Group } from \"./Group.js\";\nimport { InputAbsoluteTime } from \"./InputAbsoluteTime.js\";\nimport { InputAmount } from \"./InputAmount.js\";\nimport { InputArray } from \"./InputArray.js\";\nimport { InputChoiceHorizontal } from \"./InputChoiceHorizontal.js\";\nimport { InputChoiceStacked } from \"./InputChoiceStacked.js\";\nimport { InputFile } from \"./InputFile.js\";\nimport { InputInteger } from \"./InputInteger.js\";\nimport { InputSelectMultiple } from \"./InputSelectMultiple.js\";\nimport { InputSelectOne } from \"./InputSelectOne.js\";\nimport { InputText } from \"./InputText.js\";\nimport { InputTextArea } from \"./InputTextArea.js\";\nimport { InputToggle } from \"./InputToggle.js\";\nimport { Addon, StringConverter, UIFieldHandler } from \"./FormProvider.js\";\nimport { InternationalizationAPI, UIFieldElementDescription } from \"../index.browser.js\";\nimport { assertUnreachable, TranslatedString } from \"@gnu-taler/taler-util\";\nimport {UIFormFieldBaseConfig, UIFormElementConfig} from \"./ui-form.js\";\n/**\n * Constrain the type with the ui props\n */\ntype FieldType = {\n group: Parameters[0];\n caption: Parameters[0];\n array: Parameters>[0];\n file: Parameters>[0];\n selectOne: Parameters>[0];\n selectMultiple: Parameters>[0];\n text: Parameters>[0];\n textArea: Parameters>[0];\n choiceStacked: Parameters>[0];\n choiceHorizontal: Parameters>[0];\n absoluteTimeText: Parameters>[0];\n integer: Parameters>[0];\n toggle: Parameters>[0];\n amount: Parameters>[0];\n};\n\n/**\n * List all the form fields so typescript can type-check the form instance\n */\nexport type UIFormField =\n | { type: \"group\"; properties: FieldType[\"group\"] }\n | { type: \"caption\"; properties: FieldType[\"caption\"] }\n | { type: \"array\"; properties: FieldType[\"array\"] }\n | { type: \"file\"; properties: FieldType[\"file\"] }\n | { type: \"amount\"; properties: FieldType[\"amount\"] }\n | { type: \"selectOne\"; properties: FieldType[\"selectOne\"] }\n | {\n type: \"selectMultiple\";\n properties: FieldType[\"selectMultiple\"];\n }\n | { type: \"text\"; properties: FieldType[\"text\"] }\n | { type: \"textArea\"; properties: FieldType[\"textArea\"] }\n | {\n type: \"choiceStacked\";\n properties: FieldType[\"choiceStacked\"];\n }\n | {\n type: \"choiceHorizontal\";\n properties: FieldType[\"choiceHorizontal\"];\n }\n | { type: \"integer\"; properties: FieldType[\"integer\"] }\n | { type: \"toggle\"; properties: FieldType[\"toggle\"] }\n | {\n type: \"absoluteTimeText\";\n properties: FieldType[\"absoluteTimeText\"];\n };\n\ntype FieldComponentFunction = (\n props: FieldType[key],\n) => VNode;\n\ntype UIFormFieldMap = {\n [key in keyof FieldType]: FieldComponentFunction;\n};\n\n/**\n * Maps input type with component implementation\n */\nconst UIFormConfiguration: UIFormFieldMap = {\n group: Group,\n caption: Caption,\n //@ts-ignore\n array: InputArray,\n text: InputText,\n //@ts-ignore\n file: InputFile,\n textArea: InputTextArea,\n //@ts-ignore\n absoluteTimeText: InputAbsoluteTime,\n //@ts-ignore\n choiceStacked: InputChoiceStacked,\n //@ts-ignore\n choiceHorizontal: InputChoiceHorizontal,\n integer: InputInteger,\n //@ts-ignore\n selectOne: InputSelectOne,\n //@ts-ignore\n selectMultiple: InputSelectMultiple,\n //@ts-ignore\n toggle: InputToggle,\n //@ts-ignore\n amount: InputAmount,\n};\n\nexport function RenderAllFieldsByUiConfig({\n fields,\n}: {\n fields: UIFormField[];\n}): VNode {\n return create(\n Fragment,\n {},\n fields.map((field, i) => {\n const Component = UIFormConfiguration[\n field.type\n ] as FieldComponentFunction;\n return Component(field.properties);\n }),\n );\n}\n\n// type FormSet = {\n// Provider: typeof FormProvider;\n// InputLine: () => typeof InputLine;\n// InputChoiceHorizontal: () => typeof InputChoiceHorizontal;\n// };\n\n/**\n * Helper function that created a typed object.\n *\n * @returns\n */\n// export function createNewForm() {\n// const res: FormSet = {\n// Provider: FormProvider,\n// InputLine: () => InputLine,\n// InputChoiceHorizontal: () => InputChoiceHorizontal,\n// };\n// return {\n// Provider: res.Provider,\n// InputLine: res.InputLine(),\n// InputChoiceHorizontal: res.InputChoiceHorizontal(),\n// };\n// }\n\n/**\n * convert field configuration to render function\n * \n * @param i18n_ \n * @param fieldConfig \n * @param form \n * @returns \n */\nexport function convertUiField(\n i18n_: InternationalizationAPI,\n fieldConfig: UIFormElementConfig[],\n form: object,\n getConverterById: GetConverterById,\n): UIFormField[] {\n return fieldConfig.map((config) => {\n // NON input fields\n switch (config.type) {\n case \"caption\": {\n const resp: UIFormField = {\n type: config.type,\n properties: converBaseFieldsProps(i18n_, config),\n };\n return resp;\n }\n case \"group\": {\n const resp: UIFormField = {\n type: config.type,\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n fields: convertUiField(i18n_, config.fields, form, getConverterById),\n },\n };\n return resp;\n }\n }\n // Input Fields\n switch (config.type) {\n case \"array\": {\n return {\n type: \"array\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n labelField: config.labelFieldId,\n fields: convertUiField(i18n_, config.fields, form, getConverterById),\n },\n } as UIFormField;\n }\n case \"absoluteTimeText\": {\n return {\n type: \"absoluteTimeText\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"amount\": {\n return {\n type: \"amount\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById), \n currency: config.currency, \n },\n } as UIFormField;\n }\n case \"choiceHorizontal\": {\n return {\n type: \"choiceHorizontal\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"choiceStacked\": {\n return {\n type: \"choiceStacked\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n \n },\n }as UIFormField;\n }\n case \"file\":{\n return {\n type: \"file\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n accept: config.accept,\n maxBites: config.maxBytes,\n },\n } as UIFormField;\n }\n case \"integer\":{\n return {\n type: \"integer\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"selectMultiple\":{\n return {\n type: \"selectMultiple\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"selectOne\": {\n return {\n type: \"selectOne\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"text\": {\n return {\n type: \"text\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"textArea\": {\n return {\n type: \"text\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"toggle\": {\n return {\n type: \"toggle\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n default: {\n assertUnreachable(config);\n }\n }\n });\n}\n\n\n\nfunction getAddonById(_id: string | undefined): Addon {\n return undefined!;\n}\n\n\ntype GetConverterById = (\n id: string | undefined,\n config: unknown,\n) => StringConverter;\n\n\nfunction converInputFieldsProps(\n form: object,\n p: UIFormFieldBaseConfig,\n getConverterById: GetConverterById,\n) {\n return {\n converter: getConverterById(p.converterId, p),\n handler: getValueDeeper2(form, p.id.split(\".\")),\n name: p.name,\n required: p.required,\n disabled: p.disabled,\n help: p.help,\n placeholder: p.placeholder,\n tooltip: p.tooltip,\n label: p.label as TranslatedString,\n };\n}\n\nfunction converBaseFieldsProps(\n i18n_: InternationalizationAPI,\n p: UIFieldElementDescription,\n) {\n return {\n after: getAddonById(p.addonAfterId),\n before: getAddonById(p.addonBeforeId),\n hidden: p.hidden,\n name: p.name,\n help: i18n_.str`${p.help}`,\n label: i18n_.str`${p.label}`,\n tooltip: i18n_.str`${p.tooltip}`,\n };\n}\n\nexport function getValueDeeper2(\n object: Record,\n names: string[],\n): UIFieldHandler {\n if (names.length === 0) return object as UIFieldHandler;\n const [head, ...rest] = names;\n if (!head) {\n return getValueDeeper2(object, rest);\n }\n if (object === undefined) {\n throw Error(\"handler not found\");\n }\n return getValueDeeper2(object[head], rest);\n}\n\n\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { LabelWithTooltipMaybeRequired, RenderAddon } from \"./InputLine.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField, convertUiField } from \"./forms.js\";\nimport { Addon, FormProvider } from \"./FormProvider.js\";\nimport { useField } from \"./useField.js\";\nimport { useTranslationContext } from \"../index.browser.js\";\nimport { getConverterById } from \"./converter.js\";\n\ninterface Props {\n label: TranslatedString;\n tooltip?: TranslatedString;\n help?: TranslatedString;\n before?: Addon;\n after?: Addon;\n fields: UIFormField[];\n}\n\nexport function Group({\n before,\n after,\n label,\n tooltip,\n help,\n fields,\n}: Props): VNode {\n return (\n

\n {before !== undefined && }\n \n {after !== undefined && }\n {help && (\n

\n {help}\n

\n )}\n
\n \n
\n
\n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\";\nimport { format, parse } from \"date-fns\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { Calendar } from \"./Calendar.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputAbsoluteTime(\n properties: { pattern?: string } & UIFormProps,\n): VNode {\n const pattern = properties.pattern ?? \"dd/MM/yyyy\";\n const [open, setOpen] = useState(false);\n\n //FIXME: remove deprecated\n const fieldCtx = useField(properties.name);\n const { value, onChange } =\n properties.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(properties.name);\n return (\n \n \n type=\"text\"\n after={{\n type: \"button\",\n onClick: () => {\n setOpen(true);\n },\n // icon: ,\n children: (\n \n \n \n ),\n }}\n converter={{\n //@ts-ignore\n fromStringUI: (v): AbsoluteTime | undefined => {\n if (!v) return undefined;\n try {\n const t_ms = parse(v, pattern, Date.now()).getTime();\n return AbsoluteTime.fromMilliseconds(t_ms);\n } catch (e) {\n return undefined;\n }\n },\n //@ts-ignore\n toStringUI: (v: AbsoluteTime | undefined) => {\n return !v || !v.t_ms\n ? undefined\n : v.t_ms === \"never\"\n ? \"never\"\n : format(v.t_ms, pattern);\n },\n }}\n {...properties}\n />\n {open && (\n setOpen(false)}>\n {\n onChange(v as any);\n setOpen(false);\n }}\n />\n \n )}\n {/* {open &&\n setOpen(false)} >\n {\n onChange(v as any)\n }}\n onConfirm={() => {\n setOpen(false)\n }} />\n } */}\n \n );\n}\n", "import { ComponentChildren, VNode, h } from \"preact\";\n\nexport function Dialog({ children, onClose }: { onClose?: () => void; children: ComponentChildren }): VNode {\n return
\n
\n\n
\n
\n
e.stopPropagation()}>\n {children}\n
\n
\n
\n
\n}\n", "import { useContext } from \"preact/compat\";\nimport { FieldUIOptions, FormContext } from \"./FormProvider.js\";\nimport { TranslatedString } from \"@gnu-taler/taler-util\";\n\nexport interface InputFieldHandler {\n value: Type;\n onChange: (s: Type) => void;\n state: FieldUIOptions;\n error?: TranslatedString | undefined;\n}\n\n/**\n * @deprecated removing this so we don't depend on context to create a form\n * @param name \n * @returns \n */\nexport function useField(\n name: K,\n): InputFieldHandler | undefined {\n const ctx = useContext(FormContext);\n if (!ctx) {\n //no context, can't be used\n return undefined;\n }\n const {\n value: formValue,\n computeFormState,\n onUpdate: notifyUpdate,\n readOnly: readOnlyForm,\n } = ctx\n\n type P = typeof name;\n type V = T[P];\n const formState = computeFormState ? computeFormState(formValue.current) : {};\n\n const fieldValue = readField(formValue.current, String(name)) as V;\n\n const fieldState =\n readField>(formState, String(name)) ?? {};\n\n //compute default state\n const state = {\n disabled: readOnlyForm ? true : (fieldState.disabled ?? false),\n hidden: fieldState.hidden ?? false,\n help: fieldState.help,\n elements: \"elements\" in fieldState ? fieldState.elements ?? [] : [],\n };\n\n function onChange(value: V): void {\n // setCurrentValue(value);\n formValue.current = setValueDeeper(\n formValue.current,\n String(name).split(\".\"),\n value,\n );\n if (notifyUpdate) {\n notifyUpdate(formValue.current);\n }\n }\n\n return {\n value: fieldValue,\n onChange,\n state,\n };\n}\n\n/**\n * read the field of an object an support accessing it using '.'\n *\n * @param object\n * @param name\n * @returns\n */\nfunction readField(\n object: any,\n name: string,\n): T | undefined {\n return name.split(\".\").reduce((prev, current) => {\n return prev ? prev[current] : undefined;\n }, object);\n}\n\nfunction setValueDeeper(object: any, names: string[], value: any): any {\n if (names.length === 0) return value;\n const [head, ...rest] = names;\n if (object === undefined) {\n return { [head]: setValueDeeper({}, rest, value) };\n }\n return { ...object, [head]: setValueDeeper(object[head] ?? {}, rest, value) };\n}\n", "import { AmountJson, Amounts, TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputAmount(\n props: { currency?: string } & UIFormProps,\n): VNode {\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n const currency =\n !value || !(value as any).currency\n ? props.currency\n : (value as any).currency;\n return (\n \n {...props}\n type=\"text\"\n before={{\n type: \"text\",\n text: currency as TranslatedString,\n }}\n //@ts-ignore\n converter={\n props.converter ?? {\n fromStringUI: (v): AmountJson => {\n return (\n Amounts.parse(`${currency}:${v}`) ??\n Amounts.zeroOfCurrency(currency)\n );\n },\n toStringUI: (v: AmountJson) => {\n return v === undefined ? \"\" : Amounts.stringifyValue(v);\n },\n }\n }\n />\n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport interface ChoiceH {\n label: TranslatedString;\n value: V;\n}\n\nexport function InputChoiceHorizontal(\n props: {\n choices: ChoiceH[];\n } & UIFormProps,\n): VNode {\n const { choices, label, tooltip, help, required, converter } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n if (state.hidden) {\n return ;\n }\n\n return (\n
\n \n
\n
\n {choices.map((choice, idx) => {\n const convertedValue = converter?.fromStringUI(choice.value as any)\n const isFirst = idx === 0;\n const isLast = idx === choices.length - 1;\n let clazz =\n \"relative inline-flex items-center px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 focus:z-10\";\n if (convertedValue !== undefined && convertedValue === value) {\n clazz +=\n \" text-white bg-indigo-600 hover:bg-indigo-500 ring-2 ring-indigo-600 hover:ring-indigo-500\";\n } else {\n clazz += \" hover:bg-gray-100 border-gray-300\";\n }\n if (isFirst) {\n clazz += \" rounded-l-md\";\n } else {\n clazz += \" -ml-px\";\n }\n if (isLast) {\n clazz += \" rounded-r-md\";\n }\n return (\n {\n onChange(\n (value === choice.value ? undefined : convertedValue) as any,\n );\n }}\n >\n {choice.label}\n \n );\n })}\n
\n
\n {help && (\n

\n {help}\n

\n )}\n
\n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport interface ChoiceS {\n label: TranslatedString;\n description?: TranslatedString;\n value: V;\n}\n\nexport function InputChoiceStacked(\n props: {\n choices: ChoiceS[];\n } & UIFormProps,\n): VNode {\n const {\n choices,\n name,\n label,\n tooltip,\n help,\n placeholder,\n required,\n before,\n after,\n converter,\n } = props;\n\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n if (state.hidden) {\n return ;\n }\n\n return (\n
\n \n
\n
\n {choices.map((choice, idx) => {\n // const currentValue = !converter\n // ? choice.value\n // : converter.fromStringUI(choice.value) ?? \"\";\n\n let clazz =\n \"border relative block cursor-pointer rounded-lg bg-white px-6 py-4 shadow-sm focus:outline-none sm:flex sm:justify-between\";\n if (choice.value === value) {\n clazz +=\n \" border-transparent border-indigo-600 ring-2 ring-indigo-600\";\n } else {\n clazz += \" border-gray-300\";\n }\n\n return (\n \n );\n })}\n
\n
\n {help && (\n

\n {help}\n

\n )}\n
\n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputFile(\n props: { maxBites: number; accept?: string } & UIFormProps,\n): VNode {\n const {\n label,\n tooltip,\n required,\n help: propsHelp,\n maxBites,\n accept,\n } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const help = propsHelp ?? state.help;\n if (state.hidden) {\n return
;\n }\n\n const valueStr = !value ? \"\" : value.toString();\n const firstColon = valueStr.indexOf(\";\");\n\n const { fileName, dataUri } = valueStr.startsWith(\"file:\")\n ? {\n fileName: valueStr.substring(5, firstColon),\n dataUri: valueStr.substring(firstColon + 1),\n }\n : {\n fileName: \"\",\n dataUri: valueStr,\n };\n\n return (\n
\n \n {!dataUri ? (\n
\n
\n \n \n \n {!state.disabled && (\n
\n \n Upload a file\n {\n const f: FileList | null = e.currentTarget.files;\n if (!f || f.length != 1) {\n return onChange(undefined!);\n }\n if (f[0].size > maxBites) {\n return onChange(undefined!);\n }\n const fileName = f[0].name;\n return f[0].arrayBuffer().then((b) => {\n const b64 = window.btoa(\n new Uint8Array(b).reduce(\n (data, byte) => data + String.fromCharCode(byte),\n \"\",\n ),\n );\n if (fileName) {\n return onChange(\n `file:${fileName};data:${f[0].type};base64,${b64}` as any,\n );\n } else {\n return onChange(\n `data:${f[0].type};base64,${b64}` as any,\n );\n }\n });\n }}\n />\n \n {/*

or drag and drop

*/}\n
\n )}\n
\n
\n ) : (\n
\n {(dataUri as string).startsWith(\"data:image/\") ? (\n \n ) : (\n
\n )}\n {fileName ? (\n
\n {fileName}\n
\n ) : (\n \n )}\n\n {!state.disabled && (\n {\n onChange(undefined!);\n }}\n >\n Clear\n
\n )}\n
\n )}\n {help &&

{help}

}\n
\n );\n}\n", "import { VNode, h } from \"preact\";\nimport { InputLine } from \"./InputLine.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\n\nexport function InputInteger(\n props: UIFormProps,\n): VNode {\n return (\n {\n return !v ? 0 : Number.parseInt(v, 10);\n },\n //@ts-ignore\n toStringUI: (v?: number): string => {\n return v === undefined ? \"\" : String(v);\n },\n }}\n {...props}\n />\n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { ChoiceS } from \"./InputChoiceStacked.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputSelectMultiple(\n props: {\n choices: ChoiceS[];\n unique?: boolean;\n max?: number;\n } & UIFormProps,\n): VNode {\n const { converter, label, choices, placeholder, tooltip, required, unique, max } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const [filter, setFilter] = useState(undefined);\n const regex = new RegExp(`.*${filter}.*`, \"i\");\n const choiceMap = choices.reduce(\n (prev, curr) => {\n return { ...prev, [curr.value as string]: curr.label };\n },\n {} as Record,\n );\n\n const list = (value ?? []) as string[];\n const filteredChoices =\n filter === undefined\n ? undefined\n : choices.filter((v) => {\n return regex.test(v.label);\n });\n return (\n
\n \n {list.map((v, idx) => {\n return (\n \n {choiceMap[v]}\n {\n const newValue = [...list];\n newValue.splice(idx, 1);\n onChange(newValue as any);\n setFilter(undefined);\n }}\n class=\"group relative h-5 w-5 rounded-sm hover:bg-gray-500/20\"\n >\n Remove\n \n \n \n \n \n \n );\n })}\n\n {!state.disabled && (\n
\n {\n setFilter(e.currentTarget.value);\n }}\n placeholder={placeholder}\n class=\"w-full rounded-md border-0 bg-white py-1.5 pl-3 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6\"\n role=\"combobox\"\n aria-controls=\"options\"\n aria-expanded=\"false\"\n />\n {\n setFilter(filter === undefined ? \"\" : undefined);\n }}\n class=\"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none\"\n >\n \n \n \n \n\n {filteredChoices !== undefined && (\n \n {filteredChoices.map((v, idx) => {\n return (\n {\n setFilter(undefined);\n if (unique && list.indexOf(v.value as string) !== -1) {\n return;\n }\n if (max !== undefined && list.length >= max) {\n return;\n }\n const newValue = [...list];\n newValue.splice(0, 0, v.value as string);\n onChange(newValue as any);\n }}\n\n // tabindex=\"-1\"\n >\n {/* */}\n {v.label}\n\n {/* */}\n \n );\n })}\n\n {/* */}\n\n {/* */}\n \n )}\n
\n )}\n
\n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { ChoiceS } from \"./InputChoiceStacked.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputSelectOne(\n props: {\n choices: ChoiceS[];\n } & UIFormProps,\n): VNode {\n const { label, choices, placeholder, tooltip, required } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n\n const [filter, setFilter] = useState(undefined);\n const regex = new RegExp(`.*${filter}.*`, \"i\");\n const choiceMap = choices.reduce(\n (prev, curr) => {\n return { ...prev, [curr.value as string]: curr.label };\n },\n {} as Record,\n );\n\n const filteredChoices =\n filter === undefined\n ? undefined\n : choices.filter((v) => {\n return regex.test(v.label);\n });\n return (\n
\n \n {value ? (\n \n {choiceMap[value as string]}\n {\n onChange(undefined!);\n }}\n class=\"group relative h-5 w-5 rounded-sm hover:bg-gray-500/20\"\n >\n Remove\n \n \n \n \n \n \n ) : (\n
\n {\n setFilter(e.currentTarget.value);\n }}\n placeholder={placeholder}\n class=\"w-full rounded-md border-0 bg-white py-1.5 pl-3 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6\"\n role=\"combobox\"\n aria-controls=\"options\"\n aria-expanded=\"false\"\n />\n {\n setFilter(filter === undefined ? \"\" : undefined);\n }}\n class=\"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none\"\n >\n \n \n \n \n\n {filteredChoices !== undefined && (\n \n {filteredChoices.map((v, idx) => {\n return (\n {\n setFilter(undefined);\n onChange(v.value as any);\n }}\n\n // tabindex=\"-1\"\n >\n {/* */}\n {v.label}\n\n {/* */}\n \n );\n })}\n\n {/* */}\n\n {/* */}\n \n )}\n
\n )}\n
\n );\n}\n", "import { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\n\nexport function InputText(\n props: UIFormProps,\n): VNode {\n return ;\n}\n", "import { VNode, h } from \"preact\";\nimport { InputLine } from \"./InputLine.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\n\nexport function InputTextArea(\n props: UIFormProps,\n): VNode {\n return ;\n}\n", "import { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputToggle(\n props: UIFormProps,\n): VNode {\n const {\n name,\n label,\n tooltip,\n help,\n placeholder,\n required,\n before,\n after,\n converter,\n } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const isOn = !!value;\n return (\n
\n
\n \n {\n onChange(!isOn as any);\n }}\n >\n \n \n
\n
\n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { FormProvider, FormProviderProps, FormState } from \"./FormProvider.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField } from \"./forms.js\";\nimport { TranslatedString } from \"@gnu-taler/taler-util\";\n// import { FlexibleForm } from \"./ui-form.js\";\n\n/**\n * Flexible form uses a DoubleColumForm for design\n * and may have a dynamic properties defined by \n * behavior function.\n */\nexport interface FlexibleForm_Deprecated {\n design: DoubleColumnForm_Deprecated;\n behavior?: (form: Partial) => FormState;\n}\n\n/**\n * Double column form\n * \n * Form with sections, every sections have a title and may\n * have a description.\n * Every sections contain a set of fields.\n */\nexport type DoubleColumnForm_Deprecated = Array;\n\nexport type DoubleColumnFormSection_Deprecated = {\n title: TranslatedString;\n description?: TranslatedString;\n fields: UIFormField[];\n};\n\n/**\n * Form Provider implementation that use FlexibleForm\n * to defined behavior and fields.\n */\nexport function DefaultForm({\n initial,\n onUpdate,\n form,\n onSubmit,\n children,\n readOnly,\n}: Omit, \"computeFormState\"> & { form: FlexibleForm_Deprecated }): VNode {\n return (\n \n
\n {form.design.map((section, i) => {\n if (!section) return ;\n return (\n
\n
\n

\n {section.title}\n

\n {section.description && (\n

\n {section.description}\n

\n )}\n
\n
\n
\n
\n \n
\n
\n
\n
\n );\n })}\n
\n {children}\n \n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\"\nimport { getHours, getMinutes, getSeconds, setHours } from \"date-fns\"\nimport { Fragment, VNode, h } from \"preact\"\nimport { useTranslationContext } from \"../index.browser.js\"\n\nexport function TimePicker({ value, onChange, onConfirm }: { value: AbsoluteTime | undefined, onChange: (v: AbsoluteTime) => void, onConfirm: () => void }): VNode {\n const date = !value ? new Date() : new Date(AbsoluteTime.toStampMs(value))\n const hours = getHours(date) % 12\n const minutes = getMinutes(date)\n const seconds = getSeconds(date)\n\n const { i18n } = useTranslationContext()\n\n return \n
\n {/* time selection */}\n
\n
\n
\n \n \n \n :\n \n \n \n :\n \n \n \n
\n
\n \n \n
\n
\n
\n {/* clock */}\n
\n
\n\n \n
\n {/*
*/}\n
\n\n onChange(AbsoluteTime.fromStampMs(setHours(date, 12).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 114px; bottom: 224px;\">\n 0\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 1).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 169px; bottom: 209.263px;\">\n 1\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 2).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" data-selected={true} style=\"left: 209.263px; bottom: 169px;\" >\n 2\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 3).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 224px; bottom: 114px;\">\n 3\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 4).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 209.263px; bottom: 59px;\">\n 4\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 5).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 169px; bottom: 18.7372px;\">\n 5\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 6).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 114px; bottom: 4px;\">\n 6\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 7).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 59px; bottom: 18.7372px;\">\n 7\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 8).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 18.7372px; bottom: 59px;\">\n 8\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 9).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 4px; bottom: 114px;\">\n 9\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 10).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 18.7372px; bottom: 169px;\">\n 10\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 11).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 59px; bottom: 209.263px;\">\n 11\n \n
\n
\n
\n
\n
\n \n Confirm\n \n
\n
\n
\n}\n", "import {\n buildCodecForObject,\n buildCodecForUnion,\n Codec,\n codecForBoolean,\n codecForConstString,\n codecForLazy,\n codecForList,\n codecForNumber,\n codecForString,\n codecForTimestamp,\n codecOptional,\n Integer,\n TalerProtocolTimestamp,\n} from \"@gnu-taler/taler-util\";\n\nexport type FormConfiguration = DoubleColumnForm;\n\nexport type DoubleColumnForm = {\n type: \"double-column\";\n design: DoubleColumnFormSection[];\n // behavior?: (form: Partial) => FormState;\n};\n\nexport type DoubleColumnFormSection = {\n title: string;\n description?: string;\n fields: UIFormElementConfig[];\n};\n\n// export interface BaseForm {\n// state: TalerExchangeApi.AmlState;\n// threshold: AmountJson;\n// }\n\nexport type UIFormElementConfig =\n | UIFormElementGroup\n | UIFormElementCaption\n | UIFormFieldAbsoluteTime\n | UIFormFieldAmount\n | UIFormFieldArray\n | UIFormFieldChoiseHorizontal\n | UIFormFieldChoiseStacked\n | UIFormFieldFile\n | UIFormFieldInteger\n | UIFormFieldSelectMultiple\n | UIFormFieldSelectOne\n | UIFormFieldText\n | UIFormFieldTextArea\n | UIFormFieldToggle;\n\ntype UIFormFieldAbsoluteTime = {\n type: \"absoluteTimeText\";\n max?: TalerProtocolTimestamp;\n min?: TalerProtocolTimestamp;\n pattern: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldAmount = {\n type: \"amount\";\n max?: Integer;\n min?: Integer;\n currency: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldArray = {\n type: \"array\";\n // id of the field shown when the array is collapsed\n labelFieldId: UIHandlerId;\n fields: UIFormElementConfig[];\n} & UIFormFieldBaseConfig;\n\ntype UIFormElementCaption = { type: \"caption\" } & UIFieldElementDescription;\n\ntype UIFormElementGroup = {\n type: \"group\";\n fields: UIFormElementConfig[];\n} & UIFieldElementDescription;\n\ntype UIFormFieldChoiseHorizontal = {\n type: \"choiceHorizontal\";\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldChoiseStacked = {\n type: \"choiceStacked\";\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldFile = {\n type: \"file\";\n maxBytes?: Integer;\n minBytes?: Integer;\n // comma-separated list of one or more file types\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers\n accept?: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldInteger = {\n type: \"integer\";\n max?: Integer;\n min?: Integer;\n} & UIFormFieldBaseConfig;\n\ninterface SelectUiChoice {\n label: string;\n description?: string;\n value: string;\n}\n\ntype UIFormFieldSelectMultiple = {\n type: \"selectMultiple\";\n max?: Integer;\n min?: Integer;\n unique?: boolean;\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldSelectOne = {\n type: \"selectOne\";\n choices: Array;\n} & UIFormFieldBaseConfig;\ntype UIFormFieldText = { type: \"text\" } & UIFormFieldBaseConfig;\ntype UIFormFieldTextArea = { type: \"textArea\" } & UIFormFieldBaseConfig;\ntype UIFormFieldToggle = { type: \"toggle\" } & UIFormFieldBaseConfig;\n\nexport type UIFieldElementDescription = {\n /* label if the field, visible for the user */\n label: string;\n\n /* long text to be shown on user demand */\n tooltip?: string;\n\n /* short text to be shown close to the field, usually below and dimmer*/\n help?: string;\n\n /* name of the field, useful for a11y */\n name: string;\n\n /* if the field should be initially hidden */\n hidden?: boolean;\n\n /* ui element to show before */\n addonBeforeId?: string;\n\n /* ui element to show after */\n addonAfterId?: string;\n};\n\nexport type UIFormFieldBaseConfig = UIFieldElementDescription & {\n /* example to be shown inside the field */\n placeholder?: string;\n\n /* show a mark as required */\n required?: boolean;\n\n /* readonly and dim */\n disabled?: boolean;\n\n /* conversion id to convert the string into the value type\n the id should be known to the ui impl\n */\n converterId?: string;\n\n /* property id of the form */\n id: UIHandlerId;\n};\n\ndeclare const __handlerId: unique symbol;\nexport type UIHandlerId = string & { [__handlerId]: true };\n\n// FIXME: validate well formed ui field id\nconst codecForUiFieldId = codecForString as () => Codec;\n\nconst codecForUIFormFieldBaseDescriptionTemplate = <\n T extends UIFieldElementDescription,\n>() =>\n buildCodecForObject()\n .property(\"addonAfterId\", codecOptional(codecForString()))\n .property(\"addonBeforeId\", codecOptional(codecForString()))\n .property(\"hidden\", codecOptional(codecForBoolean()))\n .property(\"help\", codecOptional(codecForString()))\n .property(\"label\", codecForString())\n .property(\"name\", codecForString())\n .property(\"tooltip\", codecOptional(codecForString()));\n\nconst codecForUIFormFieldBaseConfigTemplate = <\n T extends UIFormFieldBaseConfig,\n>() =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"id\", codecForUiFieldId())\n .property(\"converterId\", codecOptional(codecForString()))\n .property(\"disabled\", codecOptional(codecForBoolean()))\n .property(\"required\", codecOptional(codecForBoolean()))\n .property(\"placeholder\", codecOptional(codecForString()));\n\nconst codecForUiFormFieldAbsoluteTime = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"absoluteTimeText\"))\n .property(\"pattern\", codecForString())\n .property(\"max\", codecOptional(codecForTimestamp))\n .property(\"min\", codecOptional(codecForTimestamp))\n .build(\"UIFormFieldAbsoluteTime\");\n\nconst codecForUiFormFieldAmount = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"amount\"))\n .property(\"currency\", codecForString())\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldAmount\");\n\nconst codecForUiFormFieldArray = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"array\"))\n .property(\"labelFieldId\", codecForUiFieldId())\n .property(\"tooltip\", codecOptional(codecForString()))\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"UIFormFieldArray\");\n\nconst codecForUiFormFieldCaption = (): Codec =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"type\", codecForConstString(\"caption\"))\n .build(\"UIFormFieldCaption\");\n\nconst codecForUiFormSelectUiChoice = (): Codec =>\n buildCodecForObject()\n .property(\"description\", codecOptional(codecForString()))\n .property(\"label\", codecForString())\n .property(\"value\", codecForString())\n .build(\"SelectUiChoice\");\n\nconst codecForUiFormFieldChoiceHorizontal =\n (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"choiceHorizontal\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldChoiseHorizontal\");\n\nconst codecForUiFormFieldChoiceStacked = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"choiceStacked\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldChoiseStacked\");\n\nconst codecForUiFormFieldFile = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"file\"))\n .property(\"accept\", codecOptional(codecForString()))\n .property(\"maxBytes\", codecOptional(codecForNumber()))\n .property(\"minBytes\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldFile\");\n\nconst codecForUiFormFieldGroup = (): Codec =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"type\", codecForConstString(\"group\"))\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"UiFormFieldGroup\");\n\nconst codecForUiFormFieldInteger = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"integer\"))\n // .property(\"properties\", codecForUIFormFieldBaseConfig())\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldInteger\");\n\nconst codecForUiFormFieldSelectMultiple =\n (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"selectMultiple\"))\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .property(\"unique\", codecOptional(codecForBoolean()))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UiFormFieldSelectMultiple\");\n\nconst codecForUiFormFieldSelectOne = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"selectOne\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldSelectOne\");\n\nconst codecForUiFormFieldText = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"text\"))\n .build(\"UIFormFieldText\");\n\nconst codecForUiFormFieldTextArea = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"textArea\"))\n .build(\"UIFormFieldTextArea\");\n\nconst codecForUiFormFieldToggle = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"toggle\"))\n .build(\"UIFormFieldToggle\");\n\nconst codecForUiFormField = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"array\", codecForLazy(codecForUiFormFieldArray))\n .alternative(\"group\", codecForLazy(codecForUiFormFieldGroup))\n .alternative(\"absoluteTimeText\", codecForUiFormFieldAbsoluteTime())\n .alternative(\"amount\", codecForUiFormFieldAmount())\n .alternative(\"caption\", codecForUiFormFieldCaption())\n .alternative(\"choiceHorizontal\", codecForUiFormFieldChoiceHorizontal())\n .alternative(\"choiceStacked\", codecForUiFormFieldChoiceStacked())\n .alternative(\"file\", codecForUiFormFieldFile())\n .alternative(\"integer\", codecForUiFormFieldInteger())\n .alternative(\"selectMultiple\", codecForUiFormFieldSelectMultiple())\n .alternative(\"selectOne\", codecForUiFormFieldSelectOne())\n .alternative(\"text\", codecForUiFormFieldText())\n .alternative(\"textArea\", codecForUiFormFieldTextArea())\n .alternative(\"toggle\", codecForUiFormFieldToggle())\n .build(\"UIFormField\");\n\nconst codecForDoubleColumnFormSection = (): Codec =>\n buildCodecForObject()\n .property(\"title\", codecForString())\n .property(\"description\", codecOptional(codecForString()))\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"DoubleColumnFormSection\");\n\nconst codecForDoubleColumnForm = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"double-column\"))\n .property(\"design\", codecForList(codecForDoubleColumnFormSection()))\n .build(\"DoubleColumnForm\");\n\nconst codecForFormConfiguration = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"double-column\", codecForDoubleColumnForm())\n .build(\"FormConfiguration\");\n\nconst codecForFormMetadata = (): Codec =>\n buildCodecForObject()\n .property(\"label\", codecForString())\n .property(\"id\", codecForString())\n .property(\"version\", codecForNumber())\n .property(\"config\", codecForFormConfiguration())\n .build(\"FormMetadata\");\n\nexport const codecForUIForms = (): Codec =>\n buildCodecForObject()\n .property(\"forms\", codecForList(codecForFormMetadata()))\n .build(\"UiForms\");\n\nexport type FormMetadata = {\n label: string;\n id: string;\n version: number;\n config: FormConfiguration;\n};\n\nexport interface UiForms {\n // Where libeufin backend is localted\n // default: window.origin without \"webui/\"\n forms: Array;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n AmountJson,\n Amounts,\n TalerExchangeApi,\n} from \"@gnu-taler/taler-util\";\nimport { format, parse } from \"date-fns\";\nimport { StringConverter } from \"./FormProvider.js\";\n\nexport const amlStateConverter = {\n toStringUI: stringifyAmlState,\n fromStringUI: parseAmlState,\n};\n\nfunction stringifyAmlState(s: TalerExchangeApi.AmlState | undefined): string {\n if (s === undefined) return \"\";\n switch (s) {\n case TalerExchangeApi.AmlState.normal:\n return \"normal\";\n case TalerExchangeApi.AmlState.pending:\n return \"pending\";\n case TalerExchangeApi.AmlState.frozen:\n return \"frozen\";\n }\n}\n\nfunction parseAmlState(s: string | undefined): TalerExchangeApi.AmlState {\n switch (s) {\n case \"normal\":\n return TalerExchangeApi.AmlState.normal;\n case \"pending\":\n return TalerExchangeApi.AmlState.pending;\n case \"frozen\":\n return TalerExchangeApi.AmlState.frozen;\n default:\n throw Error(`unknown AML state: ${s}`);\n }\n}\n\nconst nullConverter: StringConverter = {\n fromStringUI(v: string | undefined): string {\n return v ?? \"\";\n },\n toStringUI(v: unknown): string {\n return v as string;\n },\n};\n\nfunction amountConverter(config: any): StringConverter {\n const currency = config[\"currency\"];\n if (!currency || typeof currency !== \"string\") {\n throw Error(`amount converter needs a currency`);\n }\n return {\n fromStringUI(v: string | undefined): AmountJson {\n // FIXME: requires currency\n return (\n Amounts.parse(`${currency}:${v}`) ?? Amounts.zeroOfCurrency(currency)\n );\n },\n toStringUI(v: unknown): string {\n return v === undefined ? \"\" : Amounts.stringifyValue(v as AmountJson);\n },\n };\n}\n\nfunction absTimeConverter(config: any): StringConverter {\n const pattern = config[\"pattern\"];\n if (!pattern || typeof pattern !== \"string\") {\n throw Error(`absTime converter needs a pattern`);\n }\n return {\n fromStringUI(v: string | undefined): AbsoluteTime {\n if (v === undefined) {\n return AbsoluteTime.never();\n }\n try {\n const time = parse(v, pattern, new Date());\n return AbsoluteTime.fromMilliseconds(time.getTime());\n } catch (e) {\n return AbsoluteTime.never();\n }\n },\n toStringUI(v: unknown): string {\n if (v === undefined) return \"\";\n const d = v as AbsoluteTime;\n if (d.t_ms === \"never\") return \"never\";\n try {\n return format(d.t_ms, pattern);\n } catch (e) {\n return \"\";\n }\n },\n };\n}\n\nexport function getConverterById(\n id: string | undefined,\n config: unknown,\n): StringConverter {\n if (id === \"Taler.AbsoluteTime\") {\n // @ts-expect-error check this\n return absTimeConverter(config);\n }\n if (id === \"Taler.Amount\") {\n // @ts-expect-error check this\n return amountConverter(config);\n }\n if (id === \"TalerExchangeApi.AmlState\") {\n // @ts-expect-error check this\n return amlStateConverter;\n }\n return nullConverter as StringConverter;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\nimport { setupI18n } from \"@gnu-taler/taler-util\";\nimport {\n ComponentChild,\n ComponentChildren,\n Fragment,\n FunctionalComponent,\n FunctionComponent,\n h,\n JSX,\n render,\n VNode,\n} from \"preact\";\nimport { useEffect, useErrorBoundary, useState } from \"preact/hooks\";\nimport { ExampleItemSetup } from \"./tests/hook.js\";\n\nconst Page: FunctionalComponent = ({ children }): VNode => {\n return (\n \n {children}\n
\n );\n};\n\nconst SideBar: FunctionalComponent<{ width: number }> = ({\n width,\n children,\n}): VNode => {\n return (\n \n {children}\n
\n );\n};\n\nconst ResizeHandleDiv: FunctionalComponent<\n JSX.HTMLAttributes\n> = ({ children, ...props }): VNode => {\n return (\n \n {children}\n
\n );\n};\n\nconst Content: FunctionalComponent = ({ children }): VNode => {\n return (\n \n {children}\n
\n );\n};\n\nfunction findByGroupComponentName(\n allExamples: Group[],\n group: string,\n component: string,\n name: string,\n): ExampleItem | undefined {\n const gl = allExamples.filter((e) => e.title === group);\n if (gl.length === 0) {\n return undefined;\n }\n const cl = gl[0].list.filter((l) => l.name === component);\n if (cl.length === 0) {\n return undefined;\n }\n const el = cl[0].examples.filter((c) => c.name === name);\n if (el.length === 0) {\n return undefined;\n }\n return el[0];\n}\n\nfunction getContentForExample(\n item: ExampleItem | undefined,\n allExamples: Group[],\n): FunctionalComponent {\n if (!item)\n return function SelectExampleMessage() {\n return
select example from the list on the left
;\n };\n const example = findByGroupComponentName(\n allExamples,\n item.group,\n item.component,\n item.name,\n );\n if (!example) {\n return function ExampleNotFoundMessage() {\n return
example not found
;\n };\n }\n return () => example.render.component(example.render.props);\n}\n\nfunction ExampleList({\n name,\n list,\n selected,\n onSelectStory,\n}: {\n name: string;\n list: {\n name: string;\n examples: ExampleItem[];\n }[];\n selected: ExampleItem | undefined;\n onSelectStory: (i: ExampleItem, id: string) => void;\n}): VNode {\n const [isOpen, setOpen] = useState(selected && selected.group === name);\n return (\n
    \n setOpen(!isOpen)}\n >\n {name}\n
\n
\n {list.map((k) => (\n
  • \n
    \n
    {k.name}
    \n {k.examples.map((r, i) => {\n const e = encodeURIComponent;\n const eId = `${e(r.group)}-${e(r.component)}-${e(r.name)}`;\n const isSelected =\n selected &&\n selected.component === r.component &&\n selected.group === r.group &&\n selected.name === r.name;\n return (\n \n {\n e.preventDefault();\n location.hash = `#${eId}`;\n onSelectStory(r, eId);\n history.pushState({}, \"\", `#${eId}`);\n }}\n >\n {r.name}\n \n \n );\n })}\n
    \n
  • \n ))}\n
    \n \n );\n}\n\n/**\n * Prevents the UI from redirecting and inform the dev\n * where the should have redirected\n * @returns\n */\nfunction PreventLinkNavigation({\n children,\n}: {\n children: ComponentChildren;\n}): VNode {\n return (\n {\n let t: any = e.target;\n do {\n if (t.localName === \"a\" && t.getAttribute(\"href\")) {\n alert(`should navigate to: ${t.attributes.href.value}`);\n e.stopImmediatePropagation();\n e.stopPropagation();\n e.preventDefault();\n return false;\n }\n } while ((t = t.parentNode));\n return true;\n }}\n >\n {children}\n
    \n );\n}\n\nfunction ErrorReport({\n children,\n selected,\n}: {\n children: ComponentChild;\n selected: ExampleItem | undefined;\n}): VNode {\n const [error, resetError] = useErrorBoundary();\n //if there is an error, reset when unloading this component\n useEffect(() => (error ? resetError : undefined));\n if (error) {\n return (\n
    \n

    Error was thrown trying to render

    \n {selected && (\n
      \n
    • \n group: {selected.group}\n
    • \n
    • \n component: {selected.component}\n
    • \n
    • \n example: {selected.name}\n
    • \n
    • \n args:{\" \"}\n
      {JSON.stringify(selected.render.props, undefined, 2)}
      \n
    • \n
    \n )}\n

    {error.message}

    \n
    {error.stack}
    \n
    \n );\n }\n return {children};\n}\n\nfunction getSelectionFromLocationHash(\n hash: string,\n allExamples: Group[],\n): ExampleItem | undefined {\n if (!hash) return undefined;\n const parts = hash.substring(1).split(\"-\");\n if (parts.length < 3) return undefined;\n return findByGroupComponentName(\n allExamples,\n decodeURIComponent(parts[0]),\n decodeURIComponent(parts[1]),\n decodeURIComponent(parts[2]),\n );\n}\n\nfunction parseExampleImport(\n group: string,\n componentName: string,\n im: MaybeComponent,\n): ComponentItem {\n const examples: ExampleItem[] = Object.entries(im)\n .filter(([k]) => k !== \"default\")\n .map(([exampleName, exampleValue]): ExampleItem => {\n if (!exampleValue) {\n throw Error(\n `example \"${exampleName}\" from component \"${componentName}\" in group \"${group}\" is undefined`,\n );\n }\n\n if (typeof exampleValue === \"function\") {\n return {\n group,\n component: componentName,\n name: exampleName,\n render: {\n component: exampleValue as FunctionComponent,\n props: {},\n contextProps: {},\n },\n };\n }\n const v: any = exampleValue;\n if (\n \"component\" in v &&\n typeof v.component === \"function\" &&\n \"props\" in v\n ) {\n return {\n group,\n component: componentName,\n name: exampleName,\n render: v,\n };\n }\n throw Error(\n `example \"${exampleName}\" from component \"${componentName}\" in group \"${group}\" doesn't follow one of the two ways of example`,\n );\n });\n return {\n name: componentName,\n examples,\n };\n}\n\nexport function parseGroupImport(\n groups: Record,\n): Group[] {\n return Object.entries(groups).map(([groupName, value]) => {\n return {\n title: groupName,\n list: Object.entries(value).flatMap(([key, value]) =>\n folder(groupName, value),\n ),\n };\n });\n}\n\nexport interface Group {\n title: string;\n list: ComponentItem[];\n}\n\nexport interface ComponentItem {\n name: string;\n examples: ExampleItem[];\n}\n\nexport interface ExampleItem {\n group: string;\n component: string;\n name: string;\n render: ExampleItemSetup;\n}\n\ntype ComponentOrFolder = MaybeComponent | MaybeFolder;\ninterface MaybeFolder {\n default?: { title: string };\n // [exampleName: string]: FunctionalComponent;\n}\ninterface MaybeComponent {\n // default?: undefined;\n [exampleName: string]: undefined | object;\n}\n\nfunction folder(groupName: string, value: ComponentOrFolder): ComponentItem[] {\n let title: string | undefined = undefined;\n try {\n title =\n typeof value === \"object\" &&\n typeof value.default === \"object\" &&\n value.default !== undefined &&\n \"title\" in value.default &&\n typeof value.default.title === \"string\"\n ? value.default.title\n : undefined;\n } catch (e) {\n throw Error(\n `Could not defined if it is component or folder ${groupName}: ${JSON.stringify(\n value,\n undefined,\n 2,\n )}`,\n );\n }\n if (title) {\n const c = parseExampleImport(groupName, title, value as MaybeComponent);\n return [c];\n }\n return Object.entries(value).flatMap(([subkey, value]) =>\n folder(groupName, value),\n );\n}\n\ninterface Props {\n getWrapperForGroup: (name: string) => FunctionComponent;\n examplesInGroups: Group[];\n langs: Record;\n}\n\nfunction Application({\n langs,\n examplesInGroups,\n getWrapperForGroup,\n}: Props): VNode {\n const url = new URL(window.location.href);\n const initialSelection = getSelectionFromLocationHash(\n url.hash,\n examplesInGroups,\n );\n\n const currentLang = url.searchParams.get(\"lang\") || \"en\";\n\n if (!langs[\"en\"]) {\n langs[\"en\"] = {};\n }\n setupI18n(currentLang, langs);\n\n const [selected, updateSelected] = useState(\n initialSelection,\n );\n const [sidebarWidth, setSidebarWidth] = useState(200);\n useEffect(() => {\n if (url.hash) {\n const hash = url.hash.substring(1);\n const found = document.getElementById(hash);\n if (found) {\n setTimeout(() => {\n found.scrollIntoView({\n block: \"center\",\n });\n }, 50);\n }\n }\n }, []);\n\n const GroupWrapper = getWrapperForGroup(selected?.group || \"default\");\n const ExampleContent = getContentForExample(selected, examplesInGroups);\n\n //style={{ \"--with-size\": `${sidebarWidth}px` }}\n return (\n \n {/* */}\n \n
    \n Language:\n {\n const url = new URL(window.location.href);\n url.searchParams.set(\"lang\", e.currentTarget.value);\n window.location.href = url.href;\n }}\n >\n {Object.keys(langs).map((l) => (\n \n ))}\n \n
    \n {examplesInGroups.map((group) => (\n {\n document.getElementById(htmlId)?.scrollIntoView({\n block: \"center\",\n });\n updateSelected(item);\n }}\n />\n ))}\n
    \n
    \n {/* {\n setSidebarWidth((s) => s + x);\n }}\n /> */}\n \n \n \n \n \n \n \n \n \n
    \n );\n}\n\nexport interface Options {\n id?: string;\n strings?: any;\n getWrapperForGroup?: (name: string) => FunctionComponent;\n}\n\nexport function renderStories(\n groups: Record,\n options: Options = {},\n): void {\n const examples = parseGroupImport(groups);\n\n try {\n const cid = options.id ?? \"container\";\n const container = document.getElementById(cid);\n if (!container) {\n throw Error(\n `container with id ${cid} not found, can't mount page contents`,\n );\n }\n render(\n Fragment)}\n langs={options.strings ?? { en: {} }}\n />,\n container,\n );\n } catch (e) {\n console.error(\"got error\", e);\n if (e instanceof Error) {\n document.body.innerText = `Fatal error: \"${e.message}\". Please report this bug at https://bugs.gnunet.org/.`;\n }\n }\n}\n\nfunction ResizeHandle({ onUpdate }: { onUpdate: (x: number) => void }): VNode {\n const [start, setStart] = useState(undefined);\n return (\n {\n setStart(e.pageX);\n console.log(\"active\", e.pageX);\n return false;\n }}\n onMouseMove={(e: any) => {\n if (start !== undefined) {\n onUpdate(e.pageX - start);\n }\n return false;\n }}\n onMouseUp={() => {\n setStart(undefined);\n return false;\n }}\n />\n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n BrowserHashNavigationProvider,\n Loading,\n TalerWalletIntegrationBrowserProvider,\n TranslationProvider\n} from \"@gnu-taler/web-util/browser\";\nimport { h } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { SWRConfig } from \"swr\";\nimport { Routing } from \"./Routing.js\";\nimport { SettingsProvider } from \"./context/settings.js\";\nimport { strings } from \"./i18n/strings.js\";\nimport { AppUiSettings, fetchSettings } from \"./settings.js\";\nimport { canonicalizeBaseUrl } from \"./utils.js\";\nconst WITH_LOCAL_STORAGE_CACHE = false;\n\nexport function App() {\n const [settings, setSettings] = useState();\n useEffect(() => {\n fetchSettings(setSettings);\n }, []);\n if (!settings) return ;\n\n // const baseUrl = getInitialBackendBaseURL(settings.backendBaseURL);\n return (\n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\n// // @ts-expect-error creating a new property for window object\n// window.setGlobalLogLevelFromString = setGlobalLogLevelFromString;\n// // @ts-expect-error creating a new property for window object\n// window.getGlobalLevel = getGlobalLogLevel;\n\nfunction localStorageProvider(): Map {\n const map = new Map(JSON.parse(localStorage.getItem(\"app-cache\") || \"[]\"));\n\n window.addEventListener(\"beforeunload\", () => {\n const appCache = JSON.stringify(Array.from(map.entries()));\n localStorage.setItem(\"app-cache\", appCache);\n });\n return map;\n}\n\nfunction getInitialBackendBaseURL(\n backendFromSettings: string | undefined,\n): string {\n const overrideUrl =\n typeof localStorage !== \"undefined\"\n ? localStorage.getItem(\"api-base-url\")\n : undefined;\n let result: string;\n\n if (!overrideUrl) {\n // normal path\n if (!backendFromSettings) {\n console.error(\n \"ERROR: backendBaseURL was overridden by a setting file and missing. Setting value to 'window.origin'\",\n );\n result = window.origin;\n } else {\n result = backendFromSettings;\n }\n } else {\n // testing/development path\n result = overrideUrl;\n }\n try {\n return canonicalizeBaseUrl(result);\n } catch (e) {\n // fall back\n return canonicalizeBaseUrl(window.origin);\n }\n}\n", "import { useRef, useMemo, useCallback, useDebugValue } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';\nimport { OBJECT, SWRConfig as SWRConfig$1, defaultConfig, withArgs, SWRGlobalState, serialize, createCacheHelper, isUndefined, getTimestamp, UNDEFINED, isFunction, internalMutate, useIsomorphicLayoutEffect, subscribeCallback, IS_SERVER, rAF, IS_REACT_LEGACY, mergeObjects, revalidateEvents } from 'swr/_internal';\nexport { mutate, preload, useSWRConfig } from 'swr/_internal';\n\nconst WITH_DEDUPE = {\n dedupe: true\n};\nconst useSWRHandler = (_key, fetcher, config)=>{\n const { cache , compare , suspense , fallbackData , revalidateOnMount , revalidateIfStale , refreshInterval , refreshWhenHidden , refreshWhenOffline , keepPreviousData } = config;\n const [EVENT_REVALIDATORS, MUTATION, FETCH] = SWRGlobalState.get(cache);\n // `key` is the identifier of the SWR `data` state, `keyInfo` holds extra\n // states such as `error` and `isValidating` inside,\n // all of them are derived from `_key`.\n // `fnArg` is the argument/arguments parsed from the key, which will be passed\n // to the fetcher.\n const [key, fnArg] = serialize(_key);\n // If it's the initial render of this hook.\n const initialMountedRef = useRef(false);\n // If the hook is unmounted already. This will be used to prevent some effects\n // to be called after unmounting.\n const unmountedRef = useRef(false);\n // Refs to keep the key and config.\n const keyRef = useRef(key);\n const fetcherRef = useRef(fetcher);\n const configRef = useRef(config);\n const getConfig = ()=>configRef.current;\n const isActive = ()=>getConfig().isVisible() && getConfig().isOnline();\n const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache, key);\n const stateDependencies = useRef({}).current;\n const fallback = isUndefined(fallbackData) ? config.fallback[key] : fallbackData;\n const isEqual = (prev, current)=>{\n let equal = true;\n for(const _ in stateDependencies){\n const t = _;\n if (t === 'data') {\n if (!compare(current[t], prev[t])) {\n if (isUndefined(prev[t])) {\n if (!compare(current[t], returnedData)) {\n equal = false;\n }\n } else {\n equal = false;\n }\n }\n } else {\n if (current[t] !== prev[t]) {\n equal = false;\n }\n }\n }\n return equal;\n };\n const getSnapshot = useMemo(()=>{\n const shouldStartRequest = (()=>{\n if (!key) return false;\n if (!fetcher) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (!isUndefined(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n if (suspense) return false;\n if (!isUndefined(revalidateIfStale)) return revalidateIfStale;\n return true;\n })();\n // Get the cache and merge it with expected states.\n const getSelectedCache = (state)=>{\n // We only select the needed fields from the state.\n const snapshot = mergeObjects(state);\n delete snapshot._k;\n if (!shouldStartRequest) {\n return snapshot;\n }\n return {\n isValidating: true,\n isLoading: true,\n ...snapshot\n };\n };\n // To make sure that we are returning the same object reference to avoid\n // unnecessary re-renders, we keep the previous snapshot and use deep\n // comparison to check if we need to return a new one.\n let memorizedSnapshot = getSelectedCache(getCache());\n const memorizedInitialSnapshot = getSelectedCache(getInitialCache());\n return [\n ()=>{\n const newSnapshot = getSelectedCache(getCache());\n return isEqual(newSnapshot, memorizedSnapshot) ? memorizedSnapshot : memorizedSnapshot = newSnapshot;\n },\n ()=>memorizedInitialSnapshot\n ];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n cache,\n key\n ]);\n // Get the current state that SWR should return.\n const cached = useSyncExternalStore(useCallback((callback)=>subscribeCache(key, (current, prev)=>{\n if (!isEqual(prev, current)) callback();\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n cache,\n key\n ]), getSnapshot[0], getSnapshot[1]);\n const isInitialMount = !initialMountedRef.current;\n const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;\n const cachedData = cached.data;\n const data = isUndefined(cachedData) ? fallback : cachedData;\n const error = cached.error;\n // Use a ref to store previously returned data. Use the initial data as its initial value.\n const laggyDataRef = useRef(data);\n const returnedData = keepPreviousData ? isUndefined(cachedData) ? laggyDataRef.current : cachedData : data;\n // - Suspense mode and there's stale data for the initial render.\n // - Not suspense mode and there is no fallback data and `revalidateIfStale` is enabled.\n // - `revalidateIfStale` is enabled but `data` is not defined.\n const shouldDoInitialRevalidation = (()=>{\n // if a key already has revalidators and also has error, we should not trigger revalidation\n if (hasRevalidator && !isUndefined(error)) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n // Under suspense mode, it will always fetch on render if there is no\n // stale data so no need to revalidate immediately mount it again.\n // If data exists, only revalidate if `revalidateIfStale` is true.\n if (suspense) return isUndefined(data) ? false : revalidateIfStale;\n // If there is no stale data, we need to revalidate when mount;\n // If `revalidateIfStale` is set to true, we will always revalidate.\n return isUndefined(data) || revalidateIfStale;\n })();\n // Resolve the default validating state:\n // If it's able to validate, and it should revalidate when mount, this will be true.\n const defaultValidatingState = !!(key && fetcher && isInitialMount && shouldDoInitialRevalidation);\n const isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating;\n const isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading;\n // The revalidation function is a carefully crafted wrapper of the original\n // `fetcher`, to correctly handle the many edge cases.\n const revalidate = useCallback(async (revalidateOpts)=>{\n const currentFetcher = fetcherRef.current;\n if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) {\n return false;\n }\n let newData;\n let startAt;\n let loading = true;\n const opts = revalidateOpts || {};\n // If there is no ongoing concurrent request, or `dedupe` is not set, a\n // new request should be initiated.\n const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;\n /*\n For React 17\n Do unmount check for calls:\n If key has changed during the revalidation, or the component has been\n unmounted, old dispatch and old event callbacks should not take any\n effect\n\n For React 18\n only check if key has changed\n https://github.com/reactwg/react-18/discussions/82\n */ const callbackSafeguard = ()=>{\n if (IS_REACT_LEGACY) {\n return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;\n }\n return key === keyRef.current;\n };\n // The final state object when the request finishes.\n const finalState = {\n isValidating: false,\n isLoading: false\n };\n const finishRequestAndUpdateState = ()=>{\n setCache(finalState);\n };\n const cleanupState = ()=>{\n // Check if it's still the same request before deleting it.\n const requestInfo = FETCH[key];\n if (requestInfo && requestInfo[1] === startAt) {\n delete FETCH[key];\n }\n };\n // Start fetching. Change the `isValidating` state, update the cache.\n const initialState = {\n isValidating: true\n };\n // It is in the `isLoading` state, if and only if there is no cached data.\n // This bypasses fallback data and laggy data.\n if (isUndefined(getCache().data)) {\n initialState.isLoading = true;\n }\n try {\n if (shouldStartNewRequest) {\n setCache(initialState);\n // If no cache is being rendered currently (it shows a blank page),\n // we trigger the loading slow event.\n if (config.loadingTimeout && isUndefined(getCache().data)) {\n setTimeout(()=>{\n if (loading && callbackSafeguard()) {\n getConfig().onLoadingSlow(key, config);\n }\n }, config.loadingTimeout);\n }\n // Start the request and save the timestamp.\n // Key must be truthy if entering here.\n FETCH[key] = [\n currentFetcher(fnArg),\n getTimestamp()\n ];\n }\n [newData, startAt] = FETCH[key];\n newData = await newData;\n if (shouldStartNewRequest) {\n // If the request isn't interrupted, clean it up after the\n // deduplication interval.\n setTimeout(cleanupState, config.dedupingInterval);\n }\n // If there're other ongoing request(s), started after the current one,\n // we need to ignore the current one to avoid possible race conditions:\n // req1------------------>res1 (current one)\n // req2---------------->res2\n // the request that fired later will always be kept.\n // The timestamp maybe be `undefined` or a number\n if (!FETCH[key] || FETCH[key][1] !== startAt) {\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Clear error.\n finalState.error = UNDEFINED;\n // If there're other mutations(s), that overlapped with the current revalidation:\n // case 1:\n // req------------------>res\n // mutate------>end\n // case 2:\n // req------------>res\n // mutate------>end\n // case 3:\n // req------------------>res\n // mutate-------...---------->\n // we have to ignore the revalidation result (res) because it's no longer fresh.\n // meanwhile, a new revalidation should be triggered when the mutation ends.\n const mutationInfo = MUTATION[key];\n if (!isUndefined(mutationInfo) && // case 1\n (startAt <= mutationInfo[0] || // case 2\n startAt <= mutationInfo[1] || // case 3\n mutationInfo[1] === 0)) {\n finishRequestAndUpdateState();\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Deep compare with the latest state to avoid extra re-renders.\n // For local state, compare and assign.\n const cacheData = getCache().data;\n // Since the compare fn could be custom fn\n // cacheData might be different from newData even when compare fn returns True\n finalState.data = compare(cacheData, newData) ? cacheData : newData;\n // Trigger the successful callback if it's the original request.\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onSuccess(newData, key, config);\n }\n }\n } catch (err) {\n cleanupState();\n const currentConfig = getConfig();\n const { shouldRetryOnError } = currentConfig;\n // Not paused, we continue handling the error. Otherwise, discard it.\n if (!currentConfig.isPaused()) {\n // Get a new error, don't use deep comparison for errors.\n finalState.error = err;\n // Error event and retry logic. Only for the actual request, not\n // deduped ones.\n if (shouldStartNewRequest && callbackSafeguard()) {\n currentConfig.onError(err, key, currentConfig);\n if (shouldRetryOnError === true || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) {\n if (isActive()) {\n // If it's inactive, stop. It will auto-revalidate when\n // refocusing or reconnecting.\n // When retrying, deduplication is always enabled.\n currentConfig.onErrorRetry(err, key, currentConfig, revalidate, {\n retryCount: (opts.retryCount || 0) + 1,\n dedupe: true\n });\n }\n }\n }\n }\n }\n // Mark loading as stopped.\n loading = false;\n // Update the current hook's state.\n finishRequestAndUpdateState();\n return true;\n }, // `setState` is immutable, and `eventsCallback`, `fnArg`, and\n // `keyValidating` are depending on `key`, so we can exclude them from\n // the deps array.\n //\n // FIXME:\n // `fn` and `config` might be changed during the lifecycle,\n // but they might be changed every render like this.\n // `useSWR('key', () => fetch('/api/'), { suspense: true })`\n // So we omit the values from the deps array\n // even though it might cause unexpected behaviors.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n key,\n cache\n ]);\n // Similar to the global mutate but bound to the current cache and key.\n // `cache` isn't allowed to change during the lifecycle.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const boundMutate = useCallback(// Use callback to make sure `keyRef.current` returns latest result every time\n (...args)=>{\n return internalMutate(cache, keyRef.current, ...args);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n // The logic for updating refs.\n useIsomorphicLayoutEffect(()=>{\n fetcherRef.current = fetcher;\n configRef.current = config;\n // Handle laggy data updates. If there's cached data of the current key,\n // it'll be the correct reference.\n if (!isUndefined(cachedData)) {\n laggyDataRef.current = cachedData;\n }\n });\n // After mounted or key changed.\n useIsomorphicLayoutEffect(()=>{\n if (!key) return;\n const softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);\n // Expose revalidators to global event listeners. So we can trigger\n // revalidation from the outside.\n let nextFocusRevalidatedAt = 0;\n const onRevalidate = (type)=>{\n if (type == revalidateEvents.FOCUS_EVENT) {\n const now = Date.now();\n if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {\n nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;\n softRevalidate();\n }\n } else if (type == revalidateEvents.RECONNECT_EVENT) {\n if (getConfig().revalidateOnReconnect && isActive()) {\n softRevalidate();\n }\n } else if (type == revalidateEvents.MUTATE_EVENT) {\n return revalidate();\n }\n return;\n };\n const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);\n // Mark the component as mounted and update corresponding refs.\n unmountedRef.current = false;\n keyRef.current = key;\n initialMountedRef.current = true;\n // Keep the original key in the cache.\n setCache({\n _k: fnArg\n });\n // Trigger a revalidation.\n if (shouldDoInitialRevalidation) {\n if (isUndefined(data) || IS_SERVER) {\n // Revalidate immediately.\n softRevalidate();\n } else {\n // Delay the revalidate if we have data to return so we won't block\n // rendering.\n rAF(softRevalidate);\n }\n }\n return ()=>{\n // Mark it as unmounted.\n unmountedRef.current = true;\n unsubEvents();\n };\n }, [\n key\n ]);\n // Polling\n useIsomorphicLayoutEffect(()=>{\n let timer;\n function next() {\n // Use the passed interval\n // ...or invoke the function with the updated data to get the interval\n const interval = isFunction(refreshInterval) ? refreshInterval(data) : refreshInterval;\n // We only start the next interval if `refreshInterval` is not 0, and:\n // - `force` is true, which is the start of polling\n // - or `timer` is not 0, which means the effect wasn't canceled\n if (interval && timer !== -1) {\n timer = setTimeout(execute, interval);\n }\n }\n function execute() {\n // Check if it's OK to execute:\n // Only revalidate when the page is visible, online, and not errored.\n if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {\n revalidate(WITH_DEDUPE).then(next);\n } else {\n // Schedule the next interval to check again.\n next();\n }\n }\n next();\n return ()=>{\n if (timer) {\n clearTimeout(timer);\n timer = -1;\n }\n };\n }, [\n refreshInterval,\n refreshWhenHidden,\n refreshWhenOffline,\n key\n ]);\n // Display debug info in React DevTools.\n useDebugValue(returnedData);\n // In Suspense mode, we can't return the empty `data` state.\n // If there is an `error`, the `error` needs to be thrown to the error boundary.\n // If there is no `error`, the `revalidation` promise needs to be thrown to\n // the suspense boundary.\n if (suspense && isUndefined(data) && key) {\n // SWR should throw when trying to use Suspense on the server with React 18,\n // without providing any initial data. See:\n // https://github.com/vercel/swr/issues/1832\n if (!IS_REACT_LEGACY && IS_SERVER) {\n throw new Error('Fallback data is required when using suspense in SSR.');\n }\n // Always update fetcher and config refs even with the Suspense mode.\n fetcherRef.current = fetcher;\n configRef.current = config;\n unmountedRef.current = false;\n throw isUndefined(error) ? revalidate(WITH_DEDUPE) : error;\n }\n return {\n mutate: boundMutate,\n get data () {\n stateDependencies.data = true;\n return returnedData;\n },\n get error () {\n stateDependencies.error = true;\n return error;\n },\n get isValidating () {\n stateDependencies.isValidating = true;\n return isValidating;\n },\n get isLoading () {\n stateDependencies.isLoading = true;\n return isLoading;\n }\n };\n};\nconst SWRConfig = OBJECT.defineProperty(SWRConfig$1, 'defaultValue', {\n value: defaultConfig\n});\nconst unstable_serialize = (key)=>serialize(key)[0];\n/**\n * A hook to fetch data.\n *\n * @link https://swr.vercel.app\n * @example\n * ```jsx\n * import useSWR from 'swr'\n * function Profile() {\n * const { data, error } = useSWR('/api/user', fetcher)\n * if (error) return
    failed to load
    \n * if (!data) return
    loading...
    \n * return
    hello {data.name}!
    \n * }\n * ```\n */ var useSWR = withArgs(useSWRHandler);\n\n// useSWR\n\nexport { SWRConfig, useSWR as default, unstable_serialize };\n", "import React, { useEffect, useLayoutEffect, createContext, useContext, useMemo, useState, createElement, useRef, useCallback } from 'react';\n\n// Global state used to deduplicate requests and store listeners\nconst SWRGlobalState = new WeakMap();\n\nconst EMPTY_CACHE = {};\nconst INITIAL_CACHE = {};\nconst noop = ()=>{};\n// Using noop() as the undefined value as undefined can be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nconst UNDEFINED = /*#__NOINLINE__*/ noop();\nconst OBJECT = Object;\nconst isUndefined = (v)=>v === UNDEFINED;\nconst isFunction = (v)=>typeof v == 'function';\nconst mergeObjects = (a, b)=>({\n ...a,\n ...b\n });\nconst STR_UNDEFINED = 'undefined';\n// NOTE: Use the function to guarantee it's re-evaluated between jsdom and node runtime for tests.\nconst isWindowDefined = typeof window != STR_UNDEFINED;\nconst isDocumentDefined = typeof document != STR_UNDEFINED;\nconst hasRequestAnimationFrame = ()=>isWindowDefined && typeof window['requestAnimationFrame'] != STR_UNDEFINED;\nconst createCacheHelper = (cache, key)=>{\n const state = SWRGlobalState.get(cache);\n return [\n // Getter\n ()=>cache.get(key) || EMPTY_CACHE,\n // Setter\n (info)=>{\n if (!isUndefined(key)) {\n const prev = cache.get(key);\n // Before writing to the store, we keep the value in the initial cache\n // if it's not there yet.\n if (!(key in INITIAL_CACHE)) {\n INITIAL_CACHE[key] = prev;\n }\n state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);\n }\n },\n // Subscriber\n state[6],\n // Get server cache snapshot\n ()=>{\n if (!isUndefined(key)) {\n // If the cache was updated on the client, we return the stored initial value.\n if (key in INITIAL_CACHE) return INITIAL_CACHE[key];\n }\n // If we haven't done any client-side updates, we return the current value.\n return cache.get(key) || EMPTY_CACHE;\n }\n ];\n};\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nconst table = new WeakMap();\n// counter of the key\nlet counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsable.\nconst stableHash = (arg)=>{\n const type = typeof arg;\n const constructor = arg && arg.constructor;\n const isDate = constructor == Date;\n let result;\n let index;\n if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result) return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (constructor == Array) {\n // Array.\n result = '@';\n for(index = 0; index < arg.length; index++){\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (constructor == OBJECT) {\n // Object, sort keys.\n result = '#';\n const keys = OBJECT.keys(arg).sort();\n while(!isUndefined(index = keys.pop())){\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n } else {\n result = isDate ? arg.toJSON() : type == 'symbol' ? arg.toString() : type == 'string' ? JSON.stringify(arg) : '' + arg;\n }\n return result;\n};\n\n/**\n * Due to the bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,\n * it's not reliable to detect if the browser is currently online or offline\n * based on `navigator.onLine`.\n * As a workaround, we always assume it's online on the first load, and change\n * the status upon `online` or `offline` events.\n */ let online = true;\nconst isOnline = ()=>online;\n// For node and React Native, `add/removeEventListener` doesn't exist on window.\nconst [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [\n window.addEventListener.bind(window),\n window.removeEventListener.bind(window)\n] : [\n noop,\n noop\n];\nconst isVisible = ()=>{\n const visibilityState = isDocumentDefined && document.visibilityState;\n return isUndefined(visibilityState) || visibilityState !== 'hidden';\n};\nconst initFocus = (callback)=>{\n // focus revalidate\n if (isDocumentDefined) {\n document.addEventListener('visibilitychange', callback);\n }\n onWindowEvent('focus', callback);\n return ()=>{\n if (isDocumentDefined) {\n document.removeEventListener('visibilitychange', callback);\n }\n offWindowEvent('focus', callback);\n };\n};\nconst initReconnect = (callback)=>{\n // revalidate on reconnected\n const onOnline = ()=>{\n online = true;\n callback();\n };\n // nothing to revalidate, just update the status\n const onOffline = ()=>{\n online = false;\n };\n onWindowEvent('online', onOnline);\n onWindowEvent('offline', onOffline);\n return ()=>{\n offWindowEvent('online', onOnline);\n offWindowEvent('offline', onOffline);\n };\n};\nconst preset = {\n isOnline,\n isVisible\n};\nconst defaultConfigOptions = {\n initFocus,\n initReconnect\n};\n\nconst IS_REACT_LEGACY = !React.useId;\nconst IS_SERVER = !isWindowDefined || 'Deno' in window;\n// Polyfill requestAnimationFrame\nconst rAF = (f)=>hasRequestAnimationFrame() ? window['requestAnimationFrame'](f) : setTimeout(f, 1);\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nconst useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;\n// This assignment is to extend the Navigator type to use effectiveType.\nconst navigatorConnection = typeof navigator !== 'undefined' && navigator.connection;\n// Adjust the config based on slow connection status (<= 70Kbps).\nconst slowConnection = !IS_SERVER && navigatorConnection && ([\n 'slow-2g',\n '2g'\n].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);\n\nconst serialize = (key)=>{\n if (isFunction(key)) {\n try {\n key = key();\n } catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n // Use the original key as the argument of fetcher. This can be a string or an\n // array of values.\n const args = key;\n // If key is not falsy, or not an empty array, hash it.\n key = typeof key == 'string' ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : '';\n return [\n key,\n args\n ];\n};\n\n// Global timestamp.\nlet __timestamp = 0;\nconst getTimestamp = ()=>++__timestamp;\n\nconst FOCUS_EVENT = 0;\nconst RECONNECT_EVENT = 1;\nconst MUTATE_EVENT = 2;\n\nvar constants = {\n __proto__: null,\n FOCUS_EVENT: FOCUS_EVENT,\n RECONNECT_EVENT: RECONNECT_EVENT,\n MUTATE_EVENT: MUTATE_EVENT\n};\n\nasync function internalMutate(...args) {\n const [cache, _key, _data, _opts] = args;\n // When passing as a boolean, it's explicitly used to disable/enable\n // revalidation.\n const options = mergeObjects({\n populateCache: true,\n throwOnError: true\n }, typeof _opts === 'boolean' ? {\n revalidate: _opts\n } : _opts || {});\n let populateCache = options.populateCache;\n const rollbackOnErrorOption = options.rollbackOnError;\n let optimisticData = options.optimisticData;\n const revalidate = options.revalidate !== false;\n const rollbackOnError = (error)=>{\n return typeof rollbackOnErrorOption === 'function' ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;\n };\n const throwOnError = options.throwOnError;\n // If the second argument is a key filter, return the mutation results for all\n // filtered keys.\n if (isFunction(_key)) {\n const keyFilter = _key;\n const matchedKeys = [];\n const it = cache.keys();\n for(let keyIt = it.next(); !keyIt.done; keyIt = it.next()){\n const key = keyIt.value;\n if (// Skip the special useSWRInfinite keys.\n !key.startsWith('$inf$') && keyFilter(cache.get(key)._k)) {\n matchedKeys.push(key);\n }\n }\n return Promise.all(matchedKeys.map(mutateByKey));\n }\n return mutateByKey(_key);\n async function mutateByKey(_k) {\n // Serialize key\n const [key] = serialize(_k);\n if (!key) return;\n const [get, set] = createCacheHelper(cache, key);\n const [EVENT_REVALIDATORS, MUTATION, FETCH] = SWRGlobalState.get(cache);\n const revalidators = EVENT_REVALIDATORS[key];\n const startRevalidate = ()=>{\n if (revalidate) {\n // Invalidate the key by deleting the concurrent request markers so new\n // requests will not be deduped.\n delete FETCH[key];\n if (revalidators && revalidators[0]) {\n return revalidators[0](MUTATE_EVENT).then(()=>get().data);\n }\n }\n return get().data;\n };\n // If there is no new data provided, revalidate the key with current state.\n if (args.length < 3) {\n // Revalidate and broadcast state.\n return startRevalidate();\n }\n let data = _data;\n let error;\n // Update global timestamps.\n const beforeMutationTs = getTimestamp();\n MUTATION[key] = [\n beforeMutationTs,\n 0\n ];\n const hasOptimisticData = !isUndefined(optimisticData);\n const state = get();\n // `displayedData` is the current value on screen. It could be the optimistic value\n // that is going to be overridden by a `committedData`, or get reverted back.\n // `committedData` is the validated value that comes from a fetch or mutation.\n const displayedData = state.data;\n const currentData = state._c;\n const committedData = isUndefined(currentData) ? displayedData : currentData;\n // Do optimistic data update.\n if (hasOptimisticData) {\n optimisticData = isFunction(optimisticData) ? optimisticData(committedData) : optimisticData;\n // When we set optimistic data, backup the current committedData data in `_c`.\n set({\n data: optimisticData,\n _c: committedData\n });\n }\n if (isFunction(data)) {\n // `data` is a function, call it passing current cache value.\n try {\n data = data(committedData);\n } catch (err) {\n // If it throws an error synchronously, we shouldn't update the cache.\n error = err;\n }\n }\n // `data` is a promise/thenable, resolve the final data first.\n if (data && isFunction(data.then)) {\n // This means that the mutation is async, we need to check timestamps to\n // avoid race conditions.\n data = await data.catch((err)=>{\n error = err;\n });\n // Check if other mutations have occurred since we've started this mutation.\n // If there's a race we don't update cache or broadcast the change,\n // just return the data.\n if (beforeMutationTs !== MUTATION[key][0]) {\n if (error) throw error;\n return data;\n } else if (error && hasOptimisticData && rollbackOnError(error)) {\n // Rollback. Always populate the cache in this case but without\n // transforming the data.\n populateCache = true;\n data = committedData;\n // Reset data to be the latest committed data, and clear the `_c` value.\n set({\n data,\n _c: UNDEFINED\n });\n }\n }\n // If we should write back the cache after request.\n if (populateCache) {\n if (!error) {\n // Transform the result into data.\n if (isFunction(populateCache)) {\n data = populateCache(data, committedData);\n }\n // Only update cached data if there's no error. Data can be `undefined` here.\n set({\n data,\n _c: UNDEFINED\n });\n }\n }\n // Reset the timestamp to mark the mutation has ended.\n MUTATION[key][1] = getTimestamp();\n // Update existing SWR Hooks' internal states:\n const res = await startRevalidate();\n // The mutation and revalidation are ended, we can clear it since the data is\n // not an optimistic value anymore.\n set({\n _c: UNDEFINED\n });\n // Throw error or return data\n if (error) {\n if (throwOnError) throw error;\n return;\n }\n return populateCache ? res : data;\n }\n}\n\nconst revalidateAllKeys = (revalidators, type)=>{\n for(const key in revalidators){\n if (revalidators[key][0]) revalidators[key][0](type);\n }\n};\nconst initCache = (provider, options)=>{\n // The global state for a specific provider will be used to deduplicate\n // requests and store listeners. As well as a mutate function that is bound to\n // the cache.\n // The provider's global state might be already initialized. Let's try to get the\n // global state associated with the provider first.\n if (!SWRGlobalState.has(provider)) {\n const opts = mergeObjects(defaultConfigOptions, options);\n // If there's no global state bound to the provider, create a new one with the\n // new mutate function.\n const EVENT_REVALIDATORS = {};\n const mutate = internalMutate.bind(UNDEFINED, provider);\n let unmount = noop;\n const subscriptions = {};\n const subscribe = (key, callback)=>{\n const subs = subscriptions[key] || [];\n subscriptions[key] = subs;\n subs.push(callback);\n return ()=>subs.splice(subs.indexOf(callback), 1);\n };\n const setter = (key, value, prev)=>{\n provider.set(key, value);\n const subs = subscriptions[key];\n if (subs) {\n for(let i = subs.length; i--;){\n subs[i](value, prev);\n }\n }\n };\n const initProvider = ()=>{\n if (!SWRGlobalState.has(provider)) {\n // Update the state if it's new, or if the provider has been extended.\n SWRGlobalState.set(provider, [\n EVENT_REVALIDATORS,\n {},\n {},\n {},\n mutate,\n setter,\n subscribe\n ]);\n if (!IS_SERVER) {\n // When listening to the native events for auto revalidations,\n // we intentionally put a delay (setTimeout) here to make sure they are\n // fired after immediate JavaScript executions, which can be\n // React's state updates.\n // This avoids some unnecessary revalidations such as\n // https://github.com/vercel/swr/issues/1680.\n const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));\n const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));\n unmount = ()=>{\n releaseFocus && releaseFocus();\n releaseReconnect && releaseReconnect();\n // When un-mounting, we need to remove the cache provider from the state\n // storage too because it's a side-effect. Otherwise, when re-mounting we\n // will not re-register those event listeners.\n SWRGlobalState.delete(provider);\n };\n }\n }\n };\n initProvider();\n // This is a new provider, we need to initialize it and setup DOM events\n // listeners for `focus` and `reconnect` actions.\n // We might want to inject an extra layer on top of `provider` in the future,\n // such as key serialization, auto GC, etc.\n // For now, it's just a `Map` interface without any modifications.\n return [\n provider,\n mutate,\n initProvider,\n unmount\n ];\n }\n return [\n provider,\n SWRGlobalState.get(provider)[4]\n ];\n};\n\n// error retry\nconst onErrorRetry = (_, __, config, revalidate, opts)=>{\n const maxRetryCount = config.errorRetryCount;\n const currentRetryCount = opts.retryCount;\n // Exponential backoff\n const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;\n if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {\n return;\n }\n setTimeout(revalidate, timeout, opts);\n};\nconst compare = (currentData, newData)=>stableHash(currentData) == stableHash(newData);\n// Default cache provider\nconst [cache, mutate] = initCache(new Map());\n// Default config\nconst defaultConfig = mergeObjects({\n // events\n onLoadingSlow: noop,\n onSuccess: noop,\n onError: noop,\n onErrorRetry,\n onDiscarded: noop,\n // switches\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n revalidateIfStale: true,\n shouldRetryOnError: true,\n // timeouts\n errorRetryInterval: slowConnection ? 10000 : 5000,\n focusThrottleInterval: 5 * 1000,\n dedupingInterval: 2 * 1000,\n loadingTimeout: slowConnection ? 5000 : 3000,\n // providers\n compare,\n isPaused: ()=>false,\n cache,\n mutate,\n fallback: {}\n}, // use web preset by default\npreset);\n\nconst mergeConfigs = (a, b)=>{\n // Need to create a new object to avoid mutating the original here.\n const v = mergeObjects(a, b);\n // If two configs are provided, merge their `use` and `fallback` options.\n if (b) {\n const { use: u1 , fallback: f1 } = a;\n const { use: u2 , fallback: f2 } = b;\n if (u1 && u2) {\n v.use = u1.concat(u2);\n }\n if (f1 && f2) {\n v.fallback = mergeObjects(f1, f2);\n }\n }\n return v;\n};\n\nconst SWRConfigContext = createContext({});\nconst SWRConfig = (props)=>{\n const { value } = props;\n const parentConfig = useContext(SWRConfigContext);\n const isFunctionalConfig = isFunction(value);\n const config = useMemo(()=>isFunctionalConfig ? value(parentConfig) : value, [\n isFunctionalConfig,\n parentConfig,\n value\n ]);\n // Extend parent context values and middleware.\n const extendedConfig = useMemo(()=>isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [\n isFunctionalConfig,\n parentConfig,\n config\n ]);\n // Should not use the inherited provider.\n const provider = config && config.provider;\n // Use a lazy initialized state to create the cache on first access.\n const [cacheContext] = useState(()=>provider ? initCache(provider(extendedConfig.cache || cache), config) : UNDEFINED);\n // Override the cache if a new provider is given.\n if (cacheContext) {\n extendedConfig.cache = cacheContext[0];\n extendedConfig.mutate = cacheContext[1];\n }\n // Unsubscribe events.\n useIsomorphicLayoutEffect(()=>{\n if (cacheContext) {\n cacheContext[2] && cacheContext[2]();\n return cacheContext[3];\n }\n }, []);\n return createElement(SWRConfigContext.Provider, mergeObjects(props, {\n value: extendedConfig\n }));\n};\n\n// @ts-expect-error\nconst enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;\nconst use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];\nconst setupDevTools = ()=>{\n if (enableDevtools) {\n // @ts-expect-error\n window.__SWR_DEVTOOLS_REACT__ = React;\n }\n};\n\nconst normalize = (args)=>{\n return isFunction(args[1]) ? [\n args[0],\n args[1],\n args[2] || {}\n ] : [\n args[0],\n null,\n (args[1] === null ? args[2] : args[1]) || {}\n ];\n};\n\nconst useSWRConfig = ()=>{\n return mergeObjects(defaultConfig, useContext(SWRConfigContext));\n};\n\nconst preload = (key_, fetcher)=>{\n const key = serialize(key_)[0];\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n // Prevent preload to be called multiple times before used.\n if (PRELOAD[key]) return PRELOAD[key];\n const req = fetcher(key_);\n PRELOAD[key] = req;\n return req;\n};\nconst middleware = (useSWRNext)=>(key_, fetcher_, config)=>{\n // fetcher might be a sync function, so this should not be an async function\n const fetcher = fetcher_ && ((...args)=>{\n const key = serialize(key_)[0];\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n const req = PRELOAD[key];\n if (req) {\n delete PRELOAD[key];\n return req;\n }\n return fetcher_(...args);\n });\n return useSWRNext(key_, fetcher, config);\n };\n\nconst BUILT_IN_MIDDLEWARE = use.concat(middleware);\n\n// It's tricky to pass generic types as parameters, so we just directly override\n// the types here.\nconst withArgs = (hook)=>{\n return function useSWRArgs(...args) {\n // Get the default and inherited configuration.\n const fallbackConfig = useSWRConfig();\n // Normalize arguments.\n const [key, fn, _config] = normalize(args);\n // Merge configurations.\n const config = mergeConfigs(fallbackConfig, _config);\n // Apply middleware\n let next = hook;\n const { use } = config;\n const middleware = (use || []).concat(BUILT_IN_MIDDLEWARE);\n for(let i = middleware.length; i--;){\n next = middleware[i](next);\n }\n return next(key, fn || config.fetcher || null, config);\n };\n};\n\n/**\n * An implementation of state with dependency-tracking.\n */ const useStateWithDeps = (state)=>{\n const rerender = useState({})[1];\n const unmountedRef = useRef(false);\n const stateRef = useRef(state);\n // If a state property (data, error, or isValidating) is accessed by the render\n // function, we mark the property as a dependency so if it is updated again\n // in the future, we trigger a rerender.\n // This is also known as dependency-tracking.\n const stateDependenciesRef = useRef({\n data: false,\n error: false,\n isValidating: false\n });\n /**\n * @param payload To change stateRef, pass the values explicitly to setState:\n * @example\n * ```js\n * setState({\n * isValidating: false\n * data: newData // set data to newData\n * error: undefined // set error to undefined\n * })\n *\n * setState({\n * isValidating: false\n * data: undefined // set data to undefined\n * error: err // set error to err\n * })\n * ```\n */ const setState = useCallback((payload)=>{\n let shouldRerender = false;\n const currentState = stateRef.current;\n for(const _ in payload){\n const k = _;\n // If the property has changed, update the state and mark rerender as\n // needed.\n if (currentState[k] !== payload[k]) {\n currentState[k] = payload[k];\n // If the property is accessed by the component, a rerender should be\n // triggered.\n if (stateDependenciesRef.current[k]) {\n shouldRerender = true;\n }\n }\n }\n if (shouldRerender && !unmountedRef.current) {\n if (IS_REACT_LEGACY) {\n rerender({});\n } else {\n React.startTransition(()=>rerender({}));\n }\n }\n }, // config.suspense isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n useIsomorphicLayoutEffect(()=>{\n unmountedRef.current = false;\n return ()=>{\n unmountedRef.current = true;\n };\n });\n return [\n stateRef,\n stateDependenciesRef.current,\n setState\n ];\n};\n\n// Add a callback function to a list of keyed callback functions and return\n// the unsubscribe function.\nconst subscribeCallback = (key, callbacks, callback)=>{\n const keyedRevalidators = callbacks[key] || (callbacks[key] = []);\n keyedRevalidators.push(callback);\n return ()=>{\n const index = keyedRevalidators.indexOf(callback);\n if (index >= 0) {\n // O(1): faster than splice\n keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];\n keyedRevalidators.pop();\n }\n };\n};\n\n// Create a custom hook with a middleware\nconst withMiddleware = (useSWR, middleware)=>{\n return (...args)=>{\n const [key, fn, config] = normalize(args);\n const uses = (config.use || []).concat(middleware);\n return useSWR(key, fn, {\n ...config,\n use: uses\n });\n };\n};\n\nsetupDevTools();\n\nexport { IS_REACT_LEGACY, IS_SERVER, OBJECT, SWRConfig, SWRGlobalState, UNDEFINED, cache, compare, createCacheHelper, defaultConfig, defaultConfigOptions, getTimestamp, hasRequestAnimationFrame, initCache, internalMutate, isDocumentDefined, isFunction, isUndefined, isWindowDefined, mergeConfigs, mergeObjects, mutate, noop, normalize, preload, preset, rAF, constants as revalidateEvents, serialize, slowConnection, stableHash, subscribeCallback, useIsomorphicLayoutEffect, useSWRConfig, useStateWithDeps, withArgs, withMiddleware };\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n urlPattern,\n useCurrentLocation,\n useNavigationContext,\n useTranslationContext,\n} from \"@gnu-taler/web-util/browser\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\n\nimport { AccessToken } from \"@gnu-taler/taler-util\";\nimport { useEffect } from \"preact/hooks\";\nimport { Home } from \"./Home.js\";\nimport { assertUnreachable } from \"./utils.js\";\n\nfunction AppFrame({ children }: { children: ComponentChildren }) {\n return (\n
    \n
    \n \n
    \n\n
    {children}
    \n
    \n );\n}\n\nexport function Routing(): VNode {\n return (\n \n {}} />\n \n );\n}\n\nconst publicPages = {\n home: urlPattern(/\\/home/, () => \"#/home\"),\n};\n\nfunction PublicRounting({\n onLoggedUser,\n}: {\n onLoggedUser: (username: string, token: AccessToken) => void;\n}): VNode {\n const { i18n } = useTranslationContext();\n const location = useCurrentLocation(publicPages);\n const { navigateTo } = useNavigationContext();\n\n useEffect(() => {\n if (location === undefined) {\n navigateTo(publicPages.home.url({}));\n }\n }, [location]);\n\n if (location === undefined) {\n return ;\n }\n\n switch (location.name) {\n case undefined:\n case \"home\": {\n return ;\n }\n\n default:\n assertUnreachable(location);\n }\n}\n", "import { VNode, h } from \"preact\";\nimport { Histogram, Normalized } from \"./Histogram.js\";\n\nexport function Home() {\n return (\n
    \n
    \n \n \n
    \n\n
    \n
    \n
    \n

    \n Crecimiento de la deuda\n

    \n

    \n Descripcion del grafico\n

    \n
    \n\n \n
    \n
    \n
    \n
    \n
    \n

    \n Asignacion presupuestaria\n

    \n

    \n Descripcion del grafico\n

    \n
    \n\n \n
    \n
    \n
    \n );\n}\n\nfunction EnConstruccion(): VNode {\n return (\n
    \n
    \n
    \n \n \n \n
    \n
    \n

    \n Sitio en construcci\u00F3n\n

    \n
    \n

    Los datos no son reales.

    \n
    \n
    \n
    \n
    \n );\n}\n\nfunction Deuda(): VNode {\n // poblacion 43.000.000\n return (\n
    \n
    \n
    \n Deuda Nacional\n
    \n
    \n US $ 370.673.000.000,00\n
    \n
    \n
    \n
    \n Deuda por persona\n
    \n
    \n US $ 8.620,30\n
    \n
    \n
    \n
    \n Producto bruto interno\n
    \n
    \n US $ 640.591.000.000,00\n
    \n
    \n
    \n
    \n Produccion por persona\n
    \n
    \n US $ 14.897,46\n
    \n
    \n
    \n );\n}\n", "export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n", "import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can\u2019t do this\n // for a comparator (except for specific, known comparators) because we can\u2019t\n // tell if the comparator is symmetric, and an asymmetric comparator can\u2019t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n", "export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n", "import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n", "export default function count(values, valueof) {\n let count = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count;\n }\n }\n }\n return count;\n}\n", "function length(array) {\n return array.length | 0;\n}\n\nfunction empty(length) {\n return !(length > 0);\n}\n\nfunction arrayify(values) {\n return typeof values !== \"object\" || \"length\" in values ? values : Array.from(values);\n}\n\nfunction reducer(reduce) {\n return values => reduce(...values);\n}\n\nexport default function cross(...values) {\n const reduce = typeof values[values.length - 1] === \"function\" && reducer(values.pop());\n values = values.map(arrayify);\n const lengths = values.map(length);\n const j = values.length - 1;\n const index = new Array(j + 1).fill(0);\n const product = [];\n if (j < 0 || lengths.some(empty)) return product;\n while (true) {\n product.push(index.map((j, i) => values[i][j]));\n let i = j;\n while (++index[i] === lengths[i]) {\n if (i === 0) return reduce ? product.map(reduce) : product;\n index[i--] = 0;\n }\n }\n}\n", "export default function cumsum(values, valueof) {\n var sum = 0, index = 0;\n return Float64Array.from(values, valueof === undefined\n ? v => (sum += +v || 0)\n : v => (sum += +valueof(v, index++, values) || 0));\n}", "export default function variance(values, valueof) {\n let count = 0;\n let delta;\n let mean = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n }\n if (count > 1) return sum / (count - 1);\n}\n", "import variance from \"./variance.js\";\n\nexport default function deviation(values, valueof) {\n const v = variance(values, valueof);\n return v ? Math.sqrt(v) : v;\n}\n", "export default function extent(values, valueof) {\n let min;\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n return [min, max];\n}\n", "// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport class Adder {\n constructor() {\n this._partials = new Float64Array(32);\n this._n = 0;\n }\n add(x) {\n const p = this._partials;\n let i = 0;\n for (let j = 0; j < this._n && j < 32; j++) {\n const y = p[j],\n hi = x + y,\n lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n if (lo) p[i++] = lo;\n x = hi;\n }\n p[i] = x;\n this._n = i + 1;\n return this;\n }\n valueOf() {\n const p = this._partials;\n let n = this._n, x, y, lo, hi = 0;\n if (n > 0) {\n hi = p[--n];\n while (n > 0) {\n x = hi;\n y = p[--n];\n hi = x + y;\n lo = y - (hi - x);\n if (lo) break;\n }\n if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {\n y = lo * 2;\n x = hi + y;\n if (y == x - hi) hi = x;\n }\n }\n return hi;\n }\n}\n\nexport function fsum(values, valueof) {\n const adder = new Adder();\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n adder.add(value);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n adder.add(value);\n }\n }\n }\n return +adder;\n}\n\nexport function fcumsum(values, valueof) {\n const adder = new Adder();\n let index = -1;\n return Float64Array.from(values, valueof === undefined\n ? v => adder.add(+v || 0)\n : v => adder.add(+valueof(v, ++index, values) || 0)\n );\n}\n", "export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n", "export default function identity(x) {\n return x;\n}\n", "import {InternMap} from \"internmap\";\nimport identity from \"./identity.js\";\n\nexport default function group(values, ...keys) {\n return nest(values, identity, identity, keys);\n}\n\nexport function groups(values, ...keys) {\n return nest(values, Array.from, identity, keys);\n}\n\nfunction flatten(groups, keys) {\n for (let i = 1, n = keys.length; i < n; ++i) {\n groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));\n }\n return groups;\n}\n\nexport function flatGroup(values, ...keys) {\n return flatten(groups(values, ...keys), keys);\n}\n\nexport function flatRollup(values, reduce, ...keys) {\n return flatten(rollups(values, reduce, ...keys), keys);\n}\n\nexport function rollup(values, reduce, ...keys) {\n return nest(values, identity, reduce, keys);\n}\n\nexport function rollups(values, reduce, ...keys) {\n return nest(values, Array.from, reduce, keys);\n}\n\nexport function index(values, ...keys) {\n return nest(values, identity, unique, keys);\n}\n\nexport function indexes(values, ...keys) {\n return nest(values, Array.from, unique, keys);\n}\n\nfunction unique(values) {\n if (values.length !== 1) throw new Error(\"duplicate key\");\n return values[0];\n}\n\nfunction nest(values, map, reduce, keys) {\n return (function regroup(values, i) {\n if (i >= keys.length) return reduce(values);\n const groups = new InternMap();\n const keyof = keys[i++];\n let index = -1;\n for (const value of values) {\n const key = keyof(value, ++index, values);\n const group = groups.get(key);\n if (group) group.push(value);\n else groups.set(key, [value]);\n }\n for (const [key, values] of groups) {\n groups.set(key, regroup(values, i));\n }\n return map(groups);\n })(values, 0);\n}\n", "export default function permute(source, keys) {\n return Array.from(keys, key => source[key]);\n}\n", "import ascending from \"./ascending.js\";\nimport permute from \"./permute.js\";\n\nexport default function sort(values, ...F) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n values = Array.from(values);\n let [f] = F;\n if ((f && f.length !== 2) || F.length > 1) {\n const index = Uint32Array.from(values, (d, i) => i);\n if (F.length > 1) {\n F = F.map(f => values.map(f));\n index.sort((i, j) => {\n for (const f of F) {\n const c = ascendingDefined(f[i], f[j]);\n if (c) return c;\n }\n });\n } else {\n f = values.map(f);\n index.sort((i, j) => ascendingDefined(f[i], f[j]));\n }\n return permute(values, index);\n }\n return values.sort(compareDefined(f));\n}\n\nexport function compareDefined(compare = ascending) {\n if (compare === ascending) return ascendingDefined;\n if (typeof compare !== \"function\") throw new TypeError(\"compare is not a function\");\n return (a, b) => {\n const x = compare(a, b);\n if (x || x === 0) return x;\n return (compare(b, b) === 0) - (compare(a, a) === 0);\n };\n}\n\nexport function ascendingDefined(a, b) {\n return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);\n}\n", "import ascending from \"./ascending.js\";\nimport group, {rollup} from \"./group.js\";\nimport sort from \"./sort.js\";\n\nexport default function groupSort(values, reduce, key) {\n return (reduce.length !== 2\n ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)))\n : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))))\n .map(([key]) => key);\n}\n", "const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n", "import count from \"../count.js\";\n\nexport default function thresholdSturges(values) {\n return Math.max(1, Math.ceil(Math.log(count(values)) / Math.LN2) + 1);\n}\n", "export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n", "export default function maxIndex(values, valueof) {\n let max;\n let maxIndex = -1;\n let index = -1;\n if (valueof === undefined) {\n for (const value of values) {\n ++index;\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value, maxIndex = index;\n }\n }\n } else {\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value, maxIndex = index;\n }\n }\n }\n return maxIndex;\n}\n", "export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n", "export default function minIndex(values, valueof) {\n let min;\n let minIndex = -1;\n let index = -1;\n if (valueof === undefined) {\n for (const value of values) {\n ++index;\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value, minIndex = index;\n }\n }\n } else {\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value, minIndex = index;\n }\n }\n }\n return minIndex;\n}\n", "import {ascendingDefined, compareDefined} from \"./sort.js\";\n\n// Based on https://github.com/mourner/quickselect\n// ISC license, Copyright 2018 Vladimir Agafonkin.\nexport default function quickselect(array, k, left = 0, right = Infinity, compare) {\n k = Math.floor(k);\n left = Math.floor(Math.max(0, left));\n right = Math.floor(Math.min(array.length - 1, right));\n\n if (!(left <= k && k <= right)) return array;\n\n compare = compare === undefined ? ascendingDefined : compareDefined(compare);\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(array, k, newLeft, newRight, compare);\n }\n\n const t = array[k];\n let i = left;\n let j = right;\n\n swap(array, left, k);\n if (compare(array[right], t) > 0) swap(array, left, right);\n\n while (i < j) {\n swap(array, i, j), ++i, --j;\n while (compare(array[i], t) < 0) ++i;\n while (compare(array[j], t) > 0) --j;\n }\n\n if (compare(array[left], t) === 0) swap(array, left, j);\n else ++j, swap(array, j, right);\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n\n return array;\n}\n\nfunction swap(array, i, j) {\n const t = array[i];\n array[i] = array[j];\n array[j] = t;\n}\n", "import ascending from \"./ascending.js\";\n\nexport default function greatest(values, compare = ascending) {\n let max;\n let defined = false;\n if (compare.length === 1) {\n let maxValue;\n for (const element of values) {\n const value = compare(element);\n if (defined\n ? ascending(value, maxValue) > 0\n : ascending(value, value) === 0) {\n max = element;\n maxValue = value;\n defined = true;\n }\n }\n } else {\n for (const value of values) {\n if (defined\n ? compare(value, max) > 0\n : compare(value, value) === 0) {\n max = value;\n defined = true;\n }\n }\n }\n return max;\n}\n", "import max from \"./max.js\";\nimport maxIndex from \"./maxIndex.js\";\nimport min from \"./min.js\";\nimport minIndex from \"./minIndex.js\";\nimport quickselect from \"./quickselect.js\";\nimport number, {numbers} from \"./number.js\";\nimport {ascendingDefined} from \"./sort.js\";\nimport greatest from \"./greatest.js\";\n\nexport default function quantile(values, p, valueof) {\n values = Float64Array.from(numbers(values, valueof));\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return min(values);\n if (p >= 1) return max(values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),\n value1 = min(values.subarray(i0 + 1));\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileSorted(values, p, valueof = number) {\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileIndex(values, p, valueof = number) {\n if (isNaN(p = +p)) return;\n numbers = Float64Array.from(values, (_, i) => number(valueof(values[i], i, values)));\n if (p <= 0) return minIndex(numbers);\n if (p >= 1) return maxIndex(numbers);\n var numbers,\n index = Uint32Array.from(values, (_, i) => i),\n j = numbers.length - 1,\n i = Math.floor(j * p);\n quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));\n i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);\n return i >= 0 ? i : -1;\n}\n", "import count from \"../count.js\";\nimport quantile from \"../quantile.js\";\n\nexport default function thresholdFreedmanDiaconis(values, min, max) {\n const c = count(values), d = quantile(values, 0.75) - quantile(values, 0.25);\n return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1;\n}\n", "import count from \"../count.js\";\nimport deviation from \"../deviation.js\";\n\nexport default function thresholdScott(values, min, max) {\n const c = count(values), d = deviation(values);\n return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1;\n}\n", "export default function mean(values, valueof) {\n let count = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n }\n if (count) return sum / count;\n}\n", "import quantile, {quantileIndex} from \"./quantile.js\";\n\nexport default function median(values, valueof) {\n return quantile(values, 0.5, valueof);\n}\n\nexport function medianIndex(values, valueof) {\n return quantileIndex(values, 0.5, valueof);\n}\n", "function* flatten(arrays) {\n for (const array of arrays) {\n yield* array;\n }\n}\n\nexport default function merge(arrays) {\n return Array.from(flatten(arrays));\n}\n", "import {InternMap} from \"internmap\";\n\nexport default function mode(values, valueof) {\n const counts = new InternMap();\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && value >= value) {\n counts.set(value, (counts.get(value) || 0) + 1);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && value >= value) {\n counts.set(value, (counts.get(value) || 0) + 1);\n }\n }\n }\n let modeValue;\n let modeCount = 0;\n for (const [value, count] of counts) {\n if (count > modeCount) {\n modeCount = count;\n modeValue = value;\n }\n }\n return modeValue;\n}\n", "export default function pairs(values, pairof = pair) {\n const pairs = [];\n let previous;\n let first = false;\n for (const value of values) {\n if (first) pairs.push(pairof(previous, value));\n previous = value;\n first = true;\n }\n return pairs;\n}\n\nexport function pair(a, b) {\n return [a, b];\n}\n", "export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n", "export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n", "export default function reverse(values) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n return Array.from(values).reverse();\n}\n", "export default function(x) {\n return x;\n}\n", "import identity from \"./identity.js\";\n\nvar top = 1,\n right = 2,\n bottom = 3,\n left = 4,\n epsilon = 1e-6;\n\nfunction translateX(x) {\n return \"translate(\" + x + \",0)\";\n}\n\nfunction translateY(y) {\n return \"translate(0,\" + y + \")\";\n}\n\nfunction number(scale) {\n return d => +scale(d);\n}\n\nfunction center(scale, offset) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n if (scale.round()) offset = Math.round(offset);\n return d => +scale(d) + offset;\n}\n\nfunction entering() {\n return !this.__axis;\n}\n\nfunction axis(orient, scale) {\n var tickArguments = [],\n tickValues = null,\n tickFormat = null,\n tickSizeInner = 6,\n tickSizeOuter = 6,\n tickPadding = 3,\n offset = typeof window !== \"undefined\" && window.devicePixelRatio > 1 ? 0 : 0.5,\n k = orient === top || orient === left ? -1 : 1,\n x = orient === left || orient === right ? \"x\" : \"y\",\n transform = orient === top || orient === bottom ? translateX : translateY;\n\n function axis(context) {\n var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,\n format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity) : tickFormat,\n spacing = Math.max(tickSizeInner, 0) + tickPadding,\n range = scale.range(),\n range0 = +range[0] + offset,\n range1 = +range[range.length - 1] + offset,\n position = (scale.bandwidth ? center : number)(scale.copy(), offset),\n selection = context.selection ? context.selection() : context,\n path = selection.selectAll(\".domain\").data([null]),\n tick = selection.selectAll(\".tick\").data(values, scale).order(),\n tickExit = tick.exit(),\n tickEnter = tick.enter().append(\"g\").attr(\"class\", \"tick\"),\n line = tick.select(\"line\"),\n text = tick.select(\"text\");\n\n path = path.merge(path.enter().insert(\"path\", \".tick\")\n .attr(\"class\", \"domain\")\n .attr(\"stroke\", \"currentColor\"));\n\n tick = tick.merge(tickEnter);\n\n line = line.merge(tickEnter.append(\"line\")\n .attr(\"stroke\", \"currentColor\")\n .attr(x + \"2\", k * tickSizeInner));\n\n text = text.merge(tickEnter.append(\"text\")\n .attr(\"fill\", \"currentColor\")\n .attr(x, k * spacing)\n .attr(\"dy\", orient === top ? \"0em\" : orient === bottom ? \"0.71em\" : \"0.32em\"));\n\n if (context !== selection) {\n path = path.transition(context);\n tick = tick.transition(context);\n line = line.transition(context);\n text = text.transition(context);\n\n tickExit = tickExit.transition(context)\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute(\"transform\"); });\n\n tickEnter\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });\n }\n\n tickExit.remove();\n\n path\n .attr(\"d\", orient === left || orient === right\n ? (tickSizeOuter ? \"M\" + k * tickSizeOuter + \",\" + range0 + \"H\" + offset + \"V\" + range1 + \"H\" + k * tickSizeOuter : \"M\" + offset + \",\" + range0 + \"V\" + range1)\n : (tickSizeOuter ? \"M\" + range0 + \",\" + k * tickSizeOuter + \"V\" + offset + \"H\" + range1 + \"V\" + k * tickSizeOuter : \"M\" + range0 + \",\" + offset + \"H\" + range1));\n\n tick\n .attr(\"opacity\", 1)\n .attr(\"transform\", function(d) { return transform(position(d) + offset); });\n\n line\n .attr(x + \"2\", k * tickSizeInner);\n\n text\n .attr(x, k * spacing)\n .text(format);\n\n selection.filter(entering)\n .attr(\"fill\", \"none\")\n .attr(\"font-size\", 10)\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"text-anchor\", orient === right ? \"start\" : orient === left ? \"end\" : \"middle\");\n\n selection\n .each(function() { this.__axis = position; });\n }\n\n axis.scale = function(_) {\n return arguments.length ? (scale = _, axis) : scale;\n };\n\n axis.ticks = function() {\n return tickArguments = Array.from(arguments), axis;\n };\n\n axis.tickArguments = function(_) {\n return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();\n };\n\n axis.tickValues = function(_) {\n return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();\n };\n\n axis.tickFormat = function(_) {\n return arguments.length ? (tickFormat = _, axis) : tickFormat;\n };\n\n axis.tickSize = function(_) {\n return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeInner = function(_) {\n return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeOuter = function(_) {\n return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;\n };\n\n axis.tickPadding = function(_) {\n return arguments.length ? (tickPadding = +_, axis) : tickPadding;\n };\n\n axis.offset = function(_) {\n return arguments.length ? (offset = +_, axis) : offset;\n };\n\n return axis;\n}\n\nexport function axisTop(scale) {\n return axis(top, scale);\n}\n\nexport function axisRight(scale) {\n return axis(right, scale);\n}\n\nexport function axisBottom(scale) {\n return axis(bottom, scale);\n}\n\nexport function axisLeft(scale) {\n return axis(left, scale);\n}\n", "var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n", "export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n", "import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n", "import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n", "function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don\u2019t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n", "function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n", "export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n", "import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "export default function(update) {\n return new Array(update.length);\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n", "export default function(x) {\n return function() {\n return x;\n };\n}\n", "import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don\u2019t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn\u2019t worried about \u201Clive\u201D collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don\u2019t; we\u2019d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n", "export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n", "export default function() {\n return Array.from(this);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n", "export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n", "export default function() {\n return !this.node();\n}\n", "export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n", "import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n", "export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n", "import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n", "function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n", "function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n", "function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n", "function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n", "function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n", "function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n", "import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n", "import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n", "function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n", "function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n", "export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n", "function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n", "import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n", "export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n", "import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n", "import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n", "export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n", "import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n", "export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n", "import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n", "export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n", "import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n", "import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n", "export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "export default x => () => x;\n", "import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n", "import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n", "export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n", "import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n", "export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n", "import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n", "import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n", "import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n", "var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n", "import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n", "import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n", "import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n", "import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n", "import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n", "import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n", "import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n", "export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n", "var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we\u2019ve set an alarm, if we haven\u2019t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n", "import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n", "import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n", "import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n", "import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n", "import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n", "import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n", "import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n", "import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n", "import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n", "import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n", "import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n", "import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n", "function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n", "import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n", "import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n", "import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n", "function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n", "import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n", "function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n", "import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n", "import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n", "import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n", "export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n", "import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n", "import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name \u201C__brush\u201D rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n", "const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We\u2019re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n", "var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"] || \\\"\\\"\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nfunction pad(value, width) {\n var s = value + \"\", length = s.length;\n return length < width ? new Array(width - length + 1).join(0) + s : s;\n}\n\nfunction formatYear(year) {\n return year < 0 ? \"-\" + pad(-year, 6)\n : year > 9999 ? \"+\" + pad(year, 6)\n : pad(year, 4);\n}\n\nfunction formatDate(date) {\n var hours = date.getUTCHours(),\n minutes = date.getUTCMinutes(),\n seconds = date.getUTCSeconds(),\n milliseconds = date.getUTCMilliseconds();\n return isNaN(date) ? \"Invalid Date\"\n : formatYear(date.getUTCFullYear(), 4) + \"-\" + pad(date.getUTCMonth() + 1, 2) + \"-\" + pad(date.getUTCDate(), 2)\n + (milliseconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \".\" + pad(milliseconds, 3) + \"Z\"\n : seconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \"Z\"\n : minutes || hours ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \"Z\"\n : \"\");\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function preformatBody(rows, columns) {\n return rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n });\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(\"\\n\");\n }\n\n function formatBody(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return preformatBody(rows, columns).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(value) {\n return value == null ? \"\"\n : value instanceof Date ? formatDate(value)\n : reFormat.test(value += \"\") ? \"\\\"\" + value.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : value;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatBody: formatBody,\n formatRows: formatRows,\n formatRow: formatRow,\n formatValue: formatValue\n };\n}\n", "import dsv from \"./dsv.js\";\n\nvar csv = dsv(\",\");\n\nexport var csvParse = csv.parse;\nexport var csvParseRows = csv.parseRows;\nexport var csvFormat = csv.format;\nexport var csvFormatBody = csv.formatBody;\nexport var csvFormatRows = csv.formatRows;\nexport var csvFormatRow = csv.formatRow;\nexport var csvFormatValue = csv.formatValue;\n", "import dsv from \"./dsv.js\";\n\nvar tsv = dsv(\"\\t\");\n\nexport var tsvParse = tsv.parse;\nexport var tsvParseRows = tsv.parseRows;\nexport var tsvFormat = tsv.format;\nexport var tsvFormatBody = tsv.formatBody;\nexport var tsvFormatRows = tsv.formatRows;\nexport var tsvFormatRow = tsv.formatRow;\nexport var tsvFormatValue = tsv.formatValue;\n", "export default function autoType(object) {\n for (var key in object) {\n var value = object[key].trim(), number, m;\n if (!value) value = null;\n else if (value === \"true\") value = true;\n else if (value === \"false\") value = false;\n else if (value === \"NaN\") value = NaN;\n else if (!isNaN(number = +value)) value = number;\n else if (m = value.match(/^([-+]\\d{2})?\\d{4}(-\\d{2}(-\\d{2})?)?(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{3})?)?(Z|[-+]\\d{2}:\\d{2})?)?$/)) {\n if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, \"/\").replace(/T/, \" \");\n value = new Date(value);\n }\n else continue;\n object[key] = value;\n }\n return object;\n}\n\n// https://github.com/d3/d3-dsv/issues/45\nconst fixtz = new Date(\"2019-01-01T00:00\").getHours() || new Date(\"2019-07-01T00:00\").getHours();", "function responseText(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.text();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseText);\n}\n", "import {csvParse, dsvFormat, tsvParse} from \"d3-dsv\";\nimport text from \"./text.js\";\n\nfunction dsvParse(parse) {\n return function(input, init, row) {\n if (arguments.length === 2 && typeof init === \"function\") row = init, init = undefined;\n return text(input, init).then(function(response) {\n return parse(response, row);\n });\n };\n}\n\nexport default function dsv(delimiter, input, init, row) {\n if (arguments.length === 3 && typeof init === \"function\") row = init, init = undefined;\n var format = dsvFormat(delimiter);\n return text(input, init).then(function(response) {\n return format.parse(response, row);\n });\n}\n\nexport var csv = dsvParse(csvParse);\nexport var tsv = dsvParse(tsvParse);\n", "export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, \u00B1Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n", "export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n", "export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n", "// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n", "// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n", "import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n", "export default function(x) {\n return x;\n}\n", "import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"\u00B5\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"\u2212\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer \u201Cvalue\u201D part that can be\n // grouped, and fractional or exponential \u201Csuffix\u201D part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n", "export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\n\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function haversin(x) {\n return (x = sin(x / 2)) * x;\n}\n", "export default function noop() {}\n", "function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nexport default function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n}\n", "import {asin, atan2, cos, sin, sqrt} from \"./math.js\";\n\nexport function spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nexport function cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n}\n\nexport function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nexport function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nexport function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nexport function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nexport function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n", "export default function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n}\n", "import compose from \"./compose.js\";\nimport {abs, asin, atan2, cos, degrees, pi, radians, sin, tau} from \"./math.js\";\n\nfunction rotationIdentity(lambda, phi) {\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nexport function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n lambda += deltaLambda;\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi),\n sinDeltaPhi = sin(deltaPhi),\n cosDeltaGamma = cos(deltaGamma),\n sinDeltaGamma = sin(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nexport default function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n };\n\n return forward;\n}\n", "import {cartesian, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport constant from \"./constant.js\";\nimport {acos, cos, degrees, epsilon, radians, sin, tau} from \"./math.js\";\nimport {rotateRadians} from \"./rotation.js\";\n\n// Generates a circle centered at [0\u00B0, 0\u00B0], with a given radius and precision.\nexport function circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos(radius),\n sinRadius = sin(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n}\n\nexport default function() {\n var center = constant([0, 0]),\n radius = constant(90),\n precision = constant(2),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees, x[1] *= degrees;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle) : precision;\n };\n\n return circle;\n}\n", "import noop from \"../noop.js\";\n\nexport default function() {\n var lines = [],\n line;\n return {\n point: function(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n}\n", "import {abs, epsilon} from \"./math.js\";\n\nexport default function(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}\n", "import pointEqual from \"../pointEqual.js\";\nimport {epsilon} from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nexport default function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}\n\nfunction link(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n", "import {Adder} from \"d3-array\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace} from \"./cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, epsilon2, halfPi, pi, quarterPi, sign, sin, tau} from \"./math.js\";\n\nfunction longitude(point) {\n return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n}\n\nexport default function(polygon, point) {\n var lambda = longitude(point),\n phi = point[1],\n sinPhi = sin(phi),\n normal = [sin(lambda), -cos(lambda), 0],\n angle = 0,\n winding = 0;\n\n var sum = new Adder();\n\n if (sinPhi === 1) phi = halfPi + epsilon;\n else if (sinPhi === -1) phi = -halfPi - epsilon;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = longitude(point0),\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin(phi0),\n cosPhi0 = cos(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = longitude(point1),\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin(phi1),\n cosPhi1 = cos(phi1),\n delta = lambda1 - lambda0,\n sign = delta >= 0 ? 1 : -1,\n absDelta = sign * delta,\n antimeridian = absDelta > pi,\n k = sinPhi0 * sinPhi1;\n\n sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));\n angle += antimeridian ? delta + sign * tau : delta;\n\n // Are the longitudes either side of the point\u2019s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon || angle < epsilon && sum < -epsilon2) ^ (winding & 1);\n}\n", "import clipBuffer from \"./buffer.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {epsilon, halfPi} from \"../math.js\";\nimport polygonContains from \"../polygonContains.js\";\nimport {merge} from \"d3-array\";\n\nexport default function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n}\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n}\n", "import clip from \"./index.js\";\nimport {abs, atan, cos, epsilon, halfPi, pi, sin} from \"../math.js\";\n\nexport default clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi, -halfPi]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi : -pi,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi) < epsilon) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon\n ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1)\n - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n", "import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from \"../cartesian.js\";\nimport {circleStream} from \"../circle.js\";\nimport {abs, cos, epsilon, pi, radians, sqrt} from \"../math.js\";\nimport pointEqual from \"../pointEqual.js\";\nimport clip from \"./index.js\";\n\nexport default function(radius) {\n var cr = cos(radius),\n delta = 2 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))\n point1[2] = 1;\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 \u2A2F n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi) < epsilon,\n meridian = polar || delta < epsilon;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n}\n", "export default function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n}\n", "import {abs, epsilon} from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {merge} from \"d3-array\";\n\nvar clipMax = 1e9, clipMin = -clipMax;\n\n// TODO Use d3-polygon\u2019s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n", "export default x => x;\n", "import {Adder} from \"d3-array\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = new Adder(),\n areaRingSum = new Adder(),\n x00,\n y00,\n x0,\n y0;\n\nvar areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n areaSum.add(abs(areaRingSum));\n areaRingSum = new Adder();\n },\n result: function() {\n var area = areaSum / 2;\n areaSum = new Adder();\n return area;\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n areaStream.point = areaPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n areaRingSum.add(y0 * x - x0 * y);\n x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n areaPoint(x00, y00);\n}\n\nexport default areaStream;\n", "import noop from \"../noop.js\";\n\nvar x0 = Infinity,\n y0 = x0,\n x1 = -x0,\n y1 = x1;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function() {\n var bounds = [[x0, y0], [x1, y1]];\n x1 = y1 = -(y0 = x0 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint(x, y) {\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n}\n\nexport default boundsStream;\n", "import {sqrt} from \"../math.js\";\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n Y0 = 0,\n Z0 = 0,\n X1 = 0,\n Y1 = 0,\n Z1 = 0,\n X2 = 0,\n Y2 = 0,\n Z2 = 0,\n x00,\n y00,\n x0,\n y0;\n\nvar centroidStream = {\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.point = centroidPoint;\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n },\n result: function() {\n var centroid = Z2 ? [X2 / Z2, Y2 / Z2]\n : Z1 ? [X1 / Z1, Y1 / Z1]\n : Z0 ? [X0 / Z0, Y0 / Z0]\n : [NaN, NaN];\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint(x, y) {\n X0 += x;\n Y0 += y;\n ++Z0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream.point = centroidPointLine;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream.point = centroidPointRing;\n centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n\n z = y0 * x - x0 * y;\n X2 += z * (x0 + x);\n Y2 += z * (y0 + y);\n Z2 += z * 3;\n centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;\n", "import {tau} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nexport default function PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau);\n break;\n }\n }\n },\n result: noop\n};\n", "import {Adder} from \"d3-array\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = new Adder(),\n lengthRing,\n x00,\n y00,\n x0,\n y0;\n\nvar lengthStream = {\n point: noop,\n lineStart: function() {\n lengthStream.point = lengthPointFirst;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint(x00, y00);\n lengthStream.point = noop;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum;\n lengthSum = new Adder();\n return length;\n }\n};\n\nfunction lengthPointFirst(x, y) {\n lengthStream.point = lengthPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n x0 -= x, y0 -= y;\n lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n x0 = x, y0 = y;\n}\n\nexport default lengthStream;\n", "// Simple caching for constant-radius points.\nlet cacheDigits, cacheAppend, cacheRadius, cacheCircle;\n\nexport default class PathString {\n constructor(digits) {\n this._append = digits == null ? append : appendRound(digits);\n this._radius = 4.5;\n this._ = \"\";\n }\n pointRadius(_) {\n this._radius = +_;\n return this;\n }\n polygonStart() {\n this._line = 0;\n }\n polygonEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line === 0) this._ += \"Z\";\n this._point = NaN;\n }\n point(x, y) {\n switch (this._point) {\n case 0: {\n this._append`M${x},${y}`;\n this._point = 1;\n break;\n }\n case 1: {\n this._append`L${x},${y}`;\n break;\n }\n default: {\n this._append`M${x},${y}`;\n if (this._radius !== cacheRadius || this._append !== cacheAppend) {\n const r = this._radius;\n const s = this._;\n this._ = \"\"; // stash the old string so we can cache the circle path fragment\n this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;\n cacheRadius = r;\n cacheAppend = this._append;\n cacheCircle = this._;\n this._ = s;\n }\n this._ += cacheCircle;\n break;\n }\n }\n }\n result() {\n const result = this._;\n this._ = \"\";\n return result.length ? result : null;\n }\n}\n\nfunction append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n const d = Math.floor(digits);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);\n if (d > 15) return append;\n if (d !== cacheDigits) {\n const k = 10 ** d;\n cacheDigits = d;\n cacheAppend = function append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n }\n return cacheAppend;\n}\n", "import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\n\nexport default function(projection, context) {\n let digits = 3,\n pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n stream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n stream(object, projectionStream(pathArea));\n return pathArea.result();\n };\n\n path.measure = function(object) {\n stream(object, projectionStream(pathMeasure));\n return pathMeasure.result();\n };\n\n path.bounds = function(object) {\n stream(object, projectionStream(pathBounds));\n return pathBounds.result();\n };\n\n path.centroid = function(object) {\n stream(object, projectionStream(pathCentroid));\n return pathCentroid.result();\n };\n\n path.projection = function(_) {\n if (!arguments.length) return projection;\n projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream;\n return path;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n path.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) digits = null;\n else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n if (context === null) contextStream = new PathString(digits);\n return path;\n };\n\n return path.projection(projection).digits(digits).context(context);\n}\n", "export default function(methods) {\n return {\n stream: transformer(methods)\n };\n}\n\nexport function transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n", "import {default as geoStream} from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n var clip = projection.clipExtent && projection.clipExtent();\n projection.scale(150).translate([0, 0]);\n if (clip != null) projection.clipExtent(null);\n geoStream(object, projection.stream(boundsStream));\n fitBounds(boundsStream.result());\n if (clip != null) projection.clipExtent(clip);\n return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n return fit(projection, function(b) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nexport function fitWidth(projection, width, object) {\n return fit(projection, function(b) {\n var w = +width,\n k = w / (b[1][0] - b[0][0]),\n x = (w - k * (b[1][0] + b[0][0])) / 2,\n y = -k * b[0][1];\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitHeight(projection, height, object) {\n return fit(projection, function(b) {\n var h = +height,\n k = h / (b[1][1] - b[0][1]),\n x = -k * b[0][0],\n y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n", "import {cartesian} from \"../cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, radians, sqrt} from \"../math.js\";\nimport {transformer} from \"../transform.js\";\n\nvar maxDepth = 16, // maximum depth of subdivision\n cosMinDistance = cos(30 * radians); // cos(minimum angular distance)\n\nexport default function(project, delta2) {\n return +delta2 ? resample(project, delta2) : resampleNone(project);\n}\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n", "import clipAntimeridian from \"../clip/antimeridian.js\";\nimport clipCircle from \"../clip/circle.js\";\nimport clipRectangle from \"../clip/rectangle.js\";\nimport compose from \"../compose.js\";\nimport identity from \"../identity.js\";\nimport {cos, degrees, radians, sin, sqrt} from \"../math.js\";\nimport {rotateRadians} from \"../rotation.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport resample from \"./resample.js\";\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction scaleTranslate(k, dx, dy, sx, sy) {\n function transform(x, y) {\n x *= sx; y *= sy;\n return [dx + k * x, dy - k * y];\n }\n transform.invert = function(x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n return transform;\n}\n\nfunction scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);\n var cosAlpha = cos(alpha),\n sinAlpha = sin(alpha),\n a = cosAlpha * k,\n b = sinAlpha * k,\n ai = cosAlpha / k,\n bi = sinAlpha / k,\n ci = (sinAlpha * dy - cosAlpha * dx) / k,\n fi = (sinAlpha * dx + cosAlpha * dy) / k;\n function transform(x, y) {\n x *= sx; y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n transform.invert = function(x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n return transform;\n}\n\nexport default function projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nexport function projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate\n alpha = 0, // post-rotate angle\n sx = 1, // reflectX\n sy = 1, // reflectX\n theta = null, preclip = clipAntimeridian, // pre-clip angle\n x0 = null, y0, x1, y1, postclip = identity, // post-clip extent\n delta2 = 0.5, // precision\n projectResample,\n projectTransform,\n projectRotateTransform,\n cache,\n cacheStream;\n\n function projection(point) {\n return projectRotateTransform(point[0] * radians, point[1] * radians);\n }\n\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees, point[1] * degrees];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];\n };\n\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;\n };\n\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),\n transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n", "import {degrees, pi, radians} from \"../math.js\";\nimport {projectionMutator} from \"./index.js\";\n\nexport function conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];\n };\n\n return p;\n}\n", "import {asin, cos, sin} from \"../math.js\";\n\nexport function cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n", "import {abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {cylindricalEqualAreaRaw} from \"./cylindricalEqualArea.js\";\n\nexport function conicEqualAreaRaw(y0, y1) {\n var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y,\n l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0)\n l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n}\n", "import conicEqualArea from \"./conicEqualArea.js\";\n\nexport default function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n}\n", "import {epsilon} from \"../math.js\";\nimport albers from \"./albers.js\";\nimport conicEqualArea from \"./conicEqualArea.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960\u00D7500. The projection also works quite well at 960\u00D7600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nexport default function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n albersUsa.fitWidth = function(width, object) {\n return fitWidth(albersUsa, width, object);\n };\n\n albersUsa.fitHeight = function(height, object) {\n return fitHeight(albersUsa, height, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n}\n", "import {asin, atan2, cos, sin, sqrt} from \"../math.js\";\n\nexport function azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos(x),\n cy = cos(y),\n k = scale(cx * cy);\n if (k === Infinity) return [2, 0];\n return [\n k * cy * sin(x),\n k * sin(y)\n ];\n }\n}\n\nexport function azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin(c),\n cc = cos(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n", "import {asin, sqrt} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nexport default function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n}\n", "import {acos, sin} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nexport default function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n}\n", "import {atan, exp, halfPi, log, pi, tan, tau} from \"../math.js\";\nimport rotation from \"../rotation.js\";\nimport projection from \"./index.js\";\n\nexport function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n};\n\nexport default function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau);\n}\n\nexport function mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n", "import {abs, atan, atan2, cos, epsilon, halfPi, log, pi, pow, sign, sin, sqrt, tan} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {mercatorRaw} from \"./mercator.js\";\n\nfunction tany(y) {\n return tan((halfPi + y) / 2);\n}\n\nexport function conicConformalRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; }\n else { if (y > halfPi - epsilon) y = halfPi - epsilon; }\n var r = f / pow(tany(y), n);\n return [r * sin(n * x), f - r * cos(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy),\n l = atan2(x, abs(fy)) * sign(fy);\n if (fy * n < 0)\n l -= pi * sign(x) * sign(fy);\n return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n}\n", "import projection from \"./index.js\";\n\nexport function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nexport default function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n}\n", "import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {equirectangularRaw} from \"./equirectangular.js\";\n\nexport function conicEquidistantRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin(nx), g - gy * cos(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y,\n l = atan2(x, abs(gy)) * sign(gy);\n if (gy * n < 0)\n l -= pi * sign(x) * sign(gy);\n return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n}\n", "import projection from \"./index.js\";\nimport {abs, asin, cos, epsilon2, sin, sqrt} from \"../math.js\";\n\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = sqrt(3) / 2,\n iterations = 12;\n\nexport function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;\n return [\n lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),\n l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))\n ];\n}\n\nequalEarthRaw.invert = function(x, y) {\n var l = y, l2 = l * l, l6 = l2 * l2 * l2;\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon2) break;\n }\n return [\n M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),\n asin(sin(l) / M)\n ];\n};\n\nexport default function() {\n return projection(equalEarthRaw)\n .scale(177.158);\n}\n", "import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function gnomonicRaw(x, y) {\n var cy = cos(y), k = cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nexport default function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n}\n", "import {asin, cos, epsilon, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nexport default function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon);\n}\n", "import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function stereographicRaw(x, y) {\n var cy = cos(y), k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nexport default function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n}\n", "import {atan, exp, halfPi, log, tan} from \"../math.js\";\nimport {mercatorProjection} from \"./mercator.js\";\n\nexport function transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi];\n};\n\nexport default function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n}\n", "export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n", "import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n", "import {range as sequence} from \"d3-array\";\nimport {initRange} from \"./init.js\";\nimport ordinal from \"./ordinal.js\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n r0 = 0,\n r1 = 1,\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = r1 < r0,\n start = reverse ? r1 : r0,\n stop = reverse ? r0 : r1;\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];\n };\n\n scale.rangeRound = function(_) {\n return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band(domain(), [r0, r1])\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return initRange.apply(rescale(), arguments);\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band.apply(null, arguments).paddingInner(1));\n}\n", "export default function constants(x) {\n return function() {\n return x;\n };\n}\n", "export default function number(x) {\n return +x;\n}\n", "import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n", "import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n", "import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n", "import {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nexport default function identity(domain) {\n var unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return identity(domain).unknown(unknown);\n };\n\n domain = arguments.length ? Array.from(domain, number) : [0, 1];\n\n return linearish(scale);\n}\n", "export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n", "import {ticks} from \"d3-array\";\nimport {format, formatSpecifier} from \"d3-format\";\nimport nice from \"./nice.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformLog(x) {\n return Math.log(x);\n}\n\nfunction transformExp(x) {\n return Math.exp(x);\n}\n\nfunction transformLogn(x) {\n return -Math.log(-x);\n}\n\nfunction transformExpn(x) {\n return -Math.exp(-x);\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : x => Math.pow(base, x);\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), x => Math.log(x) / base);\n}\n\nfunction reflect(f) {\n return (x, k) => -f(-x, k);\n}\n\nexport function loggish(transform) {\n const scale = transform(transformLog, transformExp);\n const domain = scale.domain;\n let base = 10;\n let logs;\n let pows;\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) {\n logs = reflect(logs), pows = reflect(pows);\n transform(transformLogn, transformExpn);\n } else {\n transform(transformLog, transformExp);\n }\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = count => {\n const d = domain();\n let u = d[0];\n let v = d[d.length - 1];\n const r = v < u;\n\n if (r) ([u, v] = [v, u]);\n\n let i = logs(u);\n let j = logs(v);\n let k;\n let t;\n const n = count == null ? 10 : +count;\n let z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.floor(i), j = Math.ceil(j);\n if (u > 0) for (; i <= j; ++i) {\n for (k = 1; k < base; ++k) {\n t = i < 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i <= j; ++i) {\n for (k = base - 1; k >= 1; --k) {\n t = i > 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n if (z.length * 2 < n) z = ticks(u, v, n);\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = (count, specifier) => {\n if (count == null) count = 10;\n if (specifier == null) specifier = base === 10 ? \"s\" : \",\";\n if (typeof specifier !== \"function\") {\n if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;\n specifier = format(specifier);\n }\n if (count === Infinity) return specifier;\n const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return d => {\n let i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = () => {\n return domain(nice(domain(), {\n floor: x => pows(Math.floor(logs(x))),\n ceil: x => pows(Math.ceil(logs(x)))\n }));\n };\n\n return scale;\n}\n\nexport default function log() {\n const scale = loggish(transformer()).domain([1, 10]);\n scale.copy = () => copy(scale, log()).base(scale.base());\n initRange.apply(scale, arguments);\n return scale;\n}\n", "import {linearish} from \"./linear.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformSymlog(c) {\n return function(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / c));\n };\n}\n\nfunction transformSymexp(c) {\n return function(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * c;\n };\n}\n\nexport function symlogish(transform) {\n var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));\n\n scale.constant = function(_) {\n return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;\n };\n\n return linearish(scale);\n}\n\nexport default function symlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, symlog()).constant(scale.constant());\n };\n\n return initRange.apply(scale, arguments);\n}\n", "import {linearish} from \"./linear.js\";\nimport {copy, identity, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformPow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction transformSqrt(x) {\n return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);\n}\n\nfunction transformSquare(x) {\n return x < 0 ? -x * x : x * x;\n}\n\nexport function powish(transform) {\n var scale = transform(identity, identity),\n exponent = 1;\n\n function rescale() {\n return exponent === 1 ? transform(identity, identity)\n : exponent === 0.5 ? transform(transformSqrt, transformSquare)\n : transform(transformPow(exponent), transformPow(1 / exponent));\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, rescale()) : exponent;\n };\n\n return linearish(scale);\n}\n\nexport default function pow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, pow()).exponent(scale.exponent());\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n\nexport function sqrt() {\n return pow.apply(null, arguments).exponent(0.5);\n}\n", "import {ascending, bisect, quantileSorted as threshold} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [],\n unknown;\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n", "import {bisect} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n unknown,\n n = 1;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n", "const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n", "import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n", "export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n", "import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n", "import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n", "import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n", "import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n", "import {interpolate, interpolateRound} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 1,\n t0,\n t1,\n k10,\n transform,\n interpolator = identity,\n clamp = false,\n unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1;\n return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);\n return scale;\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .interpolator(source.interpolator())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport default function sequential() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, sequential());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialLog() {\n var scale = loggish(transformer()).domain([1, 10]);\n\n scale.copy = function() {\n return copy(scale, sequentialLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSqrt() {\n return sequentialPow.apply(null, arguments).exponent(0.5);\n}\n", "import {interpolate, interpolateRound, piecewise} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {copy} from \"./sequential.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 0.5,\n x2 = 1,\n s = 1,\n t0,\n t1,\n t2,\n k10,\n k21,\n interpolator = identity,\n transform,\n clamp = false,\n unknown;\n\n function scale(x) {\n return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1, r2;\n return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;\n return scale;\n };\n}\n\nexport default function diverging() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, diverging());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingLog() {\n var scale = loggish(transformer()).domain([0.1, 1, 10]);\n\n scale.copy = function() {\n return copy(scale, divergingLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSqrt() {\n return divergingPow.apply(null, arguments).exponent(0.5);\n}\n", "export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n", "import colors from \"../colors.js\";\n\nexport default colors(\"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab\");\n", "import {interpolateRgbBasis} from \"d3-interpolate\";\n\nexport default scheme => interpolateRgbBasis(scheme[scheme.length - 1]);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"d8b365f5f5f55ab4ac\",\n \"a6611adfc27d80cdc1018571\",\n \"a6611adfc27df5f5f580cdc1018571\",\n \"8c510ad8b365f6e8c3c7eae55ab4ac01665e\",\n \"8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e\",\n \"8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e\",\n \"8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e\",\n \"5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30\",\n \"5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"af8dc3f7f7f77fbf7b\",\n \"7b3294c2a5cfa6dba0008837\",\n \"7b3294c2a5cff7f7f7a6dba0008837\",\n \"762a83af8dc3e7d4e8d9f0d37fbf7b1b7837\",\n \"762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837\",\n \"762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837\",\n \"762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837\",\n \"40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b\",\n \"40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e9a3c9f7f7f7a1d76a\",\n \"d01c8bf1b6dab8e1864dac26\",\n \"d01c8bf1b6daf7f7f7b8e1864dac26\",\n \"c51b7de9a3c9fde0efe6f5d0a1d76a4d9221\",\n \"c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221\",\n \"c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221\",\n \"c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221\",\n \"8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419\",\n \"8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"998ec3f7f7f7f1a340\",\n \"5e3c99b2abd2fdb863e66101\",\n \"5e3c99b2abd2f7f7f7fdb863e66101\",\n \"542788998ec3d8daebfee0b6f1a340b35806\",\n \"542788998ec3d8daebf7f7f7fee0b6f1a340b35806\",\n \"5427888073acb2abd2d8daebfee0b6fdb863e08214b35806\",\n \"5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806\",\n \"2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08\",\n \"2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ef8a62f7f7f767a9cf\",\n \"ca0020f4a58292c5de0571b0\",\n \"ca0020f4a582f7f7f792c5de0571b0\",\n \"b2182bef8a62fddbc7d1e5f067a9cf2166ac\",\n \"b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac\",\n \"b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac\",\n \"b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac\",\n \"67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061\",\n \"67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ef8a62ffffff999999\",\n \"ca0020f4a582bababa404040\",\n \"ca0020f4a582ffffffbababa404040\",\n \"b2182bef8a62fddbc7e0e0e09999994d4d4d\",\n \"b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d\",\n \"b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d\",\n \"b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d\",\n \"67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a\",\n \"67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf91bfdb\",\n \"d7191cfdae61abd9e92c7bb6\",\n \"d7191cfdae61ffffbfabd9e92c7bb6\",\n \"d73027fc8d59fee090e0f3f891bfdb4575b4\",\n \"d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4\",\n \"d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4\",\n \"d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4\",\n \"a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695\",\n \"a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf91cf60\",\n \"d7191cfdae61a6d96a1a9641\",\n \"d7191cfdae61ffffbfa6d96a1a9641\",\n \"d73027fc8d59fee08bd9ef8b91cf601a9850\",\n \"d73027fc8d59fee08bffffbfd9ef8b91cf601a9850\",\n \"d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850\",\n \"d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850\",\n \"a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837\",\n \"a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf99d594\",\n \"d7191cfdae61abdda42b83ba\",\n \"d7191cfdae61ffffbfabdda42b83ba\",\n \"d53e4ffc8d59fee08be6f59899d5943288bd\",\n \"d53e4ffc8d59fee08bffffbfe6f59899d5943288bd\",\n \"d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd\",\n \"d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd\",\n \"9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2\",\n \"9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e5f5f999d8c92ca25f\",\n \"edf8fbb2e2e266c2a4238b45\",\n \"edf8fbb2e2e266c2a42ca25f006d2c\",\n \"edf8fbccece699d8c966c2a42ca25f006d2c\",\n \"edf8fbccece699d8c966c2a441ae76238b45005824\",\n \"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824\",\n \"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e0ecf49ebcda8856a7\",\n \"edf8fbb3cde38c96c688419d\",\n \"edf8fbb3cde38c96c68856a7810f7c\",\n \"edf8fbbfd3e69ebcda8c96c68856a7810f7c\",\n \"edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b\",\n \"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b\",\n \"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e0f3dba8ddb543a2ca\",\n \"f0f9e8bae4bc7bccc42b8cbe\",\n \"f0f9e8bae4bc7bccc443a2ca0868ac\",\n \"f0f9e8ccebc5a8ddb57bccc443a2ca0868ac\",\n \"f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e\",\n \"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e\",\n \"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee8c8fdbb84e34a33\",\n \"fef0d9fdcc8afc8d59d7301f\",\n \"fef0d9fdcc8afc8d59e34a33b30000\",\n \"fef0d9fdd49efdbb84fc8d59e34a33b30000\",\n \"fef0d9fdd49efdbb84fc8d59ef6548d7301f990000\",\n \"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000\",\n \"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ece2f0a6bddb1c9099\",\n \"f6eff7bdc9e167a9cf02818a\",\n \"f6eff7bdc9e167a9cf1c9099016c59\",\n \"f6eff7d0d1e6a6bddb67a9cf1c9099016c59\",\n \"f6eff7d0d1e6a6bddb67a9cf3690c002818a016450\",\n \"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450\",\n \"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ece7f2a6bddb2b8cbe\",\n \"f1eef6bdc9e174a9cf0570b0\",\n \"f1eef6bdc9e174a9cf2b8cbe045a8d\",\n \"f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d\",\n \"f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b\",\n \"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b\",\n \"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e7e1efc994c7dd1c77\",\n \"f1eef6d7b5d8df65b0ce1256\",\n \"f1eef6d7b5d8df65b0dd1c77980043\",\n \"f1eef6d4b9dac994c7df65b0dd1c77980043\",\n \"f1eef6d4b9dac994c7df65b0e7298ace125691003f\",\n \"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f\",\n \"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fde0ddfa9fb5c51b8a\",\n \"feebe2fbb4b9f768a1ae017e\",\n \"feebe2fbb4b9f768a1c51b8a7a0177\",\n \"feebe2fcc5c0fa9fb5f768a1c51b8a7a0177\",\n \"feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177\",\n \"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177\",\n \"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"edf8b17fcdbb2c7fb8\",\n \"ffffcca1dab441b6c4225ea8\",\n \"ffffcca1dab441b6c42c7fb8253494\",\n \"ffffccc7e9b47fcdbb41b6c42c7fb8253494\",\n \"ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84\",\n \"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84\",\n \"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"f7fcb9addd8e31a354\",\n \"ffffccc2e69978c679238443\",\n \"ffffccc2e69978c67931a354006837\",\n \"ffffccd9f0a3addd8e78c67931a354006837\",\n \"ffffccd9f0a3addd8e78c67941ab5d238443005a32\",\n \"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32\",\n \"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fff7bcfec44fd95f0e\",\n \"ffffd4fed98efe9929cc4c02\",\n \"ffffd4fed98efe9929d95f0e993404\",\n \"ffffd4fee391fec44ffe9929d95f0e993404\",\n \"ffffd4fee391fec44ffe9929ec7014cc4c028c2d04\",\n \"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04\",\n \"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ffeda0feb24cf03b20\",\n \"ffffb2fecc5cfd8d3ce31a1c\",\n \"ffffb2fecc5cfd8d3cf03b20bd0026\",\n \"ffffb2fed976feb24cfd8d3cf03b20bd0026\",\n \"ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026\",\n \"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026\",\n \"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"deebf79ecae13182bd\",\n \"eff3ffbdd7e76baed62171b5\",\n \"eff3ffbdd7e76baed63182bd08519c\",\n \"eff3ffc6dbef9ecae16baed63182bd08519c\",\n \"eff3ffc6dbef9ecae16baed64292c62171b5084594\",\n \"f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594\",\n \"f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e5f5e0a1d99b31a354\",\n \"edf8e9bae4b374c476238b45\",\n \"edf8e9bae4b374c47631a354006d2c\",\n \"edf8e9c7e9c0a1d99b74c47631a354006d2c\",\n \"edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32\",\n \"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32\",\n \"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"f0f0f0bdbdbd636363\",\n \"f7f7f7cccccc969696525252\",\n \"f7f7f7cccccc969696636363252525\",\n \"f7f7f7d9d9d9bdbdbd969696636363252525\",\n \"f7f7f7d9d9d9bdbdbd969696737373525252252525\",\n \"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525\",\n \"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"efedf5bcbddc756bb1\",\n \"f2f0f7cbc9e29e9ac86a51a3\",\n \"f2f0f7cbc9e29e9ac8756bb154278f\",\n \"f2f0f7dadaebbcbddc9e9ac8756bb154278f\",\n \"f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486\",\n \"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486\",\n \"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee0d2fc9272de2d26\",\n \"fee5d9fcae91fb6a4acb181d\",\n \"fee5d9fcae91fb6a4ade2d26a50f15\",\n \"fee5d9fcbba1fc9272fb6a4ade2d26a50f15\",\n \"fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d\",\n \"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d\",\n \"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee6cefdae6be6550d\",\n \"feeddefdbe85fd8d3cd94701\",\n \"feeddefdbe85fd8d3ce6550da63603\",\n \"feeddefdd0a2fdae6bfd8d3ce6550da63603\",\n \"feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04\",\n \"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04\",\n \"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704\"\n).map(colors);\n\nexport default ramp(scheme);\n", "export default function(t) {\n t = Math.max(0, Math.min(1, t));\n return \"rgb(\"\n + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67)))))))\n + \")\";\n}\n", "import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n", "import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nexport var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar c = cubehelix();\n\nexport default function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n c.h = 360 * t - 100;\n c.s = 1.5 - 1.5 * ts;\n c.l = 0.8 - 0.9 * ts;\n return c + \"\";\n}\n", "import {rgb} from \"d3-color\";\n\nvar c = rgb(),\n pi_1_3 = Math.PI / 3,\n pi_2_3 = Math.PI * 2 / 3;\n\nexport default function(t) {\n var x;\n t = (0.5 - t) * Math.PI;\n c.r = 255 * (x = Math.sin(t)) * x;\n c.g = 255 * (x = Math.sin(t + pi_1_3)) * x;\n c.b = 255 * (x = Math.sin(t + pi_2_3)) * x;\n return c + \"\";\n}\n", "export default function(t) {\n t = Math.max(0, Math.min(1, t));\n return \"rgb(\"\n + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))\n + \")\";\n}\n", "import colors from \"../colors.js\";\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nexport default ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nexport var magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nexport var inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nexport var plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n", "export default function(x) {\n return function constant() {\n return x;\n };\n}\n", "export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n", "import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n", "export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n", "function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n", "export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n", "import pointRadial from \"../pointRadial.js\";\n\nclass Bump {\n constructor(context, x) {\n this._context = context;\n this._x = x;\n }\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n }\n point(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: {\n this._point = 1;\n if (this._line) this._context.lineTo(x, y);\n else this._context.moveTo(x, y);\n break;\n }\n case 1: this._point = 2; // falls through\n default: {\n if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);\n else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);\n break;\n }\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nclass BumpRadial {\n constructor(context) {\n this._context = context;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {}\n point(x, y) {\n x = +x, y = +y;\n if (this._point === 0) {\n this._point = 1;\n } else {\n const p0 = pointRadial(this._x0, this._y0);\n const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);\n const p2 = pointRadial(x, this._y0);\n const p3 = pointRadial(x, y);\n this._context.moveTo(...p0);\n this._context.bezierCurveTo(...p1, ...p2, ...p3);\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nexport function bumpX(context) {\n return new Bump(context, true);\n}\n\nexport function bumpY(context) {\n return new Bump(context, false);\n}\n\nexport function bumpRadial(context) {\n return new BumpRadial(context);\n}\n", "import {min, sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;\n const t = r / 2;\n const u = t * sqrt3;\n context.moveTo(0, r);\n context.lineTo(0, -r);\n context.moveTo(-u, -t);\n context.lineTo(u, t);\n context.moveTo(-u, t);\n context.lineTo(u, -t);\n }\n};\n", "import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.62625;\n context.moveTo(0, -r);\n context.lineTo(r, 0);\n context.lineTo(0, r);\n context.lineTo(-r, 0);\n context.closePath();\n }\n};\n", "import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 7, 2)) * 0.87559;\n context.moveTo(-r, 0);\n context.lineTo(r, 0);\n context.moveTo(0, r);\n context.lineTo(0, -r);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const w = sqrt(size);\n const x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.4431;\n context.moveTo(r, r);\n context.lineTo(r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, r);\n context.closePath();\n }\n};\n", "import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const s = sqrt(size) * 0.6824;\n const t = s / 2;\n const u = (s * sqrt3) / 2; // cos(Math.PI / 6)\n context.moveTo(0, -s);\n context.lineTo(u, t);\n context.lineTo(-u, t);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n", "import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 6, 1.7)) * 0.6189;\n context.moveTo(-r, -r);\n context.lineTo(r, r);\n context.moveTo(-r, r);\n context.lineTo(r, -r);\n }\n};\n", "import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n", "export default function() {}\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n", "import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n", "import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n", "import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n", "function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic B\u00E9zier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n", "function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n", "function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n", "export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n", "import {ascending, descending} from \"d3\";\n\nexport function defined(x) {\n return x != null && !Number.isNaN(x);\n}\n\nexport function ascendingDefined(a, b) {\n return +defined(b) - +defined(a) || ascending(a, b);\n}\n\nexport function descendingDefined(a, b) {\n return +defined(b) - +defined(a) || descending(a, b);\n}\n\nexport function nonempty(x) {\n return x != null && `${x}` !== \"\";\n}\n\nexport function finite(x) {\n return isFinite(x) ? x : NaN;\n}\n\nexport function positive(x) {\n return x > 0 && isFinite(x) ? x : NaN;\n}\n\nexport function negative(x) {\n return x < 0 && isFinite(x) ? x : NaN;\n}\n", "export default function format(date, fallback) {\n if (!(date instanceof Date)) date = new Date(+date);\n if (isNaN(date)) return typeof fallback === \"function\" ? fallback(date) : fallback;\n const hours = date.getUTCHours();\n const minutes = date.getUTCMinutes();\n const seconds = date.getUTCSeconds();\n const milliseconds = date.getUTCMilliseconds();\n return `${formatYear(date.getUTCFullYear(), 4)}-${pad(date.getUTCMonth() + 1, 2)}-${pad(date.getUTCDate(), 2)}${\n hours || minutes || seconds || milliseconds ? `T${pad(hours, 2)}:${pad(minutes, 2)}${\n seconds || milliseconds ? `:${pad(seconds, 2)}${\n milliseconds ? `.${pad(milliseconds, 3)}` : ``\n }` : ``\n }Z` : ``\n }`;\n}\n\nfunction formatYear(year) {\n return year < 0 ? `-${pad(-year, 6)}`\n : year > 9999 ? `+${pad(year, 6)}`\n : pad(year, 4);\n}\n\nfunction pad(value, width) {\n return `${value}`.padStart(width, \"0\");\n}\n", "const re = /^(?:[-+]\\d{2})?\\d{4}(?:-\\d{2}(?:-\\d{2})?)?(?:T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{3})?)?(?:Z|[-+]\\d{2}:?\\d{2})?)?$/;\n\nexport default function parse(string, fallback) {\n if (!re.test(string += \"\")) return typeof fallback === \"function\" ? fallback(string) : fallback;\n return new Date(string);\n}\n", "import {descending} from \"d3\";\n\n// Like a sort comparator, returns a positive value if the given array of values\n// is in ascending order, a negative value if the values are in descending\n// order. Assumes monotonicity; only tests the first and last values.\nexport function orderof(values) {\n if (values == null) return;\n const first = values[0];\n const last = values[values.length - 1];\n return descending(first, last);\n}\n", "import {bisector, max, pairs, timeFormat, utcFormat} from \"d3\";\nimport {utcSecond, utcMinute, utcHour, unixDay, utcWeek, utcMonth, utcYear} from \"d3\";\nimport {utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSunday} from \"d3\";\nimport {timeSecond, timeMinute, timeHour, timeDay, timeWeek, timeMonth, timeYear} from \"d3\";\nimport {timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSunday} from \"d3\";\nimport {orderof} from \"./order.js\";\n\nconst durationSecond = 1000;\nconst durationMinute = durationSecond * 60;\nconst durationHour = durationMinute * 60;\nconst durationDay = durationHour * 24;\nconst durationWeek = durationDay * 7;\nconst durationMonth = durationDay * 30;\nconst durationYear = durationDay * 365;\n\n// See https://github.com/d3/d3-time/blob/9e8dc940f38f78d7588aad68a54a25b1f0c2d97b/src/ticks.js#L14-L33\nconst tickIntervals = [\n [\"millisecond\", 1],\n [\"2 milliseconds\", 2],\n [\"5 milliseconds\", 5],\n [\"10 milliseconds\", 10],\n [\"20 milliseconds\", 20],\n [\"50 milliseconds\", 50],\n [\"100 milliseconds\", 100],\n [\"200 milliseconds\", 200],\n [\"500 milliseconds\", 500],\n [\"second\", durationSecond],\n [\"5 seconds\", 5 * durationSecond],\n [\"15 seconds\", 15 * durationSecond],\n [\"30 seconds\", 30 * durationSecond],\n [\"minute\", durationMinute],\n [\"5 minutes\", 5 * durationMinute],\n [\"15 minutes\", 15 * durationMinute],\n [\"30 minutes\", 30 * durationMinute],\n [\"hour\", durationHour],\n [\"3 hours\", 3 * durationHour],\n [\"6 hours\", 6 * durationHour],\n [\"12 hours\", 12 * durationHour],\n [\"day\", durationDay],\n [\"2 days\", 2 * durationDay],\n [\"week\", durationWeek],\n [\"2 weeks\", 2 * durationWeek], // https://github.com/d3/d3-time/issues/46\n [\"month\", durationMonth],\n [\"3 months\", 3 * durationMonth],\n [\"6 months\", 6 * durationMonth], // https://github.com/d3/d3-time/issues/46\n [\"year\", durationYear],\n [\"2 years\", 2 * durationYear],\n [\"5 years\", 5 * durationYear],\n [\"10 years\", 10 * durationYear],\n [\"20 years\", 20 * durationYear],\n [\"50 years\", 50 * durationYear],\n [\"100 years\", 100 * durationYear] // TODO generalize to longer time scales\n];\n\nconst durations = new Map([\n [\"second\", durationSecond],\n [\"minute\", durationMinute],\n [\"hour\", durationHour],\n [\"day\", durationDay],\n [\"monday\", durationWeek],\n [\"tuesday\", durationWeek],\n [\"wednesday\", durationWeek],\n [\"thursday\", durationWeek],\n [\"friday\", durationWeek],\n [\"saturday\", durationWeek],\n [\"sunday\", durationWeek],\n [\"week\", durationWeek],\n [\"month\", durationMonth],\n [\"year\", durationYear]\n]);\n\nconst timeIntervals = new Map([\n [\"second\", timeSecond],\n [\"minute\", timeMinute],\n [\"hour\", timeHour],\n [\"day\", timeDay], // https://github.com/d3/d3-time/issues/62\n [\"monday\", timeMonday],\n [\"tuesday\", timeTuesday],\n [\"wednesday\", timeWednesday],\n [\"thursday\", timeThursday],\n [\"friday\", timeFriday],\n [\"saturday\", timeSaturday],\n [\"sunday\", timeSunday],\n [\"week\", timeWeek],\n [\"month\", timeMonth],\n [\"year\", timeYear]\n]);\n\nconst utcIntervals = new Map([\n [\"second\", utcSecond],\n [\"minute\", utcMinute],\n [\"hour\", utcHour],\n [\"day\", unixDay],\n [\"monday\", utcMonday],\n [\"tuesday\", utcTuesday],\n [\"wednesday\", utcWednesday],\n [\"thursday\", utcThursday],\n [\"friday\", utcFriday],\n [\"saturday\", utcSaturday],\n [\"sunday\", utcSunday],\n [\"week\", utcWeek],\n [\"month\", utcMonth],\n [\"year\", utcYear]\n]);\n\n// These hidden fields describe standard intervals so that we can, for example,\n// generalize a scale\u2019s time interval to a larger ticks time interval to reduce\n// the number of displayed ticks. TODO We could instead allow the interval\n// implementation to expose a \u201Cgeneralize\u201D method that returns a larger, aligned\n// interval; that would allow us to move this logic to D3, and allow\n// generalization even when a custom interval is provided.\nexport const intervalDuration = Symbol(\"intervalDuration\");\nexport const intervalType = Symbol(\"intervalType\");\n\n// We greedily mutate D3\u2019s standard intervals on load so that the hidden fields\n// are available even if specified as e.g. d3.utcMonth instead of \"month\".\nfor (const [name, interval] of timeIntervals) {\n interval[intervalDuration] = durations.get(name);\n interval[intervalType] = \"time\";\n}\nfor (const [name, interval] of utcIntervals) {\n interval[intervalDuration] = durations.get(name);\n interval[intervalType] = \"utc\";\n}\n\nconst utcFormatIntervals = [\n [\"year\", utcYear, \"utc\"],\n [\"month\", utcMonth, \"utc\"],\n [\"day\", unixDay, \"utc\", 6 * durationMonth],\n [\"hour\", utcHour, \"utc\", 3 * durationDay],\n [\"minute\", utcMinute, \"utc\", 6 * durationHour],\n [\"second\", utcSecond, \"utc\", 30 * durationMinute]\n];\n\nconst timeFormatIntervals = [\n [\"year\", timeYear, \"time\"],\n [\"month\", timeMonth, \"time\"],\n [\"day\", timeDay, \"time\", 6 * durationMonth],\n [\"hour\", timeHour, \"time\", 3 * durationDay],\n [\"minute\", timeMinute, \"time\", 6 * durationHour],\n [\"second\", timeSecond, \"time\", 30 * durationMinute]\n];\n\n// An interleaved array of UTC and local time intervals, in descending order\n// from largest to smallest, used to determine the most specific standard time\n// format for a given array of dates. This is a subset of the tick intervals\n// listed above; we only need the breakpoints where the format changes.\nconst formatIntervals = [\n utcFormatIntervals[0],\n timeFormatIntervals[0],\n utcFormatIntervals[1],\n timeFormatIntervals[1],\n utcFormatIntervals[2],\n timeFormatIntervals[2],\n // Below day, local time typically has an hourly offset from UTC and hence the\n // two are aligned and indistinguishable; therefore, we only consider UTC, and\n // we don\u2019t consider these if the domain only has a single value.\n ...utcFormatIntervals.slice(3)\n];\n\nexport function parseTimeInterval(input) {\n let name = `${input}`.toLowerCase();\n if (name.endsWith(\"s\")) name = name.slice(0, -1); // drop plural\n let period = 1;\n const match = /^(?:(\\d+)\\s+)/.exec(name);\n if (match) {\n name = name.slice(match[0].length);\n period = +match[1];\n }\n switch (name) {\n case \"quarter\":\n name = \"month\";\n period *= 3;\n break;\n case \"half\":\n name = \"month\";\n period *= 6;\n break;\n }\n let interval = utcIntervals.get(name);\n if (!interval) throw new Error(`unknown interval: ${input}`);\n if (period > 1 && !interval.every) throw new Error(`non-periodic interval: ${name}`);\n return [name, period];\n}\n\nexport function maybeTimeInterval(input) {\n return asInterval(parseTimeInterval(input), \"time\");\n}\n\nexport function maybeUtcInterval(input) {\n return asInterval(parseTimeInterval(input), \"utc\");\n}\n\nfunction asInterval([name, period], type) {\n let interval = (type === \"time\" ? timeIntervals : utcIntervals).get(name);\n if (period > 1) {\n interval = interval.every(period);\n interval[intervalDuration] = durations.get(name) * period;\n interval[intervalType] = type;\n }\n return interval;\n}\n\n// If the given interval is a standard time interval, we may be able to promote\n// it a larger aligned time interval, rather than showing every nth tick.\nexport function generalizeTimeInterval(interval, n) {\n if (!(n > 1)) return; // no need to generalize\n const duration = interval[intervalDuration];\n if (!tickIntervals.some(([, d]) => d === duration)) return; // nonstandard or unknown interval\n if (duration % durationDay === 0 && durationDay < duration && duration < durationMonth) return; // not generalizable\n const [i] = tickIntervals[bisector(([, step]) => Math.log(step)).center(tickIntervals, Math.log(duration * n))];\n return (interval[intervalType] === \"time\" ? maybeTimeInterval : maybeUtcInterval)(i);\n}\n\nfunction formatTimeInterval(name, type, anchor) {\n const format = type === \"time\" ? timeFormat : utcFormat;\n // For tips and legends, use a format that doesn\u2019t require context.\n if (anchor == null) {\n return format(\n name === \"year\"\n ? \"%Y\"\n : name === \"month\"\n ? \"%Y-%m\"\n : name === \"day\"\n ? \"%Y-%m-%d\"\n : name === \"hour\" || name === \"minute\"\n ? \"%Y-%m-%dT%H:%M\"\n : name === \"second\"\n ? \"%Y-%m-%dT%H:%M:%S\"\n : \"%Y-%m-%dT%H:%M:%S.%L\"\n );\n }\n // Otherwise, assume that this is for axis ticks.\n const template = getTimeTemplate(anchor);\n switch (name) {\n case \"millisecond\":\n return formatConditional(format(\".%L\"), format(\":%M:%S\"), template);\n case \"second\":\n return formatConditional(format(\":%S\"), format(\"%-I:%M\"), template);\n case \"minute\":\n return formatConditional(format(\"%-I:%M\"), format(\"%p\"), template);\n case \"hour\":\n return formatConditional(format(\"%-I %p\"), format(\"%b %-d\"), template);\n case \"day\":\n return formatConditional(format(\"%-d\"), format(\"%b\"), template);\n case \"month\":\n return formatConditional(format(\"%b\"), format(\"%Y\"), template);\n case \"year\":\n return format(\"%Y\");\n }\n throw new Error(\"unable to format time ticks\");\n}\n\nfunction getTimeTemplate(anchor) {\n return anchor === \"left\" || anchor === \"right\"\n ? (f1, f2) => `\\n${f1}\\n${f2}` // extra newline to keep f1 centered\n : anchor === \"top\"\n ? (f1, f2) => `${f2}\\n${f1}`\n : (f1, f2) => `${f1}\\n${f2}`;\n}\n\nfunction getFormatIntervals(type) {\n return type === \"time\" ? timeFormatIntervals : type === \"utc\" ? utcFormatIntervals : formatIntervals;\n}\n\n// Given an array of dates, returns the largest compatible standard time\n// interval. If no standard interval is compatible (other than milliseconds,\n// which is universally compatible), returns undefined.\nexport function inferTimeFormat(type, dates, anchor) {\n const step = max(pairs(dates, (a, b) => Math.abs(b - a))); // maybe undefined!\n if (step < 1000) return formatTimeInterval(\"millisecond\", \"utc\", anchor);\n for (const [name, interval, intervalType, maxStep] of getFormatIntervals(type)) {\n if (step > maxStep) break; // e.g., 52 weeks\n if (name === \"hour\" && !step) break; // e.g., domain with a single date\n if (dates.every((d) => interval.floor(d) >= d)) return formatTimeInterval(name, intervalType, anchor);\n }\n}\n\nfunction formatConditional(format1, format2, template) {\n return (x, i, X) => {\n const f1 = format1(x, i); // always shown\n const f2 = format2(x, i); // only shown if different\n const j = i - orderof(X); // detect reversed domains\n return i !== j && X[j] !== undefined && f2 === format2(X[j], j) ? f1 : template(f1, f2);\n };\n}\n", "import {quantile, range as rangei} from \"d3\";\nimport {parse as isoParse} from \"isoformat\";\nimport {defined} from \"./defined.js\";\nimport {maybeTimeInterval, maybeUtcInterval} from \"./time.js\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray\nexport const TypedArray = Object.getPrototypeOf(Uint8Array);\nconst objectToString = Object.prototype.toString;\n\n// If a reindex is attached to the data, channel values expressed as arrays will\n// be reindexed when the channels are instantiated. See exclusiveFacets.\nexport const reindex = Symbol(\"reindex\");\n\nexport function valueof(data, value, type) {\n const valueType = typeof value;\n return valueType === \"string\"\n ? maybeTypedMap(data, field(value), type)\n : valueType === \"function\"\n ? maybeTypedMap(data, value, type)\n : valueType === \"number\" || value instanceof Date || valueType === \"boolean\"\n ? map(data, constant(value), type)\n : typeof value?.transform === \"function\"\n ? maybeTypedArrayify(value.transform(data), type)\n : maybeTake(maybeTypedArrayify(value, type), data?.[reindex]);\n}\n\nfunction maybeTake(values, index) {\n return index ? take(values, index) : values;\n}\n\nfunction maybeTypedMap(data, f, type) {\n return map(data, type?.prototype instanceof TypedArray ? floater(f) : f, type);\n}\n\nfunction maybeTypedArrayify(data, type) {\n return type === undefined\n ? arrayify(data) // preserve undefined type\n : data instanceof type\n ? data\n : type.prototype instanceof TypedArray && !(data instanceof TypedArray)\n ? type.from(data, coerceNumber)\n : type.from(data);\n}\n\nfunction floater(f) {\n return (d, i) => coerceNumber(f(d, i));\n}\n\nexport const singleton = [null]; // for data-less decoration marks, e.g. frame\nexport const field = (name) => (d) => d[name];\nexport const indexOf = {transform: range};\nexport const identity = {transform: (d) => d};\nexport const zero = () => 0;\nexport const one = () => 1;\nexport const yes = () => true;\nexport const string = (x) => (x == null ? x : `${x}`);\nexport const number = (x) => (x == null ? x : +x);\nexport const boolean = (x) => (x == null ? x : !!x);\nexport const first = (x) => (x ? x[0] : undefined);\nexport const second = (x) => (x ? x[1] : undefined);\nexport const third = (x) => (x ? x[2] : undefined);\nexport const constant = (x) => () => x;\n\n// Converts a string like \u201Cp25\u201D into a function that takes an index I and an\n// accessor function f, returning the corresponding percentile value.\nexport function percentile(reduce) {\n const p = +`${reduce}`.slice(1) / 100;\n return (I, f) => quantile(I, p, f);\n}\n\n// If the values are specified as a typed array, no coercion is required.\nexport function coerceNumbers(values) {\n return values instanceof TypedArray ? values : map(values, coerceNumber, Float64Array);\n}\n\n// Unlike Mark\u2019s number, here we want to convert null and undefined to NaN since\n// the result will be stored in a Float64Array and we don\u2019t want null to be\n// coerced to zero. We use Number instead of unary + to allow BigInt coercion.\nfunction coerceNumber(x) {\n return x == null ? NaN : Number(x);\n}\n\nexport function coerceDates(values) {\n return map(values, coerceDate);\n}\n\n// When coercing strings to dates, we only want to allow the ISO 8601 format\n// since the built-in string parsing of the Date constructor varies across\n// browsers. (In the future, this could be made more liberal if desired, though\n// it is still generally preferable to do date parsing yourself explicitly,\n// rather than rely on Plot.) Any non-string values are coerced to number first\n// and treated as milliseconds since UNIX epoch.\nexport function coerceDate(x) {\n return x instanceof Date && !isNaN(x)\n ? x\n : typeof x === \"string\"\n ? isoParse(x)\n : x == null || isNaN((x = +x))\n ? undefined\n : new Date(x);\n}\n\n// Some channels may allow a string constant to be specified; to differentiate\n// string constants (e.g., \"red\") from named fields (e.g., \"date\"), this\n// function tests whether the given value is a CSS color string and returns a\n// tuple [channel, constant] where one of the two is undefined, and the other is\n// the given value. If you wish to reference a named field that is also a valid\n// CSS color, use an accessor (d => d.red) instead.\nexport function maybeColorChannel(value, defaultValue) {\n if (value === undefined) value = defaultValue;\n return value === null ? [undefined, \"none\"] : isColor(value) ? [undefined, value] : [value, undefined];\n}\n\n// Similar to maybeColorChannel, this tests whether the given value is a number\n// indicating a constant, and otherwise assumes that it\u2019s a channel value.\nexport function maybeNumberChannel(value, defaultValue) {\n if (value === undefined) value = defaultValue;\n return value === null || typeof value === \"number\" ? [undefined, value] : [value, undefined];\n}\n\n// Validates the specified optional string against the allowed list of keywords.\nexport function maybeKeyword(input, name, allowed) {\n if (input != null) return keyword(input, name, allowed);\n}\n\n// Validates the specified required string against the allowed list of keywords.\nexport function keyword(input, name, allowed) {\n const i = `${input}`.toLowerCase();\n if (!allowed.includes(i)) throw new Error(`invalid ${name}: ${input}`);\n return i;\n}\n\n// Promotes the specified data to an array as needed.\nexport function arrayify(data) {\n return data == null || data instanceof Array || data instanceof TypedArray ? data : Array.from(data);\n}\n\n// An optimization of type.from(values, f): if the given values are already an\n// instanceof the desired array type, the faster values.map method is used.\nexport function map(values, f, type = Array) {\n return values == null ? values : values instanceof type ? values.map(f) : type.from(values, f);\n}\n\n// An optimization of type.from(values): if the given values are already an\n// instanceof the desired array type, the faster values.slice method is used.\nexport function slice(values, type = Array) {\n return values instanceof type ? values.slice() : type.from(values);\n}\n\n// Returns true if any of x, x1, or x2 is not (strictly) undefined.\nexport function hasX({x, x1, x2}) {\n return x !== undefined || x1 !== undefined || x2 !== undefined;\n}\n\n// Returns true if any of y, y1, or y2 is not (strictly) undefined.\nexport function hasY({y, y1, y2}) {\n return y !== undefined || y1 !== undefined || y2 !== undefined;\n}\n\n// Returns true if has x or y, or if interval is not (strictly) undefined.\nexport function hasXY(options) {\n return hasX(options) || hasY(options) || options.interval !== undefined;\n}\n\n// Disambiguates an options object (e.g., {y: \"x2\"}) from a primitive value.\nexport function isObject(option) {\n return option?.toString === objectToString;\n}\n\n// Disambiguates a scale options object (e.g., {color: {type: \"linear\"}}) from\n// some other option (e.g., {color: \"red\"}). When creating standalone legends,\n// this is used to test whether a scale is defined; this should be consistent\n// with inferScaleType when there are no channels associated with the scale, and\n// if this returns true, then normalizeScale must return non-null.\nexport function isScaleOptions(option) {\n return isObject(option) && (option.type !== undefined || option.domain !== undefined);\n}\n\n// Disambiguates an options object (e.g., {y: \"x2\"}) from a channel value\n// definition expressed as a channel transform (e.g., {transform: \u2026}).\n// TODO Check typeof option[Symbol.iterator] !== \"function\"?\nexport function isOptions(option) {\n return isObject(option) && typeof option.transform !== \"function\";\n}\n\n// Disambiguates a sort transform (e.g., {sort: \"date\"}) from a channel domain\n// sort definition (e.g., {sort: {y: \"x\"}}).\nexport function isDomainSort(sort) {\n return isOptions(sort) && sort.value === undefined && sort.channel === undefined;\n}\n\n// For marks specified either as [0, x] or [x1, x2], such as areas and bars.\nexport function maybeZero(x, x1, x2, x3 = identity) {\n if (x1 === undefined && x2 === undefined) {\n // {x} or {}\n (x1 = 0), (x2 = x === undefined ? x3 : x);\n } else if (x1 === undefined) {\n // {x, x2} or {x2}\n x1 = x === undefined ? 0 : x;\n } else if (x2 === undefined) {\n // {x, x1} or {x1}\n x2 = x === undefined ? 0 : x;\n }\n return [x1, x2];\n}\n\n// For marks that have x and y channels (e.g., cell, dot, line, text).\nexport function maybeTuple(x, y) {\n return x === undefined && y === undefined ? [first, second] : [x, y];\n}\n\n// A helper for extracting the z channel, if it is variable. Used by transforms\n// that require series, such as moving average and normalize.\nexport function maybeZ({z, fill, stroke} = {}) {\n if (z === undefined) [z] = maybeColorChannel(fill);\n if (z === undefined) [z] = maybeColorChannel(stroke);\n return z;\n}\n\n// Returns a Uint32Array with elements [0, 1, 2, \u2026 data.length - 1].\nexport function range(data) {\n const n = data.length;\n const r = new Uint32Array(n);\n for (let i = 0; i < n; ++i) r[i] = i;\n return r;\n}\n\n// Returns a filtered range of data given the test function.\nexport function where(data, test) {\n return range(data).filter((i) => test(data[i], i, data));\n}\n\n// Returns an array [values[index[0]], values[index[1]], \u2026].\nexport function take(values, index) {\n return map(index, (i) => values[i], values.constructor);\n}\n\n// If f does not take exactly one argument, wraps it in a function that uses take.\nexport function taker(f) {\n return f.length === 1 ? (index, values) => f(take(values, index)) : f;\n}\n\n// Uses subarray if available, and otherwise slice.\nexport function subarray(I, i, j) {\n return I.subarray ? I.subarray(i, j) : I.slice(i, j);\n}\n\n// Based on InternMap (d3.group).\nexport function keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n\nexport function maybeInput(key, options) {\n if (options[key] !== undefined) return options[key];\n switch (key) {\n case \"x1\":\n case \"x2\":\n key = \"x\";\n break;\n case \"y1\":\n case \"y2\":\n key = \"y\";\n break;\n }\n return options[key];\n}\n\nexport function column(source) {\n // Defines a column whose values are lazily populated by calling the returned\n // setter. If the given source is labeled, the label is propagated to the\n // returned column definition.\n let value;\n return [\n {\n transform: () => value,\n label: labelof(source)\n },\n (v) => (value = v)\n ];\n}\n\n// Like column, but allows the source to be null.\nexport function maybeColumn(source) {\n return source == null ? [source] : column(source);\n}\n\nexport function labelof(value, defaultValue) {\n return typeof value === \"string\" ? value : value && value.label !== undefined ? value.label : defaultValue;\n}\n\n// Assuming that both x1 and x2 and lazy columns (per above), this derives a new\n// a column that\u2019s the average of the two, and which inherits the column label\n// (if any). Both input columns are assumed to be quantitative. If either column\n// is temporal, the returned column is also temporal.\nexport function mid(x1, x2) {\n return {\n transform(data) {\n const X1 = x1.transform(data);\n const X2 = x2.transform(data);\n return isTemporal(X1) || isTemporal(X2)\n ? map(X1, (_, i) => new Date((+X1[i] + +X2[i]) / 2))\n : map(X1, (_, i) => (+X1[i] + +X2[i]) / 2, Float64Array);\n },\n label: x1.label\n };\n}\n\n// If the scale options declare an interval, applies it to the values V.\nexport function maybeApplyInterval(V, scale) {\n const t = maybeIntervalTransform(scale?.interval, scale?.type);\n return t ? map(V, t) : V;\n}\n\n// Returns the equivalent scale transform for the specified interval option.\nexport function maybeIntervalTransform(interval, type) {\n const i = maybeInterval(interval, type);\n return i && ((v) => (defined(v) ? i.floor(v) : v));\n}\n\n// If interval is not nullish, converts interval shorthand such as a number (for\n// multiples) or a time interval name (such as \u201Cday\u201D) to a {floor, offset,\n// range} object similar to a D3 time interval.\nexport function maybeInterval(interval, type) {\n if (interval == null) return;\n if (typeof interval === \"number\") {\n if (0 < interval && interval < 1 && Number.isInteger(1 / interval)) interval = -1 / interval;\n const n = Math.abs(interval);\n return interval < 0\n ? {\n floor: (d) => Math.floor(d * n) / n,\n offset: (d) => (d * n + 1) / n, // note: no optional step for simplicity\n range: (lo, hi) => rangei(Math.ceil(lo * n), hi * n).map((x) => x / n)\n }\n : {\n floor: (d) => Math.floor(d / n) * n,\n offset: (d) => d + n, // note: no optional step for simplicity\n range: (lo, hi) => rangei(Math.ceil(lo / n), hi / n).map((x) => x * n)\n };\n }\n if (typeof interval === \"string\") return (type === \"time\" ? maybeTimeInterval : maybeUtcInterval)(interval);\n if (typeof interval.floor !== \"function\") throw new Error(\"invalid interval; missing floor method\");\n if (typeof interval.offset !== \"function\") throw new Error(\"invalid interval; missing offset method\");\n return interval;\n}\n\n// Like maybeInterval, but requires a range method too.\nexport function maybeRangeInterval(interval, type) {\n interval = maybeInterval(interval, type);\n if (interval && typeof interval.range !== \"function\") throw new Error(\"invalid interval: missing range method\");\n return interval;\n}\n\n// Like maybeRangeInterval, but requires a ceil method too.\nexport function maybeNiceInterval(interval, type) {\n interval = maybeRangeInterval(interval, type);\n if (interval && typeof interval.ceil !== \"function\") throw new Error(\"invalid interval: missing ceil method\");\n return interval;\n}\n\nexport function isTimeInterval(t) {\n return isInterval(t) && typeof t?.floor === \"function\" && t.floor() instanceof Date;\n}\n\nexport function isInterval(t) {\n return typeof t?.range === \"function\";\n}\n\n// This distinguishes between per-dimension options and a standalone value.\nexport function maybeValue(value) {\n return value === undefined || isOptions(value) ? value : {value};\n}\n\n// Coerces the given channel values (if any) to numbers. This is useful when\n// values will be interpolated into other code, such as an SVG transform, and\n// where we don\u2019t wish to allow unexpected behavior for weird input.\nexport function numberChannel(source) {\n return source == null\n ? null\n : {\n transform: (data) => valueof(data, source, Float64Array),\n label: labelof(source)\n };\n}\n\nexport function isTuples(data) {\n if (!isIterable(data)) return false;\n for (const d of data) {\n if (d == null) continue;\n return typeof d === \"object\" && \"0\" in d && \"1\" in d;\n }\n}\n\nexport function isIterable(value) {\n return value && typeof value[Symbol.iterator] === \"function\";\n}\n\nexport function isTextual(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value !== \"object\" || value instanceof Date;\n }\n}\n\nexport function isOrdinal(values) {\n for (const value of values) {\n if (value == null) continue;\n const type = typeof value;\n return type === \"string\" || type === \"boolean\";\n }\n}\n\nexport function isTemporal(values) {\n for (const value of values) {\n if (value == null) continue;\n return value instanceof Date;\n }\n}\n\n// Are these strings that might represent dates? This is stricter than ISO 8601\n// because we want to ignore false positives on numbers; for example, the string\n// \"1192\" is more likely to represent a number than a date even though it is\n// valid ISO 8601 representing 1192-01-01.\nexport function isTemporalString(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value === \"string\" && isNaN(value) && isoParse(value);\n }\n}\n\n// Are these strings that might represent numbers? This is stricter than\n// coercion because we want to ignore false positives on e.g. empty strings.\nexport function isNumericString(values) {\n for (const value of values) {\n if (value == null) continue;\n if (typeof value !== \"string\") return false;\n if (!value.trim()) continue;\n return !isNaN(value);\n }\n}\n\nexport function isNumeric(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value === \"number\";\n }\n}\n\n// Returns true if every non-null value in the specified iterable of values\n// passes the specified predicate, and there is at least one non-null value;\n// returns false if at least one non-null value does not pass the specified\n// predicate; otherwise returns undefined (as if all values are null).\nexport function isEvery(values, is) {\n let every;\n for (const value of values) {\n if (value == null) continue;\n if (!is(value)) return false;\n every = true;\n }\n return every;\n}\n\nconst namedColors = new Set(\"none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow\".split(\",\")); // prettier-ignore\n\n// Returns true if value is a valid CSS color string. This is intentionally lax\n// because the CSS color spec keeps growing, and we don\u2019t need to parse these\n// colors\u2014we just need to disambiguate them from column names.\n// https://www.w3.org/TR/SVG11/painting.html#SpecifyingPaint\n// https://www.w3.org/TR/css-color-5/\nexport function isColor(value) {\n if (typeof value !== \"string\") return false;\n value = value.toLowerCase().trim();\n return (\n /^#[0-9a-f]{3,8}$/.test(value) || // hex rgb, rgba, rrggbb, rrggbbaa\n /^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\\(.*\\)$/.test(value) || // , CSS variable, color, etc.\n namedColors.has(value) // currentColor, red, etc.\n );\n}\n\nexport function isOpacity(value) {\n return typeof value === \"number\" && ((0 <= value && value <= 1) || isNaN(value));\n}\n\nexport function isNoneish(value) {\n return value == null || isNone(value);\n}\n\nexport function isNone(value) {\n return /^\\s*none\\s*$/i.test(value);\n}\n\nexport function isRound(value) {\n return /^\\s*round\\s*$/i.test(value);\n}\n\nexport function maybeAnchor(value, name) {\n return maybeKeyword(value, name, [\n \"middle\",\n \"top-left\",\n \"top\",\n \"top-right\",\n \"right\",\n \"bottom-right\",\n \"bottom\",\n \"bottom-left\",\n \"left\"\n ]);\n}\n\nexport function maybeFrameAnchor(value = \"middle\") {\n return maybeAnchor(value, \"frameAnchor\");\n}\n\n// Unlike {...defaults, ...options}, this ensures that any undefined (but\n// present) properties in options inherit the given default value.\nexport function inherit(options = {}, ...rest) {\n let o = options;\n for (const defaults of rest) {\n for (const key in defaults) {\n if (o[key] === undefined) {\n const value = defaults[key];\n if (o === options) o = {...o, [key]: value};\n else o[key] = value;\n }\n }\n }\n return o;\n}\n\n// Given an iterable of named things (objects with a name property), returns a\n// corresponding object with properties associated with the given name.\nexport function named(things) {\n console.warn(\"named iterables are deprecated; please use an object instead\");\n const names = new Set();\n return Object.fromEntries(\n Array.from(things, (thing) => {\n const {name} = thing;\n if (name == null) throw new Error(\"missing name\");\n const key = `${name}`;\n if (key === \"__proto__\") throw new Error(`illegal name: ${key}`);\n if (names.has(key)) throw new Error(`duplicate name: ${key}`);\n names.add(key);\n return [name, thing];\n })\n );\n}\n\nexport function maybeNamed(things) {\n return isIterable(things) ? named(things) : things;\n}\n\n// TODO Accept other types of clips (paths, urls, x, y, other marks\u2026)?\n// https://github.com/observablehq/plot/issues/181\nexport function maybeClip(clip) {\n if (clip === true) clip = \"frame\";\n else if (clip === false) clip = null;\n else if (clip != null) clip = keyword(clip, \"clip\", [\"frame\", \"sphere\"]);\n return clip;\n}\n", "// Positional scales have associated axes, and for ordinal data, a point or band\n// scale is used instead of an ordinal scale.\nexport const position = Symbol(\"position\");\n\n// Color scales default to the turbo interpolator for quantitative data, and to\n// the Tableau10 scheme for ordinal data. Color scales may also have an\n// associated legend.\nexport const color = Symbol(\"color\");\n\n// Radius scales default to the sqrt type, have a default range of [0, 3], and a\n// default domain from 0 to the median first quartile of associated channels.\nexport const radius = Symbol(\"radius\");\n\n// Length scales default to the linear type, have a default range of [0, 12],\n// and a default domain from 0 to the median median of associated channels.\nexport const length = Symbol(\"length\");\n\n// Opacity scales have a default range of [0, 1], and a default domain from 0 to\n// the maximum value of associated channels.\nexport const opacity = Symbol(\"opacity\");\n\n// Symbol scales have a default range of categorical symbols.\nexport const symbol = Symbol(\"symbol\");\n\n// There isn\u2019t really a projection scale; this represents x and y for geometry.\n// This is used to denote channels that should be projected.\nexport const projection = Symbol(\"projection\");\n\n// TODO Rather than hard-coding the list of known scale names, collect the names\n// and categories for each plot specification, so that custom marks can register\n// custom scales.\nexport const registry = new Map([\n [\"x\", position],\n [\"y\", position],\n [\"fx\", position],\n [\"fy\", position],\n [\"r\", radius],\n [\"color\", color],\n [\"opacity\", opacity],\n [\"symbol\", symbol],\n [\"length\", length],\n [\"projection\", projection]\n]);\n\nexport function isPosition(kind) {\n return kind === position || kind === projection;\n}\n\nexport function hasNumericRange(kind) {\n return kind === position || kind === radius || kind === length || kind === opacity;\n}\n", "import {symbolAsterisk, symbolDiamond2, symbolPlus, symbolSquare2, symbolTriangle2, symbolTimes} from \"d3\";\nimport {symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye} from \"d3\";\n\nexport const sqrt3 = Math.sqrt(3);\nexport const sqrt4_3 = 2 / sqrt3;\n\nconst symbolHexagon = {\n draw(context, size) {\n const rx = Math.sqrt(size / Math.PI),\n ry = rx * sqrt4_3,\n hy = ry / 2;\n context.moveTo(0, ry);\n context.lineTo(rx, hy);\n context.lineTo(rx, -hy);\n context.lineTo(0, -ry);\n context.lineTo(-rx, -hy);\n context.lineTo(-rx, hy);\n context.closePath();\n }\n};\n\nconst symbols = new Map([\n [\"asterisk\", symbolAsterisk],\n [\"circle\", symbolCircle],\n [\"cross\", symbolCross],\n [\"diamond\", symbolDiamond],\n [\"diamond2\", symbolDiamond2],\n [\"hexagon\", symbolHexagon],\n [\"plus\", symbolPlus],\n [\"square\", symbolSquare],\n [\"square2\", symbolSquare2],\n [\"star\", symbolStar],\n [\"times\", symbolTimes],\n [\"triangle\", symbolTriangle],\n [\"triangle2\", symbolTriangle2],\n [\"wye\", symbolWye]\n]);\n\nfunction isSymbolObject(value) {\n return value && typeof value.draw === \"function\";\n}\n\nexport function isSymbol(value) {\n if (isSymbolObject(value)) return true;\n if (typeof value !== \"string\") return false;\n return symbols.has(value.toLowerCase());\n}\n\nexport function maybeSymbol(symbol) {\n if (symbol == null || isSymbolObject(symbol)) return symbol;\n const value = symbols.get(`${symbol}`.toLowerCase());\n if (value) return value;\n throw new Error(`invalid symbol: ${symbol}`);\n}\n\nexport function maybeSymbolChannel(symbol) {\n if (symbol == null || isSymbolObject(symbol)) return [undefined, symbol];\n if (typeof symbol === \"string\") {\n const value = symbols.get(`${symbol}`.toLowerCase());\n if (value) return [undefined, value];\n }\n return [symbol, undefined];\n}\n", "import {randomLcg} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"../defined.js\";\nimport {arrayify, isDomainSort, isOptions, maybeValue, valueof} from \"../options.js\";\n\nexport function basic({filter: f1, sort: s1, reverse: r1, transform: t1, initializer: i1, ...options} = {}, transform) {\n // If both t1 and t2 are defined, returns a composite transform that first\n // applies t1 and then applies t2.\n if (t1 === undefined) {\n // explicit transform overrides filter, sort, and reverse\n if (f1 != null) t1 = filterTransform(f1);\n if (s1 != null && !isDomainSort(s1)) t1 = composeTransform(t1, sortTransform(s1));\n if (r1) t1 = composeTransform(t1, reverseTransform);\n }\n if (transform != null && i1 != null) throw new Error(\"transforms cannot be applied after initializers\");\n return {\n ...options,\n ...((s1 === null || isDomainSort(s1)) && {sort: s1}),\n transform: composeTransform(t1, transform)\n };\n}\n\nexport function initializer({filter: f1, sort: s1, reverse: r1, initializer: i1, ...options} = {}, initializer) {\n // If both i1 and i2 are defined, returns a composite initializer that first\n // applies i1 and then applies i2.\n if (i1 === undefined) {\n // explicit initializer overrides filter, sort, and reverse\n if (f1 != null) i1 = filterTransform(f1);\n if (s1 != null && !isDomainSort(s1)) i1 = composeInitializer(i1, sortTransform(s1));\n if (r1) i1 = composeInitializer(i1, reverseTransform);\n }\n return {\n ...options,\n ...((s1 === null || isDomainSort(s1)) && {sort: s1}),\n initializer: composeInitializer(i1, initializer)\n };\n}\n\nfunction composeTransform(t1, t2) {\n if (t1 == null) return t2 === null ? undefined : t2;\n if (t2 == null) return t1 === null ? undefined : t1;\n return function (data, facets, plotOptions) {\n ({data, facets} = t1.call(this, data, facets, plotOptions));\n return t2.call(this, arrayify(data), facets, plotOptions);\n };\n}\n\nfunction composeInitializer(i1, i2) {\n if (i1 == null) return i2 === null ? undefined : i2;\n if (i2 == null) return i1 === null ? undefined : i1;\n return function (data, facets, channels, ...args) {\n let c1, d1, f1, c2, d2, f2;\n ({data: d1 = data, facets: f1 = facets, channels: c1} = i1.call(this, data, facets, channels, ...args));\n ({data: d2 = d1, facets: f2 = f1, channels: c2} = i2.call(this, d1, f1, {...channels, ...c1}, ...args));\n return {data: d2, facets: f2, channels: {...c1, ...c2}};\n };\n}\n\nfunction apply(options, t) {\n return (options.initializer != null ? initializer : basic)(options, t);\n}\n\nexport function filter(test, options) {\n return apply(options, filterTransform(test));\n}\n\nfunction filterTransform(value) {\n return (data, facets) => {\n const V = valueof(data, value);\n return {data, facets: facets.map((I) => I.filter((i) => V[i]))};\n };\n}\n\nexport function reverse({sort, ...options} = {}) {\n return {\n ...apply(options, reverseTransform),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nfunction reverseTransform(data, facets) {\n return {data, facets: facets.map((I) => I.slice().reverse())};\n}\n\nexport function shuffle({seed, sort, ...options} = {}) {\n return {\n ...apply(options, sortValue(seed == null ? Math.random : randomLcg(seed))),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nexport function sort(order, {sort, ...options} = {}) {\n return {\n ...(isOptions(order) && order.channel !== undefined ? initializer : apply)(options, sortTransform(order)),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nfunction sortTransform(value) {\n return (typeof value === \"function\" && value.length !== 1 ? sortData : sortValue)(value);\n}\n\nfunction sortData(compare) {\n return (data, facets) => {\n const compareData = (i, j) => compare(data[i], data[j]);\n return {data, facets: facets.map((I) => I.slice().sort(compareData))};\n };\n}\n\nfunction sortValue(value) {\n let channel, order;\n ({channel, value, order} = {...maybeValue(value)});\n const negate = channel?.startsWith(\"-\");\n if (negate) channel = channel.slice(1);\n if (order === undefined) order = negate ? descendingDefined : ascendingDefined;\n if (typeof order !== \"function\") {\n switch (`${order}`.toLowerCase()) {\n case \"ascending\":\n order = ascendingDefined;\n break;\n case \"descending\":\n order = descendingDefined;\n break;\n default:\n throw new Error(`invalid order: ${order}`);\n }\n }\n return (data, facets, channels) => {\n let V;\n if (channel === undefined) {\n V = valueof(data, value);\n } else {\n if (channels === undefined) throw new Error(\"channel sort requires an initializer\");\n V = channels[channel];\n if (!V) return {}; // ignore missing channel\n V = V.value;\n }\n const compareValue = (i, j) => order(V[i], V[j]);\n return {data, facets: facets.map((I) => I.slice().sort(compareValue))};\n };\n}\n", "import {\n InternSet,\n deviation,\n group as grouper,\n max,\n maxIndex,\n mean,\n median,\n min,\n minIndex,\n mode,\n rollup,\n sort,\n sum,\n variance\n} from \"d3\";\nimport {ascendingDefined} from \"../defined.js\";\nimport {\n column,\n identity,\n isObject,\n isTemporal,\n labelof,\n maybeApplyInterval,\n maybeColorChannel,\n maybeColumn,\n maybeInput,\n maybeTuple,\n percentile,\n range,\n second,\n take,\n valueof\n} from \"../options.js\";\nimport {basic} from \"./basic.js\";\n\n// Group on {z, fill, stroke}.\nexport function groupZ(outputs, options) {\n return groupn(null, null, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on x.\nexport function groupX(outputs = {y: \"count\"}, options = {}) {\n const {x = identity} = options;\n if (x == null) throw new Error(\"missing channel: x\");\n return groupn(x, null, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on y.\nexport function groupY(outputs = {x: \"count\"}, options = {}) {\n const {y = identity} = options;\n if (y == null) throw new Error(\"missing channel: y\");\n return groupn(null, y, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on x and y.\nexport function group(outputs = {fill: \"count\"}, options = {}) {\n let {x, y} = options;\n [x, y] = maybeTuple(x, y);\n if (x == null) throw new Error(\"missing channel: x\");\n if (y == null) throw new Error(\"missing channel: y\");\n return groupn(x, y, outputs, options);\n}\n\nfunction groupn(\n x, // optionally group on x\n y, // optionally group on y\n {\n data: reduceData = reduceIdentity,\n filter,\n sort,\n reverse,\n ...outputs // output channel definitions\n } = {},\n inputs = {} // input channels and options\n) {\n // Compute the outputs.\n outputs = maybeGroupOutputs(outputs, inputs);\n reduceData = maybeGroupReduce(reduceData, identity);\n sort = sort == null ? undefined : maybeGroupOutput(\"sort\", sort, inputs);\n filter = filter == null ? undefined : maybeGroupEvaluator(\"filter\", filter, inputs);\n\n // Produce x and y output channels as appropriate.\n const [GX, setGX] = maybeColumn(x);\n const [GY, setGY] = maybeColumn(y);\n\n // Greedily materialize the z, fill, and stroke channels (if channels and not\n // constants) so that we can reference them for subdividing groups without\n // computing them more than once.\n const {\n z,\n fill,\n stroke,\n x1,\n x2, // consumed if x is an output\n y1,\n y2, // consumed if y is an output\n ...options\n } = inputs;\n const [GZ, setGZ] = maybeColumn(z);\n const [vfill] = maybeColorChannel(fill);\n const [vstroke] = maybeColorChannel(stroke);\n const [GF, setGF] = maybeColumn(vfill);\n const [GS, setGS] = maybeColumn(vstroke);\n\n return {\n ...(\"z\" in inputs && {z: GZ || z}),\n ...(\"fill\" in inputs && {fill: GF || fill}),\n ...(\"stroke\" in inputs && {stroke: GS || stroke}),\n ...basic(options, (data, facets, plotOptions) => {\n const X = maybeApplyInterval(valueof(data, x), plotOptions?.x);\n const Y = maybeApplyInterval(valueof(data, y), plotOptions?.y);\n const Z = valueof(data, z);\n const F = valueof(data, vfill);\n const S = valueof(data, vstroke);\n const G = maybeSubgroup(outputs, {z: Z, fill: F, stroke: S});\n const groupFacets = [];\n const groupData = [];\n const GX = X && setGX([]);\n const GY = Y && setGY([]);\n const GZ = Z && setGZ([]);\n const GF = F && setGF([]);\n const GS = S && setGS([]);\n let i = 0;\n for (const o of outputs) o.initialize(data);\n if (sort) sort.initialize(data);\n if (filter) filter.initialize(data);\n for (const facet of facets) {\n const groupFacet = [];\n for (const o of outputs) o.scope(\"facet\", facet);\n if (sort) sort.scope(\"facet\", facet);\n if (filter) filter.scope(\"facet\", facet);\n for (const [f, I] of maybeGroup(facet, G)) {\n for (const [y, gg] of maybeGroup(I, Y)) {\n for (const [x, g] of maybeGroup(gg, X)) {\n const extent = {data};\n if (X) extent.x = x;\n if (Y) extent.y = y;\n if (G) extent.z = f;\n if (filter && !filter.reduce(g, extent)) continue;\n groupFacet.push(i++);\n groupData.push(reduceData.reduceIndex(g, data, extent));\n if (X) GX.push(x);\n if (Y) GY.push(y);\n if (Z) GZ.push(G === Z ? f : Z[g[0]]);\n if (F) GF.push(G === F ? f : F[g[0]]);\n if (S) GS.push(G === S ? f : S[g[0]]);\n for (const o of outputs) o.reduce(g, extent);\n if (sort) sort.reduce(g, extent);\n }\n }\n }\n groupFacets.push(groupFacet);\n }\n maybeSort(groupFacets, sort, reverse);\n return {data: groupData, facets: groupFacets};\n }),\n ...(!hasOutput(outputs, \"x\") && (GX ? {x: GX} : {x1, x2})),\n ...(!hasOutput(outputs, \"y\") && (GY ? {y: GY} : {y1, y2})),\n ...Object.fromEntries(outputs.map(({name, output}) => [name, output]))\n };\n}\n\nexport function hasOutput(outputs, ...names) {\n for (const {name} of outputs) {\n if (names.includes(name)) {\n return true;\n }\n }\n return false;\n}\n\nexport function maybeOutputs(outputs, inputs, asOutput = maybeOutput) {\n const entries = Object.entries(outputs);\n // Propagate standard mark channels by default.\n if (inputs.title != null && outputs.title === undefined) entries.push([\"title\", reduceTitle]);\n if (inputs.href != null && outputs.href === undefined) entries.push([\"href\", reduceFirst]);\n return entries\n .filter(([, reduce]) => reduce !== undefined)\n .map(([name, reduce]) => (reduce === null ? nullOutput(name) : asOutput(name, reduce, inputs)));\n}\n\nexport function maybeOutput(name, reduce, inputs, asEvaluator = maybeEvaluator) {\n let scale; // optional per-channel scale override\n if (isObject(reduce) && \"reduce\" in reduce) (scale = reduce.scale), (reduce = reduce.reduce); // N.B. array.reduce\n const evaluator = asEvaluator(name, reduce, inputs);\n const [output, setOutput] = column(evaluator.label);\n let O;\n return {\n name,\n output: scale === undefined ? output : {value: output, scale},\n initialize(data) {\n evaluator.initialize(data);\n O = setOutput([]);\n },\n scope(scope, I) {\n evaluator.scope(scope, I);\n },\n reduce(I, extent) {\n O.push(evaluator.reduce(I, extent));\n }\n };\n}\n\nfunction nullOutput(name) {\n return {name, initialize() {}, scope() {}, reduce() {}};\n}\n\nexport function maybeEvaluator(name, reduce, inputs, asReduce = maybeReduce) {\n const input = maybeInput(name, inputs);\n const reducer = asReduce(reduce, input);\n let V, context;\n return {\n label: labelof(reducer === reduceCount ? null : input, reducer.label),\n initialize(data) {\n V = input === undefined ? data : valueof(data, input);\n if (reducer.scope === \"data\") {\n context = reducer.reduceIndex(range(data), V);\n }\n },\n scope(scope, I) {\n if (reducer.scope === scope) {\n context = reducer.reduceIndex(I, V);\n }\n },\n reduce(I, extent) {\n return reducer.scope == null ? reducer.reduceIndex(I, V, extent) : reducer.reduceIndex(I, V, context, extent);\n }\n };\n}\n\nexport function maybeGroup(I, X) {\n return X ? grouper(I, (i) => X[i]) : [[, I]];\n}\n\nexport function maybeReduce(reduce, value, fallback = invalidReduce) {\n if (reduce == null) return fallback(reduce);\n if (typeof reduce.reduceIndex === \"function\") return reduce;\n if (typeof reduce.reduce === \"function\" && isObject(reduce)) return reduceReduce(reduce); // N.B. array.reduce\n if (typeof reduce === \"function\") return reduceFunction(reduce);\n if (/^p\\d{2}$/i.test(reduce)) return reduceAccessor(percentile(reduce));\n switch (`${reduce}`.toLowerCase()) {\n case \"first\":\n return reduceFirst;\n case \"last\":\n return reduceLast;\n case \"identity\":\n return reduceIdentity;\n case \"count\":\n return reduceCount;\n case \"distinct\":\n return reduceDistinct;\n case \"sum\":\n return value == null ? reduceCount : reduceSum;\n case \"proportion\":\n return reduceProportion(value, \"data\");\n case \"proportion-facet\":\n return reduceProportion(value, \"facet\");\n case \"deviation\":\n return reduceAccessor(deviation);\n case \"min\":\n return reduceAccessor(min);\n case \"min-index\":\n return reduceAccessor(minIndex);\n case \"max\":\n return reduceAccessor(max);\n case \"max-index\":\n return reduceAccessor(maxIndex);\n case \"mean\":\n return reduceMaybeTemporalAccessor(mean);\n case \"median\":\n return reduceMaybeTemporalAccessor(median);\n case \"variance\":\n return reduceAccessor(variance);\n case \"mode\":\n return reduceAccessor(mode);\n }\n return fallback(reduce);\n}\n\nfunction invalidReduce(reduce) {\n throw new Error(`invalid reduce: ${reduce}`);\n}\n\nexport function maybeGroupOutputs(outputs, inputs) {\n return maybeOutputs(outputs, inputs, maybeGroupOutput);\n}\n\nfunction maybeGroupOutput(name, reduce, inputs) {\n return maybeOutput(name, reduce, inputs, maybeGroupEvaluator);\n}\n\nfunction maybeGroupEvaluator(name, reduce, inputs) {\n return maybeEvaluator(name, reduce, inputs, maybeGroupReduce);\n}\n\nfunction maybeGroupReduce(reduce, value) {\n return maybeReduce(reduce, value, maybeGroupReduceFallback);\n}\n\nfunction maybeGroupReduceFallback(reduce) {\n switch (`${reduce}`.toLowerCase()) {\n case \"x\":\n return reduceX;\n case \"y\":\n return reduceY;\n case \"z\":\n return reduceZ;\n }\n throw new Error(`invalid group reduce: ${reduce}`);\n}\n\nexport function maybeSubgroup(outputs, inputs) {\n for (const name in inputs) {\n const value = inputs[name];\n if (value !== undefined && !outputs.some((o) => o.name === name)) {\n return value;\n }\n }\n}\n\nexport function maybeSort(facets, sort, reverse) {\n if (sort) {\n const S = sort.output.transform();\n const compare = (i, j) => ascendingDefined(S[i], S[j]);\n facets.forEach((f) => f.sort(compare));\n }\n if (reverse) {\n facets.forEach((f) => f.reverse());\n }\n}\n\nfunction reduceReduce(reduce) {\n console.warn(\"deprecated reduce interface; implement reduceIndex instead.\");\n return {...reduce, reduceIndex: reduce.reduce.bind(reduce)};\n}\n\nfunction reduceFunction(f) {\n return {\n reduceIndex(I, X, extent) {\n return f(take(X, I), extent);\n }\n };\n}\n\nfunction reduceAccessor(f) {\n return {\n reduceIndex(I, X) {\n return f(I, (i) => X[i]);\n }\n };\n}\n\nfunction reduceMaybeTemporalAccessor(f) {\n return {\n reduceIndex(I, X) {\n const x = f(I, (i) => X[i]);\n return isTemporal(X) ? new Date(x) : x;\n }\n };\n}\n\nexport const reduceIdentity = {\n reduceIndex(I, X) {\n return take(X, I);\n }\n};\n\nexport const reduceFirst = {\n reduceIndex(I, X) {\n return X[I[0]];\n }\n};\n\nconst reduceTitle = {\n reduceIndex(I, X) {\n const n = 5;\n const groups = sort(\n rollup(\n I,\n (V) => V.length,\n (i) => X[i]\n ),\n second\n );\n const top = groups.slice(-n).reverse();\n if (top.length < groups.length) {\n const bottom = groups.slice(0, 1 - n);\n top[n - 1] = [`\u2026 ${bottom.length.toLocaleString(\"en-US\")} more`, sum(bottom, second)];\n }\n return top.map(([key, value]) => `${key} (${value.toLocaleString(\"en-US\")})`).join(\"\\n\");\n }\n};\n\nconst reduceLast = {\n reduceIndex(I, X) {\n return X[I[I.length - 1]];\n }\n};\n\nexport const reduceCount = {\n label: \"Frequency\",\n reduceIndex(I) {\n return I.length;\n }\n};\n\nconst reduceDistinct = {\n label: \"Distinct\",\n reduceIndex(I, X) {\n const s = new InternSet();\n for (const i of I) s.add(X[i]);\n return s.size;\n }\n};\n\nconst reduceSum = reduceAccessor(sum);\n\nfunction reduceProportion(value, scope) {\n return value == null\n ? {scope, label: \"Frequency\", reduceIndex: (I, V, basis = 1) => I.length / basis}\n : {scope, reduceIndex: (I, V, basis = 1) => sum(I, (i) => V[i]) / basis};\n}\n\nconst reduceX = {\n reduceIndex(I, X, {x}) {\n return x;\n }\n};\n\nconst reduceY = {\n reduceIndex(I, X, {y}) {\n return y;\n }\n};\n\nexport const reduceZ = {\n reduceIndex(I, X, {z}) {\n return z;\n }\n};\n\nexport function find(test) {\n if (typeof test !== \"function\") throw new Error(`invalid test function: ${test}`);\n return {\n reduceIndex(I, V, {data}) {\n return V[I.find((i) => test(data[i], i, data))];\n }\n };\n}\n", "import {InternSet, rollups} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"./defined.js\";\nimport {first, isColor, isEvery, isIterable, isOpacity, labelof, map, maybeValue, range, valueof} from \"./options.js\";\nimport {registry} from \"./scales/index.js\";\nimport {isSymbol, maybeSymbol} from \"./symbol.js\";\nimport {maybeReduce} from \"./transforms/group.js\";\n\nexport function createChannel(data, {scale, type, value, filter, hint, label = labelof(value)}, name) {\n if (hint === undefined && typeof value?.transform === \"function\") hint = value.hint;\n return inferChannelScale(name, {\n scale,\n type,\n value: valueof(data, value),\n label,\n filter,\n hint\n });\n}\n\nexport function createChannels(channels, data) {\n return Object.fromEntries(\n Object.entries(channels).map(([name, channel]) => [name, createChannel(data, channel, name)])\n );\n}\n\n// TODO Use Float64Array for scales with numeric ranges, e.g. position?\nexport function valueObject(channels, scales) {\n const values = Object.fromEntries(\n Object.entries(channels).map(([name, {scale: scaleName, value}]) => {\n const scale = scaleName == null ? null : scales[scaleName];\n return [name, scale == null ? value : map(value, scale)];\n })\n );\n values.channels = channels; // expose channel state for advanced usage\n return values;\n}\n\n// If the channel uses the \"auto\" scale (or equivalently true), infer the scale\n// from the channel name and the provided values. For color and symbol channels,\n// no scale is applied if the values are literal; however for symbols, we must\n// promote symbol names (e.g., \"plus\") to symbol implementations (symbolPlus).\n// Note: mutates channel!\nexport function inferChannelScale(name, channel) {\n const {scale, value} = channel;\n if (scale === true || scale === \"auto\") {\n switch (name) {\n case \"fill\":\n case \"stroke\":\n case \"color\":\n channel.scale = scale !== true && isEvery(value, isColor) ? null : \"color\";\n break;\n case \"fillOpacity\":\n case \"strokeOpacity\":\n case \"opacity\":\n channel.scale = scale !== true && isEvery(value, isOpacity) ? null : \"opacity\";\n break;\n case \"symbol\":\n if (scale !== true && isEvery(value, isSymbol)) {\n channel.scale = null;\n channel.value = map(value, maybeSymbol);\n } else {\n channel.scale = \"symbol\";\n }\n break;\n default:\n channel.scale = registry.has(name) ? name : null;\n break;\n }\n } else if (scale === false) {\n channel.scale = null;\n } else if (scale != null && !registry.has(scale)) {\n throw new Error(`unknown scale: ${scale}`);\n }\n return channel;\n}\n\n// Note: mutates channel.domain! This is set to a function so that it is lazily\n// computed; i.e., if the scale\u2019s domain is set explicitly, that takes priority\n// over the sort option, and we don\u2019t need to do additional work.\nexport function channelDomain(data, facets, channels, facetChannels, options) {\n const {order: defaultOrder, reverse: defaultReverse, reduce: defaultReduce = true, limit: defaultLimit} = options;\n for (const x in options) {\n if (!registry.has(x)) continue; // ignore unknown scale keys (including generic options)\n let {value: y, order = defaultOrder, reverse = defaultReverse, reduce = defaultReduce, limit = defaultLimit} = maybeValue(options[x]); // prettier-ignore\n const negate = y?.startsWith(\"-\");\n if (negate) y = y.slice(1);\n order = order === undefined ? negate !== (y === \"width\" || y === \"height\") ? descendingGroup : ascendingGroup : maybeOrder(order); // prettier-ignore\n if (reduce == null || reduce === false) continue; // disabled reducer\n const X = x === \"fx\" || x === \"fy\" ? reindexFacetChannel(facets, facetChannels[x]) : findScaleChannel(channels, x);\n if (!X) throw new Error(`missing channel for scale: ${x}`);\n const XV = X.value;\n const [lo = 0, hi = Infinity] = isIterable(limit) ? limit : limit < 0 ? [limit] : [0, limit];\n if (y == null) {\n X.domain = () => {\n let domain = Array.from(new InternSet(XV)); // remove any duplicates\n if (reverse) domain = domain.reverse();\n if (lo !== 0 || hi !== Infinity) domain = domain.slice(lo, hi);\n return domain;\n };\n } else {\n const YV =\n y === \"data\"\n ? data\n : y === \"height\"\n ? difference(channels, \"y1\", \"y2\")\n : y === \"width\"\n ? difference(channels, \"x1\", \"x2\")\n : values(channels, y, y === \"y\" ? \"y2\" : y === \"x\" ? \"x2\" : undefined);\n const reducer = maybeReduce(reduce === true ? \"max\" : reduce, YV);\n X.domain = () => {\n let domain = rollups(\n range(XV),\n (I) => reducer.reduceIndex(I, YV),\n (i) => XV[i]\n );\n if (order) domain.sort(order);\n if (reverse) domain.reverse();\n if (lo !== 0 || hi !== Infinity) domain = domain.slice(lo, hi);\n return domain.map(first);\n };\n }\n }\n}\n\nfunction findScaleChannel(channels, scale) {\n for (const name in channels) {\n const channel = channels[name];\n if (channel.scale === scale) return channel;\n }\n}\n\n// Facet channels are not affected by transforms; so, to compute the domain of a\n// facet scale, we must first re-index the facet channel according to the\n// transformed mark index. Note: mutates channel, but that should be safe here?\nfunction reindexFacetChannel(facets, channel) {\n const originalFacets = facets.original;\n if (originalFacets === facets) return channel; // not transformed\n const V1 = channel.value;\n const V2 = (channel.value = []); // mutates channel!\n for (let i = 0; i < originalFacets.length; ++i) {\n const vi = V1[originalFacets[i][0]];\n for (const j of facets[i]) V2[j] = vi;\n }\n return channel;\n}\n\nfunction difference(channels, k1, k2) {\n const X1 = values(channels, k1);\n const X2 = values(channels, k2);\n return map(X2, (x2, i) => Math.abs(x2 - X1[i]), Float64Array);\n}\n\nfunction values(channels, name, alias) {\n let channel = channels[name];\n if (!channel && alias !== undefined) channel = channels[alias];\n if (channel) return channel.value;\n throw new Error(`missing channel: ${name}`);\n}\n\nfunction maybeOrder(order) {\n if (order == null || typeof order === \"function\") return order;\n switch (`${order}`.toLowerCase()) {\n case \"ascending\":\n return ascendingGroup;\n case \"descending\":\n return descendingGroup;\n }\n throw new Error(`invalid order: ${order}`);\n}\n\nfunction ascendingGroup([ak, av], [bk, bv]) {\n return ascendingDefined(av, bv) || ascendingDefined(ak, bk);\n}\n\nfunction descendingGroup([ak, av], [bk, bv]) {\n return descendingDefined(av, bv) || ascendingDefined(ak, bk);\n}\n\nexport function getSource(channels, key) {\n let channel = channels[key];\n if (!channel) return;\n while (channel.source) channel = channel.source;\n return channel.source === null ? null : channel;\n}\n", "import {creator, select} from \"d3\";\nimport {maybeClip} from \"./options.js\";\n\nexport function createContext(options = {}) {\n const {document = typeof window !== \"undefined\" ? window.document : undefined, clip} = options;\n return {document, clip: maybeClip(clip)};\n}\n\nexport function create(name, {document}) {\n return select(creator(name).call(document.documentElement));\n}\n", "let warnings = 0;\nlet lastMessage;\n\nexport function consumeWarnings() {\n const w = warnings;\n warnings = 0;\n lastMessage = undefined;\n return w;\n}\n\nexport function warn(message) {\n if (message === lastMessage) return;\n lastMessage = message;\n console.warn(message);\n ++warnings;\n}\n", "import {\n geoAlbers,\n geoAlbersUsa,\n geoAzimuthalEqualArea,\n geoAzimuthalEquidistant,\n geoClipRectangle,\n geoConicConformal,\n geoConicEqualArea,\n geoConicEquidistant,\n geoEqualEarth,\n geoEquirectangular,\n geoGnomonic,\n geoMercator,\n geoOrthographic,\n geoPath,\n geoStereographic,\n geoStream,\n geoTransform,\n geoTransverseMercator\n} from \"d3\";\nimport {valueObject} from \"./channel.js\";\nimport {coerceNumbers, constant, isObject} from \"./options.js\";\nimport {warn} from \"./warnings.js\";\n\nconst pi = Math.PI;\nconst tau = 2 * pi;\nconst defaultAspectRatio = 0.618;\n\nexport function createProjection(\n {\n projection,\n inset: globalInset = 0,\n insetTop = globalInset,\n insetRight = globalInset,\n insetBottom = globalInset,\n insetLeft = globalInset\n } = {},\n dimensions\n) {\n if (projection == null) return;\n if (typeof projection.stream === \"function\") return projection; // d3 projection\n let options;\n let domain;\n let clip = \"frame\";\n\n // If the projection was specified as an object with additional options,\n // extract those. The order of precedence for insetTop (and other insets) is:\n // projection.insetTop, projection.inset, (global) insetTop, (global) inset.\n // Any other options on this object will be passed through to the initializer.\n if (isObject(projection)) {\n let inset;\n ({\n type: projection,\n domain,\n inset,\n insetTop = inset !== undefined ? inset : insetTop,\n insetRight = inset !== undefined ? inset : insetRight,\n insetBottom = inset !== undefined ? inset : insetBottom,\n insetLeft = inset !== undefined ? inset : insetLeft,\n clip = clip,\n ...options\n } = projection);\n if (projection == null) return;\n }\n\n // For named projections, retrieve the corresponding projection initializer.\n if (typeof projection !== \"function\") ({type: projection} = namedProjection(projection));\n\n // Compute the frame dimensions and invoke the projection initializer.\n const {width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions;\n const dx = width - marginLeft - marginRight - insetLeft - insetRight;\n const dy = height - marginTop - marginBottom - insetTop - insetBottom;\n projection = projection?.({width: dx, height: dy, clip, ...options});\n\n // The projection initializer might decide to not use a projection.\n if (projection == null) return;\n clip = maybePostClip(clip, marginLeft, marginTop, width - marginRight, height - marginBottom);\n\n // Translate the origin to the top-left corner, respecting margins and insets.\n let tx = marginLeft + insetLeft;\n let ty = marginTop + insetTop;\n let transform;\n\n // If a domain is specified, fit the projection to the frame.\n if (domain != null) {\n const [[x0, y0], [x1, y1]] = geoPath(projection).bounds(domain);\n const k = Math.min(dx / (x1 - x0), dy / (y1 - y0));\n if (k > 0) {\n tx -= (k * (x0 + x1) - dx) / 2;\n ty -= (k * (y0 + y1) - dy) / 2;\n transform = geoTransform({\n point(x, y) {\n this.stream.point(x * k + tx, y * k + ty);\n }\n });\n } else {\n warn(`Warning: the projection could not be fit to the specified domain; using the default scale.`);\n }\n }\n\n transform ??=\n tx === 0 && ty === 0\n ? identity()\n : geoTransform({\n point(x, y) {\n this.stream.point(x + tx, y + ty);\n }\n });\n\n return {stream: (s) => projection.stream(transform.stream(clip(s)))};\n}\n\nfunction namedProjection(projection) {\n switch (`${projection}`.toLowerCase()) {\n case \"albers-usa\":\n return scaleProjection(geoAlbersUsa, 0.7463, 0.4673);\n case \"albers\":\n return conicProjection(geoAlbers, 0.7463, 0.4673);\n case \"azimuthal-equal-area\":\n return scaleProjection(geoAzimuthalEqualArea, 4, 4);\n case \"azimuthal-equidistant\":\n return scaleProjection(geoAzimuthalEquidistant, tau, tau);\n case \"conic-conformal\":\n return conicProjection(geoConicConformal, tau, tau);\n case \"conic-equal-area\":\n return conicProjection(geoConicEqualArea, 6.1702, 2.9781);\n case \"conic-equidistant\":\n return conicProjection(geoConicEquidistant, 7.312, 3.6282);\n case \"equal-earth\":\n return scaleProjection(geoEqualEarth, 5.4133, 2.6347);\n case \"equirectangular\":\n return scaleProjection(geoEquirectangular, tau, pi);\n case \"gnomonic\":\n return scaleProjection(geoGnomonic, 3.4641, 3.4641);\n case \"identity\":\n return {type: identity};\n case \"reflect-y\":\n return {type: reflectY};\n case \"mercator\":\n return scaleProjection(geoMercator, tau, tau);\n case \"orthographic\":\n return scaleProjection(geoOrthographic, 2, 2);\n case \"stereographic\":\n return scaleProjection(geoStereographic, 2, 2);\n case \"transverse-mercator\":\n return scaleProjection(geoTransverseMercator, tau, tau);\n default:\n throw new Error(`unknown projection type: ${projection}`);\n }\n}\n\nfunction maybePostClip(clip, x1, y1, x2, y2) {\n if (clip === false || clip == null || typeof clip === \"number\") return (s) => s;\n if (clip === true) clip = \"frame\";\n switch (`${clip}`.toLowerCase()) {\n case \"frame\":\n return geoClipRectangle(x1, y1, x2, y2);\n default:\n throw new Error(`unknown projection clip type: ${clip}`);\n }\n}\n\nfunction scaleProjection(createProjection, kx, ky) {\n return {\n type: ({width, height, rotate, precision = 0.15, clip}) => {\n const projection = createProjection();\n if (precision != null) projection.precision?.(precision);\n if (rotate != null) projection.rotate?.(rotate);\n if (typeof clip === \"number\") projection.clipAngle?.(clip);\n projection.scale(Math.min(width / kx, height / ky));\n projection.translate([width / 2, height / 2]);\n return projection;\n },\n aspectRatio: ky / kx\n };\n}\n\nfunction conicProjection(createProjection, kx, ky) {\n const {type, aspectRatio} = scaleProjection(createProjection, kx, ky);\n return {\n type: (options) => {\n const {parallels, domain, width, height} = options;\n const projection = type(options);\n if (parallels != null) {\n projection.parallels(parallels);\n if (domain === undefined) {\n projection.fitSize([width, height], {type: \"Sphere\"});\n }\n }\n return projection;\n },\n aspectRatio\n };\n}\n\nconst identity = constant({stream: (stream) => stream});\n\nconst reflectY = constant(\n geoTransform({\n point(x, y) {\n this.stream.point(x, -y);\n }\n })\n);\n\n// Applies a point-wise projection to the given paired x and y channels.\n// Note: mutates values!\nexport function project(cx, cy, values, projection) {\n const x = values[cx];\n const y = values[cy];\n const n = x.length;\n const X = (values[cx] = new Float64Array(n).fill(NaN));\n const Y = (values[cy] = new Float64Array(n).fill(NaN));\n let i;\n const stream = projection.stream({\n point(x, y) {\n X[i] = x;\n Y[i] = y;\n }\n });\n for (i = 0; i < n; ++i) {\n stream.point(x[i], y[i]);\n }\n}\n\n// Returns true if a projection was specified. This should match the logic of\n// createProjection above, and is called before we construct the projection.\n// (Though note that we ignore the edge case where the projection initializer\n// may return null.)\nexport function hasProjection({projection} = {}) {\n if (projection == null) return false;\n if (typeof projection.stream === \"function\") return true;\n if (isObject(projection)) projection = projection.type;\n return projection != null;\n}\n\n// When a named projection is specified, we can use its natural aspect ratio to\n// determine a good value for the projection\u2019s height based on the desired\n// width. When we don\u2019t have a way to know, the golden ratio is our best guess.\n// Due to a circular dependency (we need to know the height before we can\n// construct the projection), we have to test the raw projection option rather\n// than the materialized projection; therefore we must be extremely careful that\n// the logic of this function exactly matches createProjection above!\nexport function projectionAspectRatio(projection) {\n if (typeof projection?.stream === \"function\") return defaultAspectRatio;\n if (isObject(projection)) projection = projection.type;\n if (projection == null) return;\n if (typeof projection !== \"function\") {\n const {aspectRatio} = namedProjection(projection);\n if (aspectRatio) return aspectRatio;\n }\n return defaultAspectRatio;\n}\n\n// Extract the (possibly) scaled values for the x and y channels, and apply the\n// projection if any.\nexport function applyPosition(channels, scales, {projection}) {\n const {x, y} = channels;\n let position = {};\n if (x) position.x = x;\n if (y) position.y = y;\n position = valueObject(position, scales);\n if (projection && x?.scale === \"x\" && y?.scale === \"y\") project(\"x\", \"y\", position, projection);\n if (x) position.x = coerceNumbers(position.x);\n if (y) position.y = coerceNumbers(position.y);\n return position;\n}\n\nexport function getGeometryChannels(channel) {\n const X = [];\n const Y = [];\n const x = {scale: \"x\", value: X};\n const y = {scale: \"y\", value: Y};\n const sink = {\n point(x, y) {\n X.push(x);\n Y.push(y);\n },\n lineStart() {},\n lineEnd() {},\n polygonStart() {},\n polygonEnd() {},\n sphere() {}\n };\n for (const object of channel.value) geoStream(object, sink);\n return [x, y];\n}\n", "import {\n interpolateBlues,\n interpolateBrBG,\n interpolateBuGn,\n interpolateBuPu,\n interpolateGnBu,\n interpolateGreens,\n interpolateGreys,\n interpolateOranges,\n interpolateOrRd,\n interpolatePiYG,\n interpolatePRGn,\n interpolatePuBu,\n interpolatePuBuGn,\n interpolatePuOr,\n interpolatePuRd,\n interpolatePurples,\n interpolateRdBu,\n interpolateRdGy,\n interpolateRdPu,\n interpolateRdYlBu,\n interpolateRdYlGn,\n interpolateReds,\n interpolateSpectral,\n interpolateYlGn,\n interpolateYlGnBu,\n interpolateYlOrBr,\n interpolateYlOrRd,\n interpolateTurbo,\n interpolateViridis,\n interpolateMagma,\n interpolateInferno,\n interpolatePlasma,\n interpolateCividis,\n interpolateCubehelixDefault,\n interpolateWarm,\n interpolateCool,\n interpolateRainbow,\n interpolateSinebow,\n quantize,\n schemeAccent,\n schemeBlues,\n schemeBrBG,\n schemeBuGn,\n schemeBuPu,\n schemeCategory10,\n schemeDark2,\n schemeGnBu,\n schemeGreens,\n schemeGreys,\n schemeObservable10,\n schemeOranges,\n schemeOrRd,\n schemePaired,\n schemePastel1,\n schemePastel2,\n schemePiYG,\n schemePRGn,\n schemePuBu,\n schemePuBuGn,\n schemePuOr,\n schemePuRd,\n schemePurples,\n schemeRdBu,\n schemeRdGy,\n schemeRdPu,\n schemeRdYlBu,\n schemeRdYlGn,\n schemeReds,\n schemeSet1,\n schemeSet2,\n schemeSet3,\n schemeSpectral,\n schemeTableau10,\n schemeYlGn,\n schemeYlGnBu,\n schemeYlOrBr,\n schemeYlOrRd\n} from \"d3\";\n\nconst categoricalSchemes = new Map([\n [\"accent\", schemeAccent],\n [\"category10\", schemeCategory10],\n [\"dark2\", schemeDark2],\n [\"observable10\", schemeObservable10],\n [\"paired\", schemePaired],\n [\"pastel1\", schemePastel1],\n [\"pastel2\", schemePastel2],\n [\"set1\", schemeSet1],\n [\"set2\", schemeSet2],\n [\"set3\", schemeSet3],\n [\"tableau10\", schemeTableau10]\n]);\n\nexport function isCategoricalScheme(scheme) {\n return scheme != null && categoricalSchemes.has(`${scheme}`.toLowerCase());\n}\n\nconst ordinalSchemes = new Map([\n ...categoricalSchemes,\n\n // diverging\n [\"brbg\", scheme11(schemeBrBG, interpolateBrBG)],\n [\"prgn\", scheme11(schemePRGn, interpolatePRGn)],\n [\"piyg\", scheme11(schemePiYG, interpolatePiYG)],\n [\"puor\", scheme11(schemePuOr, interpolatePuOr)],\n [\"rdbu\", scheme11(schemeRdBu, interpolateRdBu)],\n [\"rdgy\", scheme11(schemeRdGy, interpolateRdGy)],\n [\"rdylbu\", scheme11(schemeRdYlBu, interpolateRdYlBu)],\n [\"rdylgn\", scheme11(schemeRdYlGn, interpolateRdYlGn)],\n [\"spectral\", scheme11(schemeSpectral, interpolateSpectral)],\n\n // reversed diverging (for temperature data)\n [\"burd\", scheme11r(schemeRdBu, interpolateRdBu)],\n [\"buylrd\", scheme11r(schemeRdYlBu, interpolateRdYlBu)],\n\n // sequential (single-hue)\n [\"blues\", scheme9(schemeBlues, interpolateBlues)],\n [\"greens\", scheme9(schemeGreens, interpolateGreens)],\n [\"greys\", scheme9(schemeGreys, interpolateGreys)],\n [\"oranges\", scheme9(schemeOranges, interpolateOranges)],\n [\"purples\", scheme9(schemePurples, interpolatePurples)],\n [\"reds\", scheme9(schemeReds, interpolateReds)],\n\n // sequential (multi-hue)\n [\"turbo\", schemei(interpolateTurbo)],\n [\"viridis\", schemei(interpolateViridis)],\n [\"magma\", schemei(interpolateMagma)],\n [\"inferno\", schemei(interpolateInferno)],\n [\"plasma\", schemei(interpolatePlasma)],\n [\"cividis\", schemei(interpolateCividis)],\n [\"cubehelix\", schemei(interpolateCubehelixDefault)],\n [\"warm\", schemei(interpolateWarm)],\n [\"cool\", schemei(interpolateCool)],\n [\"bugn\", scheme9(schemeBuGn, interpolateBuGn)],\n [\"bupu\", scheme9(schemeBuPu, interpolateBuPu)],\n [\"gnbu\", scheme9(schemeGnBu, interpolateGnBu)],\n [\"orrd\", scheme9(schemeOrRd, interpolateOrRd)],\n [\"pubu\", scheme9(schemePuBu, interpolatePuBu)],\n [\"pubugn\", scheme9(schemePuBuGn, interpolatePuBuGn)],\n [\"purd\", scheme9(schemePuRd, interpolatePuRd)],\n [\"rdpu\", scheme9(schemeRdPu, interpolateRdPu)],\n [\"ylgn\", scheme9(schemeYlGn, interpolateYlGn)],\n [\"ylgnbu\", scheme9(schemeYlGnBu, interpolateYlGnBu)],\n [\"ylorbr\", scheme9(schemeYlOrBr, interpolateYlOrBr)],\n [\"ylorrd\", scheme9(schemeYlOrRd, interpolateYlOrRd)],\n\n // cyclical\n [\"rainbow\", schemeicyclical(interpolateRainbow)],\n [\"sinebow\", schemeicyclical(interpolateSinebow)]\n]);\n\nfunction scheme9(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 1) return [scheme[3][1]]; // favor midpoint\n if (n === 2) return [scheme[3][1], scheme[3][2]]; // favor darker\n n = Math.max(3, Math.floor(n));\n return n > 9 ? quantize(interpolate, n) : scheme[n];\n };\n}\n\nfunction scheme11(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 2) return [scheme[3][0], scheme[3][2]]; // favor diverging extrema\n n = Math.max(3, Math.floor(n));\n return n > 11 ? quantize(interpolate, n) : scheme[n];\n };\n}\n\nfunction scheme11r(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 2) return [scheme[3][2], scheme[3][0]]; // favor diverging extrema\n n = Math.max(3, Math.floor(n));\n return n > 11 ? quantize((t) => interpolate(1 - t), n) : scheme[n].slice().reverse();\n };\n}\n\nfunction schemei(interpolate) {\n return ({length: n}) => quantize(interpolate, Math.max(2, Math.floor(n)));\n}\n\nfunction schemeicyclical(interpolate) {\n return ({length: n}) => quantize(interpolate, Math.floor(n) + 1).slice(0, -1);\n}\n\nexport function ordinalScheme(scheme) {\n const s = `${scheme}`.toLowerCase();\n if (!ordinalSchemes.has(s)) throw new Error(`unknown ordinal scheme: ${s}`);\n return ordinalSchemes.get(s);\n}\n\nexport function ordinalRange(scheme, length) {\n const s = ordinalScheme(scheme);\n const r = typeof s === \"function\" ? s({length}) : s;\n return r.length !== length ? r.slice(0, length) : r;\n}\n\n// If the specified domain contains only booleans (ignoring null and undefined),\n// returns a corresponding range where false is mapped to the low color and true\n// is mapped to the high color of the specified scheme.\nexport function maybeBooleanRange(domain, scheme = \"greys\") {\n const range = new Set();\n const [f, t] = ordinalRange(scheme, 2);\n for (const value of domain) {\n if (value == null) continue;\n if (value === true) range.add(t);\n else if (value === false) range.add(f);\n else return;\n }\n return [...range];\n}\n\nconst quantitativeSchemes = new Map([\n // diverging\n [\"brbg\", interpolateBrBG],\n [\"prgn\", interpolatePRGn],\n [\"piyg\", interpolatePiYG],\n [\"puor\", interpolatePuOr],\n [\"rdbu\", interpolateRdBu],\n [\"rdgy\", interpolateRdGy],\n [\"rdylbu\", interpolateRdYlBu],\n [\"rdylgn\", interpolateRdYlGn],\n [\"spectral\", interpolateSpectral],\n\n // reversed diverging (for temperature data)\n [\"burd\", (t) => interpolateRdBu(1 - t)],\n [\"buylrd\", (t) => interpolateRdYlBu(1 - t)],\n\n // sequential (single-hue)\n [\"blues\", interpolateBlues],\n [\"greens\", interpolateGreens],\n [\"greys\", interpolateGreys],\n [\"purples\", interpolatePurples],\n [\"reds\", interpolateReds],\n [\"oranges\", interpolateOranges],\n\n // sequential (multi-hue)\n [\"turbo\", interpolateTurbo],\n [\"viridis\", interpolateViridis],\n [\"magma\", interpolateMagma],\n [\"inferno\", interpolateInferno],\n [\"plasma\", interpolatePlasma],\n [\"cividis\", interpolateCividis],\n [\"cubehelix\", interpolateCubehelixDefault],\n [\"warm\", interpolateWarm],\n [\"cool\", interpolateCool],\n [\"bugn\", interpolateBuGn],\n [\"bupu\", interpolateBuPu],\n [\"gnbu\", interpolateGnBu],\n [\"orrd\", interpolateOrRd],\n [\"pubugn\", interpolatePuBuGn],\n [\"pubu\", interpolatePuBu],\n [\"purd\", interpolatePuRd],\n [\"rdpu\", interpolateRdPu],\n [\"ylgnbu\", interpolateYlGnBu],\n [\"ylgn\", interpolateYlGn],\n [\"ylorbr\", interpolateYlOrBr],\n [\"ylorrd\", interpolateYlOrRd],\n\n // cyclical\n [\"rainbow\", interpolateRainbow],\n [\"sinebow\", interpolateSinebow]\n]);\n\nexport function quantitativeScheme(scheme) {\n const s = `${scheme}`.toLowerCase();\n if (!quantitativeSchemes.has(s)) throw new Error(`unknown quantitative scheme: ${s}`);\n return quantitativeSchemes.get(s);\n}\n\nconst divergingSchemes = new Set([\n \"brbg\",\n \"prgn\",\n \"piyg\",\n \"puor\",\n \"rdbu\",\n \"rdgy\",\n \"rdylbu\",\n \"rdylgn\",\n \"spectral\",\n \"burd\",\n \"buylrd\"\n]);\n\nexport function isDivergingScheme(scheme) {\n return scheme != null && divergingSchemes.has(`${scheme}`.toLowerCase());\n}\n", "import {\n descending,\n extent,\n interpolateHcl,\n interpolateHsl,\n interpolateLab,\n interpolateNumber,\n interpolateRgb,\n interpolateRound,\n max,\n median,\n min,\n piecewise,\n quantile,\n quantize,\n reverse as reverseof,\n scaleIdentity,\n scaleLinear,\n scaleLog,\n scalePow,\n scaleQuantile,\n scaleSymlog,\n scaleThreshold,\n ticks\n} from \"d3\";\nimport {finite, negative, positive} from \"../defined.js\";\nimport {arrayify, constant, maybeNiceInterval, maybeRangeInterval, slice} from \"../options.js\";\nimport {orderof} from \"../order.js\";\nimport {color, length, opacity, radius, registry, hasNumericRange} from \"./index.js\";\nimport {ordinalRange, quantitativeScheme} from \"./schemes.js\";\n\nexport const flip = (i) => (t) => i(1 - t);\nconst unit = [0, 1];\n\nconst interpolators = new Map([\n // numbers\n [\"number\", interpolateNumber],\n\n // color spaces\n [\"rgb\", interpolateRgb],\n [\"hsl\", interpolateHsl],\n [\"hcl\", interpolateHcl],\n [\"lab\", interpolateLab]\n]);\n\nexport function maybeInterpolator(interpolate) {\n const i = `${interpolate}`.toLowerCase();\n if (!interpolators.has(i)) throw new Error(`unknown interpolator: ${i}`);\n return interpolators.get(i);\n}\n\nexport function createScaleQ(\n key,\n scale,\n channels,\n {\n type,\n nice,\n clamp,\n zero,\n domain = inferAutoDomain(key, channels),\n unknown,\n round,\n scheme,\n interval,\n range = registry.get(key) === radius\n ? inferRadialRange(channels, domain)\n : registry.get(key) === length\n ? inferLengthRange(channels, domain)\n : registry.get(key) === opacity\n ? unit\n : undefined,\n interpolate = registry.get(key) === color\n ? scheme == null && range !== undefined\n ? interpolateRgb\n : quantitativeScheme(scheme !== undefined ? scheme : type === \"cyclical\" ? \"rainbow\" : \"turbo\")\n : round\n ? interpolateRound\n : interpolateNumber,\n reverse\n }\n) {\n interval = maybeRangeInterval(interval, type);\n if (type === \"cyclical\" || type === \"sequential\") type = \"linear\"; // shorthand for color schemes\n if (typeof interpolate !== \"function\") interpolate = maybeInterpolator(interpolate); // named interpolator\n reverse = !!reverse;\n\n // If an explicit range is specified, and it has a different length than the\n // domain, then redistribute the range using a piecewise interpolator.\n if (range !== undefined) {\n const n = (domain = arrayify(domain)).length;\n const m = (range = arrayify(range)).length;\n if (n !== m) {\n if (interpolate.length === 1) throw new Error(\"invalid piecewise interpolator\"); // e.g., turbo\n interpolate = piecewise(interpolate, range);\n range = undefined;\n }\n }\n\n // Disambiguate between a two-argument interpolator that is used in\n // conjunction with the range, and a one-argument \u201Cfixed\u201D interpolator on the\n // [0, 1] interval as with the RdBu color scheme.\n if (interpolate.length === 1) {\n if (reverse) {\n interpolate = flip(interpolate);\n reverse = false;\n }\n if (range === undefined) {\n range = Float64Array.from(domain, (_, i) => i / (domain.length - 1));\n if (range.length === 2) range = unit; // optimize common case of [0, 1]\n }\n scale.interpolate((range === unit ? constant : interpolatePiecewise)(interpolate));\n } else {\n scale.interpolate(interpolate);\n }\n\n // If a zero option is specified, we assume that the domain is numeric, and we\n // want to ensure that the domain crosses zero. However, note that the domain\n // may be reversed (descending) so we shouldn\u2019t assume that the first value is\n // smaller than the last; and also it\u2019s possible that the domain has more than\n // two values for a \u201Cpoly\u201D scale. And lastly be careful not to mutate input!\n if (zero) {\n const [min, max] = extent(domain);\n if (min > 0 || max < 0) {\n domain = slice(domain);\n if (orderof(domain) !== Math.sign(min)) domain[domain.length - 1] = 0; // [2, 1] or [-2, -1]\n else domain[0] = 0; // [1, 2] or [-1, -2]\n }\n }\n\n if (reverse) domain = reverseof(domain);\n scale.domain(domain).unknown(unknown);\n if (nice) scale.nice(maybeNice(nice, type)), (domain = scale.domain());\n if (range !== undefined) scale.range(range);\n if (clamp) scale.clamp(clamp);\n return {type, domain, range, scale, interpolate, interval};\n}\n\nfunction maybeNice(nice, type) {\n return nice === true ? undefined : typeof nice === \"number\" ? nice : maybeNiceInterval(nice, type);\n}\n\nexport function createScaleLinear(key, channels, options) {\n return createScaleQ(key, scaleLinear(), channels, options);\n}\n\nexport function createScaleSqrt(key, channels, options) {\n return createScalePow(key, channels, {...options, exponent: 0.5});\n}\n\nexport function createScalePow(key, channels, {exponent = 1, ...options}) {\n return createScaleQ(key, scalePow().exponent(exponent), channels, {...options, type: \"pow\"});\n}\n\nexport function createScaleLog(key, channels, {base = 10, domain = inferLogDomain(channels), ...options}) {\n return createScaleQ(key, scaleLog().base(base), channels, {...options, domain});\n}\n\nexport function createScaleSymlog(key, channels, {constant = 1, ...options}) {\n return createScaleQ(key, scaleSymlog().constant(constant), channels, options);\n}\n\nexport function createScaleQuantile(\n key,\n channels,\n {\n range,\n quantiles = range === undefined ? 5 : (range = [...range]).length, // deprecated; use n instead\n n = quantiles,\n scheme = \"rdylbu\",\n domain = inferQuantileDomain(channels),\n unknown,\n interpolate,\n reverse\n }\n) {\n if (range === undefined) {\n range =\n interpolate !== undefined\n ? quantize(interpolate, n)\n : registry.get(key) === color\n ? ordinalRange(scheme, n)\n : undefined;\n }\n if (domain.length > 0) {\n domain = scaleQuantile(domain, range === undefined ? {length: n} : range).quantiles();\n }\n return createScaleThreshold(key, channels, {domain, range, reverse, unknown});\n}\n\nexport function createScaleQuantize(\n key,\n channels,\n {\n range,\n n = range === undefined ? 5 : (range = [...range]).length,\n scheme = \"rdylbu\",\n domain = inferAutoDomain(key, channels),\n unknown,\n interpolate,\n reverse\n }\n) {\n const [min, max] = extent(domain);\n let thresholds;\n if (range === undefined) {\n thresholds = ticks(min, max, n); // approximate number of nice, round thresholds\n if (thresholds[0] <= min) thresholds.splice(0, 1); // drop exact lower bound\n if (thresholds[thresholds.length - 1] >= max) thresholds.pop(); // drop exact upper bound\n n = thresholds.length + 1;\n range =\n interpolate !== undefined\n ? quantize(interpolate, n)\n : registry.get(key) === color\n ? ordinalRange(scheme, n)\n : undefined;\n } else {\n thresholds = quantize(interpolateNumber(min, max), n + 1).slice(1, -1); // exactly n - 1 thresholds to match range\n if (min instanceof Date) thresholds = thresholds.map((x) => new Date(x)); // preserve date types\n }\n if (orderof(arrayify(domain)) < 0) thresholds.reverse(); // preserve descending domain\n return createScaleThreshold(key, channels, {domain: thresholds, range, reverse, unknown});\n}\n\nexport function createScaleThreshold(\n key,\n channels,\n {\n domain = [0], // explicit thresholds in ascending order\n unknown,\n scheme = \"rdylbu\",\n interpolate,\n range = interpolate !== undefined\n ? quantize(interpolate, domain.length + 1)\n : registry.get(key) === color\n ? ordinalRange(scheme, domain.length + 1)\n : undefined,\n reverse\n }\n) {\n domain = arrayify(domain);\n const sign = orderof(domain); // preserve descending domain\n if (!isNaN(sign) && !isOrdered(domain, sign)) throw new Error(`the ${key} scale has a non-monotonic domain`);\n if (reverse) range = reverseof(range); // domain ascending, so reverse range\n return {\n type: \"threshold\",\n scale: scaleThreshold(sign < 0 ? reverseof(domain) : domain, range === undefined ? [] : range).unknown(unknown),\n domain,\n range\n };\n}\n\nfunction isOrdered(domain, sign) {\n for (let i = 1, n = domain.length, d = domain[0]; i < n; ++i) {\n const s = descending(d, (d = domain[i]));\n if (s !== 0 && s !== sign) return false;\n }\n return true;\n}\n\n// For non-numeric identity scales such as color and symbol, we can\u2019t use D3\u2019s\n// identity scale because it coerces to number; and we can\u2019t compute the domain\n// (and equivalently range) since we can\u2019t know whether the values are\n// continuous or discrete.\nexport function createScaleIdentity(key) {\n return {type: \"identity\", scale: hasNumericRange(registry.get(key)) ? scaleIdentity() : (d) => d};\n}\n\nexport function inferDomain(channels, f = finite) {\n return channels.length\n ? [\n min(channels, ({value}) => (value === undefined ? value : min(value, f))),\n max(channels, ({value}) => (value === undefined ? value : max(value, f)))\n ]\n : [0, 1];\n}\n\nfunction inferAutoDomain(key, channels) {\n const type = registry.get(key);\n return (type === radius || type === opacity || type === length ? inferZeroDomain : inferDomain)(channels);\n}\n\nfunction inferZeroDomain(channels) {\n return [0, channels.length ? max(channels, ({value}) => (value === undefined ? value : max(value, finite))) : 1];\n}\n\n// We don\u2019t want the upper bound of the radial domain to be zero, as this would\n// be degenerate, so we ignore nonpositive values. We also don\u2019t want the\n// maximum default radius to exceed 30px.\nfunction inferRadialRange(channels, domain) {\n const hint = channels.find(({radius}) => radius !== undefined);\n if (hint !== undefined) return [0, hint.radius]; // a natural maximum radius, e.g. hexbins\n const h25 = quantile(channels, 0.5, ({value}) => (value === undefined ? NaN : quantile(value, 0.25, positive)));\n const range = domain.map((d) => 3 * Math.sqrt(d / h25));\n const k = 30 / max(range);\n return k < 1 ? range.map((r) => r * k) : range;\n}\n\n// We want a length scale\u2019s domain to go from zero to a positive value, and to\n// treat negative lengths if any as inverted vectors of equivalent magnitude. We\n// also don\u2019t want the maximum default length to exceed 60px.\nfunction inferLengthRange(channels, domain) {\n const h50 = median(channels, ({value}) => (value === undefined ? NaN : median(value, Math.abs)));\n const range = domain.map((d) => (12 * d) / h50);\n const k = 60 / max(range);\n return k < 1 ? range.map((r) => r * k) : range;\n}\n\nfunction inferLogDomain(channels) {\n for (const {value} of channels) {\n if (value !== undefined) {\n for (let v of value) {\n if (v > 0) return inferDomain(channels, positive);\n if (v < 0) return inferDomain(channels, negative);\n }\n }\n }\n return [1, 10];\n}\n\nfunction inferQuantileDomain(channels) {\n const domain = [];\n for (const {value} of channels) {\n if (value === undefined) continue;\n for (const v of value) domain.push(v);\n }\n return domain;\n}\n\nexport function interpolatePiecewise(interpolate) {\n return (i, j) => (t) => interpolate(i + t * (j - i));\n}\n", "import {\n descending,\n interpolateNumber,\n interpolateRgb,\n piecewise,\n scaleDiverging,\n scaleDivergingLog,\n scaleDivergingPow,\n scaleDivergingSymlog\n} from \"d3\";\nimport {negative, positive} from \"../defined.js\";\nimport {arrayify} from \"../options.js\";\nimport {warn} from \"../warnings.js\";\nimport {color, registry} from \"./index.js\";\nimport {flip, inferDomain, interpolatePiecewise, maybeInterpolator} from \"./quantitative.js\";\nimport {quantitativeScheme} from \"./schemes.js\";\n\nfunction createScaleD(\n key,\n scale,\n transform,\n channels,\n {\n type,\n nice,\n clamp,\n domain = inferDomain(channels),\n unknown,\n pivot = 0,\n scheme,\n range,\n symmetric = true,\n interpolate = registry.get(key) === color\n ? scheme == null && range !== undefined\n ? interpolateRgb\n : quantitativeScheme(scheme !== undefined ? scheme : \"rdbu\")\n : interpolateNumber,\n reverse\n }\n) {\n pivot = +pivot;\n domain = arrayify(domain);\n let [min, max] = domain;\n if (domain.length > 2) warn(`Warning: the diverging ${key} scale domain contains extra elements.`);\n\n if (descending(min, max) < 0) ([min, max] = [max, min]), (reverse = !reverse);\n min = Math.min(min, pivot);\n max = Math.max(max, pivot);\n\n // Sometimes interpolate is a named interpolator, such as \"lab\" for Lab color\n // space. Other times interpolate is a function that takes two arguments and\n // is used in conjunction with the range. And other times the interpolate\n // function is a \u201Cfixed\u201D interpolator on the [0, 1] interval, as when a\n // color scheme such as interpolateRdBu is used.\n if (typeof interpolate !== \"function\") {\n interpolate = maybeInterpolator(interpolate);\n }\n\n // If an explicit range is specified, promote it to a piecewise interpolator.\n if (range !== undefined) {\n interpolate =\n interpolate.length === 1 ? interpolatePiecewise(interpolate)(...range) : piecewise(interpolate, range);\n }\n\n // Reverse before normalization.\n if (reverse) interpolate = flip(interpolate);\n\n // Normalize the interpolator for symmetric difference around the pivot.\n if (symmetric) {\n const mid = transform.apply(pivot);\n const mindelta = mid - transform.apply(min);\n const maxdelta = transform.apply(max) - mid;\n if (mindelta < maxdelta) min = transform.invert(mid - maxdelta);\n else if (mindelta > maxdelta) max = transform.invert(mid + mindelta);\n }\n\n scale.domain([min, pivot, max]).unknown(unknown).interpolator(interpolate);\n if (clamp) scale.clamp(clamp);\n if (nice) scale.nice(nice);\n return {type, domain: [min, max], pivot, interpolate, scale};\n}\n\nexport function createScaleDiverging(key, channels, options) {\n return createScaleD(key, scaleDiverging(), transformIdentity, channels, options);\n}\n\nexport function createScaleDivergingSqrt(key, channels, options) {\n return createScaleDivergingPow(key, channels, {...options, exponent: 0.5});\n}\n\nexport function createScaleDivergingPow(key, channels, {exponent = 1, ...options}) {\n return createScaleD(key, scaleDivergingPow().exponent((exponent = +exponent)), transformPow(exponent), channels, {\n ...options,\n type: \"diverging-pow\"\n });\n}\n\nexport function createScaleDivergingLog(\n key,\n channels,\n {base = 10, pivot = 1, domain = inferDomain(channels, pivot < 0 ? negative : positive), ...options}\n) {\n return createScaleD(key, scaleDivergingLog().base((base = +base)), transformLog, channels, {\n domain,\n pivot,\n ...options\n });\n}\n\nexport function createScaleDivergingSymlog(key, channels, {constant = 1, ...options}) {\n return createScaleD(\n key,\n scaleDivergingSymlog().constant((constant = +constant)),\n transformSymlog(constant),\n channels,\n options\n );\n}\n\nconst transformIdentity = {\n apply(x) {\n return x;\n },\n invert(x) {\n return x;\n }\n};\n\nconst transformLog = {\n apply: Math.log,\n invert: Math.exp\n};\n\nconst transformSqrt = {\n apply(x) {\n return Math.sign(x) * Math.sqrt(Math.abs(x));\n },\n invert(x) {\n return Math.sign(x) * (x * x);\n }\n};\n\nfunction transformPow(exponent) {\n return exponent === 0.5\n ? transformSqrt\n : {\n apply(x) {\n return Math.sign(x) * Math.pow(Math.abs(x), exponent);\n },\n invert(x) {\n return Math.sign(x) * Math.pow(Math.abs(x), 1 / exponent);\n }\n };\n}\n\nfunction transformSymlog(constant) {\n return {\n apply(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / constant));\n },\n invert(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * constant;\n }\n };\n}\n", "import {scaleTime, scaleUtc} from \"d3\";\nimport {createScaleQ} from \"./quantitative.js\";\n\nfunction createScaleT(key, scale, channels, options) {\n return createScaleQ(key, scale, channels, options);\n}\n\nexport function createScaleTime(key, channels, options) {\n return createScaleT(key, scaleTime(), channels, options);\n}\n\nexport function createScaleUtc(key, channels, options) {\n return createScaleT(key, scaleUtc(), channels, options);\n}\n", "import {InternSet, extent, quantize, reverse as reverseof, sort, symbolsFill, symbolsStroke} from \"d3\";\nimport {scaleBand, scaleOrdinal, scalePoint, scaleImplicit} from \"d3\";\nimport {ascendingDefined} from \"../defined.js\";\nimport {isNoneish, map, maybeRangeInterval} from \"../options.js\";\nimport {maybeSymbol} from \"../symbol.js\";\nimport {registry, color, position, symbol} from \"./index.js\";\nimport {maybeBooleanRange, ordinalScheme, quantitativeScheme} from \"./schemes.js\";\n\n// This denotes an implicitly ordinal color scale: the scale type was not set,\n// but the associated values are strings or booleans. If the associated defined\n// values are entirely boolean, the range will default to greys. You can opt out\n// of this by setting the type explicitly.\nexport const ordinalImplicit = Symbol(\"ordinal\");\n\nfunction createScaleO(key, scale, channels, {type, interval, domain, range, reverse, hint}) {\n interval = maybeRangeInterval(interval, type);\n if (domain === undefined) domain = inferDomain(channels, interval, key);\n if (type === \"categorical\" || type === ordinalImplicit) type = \"ordinal\"; // shorthand for color schemes\n if (reverse) domain = reverseof(domain);\n domain = scale.domain(domain).domain(); // deduplicate\n if (range !== undefined) {\n // If the range is specified as a function, pass it the domain.\n if (typeof range === \"function\") range = range(domain);\n scale.range(range);\n }\n return {type, domain, range, scale, hint, interval};\n}\n\nexport function createScaleOrdinal(key, channels, {type, interval, domain, range, scheme, unknown, ...options}) {\n interval = maybeRangeInterval(interval, type);\n if (domain === undefined) domain = inferDomain(channels, interval, key);\n let hint;\n if (registry.get(key) === symbol) {\n hint = inferSymbolHint(channels);\n range = range === undefined ? inferSymbolRange(hint) : map(range, maybeSymbol);\n } else if (registry.get(key) === color) {\n if (range === undefined && (type === \"ordinal\" || type === ordinalImplicit)) {\n range = maybeBooleanRange(domain, scheme);\n if (range !== undefined) scheme = undefined; // Don\u2019t re-apply scheme.\n }\n if (scheme === undefined && range === undefined) {\n scheme = type === \"ordinal\" ? \"turbo\" : \"observable10\";\n }\n if (scheme !== undefined) {\n if (range !== undefined) {\n const interpolate = quantitativeScheme(scheme);\n const t0 = range[0],\n d = range[1] - range[0];\n range = ({length: n}) => quantize((t) => interpolate(t0 + d * t), n);\n } else {\n range = ordinalScheme(scheme);\n }\n }\n }\n if (unknown === scaleImplicit) {\n throw new Error(`implicit unknown on ${key} scale is not supported`);\n }\n return createScaleO(key, scaleOrdinal().unknown(unknown), channels, {...options, type, domain, range, hint});\n}\n\nexport function createScalePoint(key, channels, {align = 0.5, padding = 0.5, ...options}) {\n return maybeRound(scalePoint().align(align).padding(padding), channels, options, key);\n}\n\nexport function createScaleBand(\n key,\n channels,\n {\n align = 0.5,\n padding = 0.1,\n paddingInner = padding,\n paddingOuter = key === \"fx\" || key === \"fy\" ? 0 : padding,\n ...options\n }\n) {\n return maybeRound(\n scaleBand().align(align).paddingInner(paddingInner).paddingOuter(paddingOuter),\n channels,\n options,\n key\n );\n}\n\nfunction maybeRound(scale, channels, options, key) {\n let {round} = options;\n if (round !== undefined) scale.round((round = !!round));\n scale = createScaleO(key, scale, channels, options);\n scale.round = round; // preserve for autoScaleRound\n return scale;\n}\n\nfunction inferDomain(channels, interval, key) {\n const values = new InternSet();\n for (const {value, domain} of channels) {\n if (domain !== undefined) return domain(); // see channelDomain\n if (value === undefined) continue;\n for (const v of value) values.add(v);\n }\n if (interval !== undefined) {\n const [min, max] = extent(values).map(interval.floor, interval);\n return interval.range(min, interval.offset(max));\n }\n if (values.size > 10e3 && registry.get(key) === position) {\n throw new Error(`implicit ordinal domain of ${key} scale has more than 10,000 values`);\n }\n return sort(values, ascendingDefined);\n}\n\n// If all channels provide a consistent hint, propagate it to the scale.\nfunction inferHint(channels, key) {\n let value;\n for (const {hint} of channels) {\n const candidate = hint?.[key];\n if (candidate === undefined) continue; // no hint here\n if (value === undefined) value = candidate; // first hint\n else if (value !== candidate) return; // inconsistent hint\n }\n return value;\n}\n\nfunction inferSymbolHint(channels) {\n return {\n fill: inferHint(channels, \"fill\"),\n stroke: inferHint(channels, \"stroke\")\n };\n}\n\nfunction inferSymbolRange(hint) {\n return isNoneish(hint.fill) ? symbolsStroke : symbolsFill;\n}\n", "import {\n isOrdinal,\n isTemporal,\n isTemporalString,\n isNumericString,\n isScaleOptions,\n map,\n slice,\n coerceNumbers,\n coerceDates\n} from \"./options.js\";\nimport {orderof} from \"./order.js\";\nimport {registry, color, position, radius, opacity, symbol, length} from \"./scales/index.js\";\nimport {\n createScaleLinear,\n createScaleSqrt,\n createScalePow,\n createScaleLog,\n createScaleSymlog,\n createScaleQuantile,\n createScaleQuantize,\n createScaleThreshold,\n createScaleIdentity\n} from \"./scales/quantitative.js\";\nimport {\n createScaleDiverging,\n createScaleDivergingSqrt,\n createScaleDivergingPow,\n createScaleDivergingLog,\n createScaleDivergingSymlog\n} from \"./scales/diverging.js\";\nimport {isCategoricalScheme, isDivergingScheme} from \"./scales/schemes.js\";\nimport {createScaleTime, createScaleUtc} from \"./scales/temporal.js\";\nimport {createScaleOrdinal, createScalePoint, createScaleBand, ordinalImplicit} from \"./scales/ordinal.js\";\nimport {maybeSymbol} from \"./symbol.js\";\nimport {warn} from \"./warnings.js\";\n\nexport function createScales(\n channelsByScale,\n {\n label: globalLabel,\n inset: globalInset = 0,\n insetTop: globalInsetTop = globalInset,\n insetRight: globalInsetRight = globalInset,\n insetBottom: globalInsetBottom = globalInset,\n insetLeft: globalInsetLeft = globalInset,\n round,\n nice,\n clamp,\n zero,\n align,\n padding,\n projection,\n facet: {label: facetLabel = globalLabel} = {},\n ...options\n } = {}\n) {\n const scales = {};\n for (const [key, channels] of channelsByScale) {\n const scaleOptions = options[key];\n const scale = createScale(key, channels, {\n round: registry.get(key) === position ? round : undefined, // only for position\n nice,\n clamp,\n zero,\n align,\n padding,\n projection,\n ...scaleOptions\n });\n if (scale) {\n // populate generic scale options (percent, transform, insets)\n let {\n label = key === \"fx\" || key === \"fy\" ? facetLabel : globalLabel,\n percent,\n transform,\n inset,\n insetTop = inset !== undefined ? inset : key === \"y\" ? globalInsetTop : 0, // not fy\n insetRight = inset !== undefined ? inset : key === \"x\" ? globalInsetRight : 0, // not fx\n insetBottom = inset !== undefined ? inset : key === \"y\" ? globalInsetBottom : 0, // not fy\n insetLeft = inset !== undefined ? inset : key === \"x\" ? globalInsetLeft : 0 // not fx\n } = scaleOptions || {};\n if (transform == null) transform = undefined;\n else if (typeof transform !== \"function\") throw new Error(\"invalid scale transform; not a function\");\n scale.percent = !!percent;\n scale.label = label === undefined ? inferScaleLabel(channels, scale) : label;\n scale.transform = transform;\n if (key === \"x\" || key === \"fx\") {\n scale.insetLeft = +insetLeft;\n scale.insetRight = +insetRight;\n } else if (key === \"y\" || key === \"fy\") {\n scale.insetTop = +insetTop;\n scale.insetBottom = +insetBottom;\n }\n scales[key] = scale;\n }\n }\n return scales;\n}\n\nexport function createScaleFunctions(descriptors) {\n const scales = {};\n const scaleFunctions = {scales};\n for (const [key, descriptor] of Object.entries(descriptors)) {\n const {scale, type, interval, label} = descriptor;\n scales[key] = exposeScale(descriptor);\n scaleFunctions[key] = scale;\n // TODO: pass these properties, which are needed for axes, in the descriptor.\n scale.type = type;\n if (interval != null) scale.interval = interval;\n if (label != null) scale.label = label;\n }\n return scaleFunctions;\n}\n\n// Mutates scale.range!\nexport function autoScaleRange(scales, dimensions) {\n const {x, y, fx, fy} = scales;\n const superdimensions = fx || fy ? outerDimensions(dimensions) : dimensions;\n if (fx) autoScaleRangeX(fx, superdimensions);\n if (fy) autoScaleRangeY(fy, superdimensions);\n const subdimensions = fx || fy ? innerDimensions(scales, dimensions) : dimensions;\n if (x) autoScaleRangeX(x, subdimensions);\n if (y) autoScaleRangeY(y, subdimensions);\n}\n\n// Channels can have labels; if all the channels for a given scale are\n// consistently labeled (i.e., have the same value if not undefined), and the\n// corresponding scale doesn\u2019t already have an explicit label, then the\n// channels\u2019 label is promoted to the scale. This inferred label should have an\n// orientation-appropriate arrow added when used as an axis, but we don\u2019t want\n// to add the arrow when the label is set explicitly as an option; so, the\n// inferred label is distinguished as an object with an \u201Cinferred\u201D property.\nfunction inferScaleLabel(channels = [], scale) {\n let label;\n for (const {label: l} of channels) {\n if (l === undefined) continue;\n if (label === undefined) label = l;\n else if (label !== l) return;\n }\n if (label === undefined) return;\n if (!isOrdinalScale(scale) && scale.percent) label = `${label} (%)`;\n return {inferred: true, toString: () => label};\n}\n\n// Determines whether the scale points in the \u201Cpositive\u201D (right or down) or\n// \u201Cnegative\u201D (left or up) direction; if the scale order cannot be determined,\n// returns NaN; used to assign an appropriate label arrow.\nexport function inferScaleOrder(scale) {\n return Math.sign(orderof(scale.domain())) * Math.sign(orderof(scale.range()));\n}\n\n// Returns the dimensions of the outer frame; this is subdivided into facets\n// with the margins of each facet collapsing into the outer margins.\nexport function outerDimensions(dimensions) {\n const {\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n width,\n height,\n facet: {\n marginTop: facetMarginTop,\n marginRight: facetMarginRight,\n marginBottom: facetMarginBottom,\n marginLeft: facetMarginLeft\n }\n } = dimensions;\n return {\n marginTop: Math.max(marginTop, facetMarginTop),\n marginRight: Math.max(marginRight, facetMarginRight),\n marginBottom: Math.max(marginBottom, facetMarginBottom),\n marginLeft: Math.max(marginLeft, facetMarginLeft),\n width,\n height\n };\n}\n\n// Returns the dimensions of each facet.\nexport function innerDimensions({fx, fy}, dimensions) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = outerDimensions(dimensions);\n return {\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n width: fx ? fx.scale.bandwidth() + marginLeft + marginRight : width,\n height: fy ? fy.scale.bandwidth() + marginTop + marginBottom : height,\n facet: {width, height}\n };\n}\n\nfunction autoScaleRangeX(scale, dimensions) {\n if (scale.range === undefined) {\n const {insetLeft, insetRight} = scale;\n const {width, marginLeft = 0, marginRight = 0} = dimensions;\n const left = marginLeft + insetLeft;\n const right = width - marginRight - insetRight;\n scale.range = [left, Math.max(left, right)];\n if (!isOrdinalScale(scale)) scale.range = piecewiseRange(scale);\n scale.scale.range(scale.range);\n }\n autoScaleRound(scale);\n}\n\nfunction autoScaleRangeY(scale, dimensions) {\n if (scale.range === undefined) {\n const {insetTop, insetBottom} = scale;\n const {height, marginTop = 0, marginBottom = 0} = dimensions;\n const top = marginTop + insetTop;\n const bottom = height - marginBottom - insetBottom;\n scale.range = [Math.max(top, bottom), top];\n if (!isOrdinalScale(scale)) scale.range = piecewiseRange(scale);\n else scale.range.reverse();\n scale.scale.range(scale.range);\n }\n autoScaleRound(scale);\n}\n\nfunction autoScaleRound(scale) {\n if (scale.round === undefined && isBandScale(scale) && roundError(scale) <= 30) {\n scale.scale.round(true);\n }\n}\n\n// If we were to turn on rounding for this band or point scale, how much wasted\n// space would it introduce (on both ends of the range)? This must match\n// d3.scaleBand\u2019s rounding behavior:\n// https://github.com/d3/d3-scale/blob/83555bd759c7314420bd4240642beda5e258db9e/src/band.js#L20-L32\nfunction roundError({scale}) {\n const n = scale.domain().length;\n const [start, stop] = scale.range();\n const paddingInner = scale.paddingInner ? scale.paddingInner() : 1;\n const paddingOuter = scale.paddingOuter ? scale.paddingOuter() : scale.padding();\n const m = n - paddingInner;\n const step = Math.abs(stop - start) / Math.max(1, m + paddingOuter * 2);\n return (step - Math.floor(step)) * m;\n}\n\nfunction piecewiseRange(scale) {\n const length = scale.scale.domain().length + isThresholdScale(scale);\n if (!(length > 2)) return scale.range;\n const [start, end] = scale.range;\n return Array.from({length}, (_, i) => start + (i / (length - 1)) * (end - start));\n}\n\nexport function normalizeScale(key, scale, hint) {\n return createScale(key, hint === undefined ? undefined : [{hint}], {...scale});\n}\n\nfunction createScale(key, channels = [], options = {}) {\n const type = inferScaleType(key, channels, options);\n\n // Warn for common misuses of implicit ordinal scales. We disable this test if\n // you specify a scale interval or if you set the domain or range explicitly,\n // since setting the domain or range (typically with a cardinality of more than\n // two) is another indication that you intended for the scale to be ordinal; we\n // also disable it for facet scales since these are always band scales.\n if (\n options.type === undefined &&\n options.domain === undefined &&\n options.range === undefined &&\n options.interval == null &&\n key !== \"fx\" &&\n key !== \"fy\" &&\n isOrdinalScale({type})\n ) {\n const values = channels.map(({value}) => value).filter((value) => value !== undefined);\n if (values.some(isTemporal))\n warn(\n `Warning: some data associated with the ${key} scale are dates. Dates are typically associated with a \"utc\" or \"time\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n else if (values.some(isTemporalString))\n warn(\n `Warning: some data associated with the ${key} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a \"utc\" or \"time\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n else if (values.some(isNumericString))\n warn(\n `Warning: some data associated with the ${key} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a \"linear\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n }\n\n options.type = type; // Mutates input!\n\n // Once the scale type is known, coerce the associated channel values and any\n // explicitly-specified domain to the expected type.\n switch (type) {\n case \"diverging\":\n case \"diverging-sqrt\":\n case \"diverging-pow\":\n case \"diverging-log\":\n case \"diverging-symlog\":\n case \"cyclical\":\n case \"sequential\":\n case \"linear\":\n case \"sqrt\":\n case \"threshold\":\n case \"quantile\":\n case \"pow\":\n case \"log\":\n case \"symlog\":\n options = coerceType(channels, options, coerceNumbers);\n break;\n case \"identity\":\n switch (registry.get(key)) {\n case position:\n options = coerceType(channels, options, coerceNumbers);\n break;\n case symbol:\n options = coerceType(channels, options, coerceSymbols);\n break;\n }\n break;\n case \"utc\":\n case \"time\":\n options = coerceType(channels, options, coerceDates);\n break;\n }\n\n switch (type) {\n case \"diverging\":\n return createScaleDiverging(key, channels, options);\n case \"diverging-sqrt\":\n return createScaleDivergingSqrt(key, channels, options);\n case \"diverging-pow\":\n return createScaleDivergingPow(key, channels, options);\n case \"diverging-log\":\n return createScaleDivergingLog(key, channels, options);\n case \"diverging-symlog\":\n return createScaleDivergingSymlog(key, channels, options);\n case \"categorical\":\n case \"ordinal\":\n case ordinalImplicit:\n return createScaleOrdinal(key, channels, options);\n case \"cyclical\":\n case \"sequential\":\n case \"linear\":\n return createScaleLinear(key, channels, options);\n case \"sqrt\":\n return createScaleSqrt(key, channels, options);\n case \"threshold\":\n return createScaleThreshold(key, channels, options);\n case \"quantile\":\n return createScaleQuantile(key, channels, options);\n case \"quantize\":\n return createScaleQuantize(key, channels, options);\n case \"pow\":\n return createScalePow(key, channels, options);\n case \"log\":\n return createScaleLog(key, channels, options);\n case \"symlog\":\n return createScaleSymlog(key, channels, options);\n case \"utc\":\n return createScaleUtc(key, channels, options);\n case \"time\":\n return createScaleTime(key, channels, options);\n case \"point\":\n return createScalePoint(key, channels, options);\n case \"band\":\n return createScaleBand(key, channels, options);\n case \"identity\":\n return createScaleIdentity(key);\n case undefined:\n return;\n default:\n throw new Error(`unknown scale type: ${type}`);\n }\n}\n\nfunction formatScaleType(type) {\n return typeof type === \"symbol\" ? type.description : type;\n}\n\nfunction maybeScaleType(type) {\n return typeof type === \"string\" ? `${type}`.toLowerCase() : type;\n}\n\n// A special type symbol when the x and y scales are replaced with a projection.\nconst typeProjection = {toString: () => \"projection\"};\n\nfunction inferScaleType(key, channels, {type, domain, range, scheme, pivot, projection}) {\n type = maybeScaleType(type);\n\n // The facet scales are always band scales; this cannot be changed.\n if (key === \"fx\" || key === \"fy\") return \"band\";\n\n // If a projection is specified, the x- and y-scales are disabled; these\n // channels will be projected rather than scaled. (But still check that none\n // of the associated channels are incompatible with a projection.)\n if ((key === \"x\" || key === \"y\") && projection != null) type = typeProjection;\n\n // If a channel dictates a scale type, make sure that it is consistent with\n // the user-specified scale type (if any) and all other channels. For example,\n // barY requires x to be a band scale and disallows any other scale type.\n for (const channel of channels) {\n const t = maybeScaleType(channel.type);\n if (t === undefined) continue;\n else if (type === undefined) type = t;\n else if (type !== t) throw new Error(`scale incompatible with channel: ${type} !== ${t}`);\n }\n\n // If the scale, a channel, or user specified a (consistent) type, return it.\n if (type === typeProjection) return;\n if (type !== undefined) return type;\n\n // If there\u2019s no data (and no type) associated with this scale, don\u2019t create a scale.\n if (domain === undefined && !channels.some(({value}) => value !== undefined)) return;\n\n // Some scales have default types.\n const kind = registry.get(key);\n if (kind === radius) return \"sqrt\";\n if (kind === opacity || kind === length) return \"linear\";\n if (kind === symbol) return \"ordinal\";\n\n // If the domain or range has more than two values, assume it\u2019s ordinal. You\n // can still use a \u201Cpiecewise\u201D (or \u201Cpolylinear\u201D) scale, but you must set the\n // type explicitly.\n if ((domain || range || []).length > 2) return asOrdinalType(kind);\n\n // Otherwise, infer the scale type from the data! Prefer the domain, if\n // present, over channels. (The domain and channels should be consistently\n // typed, and the domain is more explicit and typically much smaller.) We only\n // check the first defined value for expedience and simplicity; we expect\n // that the types are consistent.\n if (domain !== undefined) {\n if (isOrdinal(domain)) return asOrdinalType(kind);\n if (isTemporal(domain)) return \"utc\";\n } else {\n const values = channels.map(({value}) => value).filter((value) => value !== undefined);\n if (values.some(isOrdinal)) return asOrdinalType(kind);\n if (values.some(isTemporal)) return \"utc\";\n }\n\n // For color scales, take a hint from the color scheme and pivot option.\n if (kind === color) {\n if (pivot != null || isDivergingScheme(scheme)) return \"diverging\";\n if (isCategoricalScheme(scheme)) return \"categorical\";\n }\n\n return \"linear\";\n}\n\n// Positional scales default to a point scale instead of an ordinal scale.\nfunction asOrdinalType(kind) {\n switch (kind) {\n case position:\n return \"point\";\n case color:\n return ordinalImplicit;\n default:\n return \"ordinal\";\n }\n}\n\nexport function isTemporalScale({type}) {\n return type === \"time\" || type === \"utc\";\n}\n\nexport function isOrdinalScale({type}) {\n return type === \"ordinal\" || type === \"point\" || type === \"band\" || type === ordinalImplicit;\n}\n\nexport function isThresholdScale({type}) {\n return type === \"threshold\";\n}\n\nfunction isBandScale({type}) {\n return type === \"point\" || type === \"band\";\n}\n\nexport function isDivergingScale({type}) {\n return /^diverging($|-)/.test(type);\n}\n\n// Certain marks have special behavior if a scale is collapsed, i.e. if the\n// domain is degenerate and represents only a single value such as [3, 3]; for\n// example, a rect will span the full extent of the chart along a collapsed\n// dimension (whereas a dot will simply be drawn in the center).\nexport function isCollapsed(scale) {\n if (scale === undefined) return true; // treat missing scale as collapsed\n const domain = scale.domain();\n const value = scale(domain[0]);\n for (let i = 1, n = domain.length; i < n; ++i) {\n if (scale(domain[i]) - value) {\n return false;\n }\n }\n return true;\n}\n\n// Mutates channel.value!\nfunction coerceType(channels, {domain, ...options}, coerceValues) {\n for (const c of channels) {\n if (c.value !== undefined) {\n if (domain === undefined) domain = c.value?.domain; // promote channel domain\n c.value = coerceValues(c.value);\n }\n }\n return {\n domain: domain === undefined ? domain : coerceValues(domain),\n ...options\n };\n}\n\nfunction coerceSymbols(values) {\n return map(values, maybeSymbol);\n}\n\nexport function scale(options = {}) {\n let scale;\n for (const key in options) {\n if (!registry.has(key)) continue; // ignore unknown properties\n if (!isScaleOptions(options[key])) continue; // e.g., ignore {color: \"red\"}\n if (scale !== undefined) throw new Error(\"ambiguous scale definition; multiple scales found\");\n scale = exposeScale(normalizeScale(key, options[key]));\n }\n if (scale === undefined) throw new Error(\"invalid scale definition; no scale found\");\n return scale;\n}\n\nexport function exposeScales(scales) {\n return (key) => {\n if (!registry.has((key = `${key}`))) throw new Error(`unknown scale: ${key}`);\n return scales[key];\n };\n}\n\n// Note: axis- and legend-related properties (such as label, ticks and\n// tickFormat) are not included here as they do not affect the scale\u2019s behavior.\nfunction exposeScale({scale, type, domain, range, interpolate, interval, transform, percent, pivot}) {\n if (type === \"identity\") return {type: \"identity\", apply: (d) => d, invert: (d) => d};\n const unknown = scale.unknown ? scale.unknown() : undefined;\n return {\n type,\n domain: slice(domain), // defensive copy\n ...(range !== undefined && {range: slice(range)}), // defensive copy\n ...(transform !== undefined && {transform}),\n ...(percent && {percent}), // only exposed if truthy\n ...(unknown !== undefined && {unknown}),\n ...(interval !== undefined && {interval}),\n\n // quantitative\n ...(interpolate !== undefined && {interpolate}),\n ...(scale.clamp && {clamp: scale.clamp()}),\n\n // diverging (always asymmetric; we never want to apply the symmetric transform twice)\n ...(pivot !== undefined && {pivot, symmetric: false}),\n\n // log, diverging-log\n ...(scale.base && {base: scale.base()}),\n\n // pow, diverging-pow\n ...(scale.exponent && {exponent: scale.exponent()}),\n\n // symlog, diverging-symlog\n ...(scale.constant && {constant: scale.constant()}),\n\n // band, point\n ...(scale.align && {align: scale.align(), round: scale.round()}),\n ...(scale.padding &&\n (scale.paddingInner\n ? {paddingInner: scale.paddingInner(), paddingOuter: scale.paddingOuter()}\n : {padding: scale.padding()})),\n ...(scale.bandwidth && {bandwidth: scale.bandwidth(), step: scale.step()}),\n\n // utilities\n apply: (t) => scale(t),\n ...(scale.invert && {invert: (t) => scale.invert(t)})\n };\n}\n", "export function memoize1(compute) {\n let cacheValue, cacheKeys;\n return (...keys) => {\n if (cacheKeys?.length !== keys.length || cacheKeys.some((k, i) => k !== keys[i])) {\n cacheKeys = keys;\n cacheValue = compute(...keys);\n }\n return cacheValue;\n };\n}\n", "import {format as isoFormat} from \"isoformat\";\nimport {string} from \"./options.js\";\nimport {memoize1} from \"./memoize.js\";\n\nconst numberFormat = memoize1((locale) => {\n return new Intl.NumberFormat(locale);\n});\n\nconst monthFormat = memoize1((locale, month) => {\n return new Intl.DateTimeFormat(locale, {timeZone: \"UTC\", ...(month && {month})});\n});\n\nconst weekdayFormat = memoize1((locale, weekday) => {\n return new Intl.DateTimeFormat(locale, {timeZone: \"UTC\", ...(weekday && {weekday})});\n});\n\nexport function formatNumber(locale = \"en-US\") {\n const format = numberFormat(locale);\n return (i) => (i != null && !isNaN(i) ? format.format(i) : undefined);\n}\n\nexport function formatMonth(locale = \"en-US\", format = \"short\") {\n const fmt = monthFormat(locale, format);\n return (i) => (i != null && !isNaN((i = +new Date(Date.UTC(2000, +i)))) ? fmt.format(i) : undefined);\n}\n\nexport function formatWeekday(locale = \"en-US\", format = \"short\") {\n const fmt = weekdayFormat(locale, format);\n return (i) => (i != null && !isNaN((i = +new Date(Date.UTC(2001, 0, +i)))) ? fmt.format(i) : undefined);\n}\n\nexport function formatIsoDate(date) {\n return isoFormat(date, \"Invalid Date\");\n}\n\nexport function formatAuto(locale = \"en-US\") {\n const number = formatNumber(locale);\n return (v) => (v instanceof Date ? formatIsoDate : typeof v === \"number\" ? number : string)(v);\n}\n\n// TODO When Plot supports a top-level locale option, this should be removed\n// because it lacks context to know which locale to use; formatAuto should be\n// used instead whenever possible.\nexport const formatDefault = formatAuto();\n", "import {geoPath, group, namespaces} from \"d3\";\nimport {create} from \"./context.js\";\nimport {defined, nonempty} from \"./defined.js\";\nimport {formatDefault} from \"./format.js\";\nimport {isNone, isNoneish, isRound, maybeColorChannel, maybeNumberChannel} from \"./options.js\";\nimport {keyof, number, string} from \"./options.js\";\nimport {warn} from \"./warnings.js\";\n\nexport const offset = (typeof window !== \"undefined\" ? window.devicePixelRatio > 1 : typeof it === \"undefined\") ? 0 : 0.5; // prettier-ignore\n\nlet nextClipId = 0;\n\nexport function getClipId() {\n return `plot-clip-${++nextClipId}`;\n}\n\nexport function styles(\n mark,\n {\n title,\n href,\n ariaLabel: variaLabel,\n ariaDescription,\n ariaHidden,\n target,\n fill,\n fillOpacity,\n stroke,\n strokeWidth,\n strokeOpacity,\n strokeLinejoin,\n strokeLinecap,\n strokeMiterlimit,\n strokeDasharray,\n strokeDashoffset,\n opacity,\n mixBlendMode,\n imageFilter,\n paintOrder,\n pointerEvents,\n shapeRendering,\n channels\n },\n {\n ariaLabel: cariaLabel,\n fill: defaultFill = \"currentColor\",\n fillOpacity: defaultFillOpacity,\n stroke: defaultStroke = \"none\",\n strokeOpacity: defaultStrokeOpacity,\n strokeWidth: defaultStrokeWidth,\n strokeLinecap: defaultStrokeLinecap,\n strokeLinejoin: defaultStrokeLinejoin,\n strokeMiterlimit: defaultStrokeMiterlimit,\n paintOrder: defaultPaintOrder\n }\n) {\n // Some marks don\u2019t support fill (e.g., tick and rule).\n if (defaultFill === null) {\n fill = null;\n fillOpacity = null;\n }\n\n // Some marks don\u2019t support stroke (e.g., image).\n if (defaultStroke === null) {\n stroke = null;\n strokeOpacity = null;\n }\n\n // Some marks default to fill with no stroke, while others default to stroke\n // with no fill. For example, bar and area default to fill, while dot and line\n // default to stroke. For marks that fill by default, the default fill only\n // applies if the stroke is (constant) none; if you set a stroke, then the\n // default fill becomes none. Similarly for marks that stroke by stroke, the\n // default stroke only applies if the fill is (constant) none.\n if (isNoneish(defaultFill)) {\n if (!isNoneish(defaultStroke) && (!isNoneish(fill) || channels?.fill)) defaultStroke = \"none\";\n } else {\n if (isNoneish(defaultStroke) && (!isNoneish(stroke) || channels?.stroke)) defaultFill = \"none\";\n }\n\n const [vfill, cfill] = maybeColorChannel(fill, defaultFill);\n const [vfillOpacity, cfillOpacity] = maybeNumberChannel(fillOpacity, defaultFillOpacity);\n const [vstroke, cstroke] = maybeColorChannel(stroke, defaultStroke);\n const [vstrokeOpacity, cstrokeOpacity] = maybeNumberChannel(strokeOpacity, defaultStrokeOpacity);\n const [vopacity, copacity] = maybeNumberChannel(opacity);\n\n // For styles that have no effect if there is no stroke, only apply the\n // defaults if the stroke is not the constant none. (If stroke is a channel,\n // then cstroke will be undefined, but there\u2019s still a stroke; hence we don\u2019t\n // use isNoneish here.)\n if (!isNone(cstroke)) {\n if (strokeWidth === undefined) strokeWidth = defaultStrokeWidth;\n if (strokeLinecap === undefined) strokeLinecap = defaultStrokeLinecap;\n if (strokeLinejoin === undefined) strokeLinejoin = defaultStrokeLinejoin;\n\n // The default stroke miterlimit need not be applied if the current stroke\n // is the constant round; this only has effect on miter joins.\n if (strokeMiterlimit === undefined && !isRound(strokeLinejoin)) strokeMiterlimit = defaultStrokeMiterlimit;\n\n // The paint order only takes effect if there is both a fill and a stroke\n // (at least if we ignore markers, which no built-in marks currently use).\n if (!isNone(cfill) && paintOrder === undefined) paintOrder = defaultPaintOrder;\n }\n\n const [vstrokeWidth, cstrokeWidth] = maybeNumberChannel(strokeWidth);\n\n // Some marks don\u2019t support fill (e.g., tick and rule).\n if (defaultFill !== null) {\n mark.fill = impliedString(cfill, \"currentColor\");\n mark.fillOpacity = impliedNumber(cfillOpacity, 1);\n }\n\n // Some marks don\u2019t support stroke (e.g., image).\n if (defaultStroke !== null) {\n mark.stroke = impliedString(cstroke, \"none\");\n mark.strokeWidth = impliedNumber(cstrokeWidth, 1);\n mark.strokeOpacity = impliedNumber(cstrokeOpacity, 1);\n mark.strokeLinejoin = impliedString(strokeLinejoin, \"miter\");\n mark.strokeLinecap = impliedString(strokeLinecap, \"butt\");\n mark.strokeMiterlimit = impliedNumber(strokeMiterlimit, 4);\n mark.strokeDasharray = impliedString(strokeDasharray, \"none\");\n mark.strokeDashoffset = impliedString(strokeDashoffset, \"0\");\n }\n\n mark.target = string(target);\n mark.ariaLabel = string(cariaLabel);\n mark.ariaDescription = string(ariaDescription);\n mark.ariaHidden = string(ariaHidden);\n mark.opacity = impliedNumber(copacity, 1);\n mark.mixBlendMode = impliedString(mixBlendMode, \"normal\");\n mark.imageFilter = impliedString(imageFilter, \"none\");\n mark.paintOrder = impliedString(paintOrder, \"normal\");\n mark.pointerEvents = impliedString(pointerEvents, \"auto\");\n mark.shapeRendering = impliedString(shapeRendering, \"auto\");\n\n return {\n title: {value: title, optional: true, filter: null},\n href: {value: href, optional: true, filter: null},\n ariaLabel: {value: variaLabel, optional: true, filter: null},\n fill: {value: vfill, scale: \"auto\", optional: true},\n fillOpacity: {value: vfillOpacity, scale: \"auto\", optional: true},\n stroke: {value: vstroke, scale: \"auto\", optional: true},\n strokeOpacity: {value: vstrokeOpacity, scale: \"auto\", optional: true},\n strokeWidth: {value: vstrokeWidth, optional: true},\n opacity: {value: vopacity, scale: \"auto\", optional: true}\n };\n}\n\n// Applies the specified titles via selection.call.\nexport function applyTitle(selection, L) {\n if (L)\n selection\n .filter((i) => nonempty(L[i]))\n .append(\"title\")\n .call(applyText, L);\n}\n\n// Like applyTitle, but for grouped data (lines, areas).\nexport function applyTitleGroup(selection, L) {\n if (L)\n selection\n .filter(([i]) => nonempty(L[i]))\n .append(\"title\")\n .call(applyTextGroup, L);\n}\n\nexport function applyText(selection, T) {\n if (T) selection.text((i) => formatDefault(T[i]));\n}\n\nexport function applyTextGroup(selection, T) {\n if (T) selection.text(([i]) => formatDefault(T[i]));\n}\n\nexport function applyChannelStyles(\n selection,\n {target, tip},\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n }\n) {\n if (AL) applyAttr(selection, \"aria-label\", (i) => AL[i]);\n if (F) applyAttr(selection, \"fill\", (i) => F[i]);\n if (FO) applyAttr(selection, \"fill-opacity\", (i) => FO[i]);\n if (S) applyAttr(selection, \"stroke\", (i) => S[i]);\n if (SO) applyAttr(selection, \"stroke-opacity\", (i) => SO[i]);\n if (SW) applyAttr(selection, \"stroke-width\", (i) => SW[i]);\n if (O) applyAttr(selection, \"opacity\", (i) => O[i]);\n if (H) applyHref(selection, (i) => H[i], target);\n if (!tip) applyTitle(selection, T);\n}\n\nexport function applyGroupedChannelStyles(\n selection,\n {target, tip},\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n }\n) {\n if (AL) applyAttr(selection, \"aria-label\", ([i]) => AL[i]);\n if (F) applyAttr(selection, \"fill\", ([i]) => F[i]);\n if (FO) applyAttr(selection, \"fill-opacity\", ([i]) => FO[i]);\n if (S) applyAttr(selection, \"stroke\", ([i]) => S[i]);\n if (SO) applyAttr(selection, \"stroke-opacity\", ([i]) => SO[i]);\n if (SW) applyAttr(selection, \"stroke-width\", ([i]) => SW[i]);\n if (O) applyAttr(selection, \"opacity\", ([i]) => O[i]);\n if (H) applyHref(selection, ([i]) => H[i], target);\n if (!tip) applyTitleGroup(selection, T);\n}\n\nfunction groupAesthetics(\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n },\n {tip}\n) {\n return [AL, tip ? undefined : T, F, FO, S, SO, SW, O, H].filter((c) => c !== undefined);\n}\n\nexport function groupZ(I, Z, z) {\n const G = group(I, (i) => Z[i]);\n if (z === undefined && G.size > (1 + I.length) >> 1) {\n warn(\n `Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null.`\n );\n }\n return G.values();\n}\n\nexport function* groupIndex(I, position, mark, channels) {\n const {z} = mark;\n const {z: Z} = channels; // group channel\n const A = groupAesthetics(channels, mark); // aesthetic channels\n const C = [...position, ...A]; // all channels\n\n // Group the current index by Z (if any).\n for (const G of Z ? groupZ(I, Z, z) : [I]) {\n let Ag; // the A-values (aesthetics) of the current group, if any\n let Gg; // the current group index (a subset of G, and I), if any\n out: for (const i of G) {\n // If any channel has an undefined value for this index, skip it.\n for (const c of C) {\n if (!defined(c[i])) {\n if (Gg) Gg.push(-1);\n continue out;\n }\n }\n\n // Otherwise, if this is a new group, record the aesthetics for this\n // group. Yield the current group and start a new one.\n if (Ag === undefined) {\n if (Gg) yield Gg;\n (Ag = A.map((c) => keyof(c[i]))), (Gg = [i]);\n continue;\n }\n\n // Otherwise, add the current index to the current group. Then, if any of\n // the aesthetics don\u2019t match the current group, yield the current group\n // and start a new group of the current index.\n Gg.push(i);\n for (let j = 0; j < A.length; ++j) {\n const k = keyof(A[j][i]);\n if (k !== Ag[j]) {\n yield Gg;\n (Ag = A.map((c) => keyof(c[i]))), (Gg = [i]);\n continue out;\n }\n }\n }\n\n // Yield the current group, if any.\n if (Gg) yield Gg;\n }\n}\n\n// Note: may mutate selection.node!\nfunction applyClip(selection, mark, dimensions, context) {\n let clipUrl;\n const {clip = context.clip} = mark;\n switch (clip) {\n case \"frame\": {\n const {width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions;\n const id = getClipId();\n clipUrl = `url(#${id})`;\n selection = create(\"svg:g\", context)\n .call((g) =>\n g\n .append(\"svg:clipPath\")\n .attr(\"id\", id)\n .append(\"rect\")\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop)\n .attr(\"width\", width - marginRight - marginLeft)\n .attr(\"height\", height - marginTop - marginBottom)\n )\n .each(function () {\n this.appendChild(selection.node());\n selection.node = () => this; // Note: mutation!\n });\n break;\n }\n case \"sphere\": {\n const {projection} = context;\n if (!projection) throw new Error(`the \"sphere\" clip option requires a projection`);\n const id = getClipId();\n clipUrl = `url(#${id})`;\n selection\n .append(\"clipPath\")\n .attr(\"id\", id)\n .append(\"path\")\n .attr(\"d\", geoPath(projection)({type: \"Sphere\"}));\n break;\n }\n }\n // Here we\u2019re careful to apply the ARIA attributes to the outer G element when\n // clipping is applied, and to apply the ARIA attributes before any other\n // attributes (for readability).\n applyAttr(selection, \"aria-label\", mark.ariaLabel);\n applyAttr(selection, \"aria-description\", mark.ariaDescription);\n applyAttr(selection, \"aria-hidden\", mark.ariaHidden);\n applyAttr(selection, \"clip-path\", clipUrl);\n}\n\n// Note: may mutate selection.node!\nexport function applyIndirectStyles(selection, mark, dimensions, context) {\n applyClip(selection, mark, dimensions, context);\n applyAttr(selection, \"fill\", mark.fill);\n applyAttr(selection, \"fill-opacity\", mark.fillOpacity);\n applyAttr(selection, \"stroke\", mark.stroke);\n applyAttr(selection, \"stroke-width\", mark.strokeWidth);\n applyAttr(selection, \"stroke-opacity\", mark.strokeOpacity);\n applyAttr(selection, \"stroke-linejoin\", mark.strokeLinejoin);\n applyAttr(selection, \"stroke-linecap\", mark.strokeLinecap);\n applyAttr(selection, \"stroke-miterlimit\", mark.strokeMiterlimit);\n applyAttr(selection, \"stroke-dasharray\", mark.strokeDasharray);\n applyAttr(selection, \"stroke-dashoffset\", mark.strokeDashoffset);\n applyAttr(selection, \"shape-rendering\", mark.shapeRendering);\n applyAttr(selection, \"filter\", mark.imageFilter);\n applyAttr(selection, \"paint-order\", mark.paintOrder);\n const {pointerEvents = context.pointerSticky === false ? \"none\" : undefined} = mark;\n applyAttr(selection, \"pointer-events\", pointerEvents);\n}\n\nexport function applyDirectStyles(selection, mark) {\n applyStyle(selection, \"mix-blend-mode\", mark.mixBlendMode);\n applyAttr(selection, \"opacity\", mark.opacity);\n}\n\nfunction applyHref(selection, href, target) {\n selection.each(function (i) {\n const h = href(i);\n if (h != null) {\n const a = this.ownerDocument.createElementNS(namespaces.svg, \"a\");\n a.setAttribute(\"fill\", \"inherit\");\n a.setAttributeNS(namespaces.xlink, \"href\", h);\n if (target != null) a.setAttribute(\"target\", target);\n this.parentNode.insertBefore(a, this).appendChild(this);\n }\n });\n}\n\nexport function applyAttr(selection, name, value) {\n if (value != null) selection.attr(name, value);\n}\n\nexport function applyStyle(selection, name, value) {\n if (value != null) selection.style(name, value);\n}\n\nexport function applyTransform(selection, mark, {x, y}, tx = offset, ty = offset) {\n tx += mark.dx;\n ty += mark.dy;\n if (x?.bandwidth) tx += x.bandwidth() / 2;\n if (y?.bandwidth) ty += y.bandwidth() / 2;\n if (tx || ty) selection.attr(\"transform\", `translate(${tx},${ty})`);\n}\n\nexport function impliedString(value, impliedValue) {\n if ((value = string(value)) !== impliedValue) return value;\n}\n\nexport function impliedNumber(value, impliedValue) {\n if ((value = number(value)) !== impliedValue) return value;\n}\n\n// https://www.w3.org/TR/CSS21/grammar.html\nconst validClassName =\n /^-?([_a-z]|[\\240-\\377]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\240-\\377]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*$/i;\n\nexport function maybeClassName(name) {\n // The default should be changed whenever the default styles are changed, so\n // as to avoid conflict when multiple versions of Plot are on the page.\n if (name === undefined) return \"plot-d6a7b5\";\n name = `${name}`;\n if (!validClassName.test(name)) throw new Error(`invalid class name: ${name}`);\n return name;\n}\n\nexport function applyInlineStyles(selection, style) {\n if (typeof style === \"string\") {\n selection.property(\"style\", style);\n } else if (style != null) {\n for (const element of selection) {\n Object.assign(element.style, style);\n }\n }\n}\n\nexport function applyFrameAnchor({frameAnchor}, {width, height, marginTop, marginRight, marginBottom, marginLeft}) {\n return [\n /left$/.test(frameAnchor)\n ? marginLeft\n : /right$/.test(frameAnchor)\n ? width - marginRight\n : (marginLeft + width - marginRight) / 2,\n /^top/.test(frameAnchor)\n ? marginTop\n : /^bottom/.test(frameAnchor)\n ? height - marginBottom\n : (marginTop + height - marginBottom) / 2\n ];\n}\n", "import {extent} from \"d3\";\nimport {projectionAspectRatio} from \"./projection.js\";\nimport {isOrdinalScale} from \"./scales.js\";\nimport {offset} from \"./style.js\";\n\nexport function createDimensions(scales, marks, options = {}) {\n // Compute the default margins: the maximum of the marks\u2019 margins. While not\n // always used, they may be needed to compute the default height of the plot.\n let marginTopDefault = 0.5 - offset,\n marginRightDefault = 0.5 + offset,\n marginBottomDefault = 0.5 + offset,\n marginLeftDefault = 0.5 - offset;\n\n for (const {marginTop, marginRight, marginBottom, marginLeft} of marks) {\n if (marginTop > marginTopDefault) marginTopDefault = marginTop;\n if (marginRight > marginRightDefault) marginRightDefault = marginRight;\n if (marginBottom > marginBottomDefault) marginBottomDefault = marginBottom;\n if (marginLeft > marginLeftDefault) marginLeftDefault = marginLeft;\n }\n\n // Compute the actual margins. The order of precedence is: the side-specific\n // margin options, then the global margin option, then the defaults.\n let {\n margin,\n marginTop = margin !== undefined ? margin : marginTopDefault,\n marginRight = margin !== undefined ? margin : marginRightDefault,\n marginBottom = margin !== undefined ? margin : marginBottomDefault,\n marginLeft = margin !== undefined ? margin : marginLeftDefault\n } = options;\n\n // Coerce the margin options to numbers.\n marginTop = +marginTop;\n marginRight = +marginRight;\n marginBottom = +marginBottom;\n marginLeft = +marginLeft;\n\n // Compute the outer dimensions of the plot. If the top and bottom margins are\n // specified explicitly, adjust the automatic height accordingly.\n let {\n width = 640,\n height = autoHeight(scales, options, {\n width,\n marginTopDefault,\n marginRightDefault,\n marginBottomDefault,\n marginLeftDefault\n }) + Math.max(0, marginTop - marginTopDefault + marginBottom - marginBottomDefault)\n } = options;\n\n // Coerce the width and height.\n width = +width;\n height = +height;\n\n const dimensions = {\n width,\n height,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft\n };\n\n // Compute the facet margins.\n if (scales.fx || scales.fy) {\n let {\n margin: facetMargin,\n marginTop: facetMarginTop = facetMargin !== undefined ? facetMargin : marginTop,\n marginRight: facetMarginRight = facetMargin !== undefined ? facetMargin : marginRight,\n marginBottom: facetMarginBottom = facetMargin !== undefined ? facetMargin : marginBottom,\n marginLeft: facetMarginLeft = facetMargin !== undefined ? facetMargin : marginLeft\n } = options.facet ?? {};\n\n // Coerce the facet margin options to numbers.\n facetMarginTop = +facetMarginTop;\n facetMarginRight = +facetMarginRight;\n facetMarginBottom = +facetMarginBottom;\n facetMarginLeft = +facetMarginLeft;\n\n dimensions.facet = {\n marginTop: facetMarginTop,\n marginRight: facetMarginRight,\n marginBottom: facetMarginBottom,\n marginLeft: facetMarginLeft\n };\n }\n\n return dimensions;\n}\n\nfunction autoHeight(\n {x, y, fy, fx},\n {projection, aspectRatio},\n {width, marginTopDefault, marginRightDefault, marginBottomDefault, marginLeftDefault}\n) {\n const nfy = fy ? fy.scale.domain().length : 1;\n\n // If a projection is specified, use its natural aspect ratio (if known).\n const ar = projectionAspectRatio(projection);\n if (ar) {\n const nfx = fx ? fx.scale.domain().length : 1;\n const far = ((1.1 * nfy - 0.1) / (1.1 * nfx - 0.1)) * ar; // 0.1 is default facet padding\n const lar = Math.max(0.1, Math.min(10, far)); // clamp the aspect ratio to a \u201Creasonable\u201D value\n return Math.round((width - marginLeftDefault - marginRightDefault) * lar + marginTopDefault + marginBottomDefault);\n }\n\n const ny = y ? (isOrdinalScale(y) ? y.scale.domain().length : Math.max(7, 17 / nfy)) : 1;\n\n // If a desired aspect ratio is given, compute a default height to match.\n if (aspectRatio != null) {\n aspectRatio = +aspectRatio;\n if (!(isFinite(aspectRatio) && aspectRatio > 0)) throw new Error(`invalid aspectRatio: ${aspectRatio}`);\n const ratio = aspectRatioLength(\"y\", y) / (aspectRatioLength(\"x\", x) * aspectRatio);\n const fxb = fx ? fx.scale.bandwidth() : 1;\n const fyb = fy ? fy.scale.bandwidth() : 1;\n const w = fxb * (width - marginLeftDefault - marginRightDefault) - x.insetLeft - x.insetRight;\n return (ratio * w + y.insetTop + y.insetBottom) / fyb + marginTopDefault + marginBottomDefault;\n }\n\n return !!(y || fy) * Math.max(1, Math.min(60, ny * nfy)) * 20 + !!fx * 30 + 60;\n}\n\nfunction aspectRatioLength(k, scale) {\n if (!scale) throw new Error(`aspectRatio requires ${k} scale`);\n const {type, domain} = scale;\n let transform;\n switch (type) {\n case \"linear\":\n case \"utc\":\n case \"time\":\n transform = Number;\n break;\n case \"pow\": {\n const exponent = scale.scale.exponent();\n transform = (x) => Math.pow(x, exponent);\n break;\n }\n case \"log\":\n transform = Math.log;\n break;\n case \"point\":\n case \"band\":\n return domain.length;\n default:\n throw new Error(`unsupported ${k} scale for aspectRatio: ${type}`);\n }\n const [min, max] = extent(domain);\n return Math.abs(transform(max) - transform(min));\n}\n", "import {InternMap, cross, rollup, sum} from \"d3\";\nimport {keyof, map, range} from \"./options.js\";\nimport {createScales} from \"./scales.js\";\n\n// Returns an array of {x?, y?, i} objects representing the facet domain.\nexport function createFacets(channelsByScale, options) {\n const {fx, fy} = createScales(channelsByScale, options);\n const fxDomain = fx?.scale.domain();\n const fyDomain = fy?.scale.domain();\n return fxDomain && fyDomain\n ? cross(fxDomain, fyDomain).map(([x, y], i) => ({x, y, i}))\n : fxDomain\n ? fxDomain.map((x, i) => ({x, i}))\n : fyDomain\n ? fyDomain.map((y, i) => ({y, i}))\n : undefined;\n}\n\nexport function recreateFacets(facets, {x: X, y: Y}) {\n X &&= facetIndex(X);\n Y &&= facetIndex(Y);\n return facets\n .filter(\n X && Y // remove any facets no longer present in the domain\n ? (f) => X.has(f.x) && Y.has(f.y)\n : X\n ? (f) => X.has(f.x)\n : (f) => Y.has(f.y)\n )\n .sort(\n X && Y // reorder facets to match the new scale domains\n ? (a, b) => X.get(a.x) - X.get(b.x) || Y.get(a.y) - Y.get(b.y)\n : X\n ? (a, b) => X.get(a.x) - X.get(b.x)\n : (a, b) => Y.get(a.y) - Y.get(b.y)\n );\n}\n\n// Returns a (possibly nested) Map of [[key1, index1], [key2, index2], \u2026]\n// representing the data indexes associated with each facet.\nexport function facetGroups(data, {fx, fy}) {\n const I = range(data);\n const FX = fx?.value;\n const FY = fy?.value;\n return fx && fy\n ? rollup(\n I,\n (G) => ((G.fx = FX[G[0]]), (G.fy = FY[G[0]]), G),\n (i) => FX[i],\n (i) => FY[i]\n )\n : fx\n ? rollup(\n I,\n (G) => ((G.fx = FX[G[0]]), G),\n (i) => FX[i]\n )\n : rollup(\n I,\n (G) => ((G.fy = FY[G[0]]), G),\n (i) => FY[i]\n );\n}\n\nexport function facetTranslator(fx, fy, {marginTop, marginLeft}) {\n return fx && fy\n ? ({x, y}) => `translate(${fx(x) - marginLeft},${fy(y) - marginTop})`\n : fx\n ? ({x}) => `translate(${fx(x) - marginLeft},0)`\n : ({y}) => `translate(0,${fy(y) - marginTop})`;\n}\n\n// Returns an index that for each facet lists all the elements present in other\n// facets in the original index. TODO Memoize to avoid repeated work?\nexport function facetExclude(index) {\n const ex = [];\n const e = new Uint32Array(sum(index, (d) => d.length));\n for (const i of index) {\n let n = 0;\n for (const j of index) {\n if (i === j) continue;\n e.set(j, n);\n n += j.length;\n }\n ex.push(e.slice(0, n));\n }\n return ex;\n}\n\nconst facetAnchors = new Map([\n [\"top\", facetAnchorTop],\n [\"right\", facetAnchorRight],\n [\"bottom\", facetAnchorBottom],\n [\"left\", facetAnchorLeft],\n [\"top-left\", and(facetAnchorTop, facetAnchorLeft)],\n [\"top-right\", and(facetAnchorTop, facetAnchorRight)],\n [\"bottom-left\", and(facetAnchorBottom, facetAnchorLeft)],\n [\"bottom-right\", and(facetAnchorBottom, facetAnchorRight)],\n [\"top-empty\", facetAnchorTopEmpty],\n [\"right-empty\", facetAnchorRightEmpty],\n [\"bottom-empty\", facetAnchorBottomEmpty],\n [\"left-empty\", facetAnchorLeftEmpty],\n [\"empty\", facetAnchorEmpty]\n]);\n\nexport function maybeFacetAnchor(facetAnchor) {\n if (facetAnchor == null) return null;\n const anchor = facetAnchors.get(`${facetAnchor}`.toLowerCase());\n if (anchor) return anchor;\n throw new Error(`invalid facet anchor: ${facetAnchor}`);\n}\n\nconst indexCache = new WeakMap();\n\nfunction facetIndex(V) {\n let I = indexCache.get(V);\n if (!I) indexCache.set(V, (I = new InternMap(map(V, (v, i) => [v, i]))));\n return I;\n}\n\n// Like V.indexOf(v), but with the same semantics as InternMap.\nfunction facetIndexOf(V, v) {\n return facetIndex(V).get(v);\n}\n\n// Like facets.find, but with the same semantics as InternMap.\nfunction facetFind(facets, x, y) {\n x = keyof(x);\n y = keyof(y);\n return facets.find((f) => Object.is(keyof(f.x), x) && Object.is(keyof(f.y), y));\n}\n\nfunction facetEmpty(facets, x, y) {\n return facetFind(facets, x, y)?.empty;\n}\n\nfunction facetAnchorTop(facets, {y: Y}, {y}) {\n return Y ? facetIndexOf(Y, y) === 0 : true;\n}\n\nfunction facetAnchorBottom(facets, {y: Y}, {y}) {\n return Y ? facetIndexOf(Y, y) === Y.length - 1 : true;\n}\n\nfunction facetAnchorLeft(facets, {x: X}, {x}) {\n return X ? facetIndexOf(X, x) === 0 : true;\n}\n\nfunction facetAnchorRight(facets, {x: X}, {x}) {\n return X ? facetIndexOf(X, x) === X.length - 1 : true;\n}\n\nfunction facetAnchorTopEmpty(facets, {y: Y}, {x, y, empty}) {\n if (empty) return false;\n if (!Y) return;\n const i = facetIndexOf(Y, y);\n if (i > 0) return facetEmpty(facets, x, Y[i - 1]);\n}\n\nfunction facetAnchorBottomEmpty(facets, {y: Y}, {x, y, empty}) {\n if (empty) return false;\n if (!Y) return;\n const i = facetIndexOf(Y, y);\n if (i < Y.length - 1) return facetEmpty(facets, x, Y[i + 1]);\n}\n\nfunction facetAnchorLeftEmpty(facets, {x: X}, {x, y, empty}) {\n if (empty) return false;\n if (!X) return;\n const i = facetIndexOf(X, x);\n if (i > 0) return facetEmpty(facets, X[i - 1], y);\n}\n\nfunction facetAnchorRightEmpty(facets, {x: X}, {x, y, empty}) {\n if (empty) return false;\n if (!X) return;\n const i = facetIndexOf(X, x);\n if (i < X.length - 1) return facetEmpty(facets, X[i + 1], y);\n}\n\nfunction facetAnchorEmpty(facets, channels, {empty}) {\n return empty;\n}\n\nfunction and(a, b) {\n return function () {\n return a.apply(null, arguments) && b.apply(null, arguments);\n };\n}\n\n// Facet filter, by mark; for now only the \"eq\" filter is provided.\nexport function facetFilter(facets, {channels: {fx, fy}, groups}) {\n return fx && fy\n ? facets.map(({x, y}) => groups.get(x)?.get(y) ?? [])\n : fx\n ? facets.map(({x}) => groups.get(x) ?? [])\n : facets.map(({y}) => groups.get(y) ?? []);\n}\n", "import {channelDomain, createChannels, valueObject} from \"./channel.js\";\nimport {defined} from \"./defined.js\";\nimport {maybeFacetAnchor} from \"./facet.js\";\nimport {maybeClip, maybeNamed, maybeValue} from \"./options.js\";\nimport {arrayify, isDomainSort, isObject, isOptions, keyword, range, singleton} from \"./options.js\";\nimport {project} from \"./projection.js\";\nimport {styles} from \"./style.js\";\nimport {basic, initializer} from \"./transforms/basic.js\";\n\nexport class Mark {\n constructor(data, channels = {}, options = {}, defaults) {\n const {\n facet = \"auto\",\n facetAnchor,\n fx,\n fy,\n sort,\n dx = 0,\n dy = 0,\n margin = 0,\n marginTop = margin,\n marginRight = margin,\n marginBottom = margin,\n marginLeft = margin,\n clip = defaults?.clip,\n channels: extraChannels,\n tip,\n render\n } = options;\n this.data = data;\n this.sort = isDomainSort(sort) ? sort : null;\n this.initializer = initializer(options).initializer;\n this.transform = this.initializer ? options.transform : basic(options).transform;\n if (facet === null || facet === false) {\n this.facet = null;\n } else {\n this.facet = keyword(facet === true ? \"include\" : facet, \"facet\", [\"auto\", \"include\", \"exclude\", \"super\"]);\n this.fx = data === singleton && typeof fx === \"string\" ? [fx] : fx;\n this.fy = data === singleton && typeof fy === \"string\" ? [fy] : fy;\n }\n this.facetAnchor = maybeFacetAnchor(facetAnchor);\n channels = maybeNamed(channels);\n if (extraChannels !== undefined) channels = {...maybeChannels(extraChannels), ...channels};\n if (defaults !== undefined) channels = {...styles(this, options, defaults), ...channels};\n this.channels = Object.fromEntries(\n Object.entries(channels)\n .map(([name, channel]) => {\n if (isOptions(channel.value)) {\n // apply scale and label overrides\n const {value, label = channel.label, scale = channel.scale} = channel.value;\n channel = {...channel, label, scale, value};\n }\n if (data === singleton && typeof channel.value === \"string\") {\n // convert field names to singleton values for decoration marks (e.g., frame)\n const {value} = channel;\n channel = {...channel, value: [value]};\n }\n return [name, channel];\n })\n .filter(([name, {value, optional}]) => {\n if (value != null) return true;\n if (optional) return false;\n throw new Error(`missing channel value: ${name}`);\n })\n );\n this.dx = +dx;\n this.dy = +dy;\n this.marginTop = +marginTop;\n this.marginRight = +marginRight;\n this.marginBottom = +marginBottom;\n this.marginLeft = +marginLeft;\n this.clip = maybeClip(clip);\n this.tip = maybeTip(tip);\n // Super-faceting currently disallow position channels; in the future, we\n // could allow position to be specified in fx and fy in addition to (or\n // instead of) x and y.\n if (this.facet === \"super\") {\n if (fx || fy) throw new Error(`super-faceting cannot use fx or fy`);\n for (const name in this.channels) {\n const {scale} = channels[name];\n if (scale !== \"x\" && scale !== \"y\") continue;\n throw new Error(`super-faceting cannot use x or y`);\n }\n }\n if (render != null) {\n this.render = composeRender(render, this.render);\n }\n }\n initialize(facets, facetChannels, plotOptions) {\n let data = arrayify(this.data);\n if (facets === undefined && data != null) facets = [range(data)];\n const originalFacets = facets;\n if (this.transform != null) ({facets, data} = this.transform(data, facets, plotOptions)), (data = arrayify(data));\n if (facets !== undefined) facets.original = originalFacets; // needed to read facetChannels\n const channels = createChannels(this.channels, data);\n if (this.sort != null) channelDomain(data, facets, channels, facetChannels, this.sort); // mutates facetChannels!\n return {data, facets, channels};\n }\n filter(index, channels, values) {\n for (const name in channels) {\n const {filter = defined} = channels[name];\n if (filter !== null) {\n const value = values[name];\n index = index.filter((i) => filter(value[i]));\n }\n }\n return index;\n }\n // If there is a projection, and there are paired x and y channels associated\n // with the x and y scale respectively (and not already in screen coordinates\n // as with an initializer), then apply the projection, replacing the x and y\n // values. Note that the x and y scales themselves don\u2019t exist if there is a\n // projection, but whether the channels are associated with scales still\n // determines whether the projection should apply; think of the projection as\n // a combination xy-scale.\n project(channels, values, context) {\n for (const cx in channels) {\n if (channels[cx].scale === \"x\" && /^x|x$/.test(cx)) {\n const cy = cx.replace(/^x|x$/, \"y\");\n if (cy in channels && channels[cy].scale === \"y\") {\n project(cx, cy, values, context.projection);\n }\n }\n }\n }\n scale(channels, scales, context) {\n const values = valueObject(channels, scales);\n if (context.projection) this.project(channels, values, context);\n return values;\n }\n}\n\nexport function marks(...marks) {\n marks.plot = Mark.prototype.plot; // Note: depends on side-effect in plot!\n return marks;\n}\n\nexport function composeRender(r1, r2) {\n if (r1 == null) return r2 === null ? undefined : r2;\n if (r2 == null) return r1 === null ? undefined : r1;\n if (typeof r1 !== \"function\") throw new TypeError(`invalid render transform: ${r1}`);\n if (typeof r2 !== \"function\") throw new TypeError(`invalid render transform: ${r2}`);\n return function (i, s, v, d, c, next) {\n return r1.call(this, i, s, v, d, c, (i, s, v, d, c) => {\n return r2.call(this, i, s, v, d, c, next); // preserve this\n });\n };\n}\n\nfunction maybeChannels(channels) {\n return Object.fromEntries(\n Object.entries(maybeNamed(channels)).map(([name, channel]) => {\n channel = typeof channel === \"string\" ? {value: channel, label: name} : maybeValue(channel); // for shorthand extra channels, use name as label\n if (channel.filter === undefined && channel.scale == null) channel = {...channel, filter: null};\n return [name, channel];\n })\n );\n}\n\nfunction maybeTip(tip) {\n return tip === true\n ? \"xy\"\n : tip === false || tip == null\n ? null\n : typeof tip === \"string\"\n ? keyword(tip, \"tip\", [\"x\", \"y\", \"xy\"])\n : tip; // tip options object\n}\n\nexport function withTip(options, pointer) {\n return options?.tip === true\n ? {...options, tip: pointer}\n : isObject(options?.tip) && options.tip.pointer === undefined\n ? {...options, tip: {...options.tip, pointer}}\n : options;\n}\n", "import {pointer as pointof} from \"d3\";\nimport {composeRender} from \"../mark.js\";\nimport {applyFrameAnchor} from \"../style.js\";\n\nconst states = new WeakMap();\n\nfunction pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...options} = {}) {\n maxRadius = +maxRadius;\n // When px or py is used, register an extra channel that the pointer\n // interaction can use to control which point is focused; this allows pointing\n // to function independently of where the downstream mark (e.g., a tip) is\n // displayed. Also default x or y to null to disable maybeTuple etc.\n if (px != null) (x ??= null), (channels = {...channels, px: {value: px, scale: \"x\"}});\n if (py != null) (y ??= null), (channels = {...channels, py: {value: py, scale: \"y\"}});\n return {\n x,\n y,\n channels,\n ...options,\n // Unlike other composed transforms, the render transform must be the\n // outermost render function because it will re-render dynamically in\n // response to pointer events.\n render: composeRender(function (index, scales, values, dimensions, context, next) {\n context = {...context, pointerSticky: false};\n const svg = context.ownerSVGElement;\n const {data} = context.getMarkState(this);\n\n // Isolate state per-pointer, per-plot; if the pointer is reused by\n // multiple marks, they will share the same state (e.g., sticky modality).\n let state = states.get(svg);\n if (!state) states.set(svg, (state = {sticky: false, roots: [], renders: []}));\n\n // This serves as a unique identifier of the rendered mark per-plot; it is\n // used to record the currently-rendered elements (state.roots) so that we\n // can tell when a rendered element is clicked on.\n let renderIndex = state.renders.push(render) - 1;\n\n // For faceting, we want to compute the local coordinates of each point,\n // which means subtracting out the facet translation, if any. (It\u2019s\n // tempting to do this using the local coordinates in SVG, but that\u2019s\n // complicated by mark-specific transforms such as dx and dy.) Also, since\n // band scales return the upper bound of the band, we have to offset by\n // half the bandwidth.\n const {x, y, fx, fy} = scales;\n let tx = fx ? fx(index.fx) - dimensions.marginLeft : 0;\n let ty = fy ? fy(index.fy) - dimensions.marginTop : 0;\n if (x?.bandwidth) tx += x.bandwidth() / 2;\n if (y?.bandwidth) ty += y.bandwidth() / 2;\n\n // For faceting, we also need to record the closest point per facet per\n // mark (!), since each facet has its own pointer event listeners; we only\n // want the closest point across facets to be visible.\n const faceted = index.fi != null;\n let facetState;\n if (faceted) {\n let facetStates = state.facetStates;\n if (!facetStates) state.facetStates = facetStates = new Map();\n facetState = facetStates.get(this);\n if (!facetState) facetStates.set(this, (facetState = new Map()));\n }\n\n // The order of precedence for the pointer position is: px & py; the\n // middle of x1 & y1 and x2 & y2; or x1 & y1 (e.g., area); or lastly x &\n // y. If a dimension is unspecified, the frame anchor is used.\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n const {px: PX, py: PY} = values;\n const px = PX ? (i) => PX[i] : anchorX(values, cx);\n const py = PY ? (i) => PY[i] : anchorY(values, cy);\n\n let i; // currently focused index\n let g; // currently rendered mark\n let s; // currently rendered stickiness\n let f; // current animation frame\n\n // When faceting, if more than one pointer would be visible, only show\n // this one if it is the closest. We defer rendering using an animation\n // frame to allow all pointer events to be received before deciding which\n // mark to render; although when hiding, we render immediately.\n function update(ii, ri) {\n if (faceted) {\n if (f) f = cancelAnimationFrame(f);\n if (ii == null) facetState.delete(index.fi);\n else {\n facetState.set(index.fi, ri);\n f = requestAnimationFrame(() => {\n f = null;\n for (const [fi, r] of facetState) {\n if (r < ri || (r === ri && fi < index.fi)) {\n ii = null;\n break;\n }\n }\n render(ii);\n });\n return;\n }\n }\n render(ii);\n }\n\n function render(ii) {\n if (i === ii && s === state.sticky) return; // the tooltip hasn\u2019t moved\n i = ii;\n s = context.pointerSticky = state.sticky;\n const I = i == null ? [] : [i];\n if (faceted) (I.fx = index.fx), (I.fy = index.fy), (I.fi = index.fi);\n const r = next(I, scales, values, dimensions, context);\n if (g) {\n // When faceting, preserve swapped mark and facet transforms; also\n // remove ARIA attributes since these are promoted to the parent. This\n // is perhaps brittle in that it depends on how Plot renders facets,\n // but it produces a cleaner and more accessible SVG structure.\n if (faceted) {\n const p = g.parentNode;\n const ft = g.getAttribute(\"transform\");\n const mt = r.getAttribute(\"transform\");\n ft ? r.setAttribute(\"transform\", ft) : r.removeAttribute(\"transform\");\n mt ? p.setAttribute(\"transform\", mt) : p.removeAttribute(\"transform\");\n r.removeAttribute(\"aria-label\");\n r.removeAttribute(\"aria-description\");\n r.removeAttribute(\"aria-hidden\");\n }\n g.replaceWith(r);\n }\n state.roots[renderIndex] = g = r;\n\n // Dispatch the value. When simultaneously exiting this facet and\n // entering a new one, prioritize the entering facet.\n if (!(i == null && facetState?.size > 1)) context.dispatchValue(i == null ? null : data[i]);\n return r;\n }\n\n // Select the closest point to the mouse in the current facet; for\n // pointerX or pointerY, the orthogonal component of the distance is\n // squashed, selecting primarily on the dominant dimension. Across facets,\n // use unsquashed distance to determine the winner.\n function pointermove(event) {\n if (state.sticky || (event.pointerType === \"mouse\" && event.buttons === 1)) return; // dragging\n let [xp, yp] = pointof(event);\n (xp -= tx), (yp -= ty); // correct for facets and band scales\n const kpx = xp < dimensions.marginLeft || xp > dimensions.width - dimensions.marginRight ? 1 : kx;\n const kpy = yp < dimensions.marginTop || yp > dimensions.height - dimensions.marginBottom ? 1 : ky;\n let ii = null;\n let ri = maxRadius * maxRadius;\n for (const j of index) {\n const dx = kpx * (px(j) - xp);\n const dy = kpy * (py(j) - yp);\n const rj = dx * dx + dy * dy;\n if (rj <= ri) (ii = j), (ri = rj);\n }\n if (ii != null && (kx !== 1 || ky !== 1)) {\n const dx = px(ii) - xp;\n const dy = py(ii) - yp;\n ri = dx * dx + dy * dy;\n }\n update(ii, ri);\n }\n\n function pointerdown(event) {\n if (event.pointerType !== \"mouse\") return;\n if (i == null) return; // not pointing\n if (state.sticky && state.roots.some((r) => r?.contains(event.target))) return; // stay sticky\n if (state.sticky) (state.sticky = false), state.renders.forEach((r) => r(null)); // clear all pointers\n else (state.sticky = true), render(i);\n event.stopImmediatePropagation(); // suppress other pointers\n }\n\n function pointerleave(event) {\n if (event.pointerType !== \"mouse\") return;\n if (!state.sticky) update(null);\n }\n\n // We listen to the svg element; listening to the window instead would let\n // us receive pointer events from farther away, but would also make it\n // hard to know when to remove the listeners. (Using a mutation observer\n // to watch the entire document is likely too expensive.)\n svg.addEventListener(\"pointerenter\", pointermove);\n svg.addEventListener(\"pointermove\", pointermove);\n svg.addEventListener(\"pointerdown\", pointerdown);\n svg.addEventListener(\"pointerleave\", pointerleave);\n\n return render(null);\n }, render)\n };\n}\n\nexport function pointer(options) {\n return pointerK(1, 1, options);\n}\n\nexport function pointerX(options) {\n return pointerK(1, 0.01, options);\n}\n\nexport function pointerY(options) {\n return pointerK(0.01, 1, options);\n}\n\nexport function anchorX({x1: X1, x2: X2, x: X = X1}, cx) {\n return X1 && X2 ? (i) => (X1[i] + X2[i]) / 2 : X ? (i) => X[i] : () => cx;\n}\n\nexport function anchorY({y1: Y1, y2: Y2, y: Y = Y1}, cy) {\n return Y1 && Y2 ? (i) => (Y1[i] + Y2[i]) / 2 : Y ? (i) => Y[i] : () => cy;\n}\n", "import {isOrdinalScale} from \"./scales.js\";\n\nexport function inferFontVariant(scale) {\n return isOrdinalScale(scale) && scale.interval === undefined ? undefined : \"tabular-nums\";\n}\n", "import {quantize, interpolateNumber, piecewise, format, scaleBand, scaleLinear, axisBottom} from \"d3\";\nimport {inferFontVariant} from \"../axes.js\";\nimport {createContext, create} from \"../context.js\";\nimport {map, maybeNumberChannel} from \"../options.js\";\nimport {interpolatePiecewise} from \"../scales/quantitative.js\";\nimport {applyInlineStyles, impliedString, maybeClassName} from \"../style.js\";\n\nexport function legendRamp(color, options) {\n let {\n label = color.label,\n tickSize = 6,\n width = 240,\n height = 44 + tickSize,\n marginTop = 18,\n marginRight = 0,\n marginBottom = 16 + tickSize,\n marginLeft = 0,\n style,\n ticks = (width - marginLeft - marginRight) / 64,\n tickFormat,\n fontVariant = inferFontVariant(color),\n round = true,\n opacity,\n className\n } = options;\n const context = createContext(options);\n className = maybeClassName(className);\n opacity = maybeNumberChannel(opacity)[1];\n if (tickFormat === null) tickFormat = () => null;\n\n const svg = create(\"svg\", context)\n .attr(\"class\", `${className}-ramp`)\n .attr(\"font-family\", \"system-ui, sans-serif\")\n .attr(\"font-size\", 10)\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"viewBox\", `0 0 ${width} ${height}`)\n .call((svg) =>\n // Warning: if you edit this, change defaultClassName.\n svg.append(\"style\").text(\n `:where(.${className}-ramp) {\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n overflow: visible;\n}\n:where(.${className}-ramp text) {\n white-space: pre;\n}`\n )\n )\n .call(applyInlineStyles, style);\n\n let tickAdjust = (g) => g.selectAll(\".tick line\").attr(\"y1\", marginTop + marginBottom - height);\n\n let x;\n\n // Some D3 scales use scale.interpolate, some scale.interpolator, and some\n // scale.round; this normalizes the API so it works with all scale types.\n const applyRange = round ? (x, range) => x.rangeRound(range) : (x, range) => x.range(range);\n\n const {type, domain, range, interpolate, scale, pivot} = color;\n\n // Continuous\n if (interpolate) {\n // Often interpolate is a \u201Cfixed\u201D interpolator on the [0, 1] interval, as\n // with a built-in color scheme, but sometimes it is a function that takes\n // two arguments and is used in conjunction with the range.\n const interpolator =\n range === undefined\n ? interpolate\n : piecewise(interpolate.length === 1 ? interpolatePiecewise(interpolate) : interpolate, range);\n\n // Construct a D3 scale of the same type, but with a range that evenly\n // divides the horizontal extent of the legend. (In the common case, the\n // domain.length is two, and so the range is simply the extent.) For a\n // diverging scale, we need an extra point in the range for the pivot such\n // that the pivot is always drawn in the middle.\n x = applyRange(\n scale.copy(),\n quantize(\n interpolateNumber(marginLeft, width - marginRight),\n Math.min(domain.length + (pivot !== undefined), range === undefined ? Infinity : range.length)\n )\n );\n\n // Construct a 256\u00D71 canvas, filling each pixel using the interpolator.\n const n = 256;\n const canvas = context.document.createElement(\"canvas\");\n canvas.width = n;\n canvas.height = 1;\n const context2 = canvas.getContext(\"2d\");\n for (let i = 0, j = n - 1; i < n; ++i) {\n context2.fillStyle = interpolator(i / j);\n context2.fillRect(i, 0, 1, 1);\n }\n\n svg\n .append(\"image\")\n .attr(\"opacity\", opacity)\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop)\n .attr(\"width\", width - marginLeft - marginRight)\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"preserveAspectRatio\", \"none\")\n .attr(\"xlink:href\", canvas.toDataURL());\n }\n\n // Threshold\n else if (type === \"threshold\") {\n const thresholds = domain;\n\n const thresholdFormat =\n tickFormat === undefined ? (d) => d : typeof tickFormat === \"string\" ? format(tickFormat) : tickFormat;\n\n // Construct a linear scale with evenly-spaced ticks for each of the\n // thresholds; the domain extends one beyond the threshold extent.\n x = applyRange(scaleLinear().domain([-1, range.length - 1]), [marginLeft, width - marginRight]);\n\n svg\n .append(\"g\")\n .attr(\"fill-opacity\", opacity)\n .selectAll()\n .data(range)\n .enter()\n .append(\"rect\")\n .attr(\"x\", (d, i) => x(i - 1))\n .attr(\"y\", marginTop)\n .attr(\"width\", (d, i) => x(i) - x(i - 1))\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"fill\", (d) => d);\n\n ticks = map(thresholds, (_, i) => i);\n tickFormat = (i) => thresholdFormat(thresholds[i], i);\n }\n\n // Ordinal (hopefully!)\n else {\n x = applyRange(scaleBand().domain(domain), [marginLeft, width - marginRight]);\n\n svg\n .append(\"g\")\n .attr(\"fill-opacity\", opacity)\n .selectAll()\n .data(domain)\n .enter()\n .append(\"rect\")\n .attr(\"x\", x)\n .attr(\"y\", marginTop)\n .attr(\"width\", Math.max(0, x.bandwidth() - 1))\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"fill\", scale);\n\n tickAdjust = () => {};\n }\n\n svg\n .append(\"g\")\n .attr(\"transform\", `translate(0,${height - marginBottom})`)\n .call(\n axisBottom(x)\n .ticks(Array.isArray(ticks) ? null : ticks, typeof tickFormat === \"string\" ? tickFormat : undefined)\n .tickFormat(typeof tickFormat === \"function\" ? tickFormat : undefined)\n .tickSize(tickSize)\n .tickValues(Array.isArray(ticks) ? ticks : null)\n )\n .attr(\"font-size\", null)\n .attr(\"font-family\", null)\n .attr(\"font-variant\", impliedString(fontVariant, \"normal\"))\n .call(tickAdjust)\n .call((g) => g.select(\".domain\").remove());\n\n if (label !== undefined) {\n svg\n .append(\"text\")\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop - 6)\n .attr(\"fill\", \"currentColor\") // TODO move to stylesheet?\n .attr(\"font-weight\", \"bold\")\n .text(label);\n }\n\n return svg.node();\n}\n", "export const radians = Math.PI / 180;\n", "import {create} from \"./context.js\";\n\nexport function markers(mark, {marker, markerStart = marker, markerMid = marker, markerEnd = marker} = {}) {\n mark.markerStart = maybeMarker(markerStart);\n mark.markerMid = maybeMarker(markerMid);\n mark.markerEnd = maybeMarker(markerEnd);\n}\n\nfunction maybeMarker(marker) {\n if (marker == null || marker === false) return null;\n if (marker === true) return markerCircleFill;\n if (typeof marker === \"function\") return marker;\n switch (`${marker}`.toLowerCase()) {\n case \"none\":\n return null;\n case \"arrow\":\n return markerArrow(\"auto\");\n case \"arrow-reverse\":\n return markerArrow(\"auto-start-reverse\");\n case \"dot\":\n return markerDot;\n case \"circle\":\n case \"circle-fill\":\n return markerCircleFill;\n case \"circle-stroke\":\n return markerCircleStroke;\n case \"tick\":\n return markerTick(\"auto\");\n case \"tick-x\":\n return markerTick(90);\n case \"tick-y\":\n return markerTick(0);\n }\n throw new Error(`invalid marker: ${marker}`);\n}\n\nfunction markerArrow(orient) {\n return (color, context) =>\n create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"orient\", orient)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", 1.5)\n .attr(\"stroke-linecap\", \"round\")\n .attr(\"stroke-linejoin\", \"round\")\n .call((marker) => marker.append(\"path\").attr(\"d\", \"M-1.5,-3l3,3l-3,3\"))\n .node();\n}\n\nfunction markerDot(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", color)\n .attr(\"stroke\", \"none\")\n .call((marker) => marker.append(\"circle\").attr(\"r\", 2.5))\n .node();\n}\n\nfunction markerCircleFill(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", color)\n .attr(\"stroke\", \"var(--plot-background)\")\n .attr(\"stroke-width\", 1.5)\n .call((marker) => marker.append(\"circle\").attr(\"r\", 3))\n .node();\n}\n\nfunction markerCircleStroke(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", \"var(--plot-background)\")\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", 1.5)\n .call((marker) => marker.append(\"circle\").attr(\"r\", 3))\n .node();\n}\n\nfunction markerTick(orient) {\n return (color, context) =>\n create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-3 -3 6 6\")\n .attr(\"markerWidth\", 6)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", orient)\n .attr(\"stroke\", color)\n .call((marker) => marker.append(\"path\").attr(\"d\", \"M0,-3v6\"))\n .node();\n}\n\nlet nextMarkerId = 0;\n\nexport function applyMarkers(path, mark, {stroke: S}, context) {\n return applyMarkersColor(path, mark, S && ((i) => S[i]), context);\n}\n\nexport function applyGroupedMarkers(path, mark, {stroke: S}, context) {\n return applyMarkersColor(path, mark, S && (([i]) => S[i]), context);\n}\n\nfunction applyMarkersColor(path, {markerStart, markerMid, markerEnd, stroke}, strokeof = () => stroke, context) {\n const iriByMarkerColor = new Map();\n\n function applyMarker(marker) {\n return function (i) {\n const color = strokeof(i);\n let iriByColor = iriByMarkerColor.get(marker);\n if (!iriByColor) iriByMarkerColor.set(marker, (iriByColor = new Map()));\n let iri = iriByColor.get(color);\n if (!iri) {\n const node = this.parentNode.insertBefore(marker(color, context), this);\n const id = `plot-marker-${++nextMarkerId}`;\n node.setAttribute(\"id\", id);\n iriByColor.set(color, (iri = `url(#${id})`));\n }\n return iri;\n };\n }\n\n if (markerStart) path.attr(\"marker-start\", applyMarker(markerStart));\n if (markerMid) path.attr(\"marker-mid\", applyMarker(markerMid));\n if (markerEnd) path.attr(\"marker-end\", applyMarker(markerEnd));\n}\n", "import {offset} from \"../style.js\";\n\nexport function maybeInsetX({inset, insetLeft, insetRight, ...options} = {}) {\n [insetLeft, insetRight] = maybeInset(inset, insetLeft, insetRight);\n return {inset, insetLeft, insetRight, ...options};\n}\n\nexport function maybeInsetY({inset, insetTop, insetBottom, ...options} = {}) {\n [insetTop, insetBottom] = maybeInset(inset, insetTop, insetBottom);\n return {inset, insetTop, insetBottom, ...options};\n}\n\nfunction maybeInset(inset, inset1, inset2) {\n return inset === undefined && inset1 === undefined && inset2 === undefined\n ? offset\n ? [1, 0]\n : [0.5, 0.5]\n : [inset1, inset2];\n}\n", "import {isTemporal, labelof, map, maybeInterval, maybeValue, valueof} from \"../options.js\";\nimport {maybeInsetX, maybeInsetY} from \"./inset.js\";\n\n// The interval may be specified either as x: {value, interval} or as {x,\n// interval}. The former can be used to specify separate intervals for x and y,\n// for example with Plot.rect.\nfunction maybeIntervalValue(value, {interval}) {\n value = {...maybeValue(value)};\n value.interval = maybeInterval(value.interval === undefined ? interval : value.interval);\n return value;\n}\n\nfunction maybeIntervalK(k, maybeInsetK, options, trivial) {\n const {[k]: v, [`${k}1`]: v1, [`${k}2`]: v2} = options;\n const {value, interval} = maybeIntervalValue(v, options);\n if (value == null || (interval == null && !trivial)) return options;\n const label = labelof(v);\n if (interval == null) {\n let V;\n const kv = {transform: (data) => V || (V = valueof(data, value)), label};\n return {\n ...options,\n [k]: undefined,\n [`${k}1`]: v1 === undefined ? kv : v1,\n [`${k}2`]: v2 === undefined && !(v1 === v2 && trivial) ? kv : v2\n };\n }\n let D1, V1;\n function transform(data) {\n if (V1 !== undefined && data === D1) return V1; // memoize\n return (V1 = map(valueof((D1 = data), value), (v) => interval.floor(v)));\n }\n return maybeInsetK({\n ...options,\n [k]: undefined,\n [`${k}1`]: v1 === undefined ? {transform, label} : v1,\n [`${k}2`]: v2 === undefined ? {transform: (data) => transform(data).map((v) => interval.offset(v)), label} : v2\n });\n}\n\nfunction maybeIntervalMidK(k, maybeInsetK, options) {\n const {[k]: v} = options;\n const {value, interval} = maybeIntervalValue(v, options);\n if (value == null || interval == null) return options;\n return maybeInsetK({\n ...options,\n [k]: {\n label: labelof(v),\n transform: (data) => {\n const V1 = map(valueof(data, value), (v) => interval.floor(v));\n const V2 = V1.map((v) => interval.offset(v));\n return V1.map(\n isTemporal(V1)\n ? (v1, v2) =>\n v1 == null || isNaN((v1 = +v1)) || ((v2 = V2[v2]), v2 == null) || isNaN((v2 = +v2))\n ? undefined\n : new Date((v1 + v2) / 2)\n : (v1, v2) => (v1 == null || ((v2 = V2[v2]), v2 == null) ? NaN : (+v1 + +v2) / 2)\n );\n }\n }\n });\n}\n\nexport function maybeTrivialIntervalX(options = {}) {\n return maybeIntervalK(\"x\", maybeInsetX, options, true);\n}\n\nexport function maybeTrivialIntervalY(options = {}) {\n return maybeIntervalK(\"y\", maybeInsetY, options, true);\n}\n\nexport function maybeIntervalX(options = {}) {\n return maybeIntervalK(\"x\", maybeInsetX, options);\n}\n\nexport function maybeIntervalY(options = {}) {\n return maybeIntervalK(\"y\", maybeInsetY, options);\n}\n\nexport function maybeIntervalMidX(options = {}) {\n return maybeIntervalMidK(\"x\", maybeInsetX, options);\n}\n\nexport function maybeIntervalMidY(options = {}) {\n return maybeIntervalMidK(\"y\", maybeInsetY, options);\n}\n", "import {create} from \"../context.js\";\nimport {Mark, withTip} from \"../mark.js\";\nimport {applyMarkers, markers} from \"../marker.js\";\nimport {identity, number} from \"../options.js\";\nimport {isCollapsed} from \"../scales.js\";\nimport {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, offset} from \"../style.js\";\nimport {maybeIntervalX, maybeIntervalY} from \"../transforms/interval.js\";\n\nconst defaults = {\n ariaLabel: \"rule\",\n fill: null,\n stroke: \"currentColor\"\n};\n\nexport class RuleX extends Mark {\n constructor(data, options = {}) {\n const {x, y1, y2, inset = 0, insetTop = inset, insetBottom = inset} = options;\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y1: {value: y1, scale: \"y\", optional: true},\n y2: {value: y2, scale: \"y\", optional: true}\n },\n withTip(options, \"x\"),\n defaults\n );\n this.insetTop = number(insetTop);\n this.insetBottom = number(insetBottom);\n markers(this, options);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y1: Y1, y2: Y2} = channels;\n const {width, height, marginTop, marginRight, marginLeft, marginBottom} = dimensions;\n const {insetTop, insetBottom} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {x: X && x}, offset, 0)\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"line\")\n .call(applyDirectStyles, this)\n .attr(\"x1\", X ? (i) => X[i] : (marginLeft + width - marginRight) / 2)\n .attr(\"x2\", X ? (i) => X[i] : (marginLeft + width - marginRight) / 2)\n .attr(\"y1\", Y1 && !isCollapsed(y) ? (i) => Y1[i] + insetTop : marginTop + insetTop)\n .attr(\n \"y2\",\n Y2 && !isCollapsed(y)\n ? y.bandwidth\n ? (i) => Y2[i] + y.bandwidth() - insetBottom\n : (i) => Y2[i] - insetBottom\n : height - marginBottom - insetBottom\n )\n .call(applyChannelStyles, this, channels)\n .call(applyMarkers, this, channels, context)\n )\n .node();\n }\n}\n\nexport class RuleY extends Mark {\n constructor(data, options = {}) {\n const {x1, x2, y, inset = 0, insetRight = inset, insetLeft = inset} = options;\n super(\n data,\n {\n y: {value: y, scale: \"y\", optional: true},\n x1: {value: x1, scale: \"x\", optional: true},\n x2: {value: x2, scale: \"x\", optional: true}\n },\n withTip(options, \"y\"),\n defaults\n );\n this.insetRight = number(insetRight);\n this.insetLeft = number(insetLeft);\n markers(this, options);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {y: Y, x1: X1, x2: X2} = channels;\n const {width, height, marginTop, marginRight, marginLeft, marginBottom} = dimensions;\n const {insetLeft, insetRight} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {y: Y && y}, 0, offset)\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"line\")\n .call(applyDirectStyles, this)\n .attr(\"x1\", X1 && !isCollapsed(x) ? (i) => X1[i] + insetLeft : marginLeft + insetLeft)\n .attr(\n \"x2\",\n X2 && !isCollapsed(x)\n ? x.bandwidth\n ? (i) => X2[i] + x.bandwidth() - insetRight\n : (i) => X2[i] - insetRight\n : width - marginRight - insetRight\n )\n .attr(\"y1\", Y ? (i) => Y[i] : (marginTop + height - marginBottom) / 2)\n .attr(\"y2\", Y ? (i) => Y[i] : (marginTop + height - marginBottom) / 2)\n .call(applyChannelStyles, this, channels)\n .call(applyMarkers, this, channels, context)\n )\n .node();\n }\n}\n\nexport function ruleX(data, options) {\n let {x = identity, y, y1, y2, ...rest} = maybeIntervalY(options);\n [y1, y2] = maybeOptionalZero(y, y1, y2);\n return new RuleX(data, {...rest, x, y1, y2});\n}\n\nexport function ruleY(data, options) {\n let {y = identity, x, x1, x2, ...rest} = maybeIntervalX(options);\n [x1, x2] = maybeOptionalZero(x, x1, x2);\n return new RuleY(data, {...rest, y, x1, x2});\n}\n\n// For marks specified either as [0, x] or [x1, x2], or nothing.\nfunction maybeOptionalZero(x, x1, x2) {\n if (x == null) {\n if (x1 === undefined) {\n if (x2 !== undefined) return [0, x2];\n } else {\n if (x2 === undefined) return [0, x1];\n }\n } else if (x1 === undefined) {\n return x2 === undefined ? [0, x] : [x, x2];\n } else if (x2 === undefined) {\n return [x, x1];\n }\n return [x1, x2];\n}\n", "export function template(strings, ...parts) {\n let n = parts.length;\n\n // If any of the interpolated parameters are strings rather than functions,\n // bake them into the template to optimize performance during render.\n for (let j = 0, copy = true; j < n; ++j) {\n if (typeof parts[j] !== \"function\") {\n if (copy) {\n strings = strings.slice(); // copy before mutate\n copy = false;\n }\n strings.splice(j, 2, strings[j] + parts[j] + strings[j + 1]);\n parts.splice(j, 1);\n --j, --n;\n }\n }\n\n return (i) => {\n let s = strings[0];\n for (let j = 0; j < n; ++j) {\n s += parts[j](i) + strings[j + 1];\n }\n return s;\n };\n}\n", "import {namespaces} from \"d3\";\nimport {create} from \"../context.js\";\nimport {nonempty} from \"../defined.js\";\nimport {formatDefault} from \"../format.js\";\nimport {Mark} from \"../mark.js\";\nimport {\n indexOf,\n identity,\n string,\n maybeNumberChannel,\n maybeTuple,\n numberChannel,\n isNumeric,\n isTemporal,\n keyword,\n maybeFrameAnchor,\n isTextual,\n isIterable\n} from \"../options.js\";\nimport {\n applyChannelStyles,\n applyDirectStyles,\n applyIndirectStyles,\n applyAttr,\n applyTransform,\n impliedString,\n applyFrameAnchor\n} from \"../style.js\";\nimport {template} from \"../template.js\";\nimport {maybeIntervalMidX, maybeIntervalMidY} from \"../transforms/interval.js\";\n\nconst defaults = {\n ariaLabel: \"text\",\n strokeLinejoin: \"round\",\n strokeWidth: 3,\n paintOrder: \"stroke\"\n};\n\nconst softHyphen = \"\\u00ad\";\n\nexport class Text extends Mark {\n constructor(data, options = {}) {\n const {\n x,\n y,\n text = isIterable(data) && isTextual(data) ? identity : indexOf,\n frameAnchor,\n textAnchor = /right$/i.test(frameAnchor) ? \"end\" : /left$/i.test(frameAnchor) ? \"start\" : \"middle\",\n lineAnchor = /^top/i.test(frameAnchor) ? \"top\" : /^bottom/i.test(frameAnchor) ? \"bottom\" : \"middle\",\n lineHeight = 1,\n lineWidth = Infinity,\n textOverflow,\n monospace,\n fontFamily = monospace ? \"ui-monospace, monospace\" : undefined,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n rotate\n } = options;\n const [vrotate, crotate] = maybeNumberChannel(rotate, 0);\n const [vfontSize, cfontSize] = maybeFontSizeChannel(fontSize);\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y: {value: y, scale: \"y\", optional: true},\n fontSize: {value: vfontSize, optional: true},\n rotate: {value: numberChannel(vrotate), optional: true},\n text: {value: text, filter: nonempty, optional: true}\n },\n options,\n defaults\n );\n this.rotate = crotate;\n this.textAnchor = impliedString(textAnchor, \"middle\");\n this.lineAnchor = keyword(lineAnchor, \"lineAnchor\", [\"top\", \"middle\", \"bottom\"]);\n this.lineHeight = +lineHeight;\n this.lineWidth = +lineWidth;\n this.textOverflow = maybeTextOverflow(textOverflow);\n this.monospace = !!monospace;\n this.fontFamily = string(fontFamily);\n this.fontSize = cfontSize;\n this.fontStyle = string(fontStyle);\n this.fontVariant = string(fontVariant);\n this.fontWeight = string(fontWeight);\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n if (!(this.lineWidth >= 0)) throw new Error(`invalid lineWidth: ${lineWidth}`);\n this.splitLines = splitter(this);\n this.clipLine = clipper(this);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y: Y, rotate: R, text: T, title: TL, fontSize: FS} = channels;\n const {rotate} = this;\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyIndirectTextStyles, this, T, dimensions)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"text\")\n .call(applyDirectStyles, this)\n .call(applyMultilineText, this, T, TL)\n .attr(\n \"transform\",\n template`translate(${X ? (i) => X[i] : cx},${Y ? (i) => Y[i] : cy})${\n R ? (i) => ` rotate(${R[i]})` : rotate ? ` rotate(${rotate})` : ``\n }`\n )\n .call(applyAttr, \"font-size\", FS && ((i) => FS[i]))\n .call(applyChannelStyles, this, channels)\n )\n .node();\n }\n}\n\nexport function maybeTextOverflow(textOverflow) {\n return textOverflow == null\n ? null\n : keyword(textOverflow, \"textOverflow\", [\n \"clip\", // shorthand for clip-end\n \"ellipsis\", // \u2026 ellipsis-end\n \"clip-start\",\n \"clip-end\",\n \"ellipsis-start\",\n \"ellipsis-middle\",\n \"ellipsis-end\"\n ]).replace(/^(clip|ellipsis)$/, \"$1-end\");\n}\n\nfunction applyMultilineText(selection, mark, T, TL) {\n if (!T) return;\n const {lineAnchor, lineHeight, textOverflow, splitLines, clipLine} = mark;\n selection.each(function (i) {\n const lines = splitLines(formatDefault(T[i]) ?? \"\").map(clipLine);\n const n = lines.length;\n const y = lineAnchor === \"top\" ? 0.71 : lineAnchor === \"bottom\" ? 1 - n : (164 - n * 100) / 200;\n if (n > 1) {\n let m = 0;\n for (let i = 0; i < n; ++i) {\n ++m;\n if (!lines[i]) continue;\n const tspan = this.ownerDocument.createElementNS(namespaces.svg, \"tspan\");\n tspan.setAttribute(\"x\", 0);\n if (i === m - 1) tspan.setAttribute(\"y\", `${(y + i) * lineHeight}em`);\n else tspan.setAttribute(\"dy\", `${m * lineHeight}em`);\n tspan.textContent = lines[i];\n this.appendChild(tspan);\n m = 0;\n }\n } else {\n if (y) this.setAttribute(\"y\", `${y * lineHeight}em`);\n this.textContent = lines[0];\n }\n if (textOverflow && !TL && lines[0] !== T[i]) {\n const title = this.ownerDocument.createElementNS(namespaces.svg, \"title\");\n title.textContent = T[i];\n this.appendChild(title);\n }\n });\n}\n\nexport function text(data, {x, y, ...options} = {}) {\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Text(data, {...options, x, y});\n}\n\nexport function textX(data, {x = identity, ...options} = {}) {\n return new Text(data, maybeIntervalMidY({...options, x}));\n}\n\nexport function textY(data, {y = identity, ...options} = {}) {\n return new Text(data, maybeIntervalMidX({...options, y}));\n}\n\nexport function applyIndirectTextStyles(selection, mark, T) {\n applyAttr(selection, \"text-anchor\", mark.textAnchor);\n applyAttr(selection, \"font-family\", mark.fontFamily);\n applyAttr(selection, \"font-size\", mark.fontSize);\n applyAttr(selection, \"font-style\", mark.fontStyle);\n applyAttr(selection, \"font-variant\", mark.fontVariant === undefined ? inferFontVariant(T) : mark.fontVariant);\n applyAttr(selection, \"font-weight\", mark.fontWeight);\n}\n\nfunction inferFontVariant(T) {\n return T && (isNumeric(T) || isTemporal(T)) ? \"tabular-nums\" : undefined;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/CSS/font-size\nconst fontSizes = new Set([\n // global keywords\n \"inherit\",\n \"initial\",\n \"revert\",\n \"unset\",\n // absolute keywords\n \"xx-small\",\n \"x-small\",\n \"small\",\n \"medium\",\n \"large\",\n \"x-large\",\n \"xx-large\",\n \"xxx-large\",\n // relative keywords\n \"larger\",\n \"smaller\"\n]);\n\n// The font size may be expressed as a constant in the following forms:\n// - number in pixels\n// - string keyword: see above\n// - string : e.g., \"12px\"\n// - string : e.g., \"80%\"\n// Anything else is assumed to be a channel definition.\nfunction maybeFontSizeChannel(fontSize) {\n if (fontSize == null || typeof fontSize === \"number\") return [undefined, fontSize];\n if (typeof fontSize !== \"string\") return [fontSize, undefined];\n fontSize = fontSize.trim().toLowerCase();\n return fontSizes.has(fontSize) || /^[+-]?\\d*\\.?\\d+(e[+-]?\\d+)?(\\w*|%)$/.test(fontSize)\n ? [undefined, fontSize]\n : [fontSize, undefined];\n}\n\n// This is a greedy algorithm for line wrapping. It would be better to use the\n// Knuth\u2013Plass line breaking algorithm (but that would be much more complex).\n// https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap\nfunction lineWrap(input, maxWidth, widthof) {\n const lines = [];\n let lineStart,\n lineEnd = 0;\n for (const [wordStart, wordEnd, required] of lineBreaks(input)) {\n // Record the start of a line. This isn\u2019t the same as the previous line\u2019s\n // end because we often skip spaces between lines.\n if (lineStart === undefined) lineStart = wordStart;\n\n // If the current line is not empty, and if adding the current word would\n // make the line longer than the allowed width, then break the line at the\n // previous word end.\n if (lineEnd > lineStart && widthof(input, lineStart, wordEnd) > maxWidth) {\n lines.push(input.slice(lineStart, lineEnd) + (input[lineEnd - 1] === softHyphen ? \"-\" : \"\"));\n lineStart = wordStart;\n }\n\n // If this is a required break (a newline), emit the line and reset.\n if (required) {\n lines.push(input.slice(lineStart, wordEnd));\n lineStart = undefined;\n continue;\n }\n\n // Extend the current line to include the new word.\n lineEnd = wordEnd;\n }\n return lines;\n}\n\n// This is a rudimentary (and U.S.-centric) algorithm for finding opportunities\n// to break lines between words. A better and far more comprehensive approach\n// would be to use the official Unicode Line Breaking Algorithm.\n// https://unicode.org/reports/tr14/\nfunction* lineBreaks(input) {\n let i = 0,\n j = 0;\n const n = input.length;\n while (j < n) {\n let k = 1;\n switch (input[j]) {\n case softHyphen:\n case \"-\": // hyphen\n ++j;\n yield [i, j, false];\n i = j;\n break;\n case \" \":\n yield [i, j, false];\n while (input[++j] === \" \"); // skip multiple spaces\n i = j;\n break;\n case \"\\r\":\n if (input[j + 1] === \"\\n\") ++k; // falls through\n case \"\\n\":\n yield [i, j, true];\n j += k;\n i = j;\n break;\n default:\n ++j;\n break;\n }\n }\n yield [i, j, true];\n}\n\n// Computed as round(measureText(text).width * 10) at 10px system-ui. For\n// characters that are not represented in this map, we\u2019d ideally want to use a\n// weighted average of what we expect to see. But since we don\u2019t really know\n// what that is, using \u201Ce\u201D seems reasonable.\nconst defaultWidthMap = {\n a: 56,\n b: 63,\n c: 57,\n d: 63,\n e: 58,\n f: 37,\n g: 62,\n h: 60,\n i: 26,\n j: 26,\n k: 55,\n l: 26,\n m: 88,\n n: 60,\n o: 60,\n p: 62,\n q: 62,\n r: 39,\n s: 54,\n t: 38,\n u: 60,\n v: 55,\n w: 79,\n x: 54,\n y: 55,\n z: 55,\n A: 69,\n B: 67,\n C: 73,\n D: 74,\n E: 61,\n F: 58,\n G: 76,\n H: 75,\n I: 28,\n J: 55,\n K: 67,\n L: 58,\n M: 89,\n N: 75,\n O: 78,\n P: 65,\n Q: 78,\n R: 67,\n S: 65,\n T: 65,\n U: 75,\n V: 69,\n W: 98,\n X: 69,\n Y: 67,\n Z: 67,\n 0: 64,\n 1: 48,\n 2: 62,\n 3: 64,\n 4: 66,\n 5: 63,\n 6: 65,\n 7: 58,\n 8: 65,\n 9: 65,\n \" \": 29,\n \"!\": 32,\n '\"': 49,\n \"'\": 31,\n \"(\": 39,\n \")\": 39,\n \",\": 31,\n \"-\": 48,\n \".\": 31,\n \"/\": 32,\n \":\": 31,\n \";\": 31,\n \"?\": 52,\n \"\u2018\": 31,\n \"\u2019\": 31,\n \"\u201C\": 47,\n \"\u201D\": 47,\n \"\u2026\": 82\n};\n\n// This is a rudimentary (and U.S.-centric) algorithm for measuring the width of\n// a string based on a technique of Gregor Aisch; it assumes that individual\n// characters are laid out independently and does not implement the Unicode\n// grapheme cluster breaking algorithm. It does understand code points, though,\n// and so treats things like emoji as having the width of a lowercase e (and\n// should be equivalent to using for-of to iterate over code points, while also\n// being fast). TODO Optimize this by noting that we often re-measure characters\n// that were previously measured?\n// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries\n// https://exploringjs.com/impatient-js/ch_strings.html#atoms-of-text\nexport function defaultWidth(text, start = 0, end = text.length) {\n let sum = 0;\n for (let i = start; i < end; i = readCharacter(text, i)) {\n sum += defaultWidthMap[text[i]] ?? (isPictographic(text, i) ? 120 : defaultWidthMap.e);\n }\n return sum;\n}\n\n// Even for monospaced text, we can\u2019t assume that the number of UTF-16 code\n// points (i.e., the length of a string) corresponds to the number of visible\n// characters; we still have to count graphemes. And note that pictographic\n// characters such as emojis are typically not monospaced!\nexport function monospaceWidth(text, start = 0, end = text.length) {\n let sum = 0;\n for (let i = start; i < end; i = readCharacter(text, i)) {\n sum += isPictographic(text, i) ? 126 : 63;\n }\n return sum;\n}\n\nexport function splitter({monospace, lineWidth, textOverflow}) {\n if (textOverflow != null || lineWidth == Infinity) return (text) => text.split(/\\r\\n?|\\n/g);\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const maxWidth = lineWidth * 100;\n return (text) => lineWrap(text, maxWidth, widthof);\n}\n\nexport function clipper({monospace, lineWidth, textOverflow}) {\n if (textOverflow == null || lineWidth == Infinity) return (text) => text;\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const maxWidth = lineWidth * 100;\n switch (textOverflow) {\n case \"clip-start\":\n return (text) => clipStart(text, maxWidth, widthof, \"\");\n case \"clip-end\":\n return (text) => clipEnd(text, maxWidth, widthof, \"\");\n case \"ellipsis-start\":\n return (text) => clipStart(text, maxWidth, widthof, ellipsis);\n case \"ellipsis-middle\":\n return (text) => clipMiddle(text, maxWidth, widthof, ellipsis);\n case \"ellipsis-end\":\n return (text) => clipEnd(text, maxWidth, widthof, ellipsis);\n }\n}\n\nexport const ellipsis = \"\u2026\";\n\n// Cuts the given text to the given width, using the specified widthof function;\n// the returned [index, error] guarantees text.slice(0, index) fits within the\n// specified width with the given error. If the text fits naturally within the\n// given width, returns [-1, 0]. If the text needs cutting, the given inset\n// specifies how much space (in the same units as width and widthof) to reserve\n// for a possible ellipsis character.\nexport function cut(text, width, widthof, inset) {\n const I = []; // indexes of read character boundaries\n let w = 0; // current line width\n for (let i = 0, j = 0, n = text.length; i < n; i = j) {\n j = readCharacter(text, i); // read the next character\n const l = widthof(text, i, j); // current character width\n if (w + l > width) {\n w += inset;\n while (w > width && i > 0) (j = i), (i = I.pop()), (w -= widthof(text, i, j)); // remove excess\n return [i, width - w];\n }\n w += l;\n I.push(i);\n }\n return [-1, 0];\n}\n\nexport function clipEnd(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const e = widthof(ellipsis);\n const [i] = cut(text, width, widthof, e);\n return i < 0 ? text : text.slice(0, i).trimEnd() + ellipsis;\n}\n\nexport function clipMiddle(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const w = widthof(text);\n if (w <= width) return text;\n const e = widthof(ellipsis) / 2;\n const [i, ei] = cut(text, width / 2, widthof, e);\n const [j] = cut(text, w - width / 2 - ei + e, widthof, -e); // TODO read spaces?\n return j < 0 ? ellipsis : text.slice(0, i).trimEnd() + ellipsis + text.slice(readCharacter(text, j)).trimStart();\n}\n\nexport function clipStart(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const w = widthof(text);\n if (w <= width) return text;\n const e = widthof(ellipsis);\n const [j] = cut(text, w - width + e, widthof, -e); // TODO read spaces?\n return j < 0 ? ellipsis : ellipsis + text.slice(readCharacter(text, j)).trimStart();\n}\n\nconst reCombiner = /[\\p{Combining_Mark}\\p{Emoji_Modifier}]+/uy;\nconst rePictographic = /\\p{Extended_Pictographic}/uy;\n\n// Reads a single \u201Ccharacter\u201D element from the given text starting at the given\n// index, returning the index after the read character. Ideally, this implements\n// the Unicode text segmentation algorithm and understands grapheme cluster\n// boundaries, etc., but in practice this is only smart enough to detect UTF-16\n// surrogate pairs, combining marks, and zero-width joiner (zwj) sequences such\n// as emoji skin color modifiers. https://unicode.org/reports/tr29/\nexport function readCharacter(text, i) {\n i += isSurrogatePair(text, i) ? 2 : 1;\n if (isCombiner(text, i)) i = reCombiner.lastIndex;\n if (isZeroWidthJoiner(text, i)) return readCharacter(text, i + 1);\n return i;\n}\n\n// We avoid more expensive regex tests involving Unicode property classes by\n// first checking for the common case of 7-bit ASCII characters.\nfunction isAscii(text, i) {\n return text.charCodeAt(i) < 0x80;\n}\n\nfunction isSurrogatePair(text, i) {\n const hi = text.charCodeAt(i);\n if (hi >= 0xd800 && hi < 0xdc00) {\n const lo = text.charCodeAt(i + 1);\n return lo >= 0xdc00 && lo < 0xe000;\n }\n return false;\n}\n\nfunction isZeroWidthJoiner(text, i) {\n return text.charCodeAt(i) === 0x200d;\n}\n\nfunction isCombiner(text, i) {\n return isAscii(text, i) ? false : ((reCombiner.lastIndex = i), reCombiner.test(text));\n}\n\nfunction isPictographic(text, i) {\n return isAscii(text, i) ? false : ((rePictographic.lastIndex = i), rePictographic.test(text));\n}\n", "import {pathRound as path} from \"d3\";\nimport {create} from \"../context.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeFrameAnchor, maybeNumberChannel, maybeTuple, keyword, identity} from \"../options.js\";\nimport {\n applyChannelStyles,\n applyDirectStyles,\n applyFrameAnchor,\n applyIndirectStyles,\n applyTransform\n} from \"../style.js\";\nimport {template} from \"../template.js\";\n\nconst defaults = {\n ariaLabel: \"vector\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 1.5,\n strokeLinejoin: \"round\",\n strokeLinecap: \"round\"\n};\n\nconst defaultRadius = 3.5;\n\n// The size of the arrowhead is proportional to its length, but we still allow\n// the relative size of the head to be controlled via the mark\u2019s width option;\n// doubling the default radius will produce an arrowhead that is twice as big.\n// That said, we\u2019ll probably want a arrow with a fixed head size, too.\nconst wingRatio = defaultRadius * 5;\n\nconst shapeArrow = {\n draw(context, l, r) {\n const wing = (l * r) / wingRatio;\n context.moveTo(0, 0);\n context.lineTo(0, -l);\n context.moveTo(-wing, wing - l);\n context.lineTo(0, -l);\n context.lineTo(wing, wing - l);\n }\n};\n\nconst shapeSpike = {\n draw(context, l, r) {\n context.moveTo(-r, 0);\n context.lineTo(0, -l);\n context.lineTo(r, 0);\n }\n};\n\nconst shapes = new Map([\n [\"arrow\", shapeArrow],\n [\"spike\", shapeSpike]\n]);\n\nfunction isShapeObject(value) {\n return value && typeof value.draw === \"function\";\n}\n\nfunction maybeShape(shape) {\n if (isShapeObject(shape)) return shape;\n const value = shapes.get(`${shape}`.toLowerCase());\n if (value) return value;\n throw new Error(`invalid shape: ${shape}`);\n}\n\nexport class Vector extends Mark {\n constructor(data, options = {}) {\n const {x, y, r = defaultRadius, length, rotate, shape = shapeArrow, anchor = \"middle\", frameAnchor} = options;\n const [vl, cl] = maybeNumberChannel(length, 12);\n const [vr, cr] = maybeNumberChannel(rotate, 0);\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y: {value: y, scale: \"y\", optional: true},\n length: {value: vl, scale: \"length\", optional: true},\n rotate: {value: vr, optional: true}\n },\n options,\n defaults\n );\n this.r = +r;\n this.length = cl;\n this.rotate = cr;\n this.shape = maybeShape(shape);\n this.anchor = keyword(anchor, \"anchor\", [\"start\", \"middle\", \"end\"]);\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y: Y, length: L, rotate: A} = channels;\n const {length, rotate, anchor, shape, r} = this;\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .attr(\n \"transform\",\n template`translate(${X ? (i) => X[i] : cx},${Y ? (i) => Y[i] : cy})${\n A ? (i) => ` rotate(${A[i]})` : rotate ? ` rotate(${rotate})` : ``\n }${\n anchor === \"start\"\n ? ``\n : anchor === \"end\"\n ? L\n ? (i) => ` translate(0,${L[i]})`\n : ` translate(0,${length})`\n : L\n ? (i) => ` translate(0,${L[i] / 2})`\n : ` translate(0,${length / 2})`\n }`\n )\n .attr(\n \"d\",\n L\n ? (i) => {\n const p = path();\n shape.draw(p, L[i], r);\n return p;\n }\n : (() => {\n const p = path();\n shape.draw(p, length, r);\n return p;\n })()\n )\n .call(applyChannelStyles, this, channels)\n )\n .node();\n }\n}\n\nexport function vector(data, options = {}) {\n let {x, y, ...rest} = options;\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Vector(data, {...rest, x, y});\n}\n\nexport function vectorX(data, options = {}) {\n const {x = identity, ...rest} = options;\n return new Vector(data, {...rest, x});\n}\n\nexport function vectorY(data, options = {}) {\n const {y = identity, ...rest} = options;\n return new Vector(data, {...rest, y});\n}\n\nexport function spike(data, options = {}) {\n const {\n shape = shapeSpike,\n stroke = defaults.stroke,\n strokeWidth = 1,\n fill = stroke,\n fillOpacity = 0.3,\n anchor = \"start\",\n ...rest\n } = options;\n return vector(data, {...rest, shape, stroke, strokeWidth, fill, fillOpacity, anchor});\n}\n", "import {InternSet, extent, format, utcFormat} from \"d3\";\nimport {formatDefault} from \"../format.js\";\nimport {marks} from \"../mark.js\";\nimport {radians} from \"../math.js\";\nimport {arrayify, constant, identity, keyword, number, range, valueof} from \"../options.js\";\nimport {isIterable, isNoneish, isTemporal, isInterval} from \"../options.js\";\nimport {maybeColorChannel, maybeNumberChannel, maybeRangeInterval} from \"../options.js\";\nimport {inferScaleOrder} from \"../scales.js\";\nimport {offset} from \"../style.js\";\nimport {generalizeTimeInterval, inferTimeFormat, intervalDuration} from \"../time.js\";\nimport {initializer} from \"../transforms/basic.js\";\nimport {warn} from \"../warnings.js\";\nimport {ruleX, ruleY} from \"./rule.js\";\nimport {text, textX, textY} from \"./text.js\";\nimport {vectorX, vectorY} from \"./vector.js\";\n\nfunction maybeData(data, options) {\n if (arguments.length < 2 && !isIterable(data)) (options = data), (data = null);\n if (options === undefined) options = {};\n return [data, options];\n}\n\nfunction maybeAnchor({anchor} = {}, anchors) {\n return anchor === undefined ? anchors[0] : keyword(anchor, \"anchor\", anchors);\n}\n\nfunction anchorY(options) {\n return maybeAnchor(options, [\"left\", \"right\"]);\n}\n\nfunction anchorFy(options) {\n return maybeAnchor(options, [\"right\", \"left\"]);\n}\n\nfunction anchorX(options) {\n return maybeAnchor(options, [\"bottom\", \"top\"]);\n}\n\nfunction anchorFx(options) {\n return maybeAnchor(options, [\"top\", \"bottom\"]);\n}\n\nexport function axisY() {\n const [data, options] = maybeData(...arguments);\n return axisKy(\"y\", anchorY(options), data, options);\n}\n\nexport function axisFy() {\n const [data, options] = maybeData(...arguments);\n return axisKy(\"fy\", anchorFy(options), data, options);\n}\n\nexport function axisX() {\n const [data, options] = maybeData(...arguments);\n return axisKx(\"x\", anchorX(options), data, options);\n}\n\nexport function axisFx() {\n const [data, options] = maybeData(...arguments);\n return axisKx(\"fx\", anchorFx(options), data, options);\n}\n\nfunction axisKy(\n k,\n anchor,\n data,\n {\n color = \"currentColor\",\n opacity = 1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n fill = color,\n fillOpacity = opacity,\n textAnchor,\n textStroke,\n textStrokeOpacity,\n textStrokeWidth,\n tickSize = k === \"y\" ? 6 : 0,\n tickPadding,\n tickRotate,\n x,\n margin,\n marginTop = margin === undefined ? 20 : margin,\n marginRight = margin === undefined ? (anchor === \"right\" ? 40 : 0) : margin,\n marginBottom = margin === undefined ? 20 : margin,\n marginLeft = margin === undefined ? (anchor === \"left\" ? 40 : 0) : margin,\n label,\n labelAnchor,\n labelArrow,\n labelOffset,\n ...options\n }\n) {\n tickSize = number(tickSize);\n tickPadding = number(tickPadding);\n tickRotate = number(tickRotate);\n if (labelAnchor !== undefined) labelAnchor = keyword(labelAnchor, \"labelAnchor\", [\"center\", \"top\", \"bottom\"]);\n labelArrow = maybeLabelArrow(labelArrow);\n return marks(\n tickSize && !isNoneish(stroke)\n ? axisTickKy(k, anchor, data, {\n stroke,\n strokeOpacity,\n strokeWidth,\n tickSize,\n tickPadding,\n tickRotate,\n x,\n ...options\n })\n : null,\n !isNoneish(fill)\n ? axisTextKy(k, anchor, data, {\n fill,\n fillOpacity,\n stroke: textStroke,\n strokeOpacity: textStrokeOpacity,\n strokeWidth: textStrokeWidth,\n textAnchor,\n tickSize,\n tickPadding,\n tickRotate,\n x,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n ...options\n })\n : null,\n !isNoneish(fill) && label !== null\n ? text(\n [],\n labelOptions({fill, fillOpacity, ...options}, function (data, facets, channels, scales, dimensions) {\n const scale = scales[k];\n const {marginTop, marginRight, marginBottom, marginLeft} = (k === \"y\" && dimensions.inset) || dimensions;\n const cla = labelAnchor ?? (scale.bandwidth ? \"center\" : \"top\");\n const clo = labelOffset ?? (anchor === \"right\" ? marginRight : marginLeft) - 3;\n if (cla === \"center\") {\n this.textAnchor = undefined; // middle\n this.lineAnchor = anchor === \"right\" ? \"bottom\" : \"top\";\n this.frameAnchor = anchor;\n this.rotate = -90;\n } else {\n this.textAnchor = anchor === \"right\" ? \"end\" : \"start\";\n this.lineAnchor = cla;\n this.frameAnchor = `${cla}-${anchor}`;\n this.rotate = 0;\n }\n this.dy = cla === \"top\" ? 3 - marginTop : cla === \"bottom\" ? marginBottom - 3 : 0;\n this.dx = anchor === \"right\" ? clo : -clo;\n this.ariaLabel = `${k}-axis label`;\n return {\n facets: [[0]],\n channels: {text: {value: [formatAxisLabel(k, scale, {anchor, label, labelAnchor: cla, labelArrow})]}}\n };\n })\n )\n : null\n );\n}\n\nfunction axisKx(\n k,\n anchor,\n data,\n {\n color = \"currentColor\",\n opacity = 1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n fill = color,\n fillOpacity = opacity,\n textAnchor,\n textStroke,\n textStrokeOpacity,\n textStrokeWidth,\n tickSize = k === \"x\" ? 6 : 0,\n tickPadding,\n tickRotate,\n y,\n margin,\n marginTop = margin === undefined ? (anchor === \"top\" ? 30 : 0) : margin,\n marginRight = margin === undefined ? 20 : margin,\n marginBottom = margin === undefined ? (anchor === \"bottom\" ? 30 : 0) : margin,\n marginLeft = margin === undefined ? 20 : margin,\n label,\n labelAnchor,\n labelArrow,\n labelOffset,\n ...options\n }\n) {\n tickSize = number(tickSize);\n tickPadding = number(tickPadding);\n tickRotate = number(tickRotate);\n if (labelAnchor !== undefined) labelAnchor = keyword(labelAnchor, \"labelAnchor\", [\"center\", \"left\", \"right\"]);\n labelArrow = maybeLabelArrow(labelArrow);\n return marks(\n tickSize && !isNoneish(stroke)\n ? axisTickKx(k, anchor, data, {\n stroke,\n strokeOpacity,\n strokeWidth,\n tickSize,\n tickPadding,\n tickRotate,\n y,\n ...options\n })\n : null,\n !isNoneish(fill)\n ? axisTextKx(k, anchor, data, {\n fill,\n fillOpacity,\n stroke: textStroke,\n strokeOpacity: textStrokeOpacity,\n strokeWidth: textStrokeWidth,\n textAnchor,\n tickSize,\n tickPadding,\n tickRotate,\n y,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n ...options\n })\n : null,\n !isNoneish(fill) && label !== null\n ? text(\n [],\n labelOptions({fill, fillOpacity, ...options}, function (data, facets, channels, scales, dimensions) {\n const scale = scales[k];\n const {marginTop, marginRight, marginBottom, marginLeft} = (k === \"x\" && dimensions.inset) || dimensions;\n const cla = labelAnchor ?? (scale.bandwidth ? \"center\" : \"right\");\n const clo = labelOffset ?? (anchor === \"top\" ? marginTop : marginBottom) - 3;\n if (cla === \"center\") {\n this.frameAnchor = anchor;\n this.textAnchor = undefined; // middle\n } else {\n this.frameAnchor = `${anchor}-${cla}`;\n this.textAnchor = cla === \"right\" ? \"end\" : \"start\";\n }\n this.lineAnchor = anchor;\n this.dy = anchor === \"top\" ? -clo : clo;\n this.dx = cla === \"right\" ? marginRight - 3 : cla === \"left\" ? 3 - marginLeft : 0;\n this.ariaLabel = `${k}-axis label`;\n return {\n facets: [[0]],\n channels: {text: {value: [formatAxisLabel(k, scale, {anchor, label, labelAnchor: cla, labelArrow})]}}\n };\n })\n )\n : null\n );\n}\n\nfunction axisTickKy(\n k,\n anchor,\n data,\n {\n strokeWidth = 1,\n strokeLinecap = null,\n strokeLinejoin = null,\n facetAnchor = anchor + (k === \"y\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n inset = 0,\n insetLeft = inset,\n insetRight = inset,\n dx = 0,\n y = k === \"y\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n vectorY,\n k,\n data,\n {\n ariaLabel: `${k}-axis tick`,\n ariaHidden: true\n },\n {\n strokeWidth,\n strokeLinecap,\n strokeLinejoin,\n facetAnchor,\n frameAnchor,\n y,\n ...options,\n dx: anchor === \"left\" ? +dx - offset + +insetLeft : +dx + offset - insetRight,\n anchor: \"start\",\n length: tickSize,\n shape: anchor === \"left\" ? shapeTickLeft : shapeTickRight\n }\n );\n}\n\nfunction axisTickKx(\n k,\n anchor,\n data,\n {\n strokeWidth = 1,\n strokeLinecap = null,\n strokeLinejoin = null,\n facetAnchor = anchor + (k === \"x\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n inset = 0,\n insetTop = inset,\n insetBottom = inset,\n dy = 0,\n x = k === \"x\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n vectorX,\n k,\n data,\n {\n ariaLabel: `${k}-axis tick`,\n ariaHidden: true\n },\n {\n strokeWidth,\n strokeLinejoin,\n strokeLinecap,\n facetAnchor,\n frameAnchor,\n x,\n ...options,\n dy: anchor === \"bottom\" ? +dy - offset - insetBottom : +dy + offset + +insetTop,\n anchor: \"start\",\n length: tickSize,\n shape: anchor === \"bottom\" ? shapeTickBottom : shapeTickTop\n }\n );\n}\n\nfunction axisTextKy(\n k,\n anchor,\n data,\n {\n facetAnchor = anchor + (k === \"y\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n tickRotate = 0,\n tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) > 60 ? 4 * Math.cos(tickRotate * radians) : 0),\n text,\n textAnchor = Math.abs(tickRotate) > 60 ? \"middle\" : anchor === \"left\" ? \"end\" : \"start\",\n lineAnchor = tickRotate > 60 ? \"top\" : tickRotate < -60 ? \"bottom\" : \"middle\",\n fontVariant,\n inset = 0,\n insetLeft = inset,\n insetRight = inset,\n dx = 0,\n y = k === \"y\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n textY,\n k,\n data,\n {ariaLabel: `${k}-axis tick label`},\n {\n facetAnchor,\n frameAnchor,\n text,\n textAnchor,\n lineAnchor,\n fontVariant,\n rotate: tickRotate,\n y,\n ...options,\n dx: anchor === \"left\" ? +dx - tickSize - tickPadding + +insetLeft : +dx + +tickSize + +tickPadding - insetRight\n },\n function (scale, data, ticks, tickFormat, channels) {\n if (fontVariant === undefined) this.fontVariant = inferFontVariant(scale);\n if (text === undefined) channels.text = inferTextChannel(scale, data, ticks, tickFormat, anchor);\n }\n );\n}\n\nfunction axisTextKx(\n k,\n anchor,\n data,\n {\n facetAnchor = anchor + (k === \"x\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n tickRotate = 0,\n tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) >= 10 ? 4 * Math.cos(tickRotate * radians) : 0),\n text,\n textAnchor = Math.abs(tickRotate) >= 10 ? ((tickRotate < 0) ^ (anchor === \"bottom\") ? \"start\" : \"end\") : \"middle\",\n lineAnchor = Math.abs(tickRotate) >= 10 ? \"middle\" : anchor === \"bottom\" ? \"top\" : \"bottom\",\n fontVariant,\n inset = 0,\n insetTop = inset,\n insetBottom = inset,\n dy = 0,\n x = k === \"x\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n textX,\n k,\n data,\n {ariaLabel: `${k}-axis tick label`},\n {\n facetAnchor,\n frameAnchor,\n text: text === undefined ? null : text,\n textAnchor,\n lineAnchor,\n fontVariant,\n rotate: tickRotate,\n x,\n ...options,\n dy: anchor === \"bottom\" ? +dy + +tickSize + +tickPadding - insetBottom : +dy - tickSize - tickPadding + +insetTop\n },\n function (scale, data, ticks, tickFormat, channels) {\n if (fontVariant === undefined) this.fontVariant = inferFontVariant(scale);\n if (text === undefined) channels.text = inferTextChannel(scale, data, ticks, tickFormat, anchor);\n }\n );\n}\n\nexport function gridY() {\n const [data, options] = maybeData(...arguments);\n return gridKy(\"y\", anchorY(options), data, options);\n}\n\nexport function gridFy() {\n const [data, options] = maybeData(...arguments);\n return gridKy(\"fy\", anchorFy(options), data, options);\n}\n\nexport function gridX() {\n const [data, options] = maybeData(...arguments);\n return gridKx(\"x\", anchorX(options), data, options);\n}\n\nexport function gridFx() {\n const [data, options] = maybeData(...arguments);\n return gridKx(\"fx\", anchorFx(options), data, options);\n}\n\nfunction gridKy(\n k,\n anchor,\n data,\n {\n y = k === \"y\" ? undefined : null,\n x = null,\n x1 = anchor === \"left\" ? x : null,\n x2 = anchor === \"right\" ? x : null,\n ...options\n }\n) {\n return axisMark(ruleY, k, data, {ariaLabel: `${k}-grid`, ariaHidden: true}, {y, x1, x2, ...gridDefaults(options)});\n}\n\nfunction gridKx(\n k,\n anchor,\n data,\n {\n x = k === \"x\" ? undefined : null,\n y = null,\n y1 = anchor === \"top\" ? y : null,\n y2 = anchor === \"bottom\" ? y : null,\n ...options\n }\n) {\n return axisMark(ruleX, k, data, {ariaLabel: `${k}-grid`, ariaHidden: true}, {x, y1, y2, ...gridDefaults(options)});\n}\n\nfunction gridDefaults({\n color = \"currentColor\",\n opacity = 0.1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n ...options\n}) {\n return {stroke, strokeOpacity, strokeWidth, ...options};\n}\n\nfunction labelOptions(\n {\n fill,\n fillOpacity,\n fontFamily,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n monospace,\n pointerEvents,\n shapeRendering,\n clip = false\n },\n initializer\n) {\n // Only propagate these options if constant.\n [, fill] = maybeColorChannel(fill);\n [, fillOpacity] = maybeNumberChannel(fillOpacity);\n return {\n facet: \"super\",\n x: null,\n y: null,\n fill,\n fillOpacity,\n fontFamily,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n monospace,\n pointerEvents,\n shapeRendering,\n clip,\n initializer\n };\n}\n\nfunction axisMark(mark, k, data, properties, options, initialize) {\n let channels;\n\n function axisInitializer(data, facets, _channels, scales, dimensions, context) {\n const initializeFacets = data == null && (k === \"fx\" || k === \"fy\");\n const {[k]: scale} = scales;\n if (!scale) throw new Error(`missing scale: ${k}`);\n const domain = scale.domain();\n let {interval, ticks, tickFormat, tickSpacing = k === \"x\" ? 80 : 35} = options;\n // For a scale with a temporal domain, also allow the ticks to be specified\n // as a string which is promoted to a time interval. In the case of ordinal\n // scales, the interval is interpreted as UTC.\n if (typeof ticks === \"string\" && hasTemporalDomain(scale)) (interval = ticks), (ticks = undefined);\n // The interval axis option is an alternative method of specifying ticks;\n // for example, for a numeric scale, ticks = 5 means \u201Cabout 5 ticks\u201D whereas\n // interval = 5 means \u201Cticks every 5 units\u201D. (This is not to be confused\n // with the interval scale option, which affects the scale\u2019s behavior!)\n // Lastly use the tickSpacing option to infer the desired tick count.\n if (ticks === undefined) ticks = maybeRangeInterval(interval, scale.type) ?? inferTickCount(scale, tickSpacing);\n if (data == null) {\n if (isIterable(ticks)) {\n // Use explicit ticks, if specified.\n data = arrayify(ticks);\n } else if (isInterval(ticks)) {\n // Use the tick interval, if specified.\n data = inclusiveRange(ticks, ...extent(domain));\n } else if (scale.interval) {\n // If the scale interval is a standard time interval such as \"day\", we\n // may be able to generalize the scale interval it to a larger aligned\n // time interval to create the desired number of ticks.\n let interval = scale.interval;\n if (scale.ticks) {\n const [min, max] = extent(domain);\n const n = (max - min) / interval[intervalDuration]; // current tick count\n // We don\u2019t explicitly check that given interval is a time interval;\n // in that case the generalized interval will be undefined, just like\n // a nonstandard interval. TODO Generalize integer intervals, too.\n interval = generalizeTimeInterval(interval, n / ticks) ?? interval;\n data = inclusiveRange(interval, min, max);\n } else {\n data = domain;\n const n = data.length; // current tick count\n interval = generalizeTimeInterval(interval, n / ticks) ?? interval;\n if (interval !== scale.interval) data = inclusiveRange(interval, ...extent(data));\n }\n if (interval === scale.interval) {\n // If we weren\u2019t able to generalize the scale\u2019s interval, compute the\n // positive number n such that taking every nth value from the scale\u2019s\n // domain produces as close as possible to the desired number of\n // ticks. For example, if the domain has 100 values and 5 ticks are\n // desired, n = 20.\n const n = Math.round(data.length / ticks);\n if (n > 1) data = data.filter((d, i) => i % n === 0);\n }\n } else if (scale.ticks) {\n data = scale.ticks(ticks);\n } else {\n // For ordinal scales, the domain will already be generated using the\n // scale\u2019s interval, if any.\n data = domain;\n }\n if (!scale.ticks && data.length && data !== domain) {\n // For ordinal scales, intersect the ticks with the scale domain since\n // the scale is only defined on its domain. If all of the ticks are\n // removed, then warn that the ticks and scale domain may be misaligned\n // (e.g., \"year\" ticks and \"4 weeks\" interval).\n const domainSet = new InternSet(domain);\n data = data.filter((d) => domainSet.has(d));\n if (!data.length) warn(`Warning: the ${k}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`); // prettier-ignore\n }\n if (k === \"y\" || k === \"x\") {\n facets = [range(data)];\n } else {\n channels[k] = {scale: k, value: identity};\n }\n }\n initialize?.call(this, scale, data, ticks, tickFormat, channels);\n const initializedChannels = Object.fromEntries(\n Object.entries(channels).map(([name, channel]) => {\n return [name, {...channel, value: valueof(data, channel.value)}];\n })\n );\n if (initializeFacets) facets = context.filterFacets(data, initializedChannels);\n return {data, facets, channels: initializedChannels};\n }\n\n // Apply any basic initializers after the axis initializer computes the ticks.\n const basicInitializer = initializer(options).initializer;\n const m = mark(data, initializer({...options, initializer: axisInitializer}, basicInitializer));\n if (data == null) {\n channels = m.channels;\n m.channels = {};\n } else {\n channels = {};\n }\n if (properties !== undefined) Object.assign(m, properties);\n if (m.clip === undefined) m.clip = false; // don\u2019t clip axes by default\n return m;\n}\n\nfunction inferTickCount(scale, tickSpacing) {\n const [min, max] = extent(scale.range());\n return (max - min) / tickSpacing;\n}\n\nfunction inferTextChannel(scale, data, ticks, tickFormat, anchor) {\n return {value: inferTickFormat(scale, data, ticks, tickFormat, anchor)};\n}\n\n// D3\u2019s ordinal scales simply use toString by default, but if the ordinal scale\n// domain (or ticks) are numbers or dates (say because we\u2019re applying a time\n// interval to the ordinal scale), we want Plot\u2019s default formatter. And for\n// time ticks, we want to use the multi-line time format (e.g., Jan 26) if\n// possible, or the default ISO format (2014-01-26). TODO We need a better way\n// to infer whether the ordinal scale is UTC or local time.\nexport function inferTickFormat(scale, data, ticks, tickFormat, anchor) {\n return typeof tickFormat === \"function\"\n ? tickFormat\n : tickFormat === undefined && data && isTemporal(data)\n ? inferTimeFormat(scale.type, data, anchor) ?? formatDefault\n : scale.tickFormat\n ? scale.tickFormat(typeof ticks === \"number\" ? ticks : null, tickFormat)\n : tickFormat === undefined\n ? formatDefault\n : typeof tickFormat === \"string\"\n ? (isTemporal(scale.domain()) ? utcFormat : format)(tickFormat)\n : constant(tickFormat);\n}\n\nfunction inclusiveRange(interval, min, max) {\n return interval.range(min, interval.offset(interval.floor(max)));\n}\n\nconst shapeTickBottom = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(0, l);\n }\n};\n\nconst shapeTickTop = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(0, -l);\n }\n};\n\nconst shapeTickLeft = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(-l, 0);\n }\n};\n\nconst shapeTickRight = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(l, 0);\n }\n};\n\n// TODO Unify this with the other inferFontVariant; here we only have a scale\n// function rather than a scale descriptor.\nfunction inferFontVariant(scale) {\n return scale.bandwidth && !scale.interval ? undefined : \"tabular-nums\";\n}\n\n// Takes the scale label, and if this is not an ordinal scale and the label was\n// inferred from an associated channel, adds an orientation-appropriate arrow.\nfunction formatAxisLabel(k, scale, {anchor, label = scale.label, labelAnchor, labelArrow} = {}) {\n if (label == null || (label.inferred && hasTemporalDomain(scale) && /^(date|time|year)$/i.test(label))) return;\n label = String(label); // coerce to a string after checking if inferred\n if (labelArrow === \"auto\") labelArrow = (!scale.bandwidth || scale.interval) && !/[\u2191\u2193\u2192\u2190]/.test(label);\n if (!labelArrow) return label;\n if (labelArrow === true) {\n const order = inferScaleOrder(scale);\n if (order)\n labelArrow =\n /x$/.test(k) || labelAnchor === \"center\"\n ? /x$/.test(k) === order < 0\n ? \"left\"\n : \"right\"\n : order < 0\n ? \"up\"\n : \"down\";\n }\n switch (labelArrow) {\n case \"left\":\n return `\u2190 ${label}`;\n case \"right\":\n return `${label} \u2192`;\n case \"up\":\n return anchor === \"right\" ? `${label} \u2191` : `\u2191 ${label}`;\n case \"down\":\n return anchor === \"right\" ? `${label} \u2193` : `\u2193 ${label}`;\n }\n return label;\n}\n\nfunction maybeLabelArrow(labelArrow = \"auto\") {\n return isNoneish(labelArrow)\n ? false\n : typeof labelArrow === \"boolean\"\n ? labelArrow\n : keyword(labelArrow, \"labelArrow\", [\"auto\", \"up\", \"right\", \"down\", \"left\"]);\n}\n\nfunction hasTemporalDomain(scale) {\n return isTemporal(scale.domain());\n}\n", "import {pathRound as path} from \"d3\";\nimport {inferFontVariant} from \"../axes.js\";\nimport {create, createContext} from \"../context.js\";\nimport {isNoneish, maybeColorChannel, maybeNumberChannel} from \"../options.js\";\nimport {isOrdinalScale, isThresholdScale} from \"../scales.js\";\nimport {applyInlineStyles, impliedString, maybeClassName} from \"../style.js\";\nimport {inferTickFormat} from \"../marks/axis.js\";\n\nfunction maybeScale(scale, key) {\n if (key == null) return key;\n const s = scale(key);\n if (!s) throw new Error(`scale not found: ${key}`);\n return s;\n}\n\nexport function legendSwatches(color, {opacity, ...options} = {}) {\n if (!isOrdinalScale(color) && !isThresholdScale(color))\n throw new Error(`swatches legend requires ordinal or threshold color scale (not ${color.type})`);\n return legendItems(color, options, (selection, scale, width, height) =>\n selection\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"fill\", scale.scale)\n .attr(\"fill-opacity\", maybeNumberChannel(opacity)[1])\n .append(\"rect\")\n .attr(\"width\", \"100%\")\n .attr(\"height\", \"100%\")\n );\n}\n\nexport function legendSymbols(\n symbol,\n {\n fill = symbol.hint?.fill !== undefined ? symbol.hint.fill : \"none\",\n fillOpacity = 1,\n stroke = symbol.hint?.stroke !== undefined ? symbol.hint.stroke : isNoneish(fill) ? \"currentColor\" : \"none\",\n strokeOpacity = 1,\n strokeWidth = 1.5,\n r = 4.5,\n ...options\n } = {},\n scale\n) {\n const [vf, cf] = maybeColorChannel(fill);\n const [vs, cs] = maybeColorChannel(stroke);\n const sf = maybeScale(scale, vf);\n const ss = maybeScale(scale, vs);\n const size = r * r * Math.PI;\n fillOpacity = maybeNumberChannel(fillOpacity)[1];\n strokeOpacity = maybeNumberChannel(strokeOpacity)[1];\n strokeWidth = maybeNumberChannel(strokeWidth)[1];\n return legendItems(symbol, options, (selection, scale, width, height) =>\n selection\n .append(\"svg\")\n .attr(\"viewBox\", \"-8 -8 16 16\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"fill\", vf === \"color\" ? (d) => sf.scale(d) : cf)\n .attr(\"fill-opacity\", fillOpacity)\n .attr(\"stroke\", vs === \"color\" ? (d) => ss.scale(d) : cs)\n .attr(\"stroke-opacity\", strokeOpacity)\n .attr(\"stroke-width\", strokeWidth)\n .append(\"path\")\n .attr(\"d\", (d) => {\n const p = path();\n symbol.scale(d).draw(p, size);\n return p;\n })\n );\n}\n\nfunction legendItems(scale, options = {}, swatch) {\n let {\n columns,\n tickFormat,\n fontVariant = inferFontVariant(scale),\n // TODO label,\n swatchSize = 15,\n swatchWidth = swatchSize,\n swatchHeight = swatchSize,\n marginLeft = 0,\n className,\n style,\n width\n } = options;\n const context = createContext(options);\n className = maybeClassName(className);\n tickFormat = inferTickFormat(scale.scale, scale.domain, undefined, tickFormat);\n\n const swatches = create(\"div\", context).attr(\n \"class\",\n `${className}-swatches ${className}-swatches-${columns != null ? \"columns\" : \"wrap\"}`\n );\n\n let extraStyle;\n\n if (columns != null) {\n extraStyle = `:where(.${className}-swatches-columns .${className}-swatch) {\n display: flex;\n align-items: center;\n break-inside: avoid;\n padding-bottom: 1px;\n}\n:where(.${className}-swatches-columns .${className}-swatch::before) {\n flex-shrink: 0;\n}\n:where(.${className}-swatches-columns .${className}-swatch-label) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}`;\n\n swatches\n .style(\"columns\", columns)\n .selectAll()\n .data(scale.domain)\n .enter()\n .append(\"div\")\n .attr(\"class\", `${className}-swatch`)\n .call(swatch, scale, swatchWidth, swatchHeight)\n .call((item) =>\n item.append(\"div\").attr(\"class\", `${className}-swatch-label`).attr(\"title\", tickFormat).text(tickFormat)\n );\n } else {\n extraStyle = `:where(.${className}-swatches-wrap) {\n display: flex;\n align-items: center;\n min-height: 33px;\n flex-wrap: wrap;\n}\n:where(.${className}-swatches-wrap .${className}-swatch) {\n display: inline-flex;\n align-items: center;\n margin-right: 1em;\n}`;\n\n swatches\n .selectAll()\n .data(scale.domain)\n .enter()\n .append(\"span\")\n .attr(\"class\", `${className}-swatch`)\n .call(swatch, scale, swatchWidth, swatchHeight)\n .append(function () {\n return this.ownerDocument.createTextNode(tickFormat.apply(this, arguments));\n });\n }\n\n return swatches\n .call((div) =>\n div.insert(\"style\", \"*\").text(\n `:where(.${className}-swatches) {\n font-family: system-ui, sans-serif;\n font-size: 10px;\n margin-bottom: 0.5em;\n}\n:where(.${className}-swatch > svg) {\n margin-right: 0.5em;\n overflow: visible;\n}\n${extraStyle}`\n )\n )\n .style(\"margin-left\", marginLeft ? `${+marginLeft}px` : null)\n .style(\"width\", width === undefined ? null : `${+width}px`)\n .style(\"font-variant\", impliedString(fontVariant, \"normal\"))\n .call(applyInlineStyles, style)\n .node();\n}\n", "import {rgb} from \"d3\";\nimport {createContext} from \"./context.js\";\nimport {legendRamp} from \"./legends/ramp.js\";\nimport {legendSwatches, legendSymbols} from \"./legends/swatches.js\";\nimport {inherit, isScaleOptions} from \"./options.js\";\nimport {normalizeScale} from \"./scales.js\";\n\nconst legendRegistry = new Map([\n [\"symbol\", legendSymbols],\n [\"color\", legendColor],\n [\"opacity\", legendOpacity]\n]);\n\nexport function legend(options = {}) {\n for (const [key, value] of legendRegistry) {\n const scale = options[key];\n if (isScaleOptions(scale)) {\n // e.g., ignore {color: \"red\"}\n const context = createContext(options);\n let hint;\n // For symbol legends, pass a hint to the symbol scale.\n if (key === \"symbol\") {\n const {fill, stroke = fill === undefined && isScaleOptions(options.color) ? \"color\" : undefined} = options;\n hint = {fill, stroke};\n }\n return value(normalizeScale(key, scale, hint), legendOptions(context, scale, options), (key) =>\n isScaleOptions(options[key]) ? normalizeScale(key, options[key]) : null\n );\n }\n }\n throw new Error(\"unknown legend type; no scale found\");\n}\n\nexport function exposeLegends(scales, context, defaults = {}) {\n return (key, options) => {\n if (!legendRegistry.has(key)) throw new Error(`unknown legend type: ${key}`);\n if (!(key in scales)) return;\n return legendRegistry.get(key)(scales[key], legendOptions(context, defaults[key], options), (key) => scales[key]);\n };\n}\n\nfunction legendOptions({className, ...context}, {label, ticks, tickFormat} = {}, options) {\n return inherit(options, {className, ...context}, {label, ticks, tickFormat});\n}\n\nfunction legendColor(color, {legend = true, ...options}) {\n if (legend === true) legend = color.type === \"ordinal\" ? \"swatches\" : \"ramp\";\n if (color.domain === undefined) return;\n switch (`${legend}`.toLowerCase()) {\n case \"swatches\":\n return legendSwatches(color, options);\n case \"ramp\":\n return legendRamp(color, options);\n default:\n throw new Error(`unknown legend type: ${legend}`);\n }\n}\n\nfunction legendOpacity({type, interpolate, ...scale}, {legend = true, color = rgb(0, 0, 0), ...options}) {\n if (!interpolate) throw new Error(`${type} opacity scales are not supported`);\n if (legend === true) legend = \"ramp\";\n if (`${legend}`.toLowerCase() !== \"ramp\") throw new Error(`${legend} opacity legends are not supported`);\n return legendColor({type, ...scale, interpolate: interpolateOpacity(color)}, {legend, ...options});\n}\n\nfunction interpolateOpacity(color) {\n const {r, g, b} = rgb(color) || rgb(0, 0, 0); // treat invalid color as black\n return (t) => `rgba(${r},${g},${b},${t})`;\n}\n\nexport function createLegends(scales, context, options) {\n const legends = [];\n for (const [key, value] of legendRegistry) {\n const o = options[key];\n if (o?.legend && key in scales) {\n const legend = value(scales[key], legendOptions(context, scales[key], o), (key) => scales[key]);\n if (legend != null) legends.push(legend);\n }\n }\n return legends;\n}\n", "import {create} from \"../context.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeKeyword, number, singleton} from \"../options.js\";\nimport {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform} from \"../style.js\";\n\nconst defaults = {\n ariaLabel: \"frame\",\n fill: \"none\",\n stroke: \"currentColor\",\n clip: false\n};\n\nconst lineDefaults = {\n ariaLabel: \"frame\",\n fill: null,\n stroke: \"currentColor\",\n strokeLinecap: \"square\",\n clip: false\n};\n\nexport class Frame extends Mark {\n constructor(options = {}) {\n const {\n anchor = null,\n inset = 0,\n insetTop = inset,\n insetRight = inset,\n insetBottom = inset,\n insetLeft = inset,\n rx,\n ry\n } = options;\n super(singleton, undefined, options, anchor == null ? defaults : lineDefaults);\n this.anchor = maybeKeyword(anchor, \"anchor\", [\"top\", \"right\", \"bottom\", \"left\"]);\n this.insetTop = number(insetTop);\n this.insetRight = number(insetRight);\n this.insetBottom = number(insetBottom);\n this.insetLeft = number(insetLeft);\n this.rx = number(rx);\n this.ry = number(ry);\n }\n render(index, scales, channels, dimensions, context) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = dimensions;\n const {anchor, insetTop, insetRight, insetBottom, insetLeft, rx, ry} = this;\n const x1 = marginLeft + insetLeft;\n const x2 = width - marginRight - insetRight;\n const y1 = marginTop + insetTop;\n const y2 = height - marginBottom - insetBottom;\n return create(anchor ? \"svg:line\" : \"svg:rect\", context)\n .datum(0)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyDirectStyles, this)\n .call(applyChannelStyles, this, channels)\n .call(applyTransform, this, {})\n .call(\n anchor === \"left\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x1).attr(\"y1\", y1).attr(\"y2\", y2)\n : anchor === \"right\"\n ? (line) => line.attr(\"x1\", x2).attr(\"x2\", x2).attr(\"y1\", y1).attr(\"y2\", y2)\n : anchor === \"top\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x2).attr(\"y1\", y1).attr(\"y2\", y1)\n : anchor === \"bottom\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x2).attr(\"y1\", y2).attr(\"y2\", y2)\n : (rect) =>\n rect\n .attr(\"x\", x1)\n .attr(\"y\", y1)\n .attr(\"width\", x2 - x1)\n .attr(\"height\", y2 - y1)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry)\n )\n .node();\n }\n}\n\nexport function frame(options) {\n return new Frame(options);\n}\n", "import {select, format as numberFormat, utcFormat} from \"d3\";\nimport {getSource} from \"../channel.js\";\nimport {create} from \"../context.js\";\nimport {defined} from \"../defined.js\";\nimport {formatDefault} from \"../format.js\";\nimport {anchorX, anchorY} from \"../interactions/pointer.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeAnchor, maybeFrameAnchor, maybeTuple, number, string} from \"../options.js\";\nimport {applyDirectStyles, applyFrameAnchor, applyIndirectStyles, applyTransform, impliedString} from \"../style.js\";\nimport {identity, isIterable, isTemporal, isTextual} from \"../options.js\";\nimport {inferTickFormat} from \"./axis.js\";\nimport {applyIndirectTextStyles, defaultWidth, ellipsis, monospaceWidth} from \"./text.js\";\nimport {cut, clipper, splitter, maybeTextOverflow} from \"./text.js\";\n\nconst defaults = {\n ariaLabel: \"tip\",\n fill: \"var(--plot-background)\",\n stroke: \"currentColor\"\n};\n\n// These channels are not displayed in the default tip; see formatChannels.\nconst ignoreChannels = new Set([\"geometry\", \"href\", \"src\", \"ariaLabel\", \"scales\"]);\n\nexport class Tip extends Mark {\n constructor(data, options = {}) {\n if (options.tip) options = {...options, tip: false};\n if (options.title === undefined && isIterable(data) && isTextual(data)) options = {...options, title: identity};\n const {\n x,\n y,\n x1,\n x2,\n y1,\n y2,\n anchor,\n preferredAnchor = \"bottom\",\n monospace,\n fontFamily = monospace ? \"ui-monospace, monospace\" : undefined,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n lineHeight = 1,\n lineWidth = 20,\n frameAnchor,\n format,\n textAnchor = \"start\",\n textOverflow,\n textPadding = 8,\n title,\n pointerSize = 12,\n pathFilter = \"drop-shadow(0 3px 4px rgba(0,0,0,0.2))\"\n } = options;\n super(\n data,\n {\n x: {value: x1 != null && x2 != null ? null : x, scale: \"x\", optional: true}, // ignore midpoint\n y: {value: y1 != null && y2 != null ? null : y, scale: \"y\", optional: true}, // ignore midpoint\n x1: {value: x1, scale: \"x\", optional: x2 == null},\n y1: {value: y1, scale: \"y\", optional: y2 == null},\n x2: {value: x2, scale: \"x\", optional: x1 == null},\n y2: {value: y2, scale: \"y\", optional: y1 == null},\n title: {value: title, optional: true} // filter: defined\n },\n options,\n defaults\n );\n this.anchor = maybeAnchor(anchor, \"anchor\");\n this.preferredAnchor = maybeAnchor(preferredAnchor, \"preferredAnchor\");\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n this.textAnchor = impliedString(textAnchor, \"middle\");\n this.textPadding = +textPadding;\n this.pointerSize = +pointerSize;\n this.pathFilter = string(pathFilter);\n this.lineHeight = +lineHeight;\n this.lineWidth = +lineWidth;\n this.textOverflow = maybeTextOverflow(textOverflow);\n this.monospace = !!monospace;\n this.fontFamily = string(fontFamily);\n this.fontSize = number(fontSize);\n this.fontStyle = string(fontStyle);\n this.fontVariant = string(fontVariant);\n this.fontWeight = string(fontWeight);\n for (const key in defaults) if (key in this.channels) this[key] = defaults[key]; // apply default even if channel\n this.splitLines = splitter(this);\n this.clipLine = clipper(this);\n this.format = {...format}; // defensive copy before mutate; also promote nullish to empty\n }\n render(index, scales, values, dimensions, context) {\n const mark = this;\n const {x, y, fx, fy} = scales;\n const {ownerSVGElement: svg, document} = context;\n const {anchor, monospace, lineHeight, lineWidth} = this;\n const {textPadding: r, pointerSize: m, pathFilter} = this;\n const {marginTop, marginLeft} = dimensions;\n\n // The anchor position is the middle of x1 & y1 and x2 & y2, if available,\n // or x & y; the former is considered more specific because it\u2019s how we\n // disable the implicit stack and interval transforms. If any dimension is\n // unspecified, we fallback to the frame anchor. We also need to know the\n // facet offsets to detect when the tip would draw outside the plot, and\n // thus we need to change the orientation.\n const {x1: X1, y1: Y1, x2: X2, y2: Y2, x: X = X1 ?? X2, y: Y = Y1 ?? Y2} = values;\n const ox = fx ? fx(index.fx) - marginLeft : 0;\n const oy = fy ? fy(index.fy) - marginTop : 0;\n\n // The order of precedence for the anchor position is: the middle of x1 & y1\n // and x2 & y2; or x1 & y1 (e.g., area); or lastly x & y. If a dimension is\n // unspecified, the frame anchor is used.\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n const px = anchorX(values, cx);\n const py = anchorY(values, cy);\n\n // Resolve the text metric implementation. We may need an ellipsis for text\n // truncation, so we optimistically compute the ellipsis width.\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const ee = widthof(ellipsis);\n\n // If there\u2019s a title channel, display that as-is; otherwise, show multiple\n // channels as name-value pairs.\n let sources, format;\n if (\"title\" in values) {\n sources = values.channels;\n format = formatTitle;\n } else {\n sources = getSourceChannels.call(this, values, scales);\n format = formatChannels;\n }\n\n // We don\u2019t call applyChannelStyles because we only use the channels to\n // derive the content of the tip, not its aesthetics.\n const g = create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyIndirectTextStyles, this)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"g\")\n .attr(\"transform\", (i) => `translate(${Math.round(px(i))},${Math.round(py(i))})`) // crisp edges\n .call(applyDirectStyles, this)\n .call((g) => g.append(\"path\").attr(\"filter\", pathFilter))\n .call((g) =>\n g.append(\"text\").each(function (i) {\n const that = select(this);\n // prevent style inheritance (from path)\n this.setAttribute(\"fill\", \"currentColor\");\n this.setAttribute(\"fill-opacity\", 1);\n this.setAttribute(\"stroke\", \"none\");\n // iteratively render each channel value\n const lines = format.call(mark, i, index, sources, scales, values);\n if (typeof lines === \"string\") {\n for (const line of mark.splitLines(lines)) {\n renderLine(that, {value: mark.clipLine(line)});\n }\n } else {\n const labels = new Set();\n for (const line of lines) {\n const {label = \"\"} = line;\n if (label && labels.has(label)) continue;\n else labels.add(label);\n renderLine(that, line);\n }\n }\n })\n )\n );\n\n // Renders a single line (a name-value pair) to the tip, truncating the text\n // as needed, and adding a title if the text is truncated. Note that this is\n // just the initial layout of the text; in postrender we will compute the\n // exact text metrics and translate the text as needed once we know the\n // tip\u2019s orientation (anchor).\n function renderLine(selection, {label, value, color, opacity}) {\n (label ??= \"\"), (value ??= \"\");\n const swatch = color != null || opacity != null;\n let title;\n let w = lineWidth * 100;\n const [j] = cut(label, w, widthof, ee);\n if (j >= 0) {\n // label is truncated\n label = label.slice(0, j).trimEnd() + ellipsis;\n title = value.trim();\n value = \"\";\n } else {\n if (label || (!value && !swatch)) value = \" \" + value;\n const [k] = cut(value, w - widthof(label), widthof, ee);\n if (k >= 0) {\n // value is truncated\n title = value.trim();\n value = value.slice(0, k).trimEnd() + ellipsis;\n }\n }\n const line = selection.append(\"tspan\").attr(\"x\", 0).attr(\"dy\", `${lineHeight}em`).text(\"\\u200b\"); // zwsp for double-click\n if (label) line.append(\"tspan\").attr(\"font-weight\", \"bold\").text(label);\n if (value) line.append(() => document.createTextNode(value));\n if (swatch) line.append(\"tspan\").text(\" \u25A0\").attr(\"fill\", color).attr(\"fill-opacity\", opacity).style(\"user-select\", \"none\"); // prettier-ignore\n if (title) line.append(\"title\").text(title);\n }\n\n // Only after the plot is attached to the page can we compute the exact text\n // metrics needed to determine the tip size and orientation (anchor).\n function postrender() {\n const {width, height} = dimensions.facet ?? dimensions;\n g.selectChildren().each(function (i) {\n let {x: tx, width: w, height: h} = this.getBBox();\n (w = Math.round(w)), (h = Math.round(h)); // crisp edges\n let a = anchor; // use the specified anchor, if any\n if (a === undefined) {\n const x = px(i) + ox;\n const y = py(i) + oy;\n const fitLeft = x + w + m + r * 2 < width;\n const fitRight = x - w - m - r * 2 > 0;\n const fitTop = y + h + m + r * 2 < height;\n const fitBottom = y - h - m - r * 2 > 0;\n a =\n fitLeft && fitRight\n ? fitTop && fitBottom\n ? mark.preferredAnchor\n : fitBottom\n ? \"bottom\"\n : \"top\"\n : fitTop && fitBottom\n ? fitLeft\n ? \"left\"\n : \"right\"\n : (fitLeft || fitRight) && (fitTop || fitBottom)\n ? `${fitBottom ? \"bottom\" : \"top\"}-${fitLeft ? \"left\" : \"right\"}`\n : mark.preferredAnchor;\n }\n const path = this.firstChild; // note: assumes exactly two children!\n const text = this.lastChild; // note: assumes exactly two children!\n path.setAttribute(\"d\", getPath(a, m, r, w, h));\n if (tx) for (const t of text.childNodes) t.setAttribute(\"x\", -tx);\n text.setAttribute(\"y\", `${+getLineOffset(a, text.childNodes.length, lineHeight).toFixed(6)}em`);\n text.setAttribute(\"transform\", `translate(${getTextTranslate(a, m, r, w, h)})`);\n });\n g.attr(\"visibility\", null);\n }\n\n // Wait until the plot is inserted into the page so that we can use getBBox\n // to compute the exact text dimensions. If the SVG is already connected, as\n // when the pointer interaction triggers the re-render, use a faster\n // microtask instead of an animation frame; if this SSR (e.g., JSDOM), skip\n // this step. Perhaps this could be done synchronously; getting the\n // dimensions of the SVG is easy, and although accurate text metrics are\n // hard, we could use approximate heuristics.\n if (index.length) {\n g.attr(\"visibility\", \"hidden\"); // hide until postrender\n if (svg.isConnected) Promise.resolve().then(postrender);\n else if (typeof requestAnimationFrame !== \"undefined\") requestAnimationFrame(postrender);\n }\n\n return g.node();\n }\n}\n\nexport function tip(data, {x, y, ...options} = {}) {\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Tip(data, {...options, x, y});\n}\n\nfunction getLineOffset(anchor, length, lineHeight) {\n return /^top(?:-|$)/.test(anchor)\n ? 0.94 - lineHeight\n : /^bottom(?:-|$)/\n ? -0.29 - length * lineHeight\n : (length / 2) * lineHeight;\n}\n\nfunction getTextTranslate(anchor, m, r, width, height) {\n switch (anchor) {\n case \"middle\":\n return [-width / 2, height / 2];\n case \"top-left\":\n return [r, m + r];\n case \"top\":\n return [-width / 2, m / 2 + r];\n case \"top-right\":\n return [-width - r, m + r];\n case \"right\":\n return [-m / 2 - width - r, height / 2];\n case \"bottom-left\":\n return [r, -m - r];\n case \"bottom\":\n return [-width / 2, -m / 2 - r];\n case \"bottom-right\":\n return [-width - r, -m - r];\n case \"left\":\n return [r + m / 2, height / 2];\n }\n}\n\nfunction getPath(anchor, m, r, width, height) {\n const w = width + r * 2;\n const h = height + r * 2;\n switch (anchor) {\n case \"middle\":\n return `M${-w / 2},${-h / 2}h${w}v${h}h${-w}z`;\n case \"top-left\":\n return `M0,0l${m},${m}h${w - m}v${h}h${-w}z`;\n case \"top\":\n return `M0,0l${m / 2},${m / 2}h${(w - m) / 2}v${h}h${-w}v${-h}h${(w - m) / 2}z`;\n case \"top-right\":\n return `M0,0l${-m},${m}h${m - w}v${h}h${w}z`;\n case \"right\":\n return `M0,0l${-m / 2},${-m / 2}v${m / 2 - h / 2}h${-w}v${h}h${w}v${m / 2 - h / 2}z`;\n case \"bottom-left\":\n return `M0,0l${m},${-m}h${w - m}v${-h}h${-w}z`;\n case \"bottom\":\n return `M0,0l${m / 2},${-m / 2}h${(w - m) / 2}v${-h}h${-w}v${h}h${(w - m) / 2}z`;\n case \"bottom-right\":\n return `M0,0l${-m},${-m}h${m - w}v${-h}h${w}z`;\n case \"left\":\n return `M0,0l${m / 2},${-m / 2}v${m / 2 - h / 2}h${w}v${h}h${-w}v${m / 2 - h / 2}z`;\n }\n}\n\n// Note: mutates this.format!\nfunction getSourceChannels({channels}, scales) {\n const sources = {};\n\n // Promote x and y shorthand for paired channels (in order).\n let format = this.format;\n format = maybeExpandPairedFormat(format, channels, \"x\");\n format = maybeExpandPairedFormat(format, channels, \"y\");\n this.format = format;\n\n // Prioritize channels with explicit formats, in the given order.\n for (const key in format) {\n const value = format[key];\n if (value === null || value === false) {\n continue;\n } else if (key === \"fx\" || key === \"fy\") {\n sources[key] = true;\n } else {\n const source = getSource(channels, key);\n if (source) sources[key] = source;\n }\n }\n\n // Then fallback to all other (non-ignored) channels.\n for (const key in channels) {\n if (key in sources || key in format || ignoreChannels.has(key)) continue;\n const source = getSource(channels, key);\n if (source) sources[key] = source;\n }\n\n // And lastly facet channels, but only if this mark is faceted.\n if (this.facet) {\n if (scales.fx && !(\"fx\" in format)) sources.fx = true;\n if (scales.fy && !(\"fy\" in format)) sources.fy = true;\n }\n\n // Promote shorthand string formats, and materialize default formats.\n for (const key in sources) {\n const format = this.format[key];\n if (typeof format === \"string\") {\n const value = sources[key]?.value ?? scales[key]?.domain() ?? [];\n this.format[key] = (isTemporal(value) ? utcFormat : numberFormat)(format);\n } else if (format === undefined || format === true) {\n // For ordinal scales, the inferred tick format can be more concise, such\n // as only showing the year for yearly data.\n const scale = scales[key];\n this.format[key] = scale?.bandwidth ? inferTickFormat(scale, scale.domain()) : formatDefault;\n }\n }\n\n return sources;\n}\n\n// Promote x and y shorthand for paired channels, while preserving order.\nfunction maybeExpandPairedFormat(format, channels, key) {\n if (!(key in format)) return format;\n const key1 = `${key}1`;\n const key2 = `${key}2`;\n if ((key1 in format || !(key1 in channels)) && (key2 in format || !(key2 in channels))) return format;\n const entries = Object.entries(format);\n const value = format[key];\n entries.splice(entries.findIndex(([name]) => name === key) + 1, 0, [key1, value], [key2, value]);\n return Object.fromEntries(entries);\n}\n\nfunction formatTitle(i, index, {title}) {\n return formatDefault(title.value[i], i);\n}\n\nfunction* formatChannels(i, index, channels, scales, values) {\n for (const key in channels) {\n if (key === \"fx\" || key === \"fy\") {\n yield {\n label: formatLabel(scales, channels, key),\n value: this.format[key](index[key], i)\n };\n continue;\n }\n if (key === \"x1\" && \"x2\" in channels) continue;\n if (key === \"y1\" && \"y2\" in channels) continue;\n const channel = channels[key];\n if (key === \"x2\" && \"x1\" in channels) {\n yield {\n label: formatPairLabel(scales, channels, \"x\"),\n value: formatPair(this.format.x2, channels.x1, channel, i)\n };\n } else if (key === \"y2\" && \"y1\" in channels) {\n yield {\n label: formatPairLabel(scales, channels, \"y\"),\n value: formatPair(this.format.y2, channels.y1, channel, i)\n };\n } else {\n const value = channel.value[i];\n const scale = channel.scale;\n if (!defined(value) && scale == null) continue;\n yield {\n label: formatLabel(scales, channels, key),\n value: this.format[key](value, i),\n color: scale === \"color\" ? values[key][i] : null,\n opacity: scale === \"opacity\" ? values[key][i] : null\n };\n }\n }\n}\n\nfunction formatPair(formatValue, c1, c2, i) {\n return c2.hint?.length // e.g., stackY\u2019s y1 and y2\n ? `${formatValue(c2.value[i] - c1.value[i], i)}`\n : `${formatValue(c1.value[i], i)}\u2013${formatValue(c2.value[i], i)}`;\n}\n\nfunction formatPairLabel(scales, channels, key) {\n const l1 = formatLabel(scales, channels, `${key}1`, key);\n const l2 = formatLabel(scales, channels, `${key}2`, key);\n return l1 === l2 ? l1 : `${l1}\u2013${l2}`;\n}\n\nfunction formatLabel(scales, channels, key, defaultLabel = key) {\n const channel = channels[key];\n const scale = scales[channel?.scale ?? key];\n return String(scale?.label ?? channel?.label ?? defaultLabel);\n}\n", "import {creator, select} from \"d3\";\nimport {createChannel, inferChannelScale} from \"./channel.js\";\nimport {createContext} from \"./context.js\";\nimport {createDimensions} from \"./dimensions.js\";\nimport {createFacets, recreateFacets, facetExclude, facetGroups, facetTranslator, facetFilter} from \"./facet.js\";\nimport {pointer, pointerX, pointerY} from \"./interactions/pointer.js\";\nimport {createLegends, exposeLegends} from \"./legends.js\";\nimport {Mark} from \"./mark.js\";\nimport {axisFx, axisFy, axisX, axisY, gridFx, gridFy, gridX, gridY} from \"./marks/axis.js\";\nimport {frame} from \"./marks/frame.js\";\nimport {tip} from \"./marks/tip.js\";\nimport {isColor, isIterable, isNone, isScaleOptions} from \"./options.js\";\nimport {arrayify, map, yes, maybeIntervalTransform, subarray} from \"./options.js\";\nimport {createProjection, getGeometryChannels, hasProjection} from \"./projection.js\";\nimport {createScales, createScaleFunctions, autoScaleRange, exposeScales} from \"./scales.js\";\nimport {innerDimensions, outerDimensions} from \"./scales.js\";\nimport {isPosition, registry as scaleRegistry} from \"./scales/index.js\";\nimport {applyInlineStyles, maybeClassName} from \"./style.js\";\nimport {initializer} from \"./transforms/basic.js\";\nimport {consumeWarnings, warn} from \"./warnings.js\";\n\nexport function plot(options = {}) {\n const {facet, style, title, subtitle, caption, ariaLabel, ariaDescription} = options;\n\n // className for inline styles\n const className = maybeClassName(options.className);\n\n // Flatten any nested marks.\n const marks = options.marks === undefined ? [] : flatMarks(options.marks);\n\n // Add implicit tips.\n marks.push(...inferTips(marks));\n\n // Compute the top-level facet state. This has roughly the same structure as\n // mark-specific facet state, except there isn\u2019t a facetsIndex, and there\u2019s a\n // data and dataLength so we can warn the user if a different data of the same\n // length is used in a mark.\n const topFacetState = maybeTopFacet(facet, options);\n\n // Construct a map from (faceted) Mark instance to facet state, including:\n // channels - an {fx?, fy?} object to add to the fx and fy scale\n // groups - a possibly-nested map from facet values to indexes in the data array\n // facetsIndex - a sparse nested array of indices corresponding to the valid facets\n const facetStateByMark = new Map();\n for (const mark of marks) {\n const facetState = maybeMarkFacet(mark, topFacetState, options);\n if (facetState) facetStateByMark.set(mark, facetState);\n }\n\n // Compute a Map from scale name to an array of associated channels.\n const channelsByScale = new Map();\n if (topFacetState) addScaleChannels(channelsByScale, [topFacetState], options);\n addScaleChannels(channelsByScale, facetStateByMark, options);\n\n // Add implicit axis marks. Because this happens after faceting (because it\n // depends on whether faceting is present), we must initialize the facet state\n // of any implicit axes, too.\n const axes = flatMarks(inferAxes(marks, channelsByScale, options));\n for (const mark of axes) {\n const facetState = maybeMarkFacet(mark, topFacetState, options);\n if (facetState) facetStateByMark.set(mark, facetState);\n }\n marks.unshift(...axes);\n\n // All the possible facets are given by the domains of the fx or fy scales, or\n // the cross-product of these domains if we facet by both x and y. We sort\n // them in order to apply the facet filters afterwards.\n let facets = createFacets(channelsByScale, options);\n\n if (facets !== undefined) {\n const topFacetsIndex = topFacetState ? facetFilter(facets, topFacetState) : undefined;\n\n // Compute a facet index for each mark, parallel to the facets array. For\n // mark-level facets, compute an index for that mark\u2019s data and options.\n // Otherwise, use the top-level facet index.\n for (const mark of marks) {\n if (mark.facet === null || mark.facet === \"super\") continue;\n const facetState = facetStateByMark.get(mark);\n if (facetState === undefined) continue;\n facetState.facetsIndex = mark.fx != null || mark.fy != null ? facetFilter(facets, facetState) : topFacetsIndex;\n }\n\n // The cross product of the domains of fx and fy can include fx-fy\n // combinations for which no mark has an instance associated with that\n // combination, and therefore we don\u2019t want to render this facet (not even\n // the frame). The same can occur if you specify the domain of fx and fy\n // explicitly, but there is no mark instance associated with some values in\n // the domain. Expunge empty facets, and clear the corresponding elements\n // from the nested index in each mark.\n const nonEmpty = new Set();\n for (const {facetsIndex} of facetStateByMark.values()) {\n facetsIndex?.forEach((index, i) => {\n if (index?.length > 0) {\n nonEmpty.add(i);\n }\n });\n }\n\n // If all the facets are empty (as when none of the marks are actually\n // faceted), none of them are empty.\n facets.forEach(\n 0 < nonEmpty.size && nonEmpty.size < facets.length\n ? (f, i) => (f.empty = !nonEmpty.has(i))\n : (f) => (f.empty = false)\n );\n\n // For any mark using the \u201Cexclude\u201D facet mode, invert the index.\n for (const mark of marks) {\n if (mark.facet === \"exclude\") {\n const facetState = facetStateByMark.get(mark);\n if (facetState !== undefined) facetState.facetsIndex = facetExclude(facetState.facetsIndex);\n }\n }\n }\n\n // If a scale is explicitly declared in options, initialize its associated\n // channels to the empty array; this will guarantee that a corresponding scale\n // will be created later (even if there are no other channels). Ignore facet\n // scale declarations, which are handled above.\n for (const key of scaleRegistry.keys()) {\n if (isScaleOptions(options[key]) && key !== \"fx\" && key !== \"fy\") {\n channelsByScale.set(key, []);\n }\n }\n\n // A Map from Mark instance to its render state, including:\n // index - the data index e.g. [0, 1, 2, 3, \u2026]\n // channels - an array of materialized channels e.g. [[\"x\", {value}], \u2026]\n // faceted - a boolean indicating whether this mark is faceted\n // values - an object of scaled values e.g. {x: [40, 32, \u2026], \u2026}\n const stateByMark = new Map();\n\n // Initialize the marks\u2019 state.\n for (const mark of marks) {\n if (stateByMark.has(mark)) throw new Error(\"duplicate mark; each mark must be unique\");\n const {facetsIndex, channels: facetChannels} = facetStateByMark.get(mark) ?? {};\n const {data, facets, channels} = mark.initialize(facetsIndex, facetChannels, options);\n applyScaleTransforms(channels, options);\n stateByMark.set(mark, {data, facets, channels});\n }\n\n // Initalize the scales and dimensions.\n const scaleDescriptors = createScales(addScaleChannels(channelsByScale, stateByMark, options), options);\n const dimensions = createDimensions(scaleDescriptors, marks, options);\n\n autoScaleRange(scaleDescriptors, dimensions);\n\n const scales = createScaleFunctions(scaleDescriptors);\n const {fx, fy} = scales;\n const subdimensions = fx || fy ? innerDimensions(scaleDescriptors, dimensions) : dimensions;\n const superdimensions = fx || fy ? actualDimensions(scales, dimensions) : dimensions;\n\n // Initialize the context.\n const context = createContext(options);\n const document = context.document;\n const svg = creator(\"svg\").call(document.documentElement);\n let figure = svg; // replaced with the figure element, if any\n context.ownerSVGElement = svg;\n context.className = className;\n context.projection = createProjection(options, subdimensions);\n\n // Allows e.g. the axis mark to determine faceting lazily.\n context.filterFacets = (data, channels) => {\n return facetFilter(facets, {channels, groups: facetGroups(data, channels)});\n };\n\n // Allows e.g. the tip mark to reference channels and data on other marks.\n context.getMarkState = (mark) => {\n const state = stateByMark.get(mark);\n const facetState = facetStateByMark.get(mark);\n return {...state, channels: {...state.channels, ...facetState?.channels}};\n };\n\n // Allows e.g. the pointer transform to support viewof.\n context.dispatchValue = (value) => {\n if (figure.value === value) return;\n figure.value = value;\n figure.dispatchEvent(new Event(\"input\", {bubbles: true}));\n };\n\n // Reinitialize; for deriving channels dependent on other channels.\n const newByScale = new Set();\n for (const [mark, state] of stateByMark) {\n if (mark.initializer != null) {\n const dimensions = mark.facet === \"super\" ? superdimensions : subdimensions;\n const update = mark.initializer(state.data, state.facets, state.channels, scales, dimensions, context);\n if (update.data !== undefined) {\n state.data = update.data;\n }\n if (update.facets !== undefined) {\n state.facets = update.facets;\n }\n if (update.channels !== undefined) {\n const {fx, fy, ...channels} = update.channels; // separate facet channels\n inferChannelScales(channels);\n Object.assign(state.channels, channels);\n for (const channel of Object.values(channels)) {\n const {scale} = channel;\n // Initializers aren\u2019t allowed to redefine position scales as this\n // would introduce a circular dependency; so simply scale these\n // channels as-is rather than creating new scales, and assume that\n // they already have the scale\u2019s transform applied, if any (e.g., when\n // generating ticks for the axis mark).\n if (scale != null && !isPosition(scaleRegistry.get(scale))) {\n applyScaleTransform(channel, options);\n newByScale.add(scale);\n }\n }\n // If the initializer returns new mark-level facet channels, we must\n // record that the mark is now faceted. Note: we aren\u2019t actually\n // populating the facet state, but subsequently we won\u2019t need it.\n if (fx != null || fy != null) facetStateByMark.set(mark, true);\n }\n }\n }\n\n // Reconstruct scales if new scaled channels were created during\n // reinitialization. Preserve existing scale labels, if any.\n if (newByScale.size) {\n const newChannelsByScale = new Map();\n addScaleChannels(newChannelsByScale, stateByMark, options, (key) => newByScale.has(key));\n addScaleChannels(channelsByScale, stateByMark, options, (key) => newByScale.has(key));\n const newScaleDescriptors = inheritScaleLabels(createScales(newChannelsByScale, options), scaleDescriptors);\n const {scales: newExposedScales, ...newScales} = createScaleFunctions(newScaleDescriptors);\n Object.assign(scaleDescriptors, newScaleDescriptors);\n Object.assign(scales, newScales);\n Object.assign(scales.scales, newExposedScales);\n }\n\n // Sort and filter the facets to match the fx and fy domains; this is needed\n // because the facets were constructed prior to the fx and fy scales.\n let facetDomains, facetTranslate;\n if (facets !== undefined) {\n facetDomains = {x: fx?.domain(), y: fy?.domain()};\n facets = recreateFacets(facets, facetDomains);\n facetTranslate = facetTranslator(fx, fy, dimensions);\n }\n\n // Compute value objects, applying scales and projection as needed.\n for (const [mark, state] of stateByMark) {\n state.values = mark.scale(state.channels, scales, context);\n }\n\n const {width, height} = dimensions;\n\n select(svg)\n .attr(\"class\", className)\n .attr(\"fill\", \"currentColor\")\n .attr(\"font-family\", \"system-ui, sans-serif\")\n .attr(\"font-size\", 10)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"viewBox\", `0 0 ${width} ${height}`)\n .attr(\"aria-label\", ariaLabel)\n .attr(\"aria-description\", ariaDescription)\n .call((svg) =>\n // Warning: if you edit this, change defaultClassName.\n svg.append(\"style\").text(\n `:where(.${className}) {\n --plot-background: white;\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n}\n:where(.${className} text),\n:where(.${className} tspan) {\n white-space: pre;\n}`\n )\n )\n .call(applyInlineStyles, style);\n\n // Render marks.\n for (const mark of marks) {\n const {channels, values, facets: indexes} = stateByMark.get(mark);\n\n // Render a non-faceted mark.\n if (facets === undefined || mark.facet === \"super\") {\n let index = null;\n if (indexes) {\n index = indexes[0];\n index = mark.filter(index, channels, values);\n if (index.length === 0) continue;\n }\n const node = mark.render(index, scales, values, superdimensions, context);\n if (node == null) continue;\n svg.appendChild(node);\n }\n\n // Render a faceted mark.\n else {\n let g;\n for (const f of facets) {\n if (!(mark.facetAnchor?.(facets, facetDomains, f) ?? !f.empty)) continue;\n let index = null;\n if (indexes) {\n const faceted = facetStateByMark.has(mark);\n index = indexes[faceted ? f.i : 0];\n index = mark.filter(index, channels, values);\n if (index.length === 0) continue;\n if (!faceted && index === indexes[0]) index = subarray(index); // copy before assigning fx, fy, fi\n (index.fx = f.x), (index.fy = f.y), (index.fi = f.i);\n }\n const node = mark.render(index, scales, values, subdimensions, context);\n if (node == null) continue;\n // Lazily construct the shared group (to drop empty marks).\n (g ??= select(svg).append(\"g\")).append(() => node).datum(f);\n // Promote ARIA attributes and mark transform to avoid repetition on\n // each facet; this assumes that these attributes are consistent across\n // facets, but that should be the case!\n for (const name of [\"aria-label\", \"aria-description\", \"aria-hidden\", \"transform\"]) {\n if (node.hasAttribute(name)) {\n g.attr(name, node.getAttribute(name));\n node.removeAttribute(name);\n }\n }\n }\n g?.selectChildren().attr(\"transform\", facetTranslate);\n }\n }\n\n // Wrap the plot in a figure, if needed.\n const legends = createLegends(scaleDescriptors, context, options);\n const {figure: figured = title != null || subtitle != null || caption != null || legends.length > 0} = options;\n if (figured) {\n figure = document.createElement(\"figure\");\n figure.className = `${className}-figure`;\n figure.style.maxWidth = \"initial\"; // avoid Observable default style\n if (title != null) figure.append(createTitleElement(document, title, \"h2\"));\n if (subtitle != null) figure.append(createTitleElement(document, subtitle, \"h3\"));\n figure.append(...legends, svg);\n if (caption != null) figure.append(createFigcaption(document, caption));\n }\n\n figure.scale = exposeScales(scales.scales);\n figure.legend = exposeLegends(scaleDescriptors, context, options);\n\n const w = consumeWarnings();\n if (w > 0) {\n select(svg)\n .append(\"text\")\n .attr(\"x\", width)\n .attr(\"y\", 20)\n .attr(\"dy\", \"-1em\")\n .attr(\"text-anchor\", \"end\")\n .attr(\"font-family\", \"initial\") // fix emoji rendering in Chrome\n .text(\"\\u26a0\\ufe0f\") // emoji variation selector\n .append(\"title\")\n .text(`${w.toLocaleString(\"en-US\")} warning${w === 1 ? \"\" : \"s\"}. Please check the console.`);\n }\n\n return figure;\n}\n\nfunction createTitleElement(document, contents, tag) {\n if (contents.ownerDocument) return contents;\n const e = document.createElement(tag);\n e.append(contents);\n return e;\n}\n\nfunction createFigcaption(document, caption) {\n const e = document.createElement(\"figcaption\");\n e.append(caption);\n return e;\n}\n\nfunction plotThis({marks = [], ...options} = {}) {\n return plot({...options, marks: [...marks, this]});\n}\n\n// Note: This side-effect avoids a circular dependency.\nMark.prototype.plot = plotThis;\n\nfunction flatMarks(marks) {\n return marks\n .flat(Infinity)\n .filter((mark) => mark != null)\n .map(markify);\n}\n\nfunction markify(mark) {\n return typeof mark.render === \"function\" ? mark : new Render(mark);\n}\n\nclass Render extends Mark {\n constructor(render) {\n if (typeof render !== \"function\") throw new TypeError(\"invalid mark; missing render function\");\n super();\n this.render = render;\n }\n render() {}\n}\n\n// Note: mutates channel.value to apply the scale transform, if any.\nfunction applyScaleTransforms(channels, options) {\n for (const name in channels) applyScaleTransform(channels[name], options);\n return channels;\n}\n\n// Note: mutates channel.value to apply the scale transform, if any. Also sets\n// channel.transform to false to prevent duplicate transform application.\nfunction applyScaleTransform(channel, options) {\n const {scale, transform: t = true} = channel;\n if (scale == null || !t) return;\n const {\n type,\n percent,\n interval,\n transform = percent ? (x) => x * 100 : maybeIntervalTransform(interval, type)\n } = options[scale] ?? {};\n if (transform == null) return;\n channel.value = map(channel.value, transform);\n channel.transform = false;\n}\n\n// An initializer may generate channels without knowing how the downstream mark\n// will use them. Marks are typically responsible associated scales with\n// channels, but here we assume common behavior across marks.\nfunction inferChannelScales(channels) {\n for (const name in channels) {\n inferChannelScale(name, channels[name]);\n }\n}\n\nfunction addScaleChannels(channelsByScale, stateByMark, options, filter = yes) {\n for (const {channels} of stateByMark.values()) {\n for (const name in channels) {\n const channel = channels[name];\n const {scale} = channel;\n if (scale != null && filter(scale)) {\n // Geo marks affect the default x and y domains if there is no\n // projection. Skip this (as an optimization) when a projection is\n // specified, or when the domains for x and y are specified.\n if (scale === \"projection\") {\n if (!hasProjection(options)) {\n const gx = options.x?.domain === undefined;\n const gy = options.y?.domain === undefined;\n if (gx || gy) {\n const [x, y] = getGeometryChannels(channel);\n if (gx) addScaleChannel(channelsByScale, \"x\", x);\n if (gy) addScaleChannel(channelsByScale, \"y\", y);\n }\n }\n } else {\n addScaleChannel(channelsByScale, scale, channel);\n }\n }\n }\n }\n return channelsByScale;\n}\n\nfunction addScaleChannel(channelsByScale, scale, channel) {\n const scaleChannels = channelsByScale.get(scale);\n if (scaleChannels !== undefined) scaleChannels.push(channel);\n else channelsByScale.set(scale, [channel]);\n}\n\n// Returns the facet groups, and possibly fx and fy channels, associated with\n// the top-level facet option {data, x, y}.\nfunction maybeTopFacet(facet, options) {\n if (facet == null) return;\n const {x, y} = facet;\n if (x == null && y == null) return;\n const data = arrayify(facet.data);\n if (data == null) throw new Error(\"missing facet data\");\n const channels = {};\n if (x != null) channels.fx = createChannel(data, {value: x, scale: \"fx\"});\n if (y != null) channels.fy = createChannel(data, {value: y, scale: \"fy\"});\n applyScaleTransforms(channels, options);\n const groups = facetGroups(data, channels);\n return {channels, groups, data: facet.data};\n}\n\n// Returns the facet groups, and possibly fx and fy channels, associated with a\n// mark, either through top-level faceting or mark-level facet options {fx, fy}.\nfunction maybeMarkFacet(mark, topFacetState, options) {\n if (mark.facet === null || mark.facet === \"super\") return;\n\n // This mark defines a mark-level facet. TODO There\u2019s some code duplication\n // here with maybeTopFacet that we could reduce.\n const {fx, fy} = mark;\n if (fx != null || fy != null) {\n const data = arrayify(mark.data ?? fx ?? fy);\n if (data === undefined) throw new Error(`missing facet data in ${mark.ariaLabel}`);\n if (data === null) return; // ignore channel definitions if no data is provided TODO this right?\n const channels = {};\n if (fx != null) channels.fx = createChannel(data, {value: fx, scale: \"fx\"});\n if (fy != null) channels.fy = createChannel(data, {value: fy, scale: \"fy\"});\n applyScaleTransforms(channels, options);\n return {channels, groups: facetGroups(data, channels)};\n }\n\n // This mark links to a top-level facet, if present.\n if (topFacetState === undefined) return;\n\n // TODO Can we link the top-level facet channels here?\n const {channels, groups, data} = topFacetState;\n if (mark.facet !== \"auto\" || mark.data === data) return {channels, groups};\n\n // Warn for the common pitfall of wanting to facet mapped data with the\n // top-level facet option.\n if (\n data.length > 0 &&\n (groups.size > 1 || (groups.size === 1 && channels.fx && channels.fy && [...groups][0][1].size > 1)) &&\n arrayify(mark.data)?.length === data.length\n ) {\n warn(\n `Warning: the ${mark.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is \"auto\", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`\n );\n }\n}\n\nfunction derive(mark, options = {}) {\n return initializer({...options, x: null, y: null}, (data, facets, channels, scales, dimensions, context) => {\n return context.getMarkState(mark);\n });\n}\n\nfunction inferTips(marks) {\n const tips = [];\n for (const mark of marks) {\n let tipOptions = mark.tip;\n if (tipOptions) {\n if (tipOptions === true) tipOptions = {};\n else if (typeof tipOptions === \"string\") tipOptions = {pointer: tipOptions};\n let {pointer: p, preferredAnchor: a} = tipOptions;\n p = /^x$/i.test(p) ? pointerX : /^y$/i.test(p) ? pointerY : pointer; // TODO validate?\n tipOptions = p(derive(mark, tipOptions));\n tipOptions.title = null; // prevent implicit title for primitive data\n if (a === undefined) tipOptions.preferredAnchor = p === pointerY ? \"left\" : \"bottom\";\n const t = tip(mark.data, tipOptions);\n t.facet = mark.facet; // inherit facet settings\n t.facetAnchor = mark.facetAnchor; // inherit facet settings\n tips.push(t);\n }\n }\n return tips;\n}\n\nfunction inferAxes(marks, channelsByScale, options) {\n let {\n projection,\n x = {},\n y = {},\n fx = {},\n fy = {},\n axis,\n grid,\n facet = {},\n facet: {axis: facetAxis = axis, grid: facetGrid} = facet,\n x: {axis: xAxis = axis, grid: xGrid = xAxis === null ? null : grid} = x,\n y: {axis: yAxis = axis, grid: yGrid = yAxis === null ? null : grid} = y,\n fx: {axis: fxAxis = facetAxis, grid: fxGrid = fxAxis === null ? null : facetGrid} = fx,\n fy: {axis: fyAxis = facetAxis, grid: fyGrid = fyAxis === null ? null : facetGrid} = fy\n } = options;\n\n // Disable axes if the corresponding scale is not present.\n if (projection || (!isScaleOptions(x) && !hasPositionChannel(\"x\", marks))) xAxis = xGrid = null;\n if (projection || (!isScaleOptions(y) && !hasPositionChannel(\"y\", marks))) yAxis = yGrid = null;\n if (!channelsByScale.has(\"fx\")) fxAxis = fxGrid = null;\n if (!channelsByScale.has(\"fy\")) fyAxis = fyGrid = null;\n\n // Resolve the default implicit axes by checking for explicit ones.\n if (xAxis === undefined) xAxis = !hasAxis(marks, \"x\");\n if (yAxis === undefined) yAxis = !hasAxis(marks, \"y\");\n if (fxAxis === undefined) fxAxis = !hasAxis(marks, \"fx\");\n if (fyAxis === undefined) fyAxis = !hasAxis(marks, \"fy\");\n\n // Resolve the default orientation of axes.\n if (xAxis === true) xAxis = \"bottom\";\n if (yAxis === true) yAxis = \"left\";\n if (fxAxis === true) fxAxis = xAxis === \"top\" || xAxis === null ? \"bottom\" : \"top\";\n if (fyAxis === true) fyAxis = yAxis === \"right\" || yAxis === null ? \"left\" : \"right\";\n\n const axes = [];\n maybeGrid(axes, fyGrid, gridFy, fy);\n maybeAxis(axes, fyAxis, axisFy, \"right\", \"left\", facet, fy);\n maybeGrid(axes, fxGrid, gridFx, fx);\n maybeAxis(axes, fxAxis, axisFx, \"top\", \"bottom\", facet, fx);\n maybeGrid(axes, yGrid, gridY, y);\n maybeAxis(axes, yAxis, axisY, \"left\", \"right\", options, y);\n maybeGrid(axes, xGrid, gridX, x);\n maybeAxis(axes, xAxis, axisX, \"bottom\", \"top\", options, x);\n return axes;\n}\n\nfunction maybeAxis(axes, axis, axisType, primary, secondary, defaults, options) {\n if (!axis) return;\n const both = isBoth(axis);\n options = axisOptions(both ? primary : axis, defaults, options);\n const {line} = options;\n if ((axisType === axisY || axisType === axisX) && line && !isNone(line)) axes.push(frame(lineOptions(options)));\n axes.push(axisType(options));\n if (both) axes.push(axisType({...options, anchor: secondary, label: null}));\n}\n\nfunction maybeGrid(axes, grid, gridType, options) {\n if (!grid || isNone(grid)) return;\n axes.push(gridType(gridOptions(grid, options)));\n}\n\nfunction isBoth(value) {\n return /^\\s*both\\s*$/i.test(value);\n}\n\nfunction axisOptions(\n anchor,\n defaults,\n {\n line = defaults.line,\n ticks,\n tickSize,\n tickSpacing,\n tickPadding,\n tickFormat,\n tickRotate,\n fontVariant,\n ariaLabel,\n ariaDescription,\n label = defaults.label,\n labelAnchor,\n labelArrow = defaults.labelArrow,\n labelOffset\n }\n) {\n return {\n anchor,\n line,\n ticks,\n tickSize,\n tickSpacing,\n tickPadding,\n tickFormat,\n tickRotate,\n fontVariant,\n ariaLabel,\n ariaDescription,\n label,\n labelAnchor,\n labelArrow,\n labelOffset\n };\n}\n\nfunction lineOptions(options) {\n const {anchor, line} = options;\n return {anchor, facetAnchor: anchor + \"-empty\", stroke: line === true ? undefined : line};\n}\n\nfunction gridOptions(\n grid,\n {\n stroke = isColor(grid) ? grid : undefined,\n ticks = isGridTicks(grid) ? grid : undefined,\n tickSpacing,\n ariaLabel,\n ariaDescription\n }\n) {\n return {\n stroke,\n ticks,\n tickSpacing,\n ariaLabel,\n ariaDescription\n };\n}\n\nfunction isGridTicks(grid) {\n switch (typeof grid) {\n case \"number\":\n return true;\n case \"string\":\n return !isColor(grid);\n }\n return isIterable(grid) || typeof grid?.range === \"function\";\n}\n\n// Is there an explicit axis already present? TODO We probably want a more\n// explicit test than looking for the ARIA label, but it does afford some\n// flexibility in axis implementation which is nice.\nfunction hasAxis(marks, k) {\n const prefix = `${k}-axis `;\n return marks.some((m) => m.ariaLabel?.startsWith(prefix));\n}\n\nfunction hasPositionChannel(k, marks) {\n for (const mark of marks) {\n for (const key in mark.channels) {\n const {scale} = mark.channels[key];\n if (scale === k || scale === \"projection\") {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction inheritScaleLabels(newScales, scales) {\n for (const key in newScales) {\n const newScale = newScales[key];\n const scale = scales[key];\n if (newScale.label === undefined && scale) {\n newScale.label = scale.label;\n }\n }\n return newScales;\n}\n\n// This differs from the other outerDimensions in that it accounts for rounding\n// and outer padding in the facet scales; we want the frame to align exactly\n// with the actual range, not the desired range.\nfunction actualDimensions({fx, fy}, dimensions) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = outerDimensions(dimensions);\n const fxr = fx && outerRange(fx);\n const fyr = fy && outerRange(fy);\n return {\n marginTop: fy ? fyr[0] : marginTop,\n marginRight: fx ? width - fxr[1] : marginRight,\n marginBottom: fy ? height - fyr[1] : marginBottom,\n marginLeft: fx ? fxr[0] : marginLeft,\n // Some marks, namely the x- and y-axis labels, want to know what the\n // desired (rather than actual) margins are for positioning.\n inset: {\n marginTop: dimensions.marginTop,\n marginRight: dimensions.marginRight,\n marginBottom: dimensions.marginBottom,\n marginLeft: dimensions.marginLeft\n },\n width,\n height\n };\n}\n\nfunction outerRange(scale) {\n const domain = scale.domain();\n let x1 = scale(domain[0]);\n let x2 = scale(domain[domain.length - 1]);\n if (x2 < x1) [x1, x2] = [x2, x1];\n return [x1, x2 + scale.bandwidth()];\n}\n", "import {\n curveBasis,\n curveBasisClosed,\n curveBasisOpen,\n curveBundle,\n curveBumpX,\n curveBumpY,\n curveCardinal,\n curveCardinalClosed,\n curveCardinalOpen,\n curveCatmullRom,\n curveCatmullRomClosed,\n curveCatmullRomOpen,\n curveLinear,\n curveLinearClosed,\n curveMonotoneX,\n curveMonotoneY,\n curveNatural,\n curveStep,\n curveStepAfter,\n curveStepBefore\n} from \"d3\";\n\nconst curves = new Map([\n [\"basis\", curveBasis],\n [\"basis-closed\", curveBasisClosed],\n [\"basis-open\", curveBasisOpen],\n [\"bundle\", curveBundle],\n [\"bump-x\", curveBumpX],\n [\"bump-y\", curveBumpY],\n [\"cardinal\", curveCardinal],\n [\"cardinal-closed\", curveCardinalClosed],\n [\"cardinal-open\", curveCardinalOpen],\n [\"catmull-rom\", curveCatmullRom],\n [\"catmull-rom-closed\", curveCatmullRomClosed],\n [\"catmull-rom-open\", curveCatmullRomOpen],\n [\"linear\", curveLinear],\n [\"linear-closed\", curveLinearClosed],\n [\"monotone-x\", curveMonotoneX],\n [\"monotone-y\", curveMonotoneY],\n [\"natural\", curveNatural],\n [\"step\", curveStep],\n [\"step-after\", curveStepAfter],\n [\"step-before\", curveStepBefore]\n]);\n\nexport function maybeCurve(curve = curveLinear, tension) {\n if (typeof curve === \"function\") return curve; // custom curve\n const c = curves.get(`${curve}`.toLowerCase());\n if (!c) throw new Error(`unknown curve: ${curve}`);\n if (tension !== undefined) {\n if (\"beta\" in c) {\n return c.beta(tension);\n } else if (\"tension\" in c) {\n return c.tension(tension);\n } else if (\"alpha\" in c) {\n return c.alpha(tension);\n }\n }\n return c;\n}\n\n// For the \u201Cauto\u201D curve, return a symbol instead of a curve implementation;\n// we\u2019ll use d3.geoPath to render if there\u2019s a projection.\nexport function maybeCurveAuto(curve = curveAuto, tension) {\n return typeof curve !== \"function\" && `${curve}`.toLowerCase() === \"auto\" ? curveAuto : maybeCurve(curve, tension);\n}\n\n// This is a special built-in curve that will use d3.geoPath when there is a\n// projection, and the linear curve when there is not. You can explicitly\n// opt-out of d3.geoPath and instead use d3.line with the \"linear\" curve.\nexport function curveAuto(context) {\n return curveLinear(context);\n}\n", "import {\n bisect,\n extent,\n thresholdFreedmanDiaconis,\n thresholdScott,\n thresholdSturges,\n tickIncrement,\n ticks,\n utcTickInterval\n} from \"d3\";\nimport {withTip} from \"../mark.js\";\nimport {\n coerceDate,\n coerceNumbers,\n identity,\n isInterval,\n isIterable,\n isTemporal,\n isTimeInterval,\n labelof,\n map,\n maybeApplyInterval,\n maybeColorChannel,\n maybeColumn,\n maybeRangeInterval,\n maybeTuple,\n maybeValue,\n mid,\n valueof\n} from \"../options.js\";\nimport {maybeUtcInterval} from \"../time.js\";\nimport {basic} from \"./basic.js\";\nimport {\n hasOutput,\n maybeEvaluator,\n maybeGroup,\n maybeOutput,\n maybeOutputs,\n maybeReduce,\n maybeSort,\n maybeSubgroup,\n reduceCount,\n reduceFirst,\n reduceIdentity,\n reduceZ\n} from \"./group.js\";\nimport {maybeInsetX, maybeInsetY} from \"./inset.js\";\n\n// Group on {z, fill, stroke}, then optionally on y, then bin x.\nexport function binX(outputs = {y: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = options;\n return binn(maybeBinValue(x, options, identity), null, null, y, outputs, maybeInsetX(options));\n}\n\n// Group on {z, fill, stroke}, then optionally on x, then bin y.\nexport function binY(outputs = {x: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = options;\n return binn(null, maybeBinValue(y, options, identity), x, null, outputs, maybeInsetY(options));\n}\n\n// Group on {z, fill, stroke}, then bin on x and y.\nexport function bin(outputs = {fill: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = maybeBinValueTuple(options);\n return binn(x, y, null, null, outputs, maybeInsetX(maybeInsetY(options)));\n}\n\nfunction maybeDenseInterval(bin, k, options = {}) {\n if (options?.interval == null) return options;\n const {reduce = reduceFirst} = options;\n const outputs = {filter: null};\n if (options[k] != null) outputs[k] = reduce;\n if (options[`${k}1`] != null) outputs[`${k}1`] = reduce;\n if (options[`${k}2`] != null) outputs[`${k}2`] = reduce;\n return bin(outputs, options);\n}\n\nexport function maybeDenseIntervalX(options = {}) {\n return maybeDenseInterval(binX, \"y\", withTip(options, \"x\"));\n}\n\nexport function maybeDenseIntervalY(options = {}) {\n return maybeDenseInterval(binY, \"x\", withTip(options, \"y\"));\n}\n\nfunction binn(\n bx, // optionally bin on x (exclusive with gx)\n by, // optionally bin on y (exclusive with gy)\n gx, // optionally group on x (exclusive with bx and gy)\n gy, // optionally group on y (exclusive with by and gx)\n {\n data: reduceData = reduceIdentity, // TODO avoid materializing when unused?\n filter = reduceCount, // return only non-empty bins by default\n sort,\n reverse,\n ...outputs // output channel definitions\n } = {},\n inputs = {} // input channels and options\n) {\n bx = maybeBin(bx);\n by = maybeBin(by);\n\n // Compute the outputs.\n outputs = maybeBinOutputs(outputs, inputs);\n reduceData = maybeBinReduce(reduceData, identity);\n sort = sort == null ? undefined : maybeBinOutput(\"sort\", sort, inputs);\n filter = filter == null ? undefined : maybeBinEvaluator(\"filter\", filter, inputs);\n\n // Don\u2019t group on a channel if an output requires it as an input!\n if (gx != null && hasOutput(outputs, \"x\", \"x1\", \"x2\")) gx = null;\n if (gy != null && hasOutput(outputs, \"y\", \"y1\", \"y2\")) gy = null;\n\n // Produce x1, x2, y1, and y2 output channels as appropriate (when binning).\n const [BX1, setBX1] = maybeColumn(bx);\n const [BX2, setBX2] = maybeColumn(bx);\n const [BY1, setBY1] = maybeColumn(by);\n const [BY2, setBY2] = maybeColumn(by);\n\n // Produce x or y output channels as appropriate (when grouping).\n const [k, gk] = gx != null ? [gx, \"x\"] : gy != null ? [gy, \"y\"] : [];\n const [GK, setGK] = maybeColumn(k);\n\n // Greedily materialize the z, fill, and stroke channels (if channels and not\n // constants) so that we can reference them for subdividing groups without\n // computing them more than once. We also want to consume options that should\n // only apply to this transform rather than passing them through to the next.\n const {\n x,\n y,\n z,\n fill,\n stroke,\n x1,\n x2, // consumed if x is an output\n y1,\n y2, // consumed if y is an output\n domain,\n cumulative,\n thresholds,\n interval,\n ...options\n } = inputs;\n const [GZ, setGZ] = maybeColumn(z);\n const [vfill] = maybeColorChannel(fill);\n const [vstroke] = maybeColorChannel(stroke);\n const [GF, setGF] = maybeColumn(vfill);\n const [GS, setGS] = maybeColumn(vstroke);\n\n return {\n ...(\"z\" in inputs && {z: GZ || z}),\n ...(\"fill\" in inputs && {fill: GF || fill}),\n ...(\"stroke\" in inputs && {stroke: GS || stroke}),\n ...basic(options, (data, facets, plotOptions) => {\n const K = maybeApplyInterval(valueof(data, k), plotOptions?.[gk]);\n const Z = valueof(data, z);\n const F = valueof(data, vfill);\n const S = valueof(data, vstroke);\n const G = maybeSubgroup(outputs, {z: Z, fill: F, stroke: S});\n const groupFacets = [];\n const groupData = [];\n const GK = K && setGK([]);\n const GZ = Z && setGZ([]);\n const GF = F && setGF([]);\n const GS = S && setGS([]);\n const BX1 = bx && setBX1([]);\n const BX2 = bx && setBX2([]);\n const BY1 = by && setBY1([]);\n const BY2 = by && setBY2([]);\n const bin = bing(bx, by, data);\n let i = 0;\n for (const o of outputs) o.initialize(data);\n if (sort) sort.initialize(data);\n if (filter) filter.initialize(data);\n for (const facet of facets) {\n const groupFacet = [];\n for (const o of outputs) o.scope(\"facet\", facet);\n if (sort) sort.scope(\"facet\", facet);\n if (filter) filter.scope(\"facet\", facet);\n for (const [f, I] of maybeGroup(facet, G)) {\n for (const [k, g] of maybeGroup(I, K)) {\n for (const [b, extent] of bin(g)) {\n if (G) extent.z = f;\n if (filter && !filter.reduce(b, extent)) continue;\n groupFacet.push(i++);\n groupData.push(reduceData.reduceIndex(b, data, extent));\n if (K) GK.push(k);\n if (Z) GZ.push(G === Z ? f : Z[(b.length > 0 ? b : g)[0]]);\n if (F) GF.push(G === F ? f : F[(b.length > 0 ? b : g)[0]]);\n if (S) GS.push(G === S ? f : S[(b.length > 0 ? b : g)[0]]);\n if (BX1) BX1.push(extent.x1), BX2.push(extent.x2);\n if (BY1) BY1.push(extent.y1), BY2.push(extent.y2);\n for (const o of outputs) o.reduce(b, extent);\n if (sort) sort.reduce(b, extent);\n }\n }\n }\n groupFacets.push(groupFacet);\n }\n maybeSort(groupFacets, sort, reverse);\n return {data: groupData, facets: groupFacets};\n }),\n ...(!hasOutput(outputs, \"x\") && (BX1 ? {x1: BX1, x2: BX2, x: mid(BX1, BX2)} : {x, x1, x2})),\n ...(!hasOutput(outputs, \"y\") && (BY1 ? {y1: BY1, y2: BY2, y: mid(BY1, BY2)} : {y, y1, y2})),\n ...(GK && {[gk]: GK}),\n ...Object.fromEntries(outputs.map(({name, output}) => [name, output]))\n };\n}\n\n// Allow bin options to be specified as part of outputs; merge them into options.\nfunction mergeOptions({cumulative, domain, thresholds, interval, ...outputs}, options) {\n return [outputs, {cumulative, domain, thresholds, interval, ...options}];\n}\n\nfunction maybeBinValue(value, {cumulative, domain, thresholds, interval}, defaultValue) {\n value = {...maybeValue(value)};\n if (value.domain === undefined) value.domain = domain;\n if (value.cumulative === undefined) value.cumulative = cumulative;\n if (value.thresholds === undefined) value.thresholds = thresholds;\n if (value.interval === undefined) value.interval = interval;\n if (value.value === undefined) value.value = defaultValue;\n value.thresholds = maybeThresholds(value.thresholds, value.interval);\n return value;\n}\n\nfunction maybeBinValueTuple(options) {\n let {x, y} = options;\n x = maybeBinValue(x, options);\n y = maybeBinValue(y, options);\n [x.value, y.value] = maybeTuple(x.value, y.value);\n return {x, y};\n}\n\nfunction maybeBin(options) {\n if (options == null) return;\n const {value, cumulative, domain = extent, thresholds} = options;\n const bin = (data) => {\n let V = valueof(data, value);\n let T; // bin thresholds\n if (isTemporal(V) || isTimeThresholds(thresholds)) {\n V = map(V, coerceDate, Float64Array); // like coerceDates, but faster\n let [min, max] = typeof domain === \"function\" ? domain(V) : domain;\n let t = typeof thresholds === \"function\" && !isInterval(thresholds) ? thresholds(V, min, max) : thresholds;\n if (typeof t === \"number\") t = utcTickInterval(min, max, t);\n if (isInterval(t)) {\n if (domain === extent) {\n min = t.floor(min);\n max = t.offset(t.floor(max));\n }\n t = t.range(min, t.offset(max));\n }\n T = t;\n } else {\n V = coerceNumbers(V);\n let [min, max] = typeof domain === \"function\" ? domain(V) : domain;\n let t = typeof thresholds === \"function\" && !isInterval(thresholds) ? thresholds(V, min, max) : thresholds;\n if (typeof t === \"number\") {\n // This differs from d3.ticks with regard to exclusive bounds: we want a\n // first threshold less than or equal to the minimum, and a last\n // threshold (strictly) greater than the maximum.\n if (domain === extent) {\n let step = tickIncrement(min, max, t);\n if (isFinite(step)) {\n if (step > 0) {\n let r0 = Math.round(min / step);\n let r1 = Math.round(max / step);\n if (!(r0 * step <= min)) --r0;\n if (!(r1 * step > max)) ++r1;\n let n = r1 - r0 + 1;\n t = new Float64Array(n);\n for (let i = 0; i < n; ++i) t[i] = (r0 + i) * step;\n } else if (step < 0) {\n step = -step;\n let r0 = Math.round(min * step);\n let r1 = Math.round(max * step);\n if (!(r0 / step <= min)) --r0;\n if (!(r1 / step > max)) ++r1;\n let n = r1 - r0 + 1;\n t = new Float64Array(n);\n for (let i = 0; i < n; ++i) t[i] = (r0 + i) / step;\n } else {\n t = [min];\n }\n } else {\n t = [min];\n }\n } else {\n t = ticks(min, max, t);\n }\n } else if (isInterval(t)) {\n if (domain === extent) {\n min = t.floor(min);\n max = t.offset(t.floor(max));\n }\n t = t.range(min, t.offset(max));\n }\n T = t;\n }\n const E = [];\n if (T.length === 1) E.push([T[0], T[0]]); // collapsed domain\n else for (let i = 1; i < T.length; ++i) E.push([T[i - 1], T[i]]);\n E.bin = (cumulative < 0 ? bin1cn : cumulative > 0 ? bin1cp : bin1)(E, T, V);\n return E;\n };\n bin.label = labelof(value);\n return bin;\n}\n\nexport function maybeThresholds(thresholds, interval, defaultThresholds = thresholdAuto) {\n if (thresholds === undefined) {\n return interval === undefined ? defaultThresholds : maybeRangeInterval(interval);\n }\n if (typeof thresholds === \"string\") {\n switch (thresholds.toLowerCase()) {\n case \"freedman-diaconis\":\n return thresholdFreedmanDiaconis;\n case \"scott\":\n return thresholdScott;\n case \"sturges\":\n return thresholdSturges;\n case \"auto\":\n return thresholdAuto;\n }\n return maybeUtcInterval(thresholds);\n }\n return thresholds; // pass array, count, or function to bin.thresholds\n}\n\nfunction maybeBinOutputs(outputs, inputs) {\n return maybeOutputs(outputs, inputs, maybeBinOutput);\n}\n\nfunction maybeBinOutput(name, reduce, inputs) {\n return maybeOutput(name, reduce, inputs, maybeBinEvaluator);\n}\n\nfunction maybeBinEvaluator(name, reduce, inputs) {\n return maybeEvaluator(name, reduce, inputs, maybeBinReduce);\n}\n\nfunction maybeBinReduce(reduce, value) {\n return maybeReduce(reduce, value, maybeBinReduceFallback);\n}\n\nfunction maybeBinReduceFallback(reduce) {\n switch (`${reduce}`.toLowerCase()) {\n case \"x\":\n return reduceX;\n case \"x1\":\n return reduceX1;\n case \"x2\":\n return reduceX2;\n case \"y\":\n return reduceY;\n case \"y1\":\n return reduceY1;\n case \"y2\":\n return reduceY2;\n case \"z\":\n return reduceZ;\n }\n throw new Error(`invalid bin reduce: ${reduce}`);\n}\n\nfunction thresholdAuto(values, min, max) {\n return Math.min(200, thresholdScott(values, min, max));\n}\n\nfunction isTimeThresholds(t) {\n return isTimeInterval(t) || (isIterable(t) && isTemporal(t));\n}\n\nfunction bing(bx, by, data) {\n const EX = bx?.(data);\n const EY = by?.(data);\n return EX && EY\n ? function* (I) {\n const X = EX.bin(I); // first bin on x\n for (const [ix, [x1, x2]] of EX.entries()) {\n const Y = EY.bin(X[ix]); // then bin on y\n for (const [iy, [y1, y2]] of EY.entries()) {\n yield [Y[iy], {data, x1, y1, x2, y2}];\n }\n }\n }\n : EX\n ? function* (I) {\n const X = EX.bin(I);\n for (const [i, [x1, x2]] of EX.entries()) {\n yield [X[i], {data, x1, x2}];\n }\n }\n : function* (I) {\n const Y = EY.bin(I);\n for (const [i, [y1, y2]] of EY.entries()) {\n yield [Y[i], {data, y1, y2}];\n }\n };\n}\n\n// non-cumulative distribution\nfunction bin1(E, T, V) {\n T = coerceNumbers(T); // for faster bisection\n return (I) => {\n const B = E.map(() => []);\n for (const i of I) B[bisect(T, V[i]) - 1]?.push(i); // TODO quantization?\n return B;\n };\n}\n\n// cumulative distribution\nfunction bin1cp(E, T, V) {\n const bin = bin1(E, T, V);\n return (I) => {\n const B = bin(I);\n for (let i = 1, n = B.length; i < n; ++i) {\n const C = B[i - 1];\n const b = B[i];\n for (const j of C) b.push(j);\n }\n return B;\n };\n}\n\n// complementary cumulative distribution\nfunction bin1cn(E, T, V) {\n const bin = bin1(E, T, V);\n return (I) => {\n const B = bin(I);\n for (let i = B.length - 2; i >= 0; --i) {\n const C = B[i + 1];\n const b = B[i];\n for (const j of C) b.push(j);\n }\n return B;\n };\n}\n\nfunction mid1(x1, x2) {\n const m = (+x1 + +x2) / 2;\n return x1 instanceof Date ? new Date(m) : m;\n}\n\nconst reduceX = {\n reduceIndex(I, X, {x1, x2}) {\n return mid1(x1, x2);\n }\n};\n\nconst reduceY = {\n reduceIndex(I, X, {y1, y2}) {\n return mid1(y1, y2);\n }\n};\n\nconst reduceX1 = {\n reduceIndex(I, X, {x1}) {\n return x1;\n }\n};\n\nconst reduceX2 = {\n reduceIndex(I, X, {x2}) {\n return x2;\n }\n};\n\nconst reduceY1 = {\n reduceIndex(I, X, {y1}) {\n return y1;\n }\n};\n\nconst reduceY2 = {\n reduceIndex(I, X, {y2}) {\n return y2;\n }\n};\n", "import {hasX, hasY, identity} from \"../options.js\";\n\nexport function maybeIdentityX(options = {}) {\n return hasX(options) ? options : {...options, x: identity};\n}\n\nexport function maybeIdentityY(options = {}) {\n return hasY(options) ? options : {...options, y: identity};\n}\n", "import {reindex, slice} from \"../options.js\";\n\nexport function exclusiveFacets(data, facets) {\n if (facets.length === 1) return {data, facets}; // only one facet; trivially exclusive\n\n const n = data.length;\n const O = new Uint8Array(n);\n let overlaps = 0;\n\n // Count the number of overlapping indexes across facets.\n for (const facet of facets) {\n for (const i of facet) {\n if (O[i]) ++overlaps;\n O[i] = 1;\n }\n }\n\n // Do nothing if the facets are already exclusive.\n if (overlaps === 0) return {data, facets}; // facets are exclusive\n\n // For each overlapping index (duplicate), assign a new unique index at the\n // end of the existing array, duplicating the datum. For example, [[0, 1, 2],\n // [2, 1, 3]] would become [[0, 1, 2], [4, 5, 3]]. Also attach a reindex to\n // the data to preserve the association of channel values specified as arrays.\n data = slice(data);\n const R = (data[reindex] = new Uint32Array(n + overlaps));\n facets = facets.map((facet) => slice(facet, Uint32Array));\n let j = n;\n O.fill(0);\n for (const facet of facets) {\n for (let k = 0, m = facet.length; k < m; ++k) {\n const i = facet[k];\n if (O[i]) (facet[k] = j), (data[j] = data[i]), (R[j] = i), ++j;\n else R[i] = i;\n O[i] = 1;\n }\n }\n\n return {data, facets};\n}\n", "import {InternMap, cumsum, greatest, group, groupSort, max, min, rollup, sum} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"../defined.js\";\nimport {withTip} from \"../mark.js\";\nimport {maybeApplyInterval, maybeColumn, maybeZ, maybeZero} from \"../options.js\";\nimport {column, field, mid, one, range, valueof} from \"../options.js\";\nimport {basic} from \"./basic.js\";\nimport {exclusiveFacets} from \"./exclusiveFacets.js\";\n\nexport function stackX(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x, ...rest} = options; // note: consumes x!\n const [transform, Y, x1, x2] = stack(y, x, \"y\", \"x\", stackOptions, rest);\n return {...transform, y1, y: Y, x1, x2, x: mid(x1, x2)};\n}\n\nexport function stackX1(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x} = options;\n const [transform, Y, X] = stack(y, x, \"y\", \"x\", stackOptions, options);\n return {...transform, y1, y: Y, x: X};\n}\n\nexport function stackX2(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x} = options;\n const [transform, Y, , X] = stack(y, x, \"y\", \"x\", stackOptions, options);\n return {...transform, y1, y: Y, x: X};\n}\n\nexport function stackY(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y, ...rest} = options; // note: consumes y!\n const [transform, X, y1, y2] = stack(x, y, \"x\", \"y\", stackOptions, rest);\n return {...transform, x1, x: X, y1, y2, y: mid(y1, y2)};\n}\n\nexport function stackY1(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y} = options;\n const [transform, X, Y] = stack(x, y, \"x\", \"y\", stackOptions, options);\n return {...transform, x1, x: X, y: Y};\n}\n\nexport function stackY2(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y} = options;\n const [transform, X, , Y] = stack(x, y, \"x\", \"y\", stackOptions, options);\n return {...transform, x1, x: X, y: Y};\n}\n\nexport function maybeStackX({x, x1, x2, ...options} = {}) {\n options = withTip(options, \"y\");\n if (x1 === undefined && x2 === undefined) return stackX({x, ...options});\n [x1, x2] = maybeZero(x, x1, x2);\n return {...options, x1, x2};\n}\n\nexport function maybeStackY({y, y1, y2, ...options} = {}) {\n options = withTip(options, \"x\");\n if (y1 === undefined && y2 === undefined) return stackY({y, ...options});\n [y1, y2] = maybeZero(y, y1, y2);\n return {...options, y1, y2};\n}\n\n// The reverse option is ambiguous: it is both a stack option and a basic\n// transform. If only one options object is specified, we interpret it as a\n// stack option, and therefore must remove it from the propagated options.\nfunction mergeOptions(options) {\n const {offset, order, reverse, ...rest} = options;\n return [{offset, order, reverse}, rest];\n}\n\n// This is a hint to the tooltip mark that the y1 and y2 channels (for stackY,\n// or conversely x1 and x2 for stackX) represent a stacked length, and that the\n// tooltip should therefore show y2-y1 instead of an extent.\nconst lengthy = {length: true};\n\nfunction stack(x, y = one, kx, ky, {offset, order, reverse}, options) {\n if (y === null) throw new Error(`stack requires ${ky}`);\n const z = maybeZ(options);\n const [X, setX] = maybeColumn(x);\n const [Y1, setY1] = column(y);\n const [Y2, setY2] = column(y);\n Y1.hint = Y2.hint = lengthy;\n offset = maybeOffset(offset);\n order = maybeOrder(order, offset, ky);\n return [\n basic(options, (data, facets, plotOptions) => {\n ({data, facets} = exclusiveFacets(data, facets));\n const X = x == null ? undefined : setX(maybeApplyInterval(valueof(data, x), plotOptions?.[kx]));\n const Y = valueof(data, y, Float64Array);\n const Z = valueof(data, z);\n const compare = order && order(data, X, Y, Z);\n const n = data.length;\n const Y1 = setY1(new Float64Array(n));\n const Y2 = setY2(new Float64Array(n));\n const facetstacks = [];\n for (const facet of facets) {\n const stacks = X ? Array.from(group(facet, (i) => X[i]).values()) : [facet];\n if (compare) for (const stack of stacks) stack.sort(compare);\n for (const stack of stacks) {\n let yn = 0;\n let yp = 0;\n if (reverse) stack.reverse();\n for (const i of stack) {\n const y = Y[i];\n if (y < 0) yn = Y2[i] = (Y1[i] = yn) + y;\n else if (y > 0) yp = Y2[i] = (Y1[i] = yp) + y;\n else Y2[i] = Y1[i] = yp; // NaN or zero\n }\n }\n facetstacks.push(stacks);\n }\n if (offset) offset(facetstacks, Y1, Y2, Z);\n return {data, facets};\n }),\n X,\n Y1,\n Y2\n ];\n}\n\nfunction maybeOffset(offset) {\n if (offset == null) return;\n if (typeof offset === \"function\") return offset;\n switch (`${offset}`.toLowerCase()) {\n case \"expand\":\n case \"normalize\":\n return offsetExpand;\n case \"center\":\n case \"silhouette\":\n return offsetCenter;\n case \"wiggle\":\n return offsetWiggle;\n }\n throw new Error(`unknown offset: ${offset}`);\n}\n\n// Given a single stack, returns the minimum and maximum values from the given\n// Y2 column. Note that this relies on Y2 always being the outer column for\n// diverging values.\nfunction extent(stack, Y2) {\n let min = 0,\n max = 0;\n for (const i of stack) {\n const y = Y2[i];\n if (y < min) min = y;\n if (y > max) max = y;\n }\n return [min, max];\n}\n\nfunction offsetExpand(facetstacks, Y1, Y2) {\n for (const stacks of facetstacks) {\n for (const stack of stacks) {\n const [yn, yp] = extent(stack, Y2);\n for (const i of stack) {\n const m = 1 / (yp - yn || 1);\n Y1[i] = m * (Y1[i] - yn);\n Y2[i] = m * (Y2[i] - yn);\n }\n }\n }\n}\n\nfunction offsetCenter(facetstacks, Y1, Y2) {\n for (const stacks of facetstacks) {\n for (const stack of stacks) {\n const [yn, yp] = extent(stack, Y2);\n for (const i of stack) {\n const m = (yp + yn) / 2;\n Y1[i] -= m;\n Y2[i] -= m;\n }\n }\n offsetZero(stacks, Y1, Y2);\n }\n offsetCenterFacets(facetstacks, Y1, Y2);\n}\n\nfunction offsetWiggle(facetstacks, Y1, Y2, Z) {\n for (const stacks of facetstacks) {\n const prev = new InternMap();\n let y = 0;\n for (const stack of stacks) {\n let j = -1;\n const Fi = stack.map((i) => Math.abs(Y2[i] - Y1[i]));\n const Df = stack.map((i) => {\n j = Z ? Z[i] : ++j;\n const value = Y2[i] - Y1[i];\n const diff = prev.has(j) ? value - prev.get(j) : 0;\n prev.set(j, value);\n return diff;\n });\n const Cf1 = [0, ...cumsum(Df)];\n for (const i of stack) {\n Y1[i] += y;\n Y2[i] += y;\n }\n const s1 = sum(Fi);\n if (s1) y -= sum(Fi, (d, i) => (Df[i] / 2 + Cf1[i]) * d) / s1;\n }\n offsetZero(stacks, Y1, Y2);\n }\n offsetCenterFacets(facetstacks, Y1, Y2);\n}\n\nfunction offsetZero(stacks, Y1, Y2) {\n const m = min(stacks, (stack) => min(stack, (i) => Y1[i]));\n for (const stack of stacks) {\n for (const i of stack) {\n Y1[i] -= m;\n Y2[i] -= m;\n }\n }\n}\n\nfunction offsetCenterFacets(facetstacks, Y1, Y2) {\n const n = facetstacks.length;\n if (n === 1) return;\n const facets = facetstacks.map((stacks) => stacks.flat());\n const m = facets.map((I) => (min(I, (i) => Y1[i]) + max(I, (i) => Y2[i])) / 2);\n const m0 = min(m);\n for (let j = 0; j < n; j++) {\n const p = m0 - m[j];\n for (const i of facets[j]) {\n Y1[i] += p;\n Y2[i] += p;\n }\n }\n}\n\nfunction maybeOrder(order, offset, ky) {\n if (order === undefined && offset === offsetWiggle) return orderInsideOut(ascendingDefined);\n if (order == null) return;\n if (typeof order === \"string\") {\n const negate = order.startsWith(\"-\");\n const compare = negate ? descendingDefined : ascendingDefined;\n switch ((negate ? order.slice(1) : order).toLowerCase()) {\n case \"value\":\n case ky:\n return orderY(compare);\n case \"z\":\n return orderZ(compare);\n case \"sum\":\n return orderSum(compare);\n case \"appearance\":\n return orderAppearance(compare);\n case \"inside-out\":\n return orderInsideOut(compare);\n }\n return orderAccessor(field(order));\n }\n if (typeof order === \"function\") return (order.length === 1 ? orderAccessor : orderComparator)(order);\n if (Array.isArray(order)) return orderGiven(order);\n throw new Error(`invalid order: ${order}`);\n}\n\n// by value\nfunction orderY(compare) {\n return (data, X, Y) => (i, j) => compare(Y[i], Y[j]);\n}\n\n// by location\nfunction orderZ(compare) {\n return (data, X, Y, Z) => (i, j) => compare(Z[i], Z[j]);\n}\n\n// by sum of value (a.k.a. \u201Cascending\u201D)\nfunction orderSum(compare) {\n return orderZDomain(compare, (data, X, Y, Z) =>\n groupSort(\n range(data),\n (I) => sum(I, (i) => Y[i]),\n (i) => Z[i]\n )\n );\n}\n\n// by x = argmax of value\nfunction orderAppearance(compare) {\n return orderZDomain(compare, (data, X, Y, Z) =>\n groupSort(\n range(data),\n (I) => X[greatest(I, (i) => Y[i])],\n (i) => Z[i]\n )\n );\n}\n\n// by x = argmax of value, but rearranged inside-out by alternating series\n// according to the sign of a running divergence of sums\nfunction orderInsideOut(compare) {\n return orderZDomain(compare, (data, X, Y, Z) => {\n const I = range(data);\n const K = groupSort(\n I,\n (I) => X[greatest(I, (i) => Y[i])],\n (i) => Z[i]\n );\n const sums = rollup(\n I,\n (I) => sum(I, (i) => Y[i]),\n (i) => Z[i]\n );\n const Kp = [],\n Kn = [];\n let s = 0;\n for (const k of K) {\n if (s < 0) {\n s += sums.get(k);\n Kp.push(k);\n } else {\n s -= sums.get(k);\n Kn.push(k);\n }\n }\n return Kn.reverse().concat(Kp);\n });\n}\n\nfunction orderAccessor(f) {\n return (data) => {\n const O = valueof(data, f);\n return (i, j) => ascendingDefined(O[i], O[j]);\n };\n}\n\nfunction orderComparator(f) {\n return (data) => (i, j) => f(data[i], data[j]);\n}\n\nfunction orderGiven(domain) {\n return orderZDomain(ascendingDefined, () => domain);\n}\n\n// Given an ordering (domain) of distinct values in z that can be derived from\n// the data, returns a comparator that can be used to sort stacks. Note that\n// this is a series order: it will be consistent across stacks.\nfunction orderZDomain(compare, domain) {\n return (data, X, Y, Z) => {\n if (!Z) throw new Error(\"missing channel: z\");\n const map = new InternMap(domain(data, X, Y, Z).map((d, i) => [d, i]));\n return (i, j) => compare(map.get(Z[i]), map.get(Z[j]));\n };\n}\n", "import {area as shapeArea} from \"d3\";\nimport {create} from \"../context.js\";\nimport {maybeCurve} from \"../curve.js\";\nimport {Mark} from \"../mark.js\";\nimport {first, indexOf, maybeZ, second} from \"../options.js\";\nimport {\n applyDirectStyles,\n applyIndirectStyles,\n applyTransform,\n applyGroupedChannelStyles,\n groupIndex\n} from \"../style.js\";\nimport {maybeDenseIntervalX, maybeDenseIntervalY} from \"../transforms/bin.js\";\nimport {maybeIdentityX, maybeIdentityY} from \"../transforms/identity.js\";\nimport {maybeStackX, maybeStackY} from \"../transforms/stack.js\";\n\nconst defaults = {\n ariaLabel: \"area\",\n strokeWidth: 1,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeMiterlimit: 1\n};\n\nexport class Area extends Mark {\n constructor(data, options = {}) {\n const {x1, y1, x2, y2, z, curve, tension} = options;\n super(\n data,\n {\n x1: {value: x1, scale: \"x\"},\n y1: {value: y1, scale: \"y\"},\n x2: {value: x2, scale: \"x\", optional: true},\n y2: {value: y2, scale: \"y\", optional: true},\n z: {value: maybeZ(options), optional: true}\n },\n options,\n defaults\n );\n this.z = z;\n this.curve = maybeCurve(curve, tension);\n }\n filter(index) {\n return index;\n }\n render(index, scales, channels, dimensions, context) {\n const {x1: X1, y1: Y1, x2: X2 = X1, y2: Y2 = Y1} = channels;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, scales, 0, 0)\n .call((g) =>\n g\n .selectAll()\n .data(groupIndex(index, [X1, Y1, X2, Y2], this, channels))\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .call(applyGroupedChannelStyles, this, channels)\n .attr(\n \"d\",\n shapeArea()\n .curve(this.curve)\n .defined((i) => i >= 0)\n .x0((i) => X1[i])\n .y0((i) => Y1[i])\n .x1((i) => X2[i])\n .y1((i) => Y2[i])\n )\n )\n .node();\n }\n}\n\nexport function area(data, options) {\n if (options === undefined) return areaY(data, {x: first, y: second});\n return new Area(data, options);\n}\n\nexport function areaX(data, options) {\n const {y = indexOf, ...rest} = maybeDenseIntervalY(options);\n return new Area(data, maybeStackX(maybeIdentityX({...rest, y1: y, y2: undefined})));\n}\n\nexport function areaY(data, options) {\n const {x = indexOf, ...rest} = maybeDenseIntervalX(options);\n return new Area(data, maybeStackY(maybeIdentityY({...rest, x1: x, x2: undefined})));\n}\n", "import {geoPath, line as shapeLine} from \"d3\";\nimport {create} from \"../context.js\";\nimport {curveAuto, maybeCurveAuto} from \"../curve.js\";\nimport {Mark} from \"../mark.js\";\nimport {applyGroupedMarkers, markers} from \"../marker.js\";\nimport {coerceNumbers, indexOf, identity, maybeTuple, maybeZ} from \"../options.js\";\nimport {\n applyDirectStyles,\n applyIndirectStyles,\n applyTransform,\n applyGroupedChannelStyles,\n groupIndex\n} from \"../style.js\";\nimport {maybeDenseIntervalX, maybeDenseIntervalY} from \"../transforms/bin.js\";\n\nconst defaults = {\n ariaLabel: \"line\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 1.5,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeMiterlimit: 1\n};\n\nexport class Line extends Mark {\n constructor(data, options = {}) {\n const {x, y, z, curve, tension} = options;\n super(\n data,\n {\n x: {value: x, scale: \"x\"},\n y: {value: y, scale: \"y\"},\n z: {value: maybeZ(options), optional: true}\n },\n options,\n defaults\n );\n this.z = z;\n this.curve = maybeCurveAuto(curve, tension);\n markers(this, options);\n }\n filter(index) {\n return index;\n }\n project(channels, values, context) {\n // For the auto curve, projection is handled at render.\n if (this.curve !== curveAuto) {\n super.project(channels, values, context);\n }\n }\n render(index, scales, channels, dimensions, context) {\n const {x: X, y: Y} = channels;\n const {curve} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, scales)\n .call((g) =>\n g\n .selectAll()\n .data(groupIndex(index, [X, Y], this, channels))\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .call(applyGroupedChannelStyles, this, channels)\n .call(applyGroupedMarkers, this, channels, context)\n .attr(\n \"d\",\n curve === curveAuto && context.projection\n ? sphereLine(context.projection, X, Y)\n : shapeLine()\n .curve(curve)\n .defined((i) => i >= 0)\n .x((i) => X[i])\n .y((i) => Y[i])\n )\n )\n .node();\n }\n}\n\nfunction sphereLine(projection, X, Y) {\n const path = geoPath(projection);\n X = coerceNumbers(X);\n Y = coerceNumbers(Y);\n return (I) => {\n let line = [];\n const lines = [line];\n for (const i of I) {\n // Check for undefined value; see groupIndex.\n if (i === -1) {\n line = [];\n lines.push(line);\n } else {\n line.push([X[i], Y[i]]);\n }\n }\n return path({type: \"MultiLineString\", coordinates: lines});\n };\n}\n\nexport function line(data, {x, y, ...options} = {}) {\n [x, y] = maybeTuple(x, y);\n return new Line(data, {...options, x, y});\n}\n\nexport function lineX(data, {x = identity, y = indexOf, ...options} = {}) {\n return new Line(data, maybeDenseIntervalY({...options, x, y}));\n}\n\nexport function lineY(data, {x = indexOf, y = identity, ...options} = {}) {\n return new Line(data, maybeDenseIntervalX({...options, x, y}));\n}\n", "import * as Plot from \"@observablehq/plot\";\nimport * as d3 from \"d3\";\nimport {\n format,\n parse,\n setDay,\n setHours,\n setMinutes,\n setMonth,\n setSeconds,\n setYear,\n} from \"date-fns\";\nimport { h, VNode } from \"preact\";\nimport { useEffect, useRef, useState } from \"preact/hooks\";\n// import {createElement as h} from \"preact\";\ninterface Props {}\n\ninterface Data {\n operation: string;\n date: Date;\n value: number;\n interest: number;\n raw: any;\n}\nconst before = new Date(2023, 11, 11, 0, 0, 0);\nfunction defined(x: Data | undefined): x is Data {\n return (\n !!x &&\n x.operation !== \" BID 4796 PROG APOY REF TRANS\" &&\n x.date.getTime() < before.getTime()\n );\n}\n\nexport function Histogram({}: Props): VNode {\n const containerRef = useRef(null);\n const [goog, setGoog] = useState>();\n const [aapl, setAapl] = useState>();\n useEffect(() => {\n d3.csv(\"assets/data/goog.csv\", d3.autoType).then((d) => {\n setGoog(d);\n });\n d3.csv(\"assets/data/aapl.csv\", d3.autoType).then((d) => {\n setAapl(d);\n });\n }, []);\n\n useEffect(() => {\n if (goog === undefined) return;\n if (aapl === undefined) return;\n if (containerRef.current === null) return;\n\n const plot = Plot.plot({\n style: \"width: 100%;\",\n grid: true,\n height: 300,\n x: { label: \"Fecha \" },\n y: { label: \"Precio (ARS)\" },\n marks: [\n Plot.lineY(goog, { x: \"Date\", y: \"Close\", stroke: \"red\" }),\n Plot.lineY(aapl, { x: \"Date\", y: \"Close\", stroke: \"blue\" }),\n ],\n });\n\n containerRef.current.append(plot);\n return () => plot.remove();\n }, [goog, aapl]);\n\n return
    ;\n}\n\nexport function Normalized({}: Props): VNode {\n const containerRef = useRef(null);\n const [riaa, setRiaa] = useState>();\n useEffect(() => {\n d3.csv(\"assets/data/riaa-us-revenue.csv\", d3.autoType).then((d) => {\n setRiaa(d);\n });\n }, []);\n\n useEffect(() => {\n if (riaa === undefined) return;\n if (containerRef.current === null) return;\n\n // const plot = Plot.plot({\n // style: \"width: 100%;\",\n // grid: true,\n // height: 300,\n // x: { label: \"Fecha \" },\n // y: { label: \"Precio (ARS)\", percent: true },\n // marks: [\n // Plot.areaY(\n // riaa,\n // Plot.stackY(\n // { offset: \"normalize\", order: \"group\", reverse: true },\n // { x: \"year\", y: \"revenue\", z: \"format\", fill: \"group\" }\n // )\n // ),\n // Plot.ruleY([0, 1]),\n // ],\n // });\n console.log(riaa)\n const plot = Plot.plot({\n y: {\n label: \"\u2191 Annual revenue (%)\",\n percent: true\n },\n marks: [\n Plot.areaY(riaa, Plot.stackY({offset: \"normalize\", order: \"group\", reverse: true}, {x: \"year\", y: \"revenue\", z: \"format\", fill: \"group\"})),\n Plot.ruleY([0, 1])\n ]\n })\n\n containerRef.current.append(plot);\n return () => plot.remove();\n }, [riaa]);\n\n return
    ;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { useEffect, useState } from \"preact/hooks\";\nimport { AbsoluteTime } from \"./time.js\";\nimport { Codec, codecForString } from \"./codec.js\";\n\ndeclare const opaque_StorageKey: unique symbol;\n\ntype StorageKey = {\n id: string;\n [opaque_StorageKey]: true;\n codec: Codec;\n};\n\nexport function buildStorageKey(\n name: string,\n codec: Codec,\n): StorageKey;\nexport function buildStorageKey(name: string): StorageKey;\nexport function buildStorageKey(\n name: string,\n codec?: Codec,\n): StorageKey {\n return {\n id: name,\n codec: codec ?? (codecForString() as Codec),\n } as StorageKey;\n}\n\n\nexport interface StorageState {\n value: Type;\n update: (s: Type) => void;\n reset: () => void;\n}\n\nexport function assertUnreachable(x: never): never {\n throw new Error(\"Didn't expect to get here\");\n}\n\nexport function canonicalizeBaseUrl(url: string): string {\n if (!url.startsWith(\"http\") && !url.startsWith(\"https\")) {\n url = \"https://\" + url;\n }\n const x = new URL(url);\n if (!x.pathname.endsWith(\"/\")) {\n x.pathname = x.pathname + \"/\";\n }\n x.search = \"\";\n x.hash = \"\";\n return x.href;\n}\n\nexport enum KnownErrorCode {\n UNEXPECTED_EXCEPTION = 0,\n}\n\nexport interface KnownErrorDetail {\n code: KnownErrorCode;\n when?: AbsoluteTime;\n hint?: string;\n [x: string]: unknown;\n}\n\nexport interface DetailsMap {\n [KnownErrorCode.UNEXPECTED_EXCEPTION]: {\n };\n}\n\ntype empty = Record;\n\ntype ErrBody = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;\n\nexport class KnownError extends Error {\n errorDetail: KnownErrorDetail & T;\n cause: Error | undefined;\n static GENERIC_TIMEOUT: any;\n static GENERIC_CLIENT_INTERNAL_ERROR: any;\n static HTTP_REQUEST_GENERIC_TIMEOUT: any;\n static HTTP_REQUEST_THROTTLED: any;\n static RECEIVED_MALFORMED_RESPONSE: any;\n static NETWORK_ERROR: any;\n static UNEXPECTED_REQUEST_ERROR: any;\n private constructor(d: KnownErrorDetail & T, cause?: Error) {\n super(d.hint ?? `Error (code ${d.code})`);\n this.errorDetail = d;\n this.cause = cause;\n Object.setPrototypeOf(this, KnownError.prototype);\n }\n\n static fromDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n cause?: Error,\n ): KnownError {\n if (!hint) {\n hint = getDefaultHint(code);\n }\n const when = AbsoluteTime.now();\n return new KnownError({ code, when, hint, ...detail }, cause);\n }\n\n static fromUncheckedDetail(d: KnownErrorDetail, c?: Error): KnownError {\n return new KnownError({ ...d }, c);\n }\n\n static fromException(e: any): KnownError {\n const errDetail = getErrorDetailFromException(e);\n return new KnownError(errDetail, e);\n }\n\n hasErrorCode(\n code: C,\n ): this is KnownError {\n return this.errorDetail.code === code;\n }\n\n toString(): string {\n return `KnownError: ${JSON.stringify(this.errorDetail)}`;\n }\n}\n\n/**\n * Convert an exception (or anything that was thrown) into\n * a KnownErrorDetail object.\n */\nexport function getErrorDetailFromException(e: any): KnownErrorDetail {\n if (e instanceof KnownError) {\n return e.errorDetail;\n }\n if (e instanceof Error) {\n const err = makeErrorDetail(\n KnownErrorCode.UNEXPECTED_EXCEPTION,\n {\n stack: e.stack,\n },\n `unexpected exception (message: ${e.message})`,\n );\n return err;\n }\n // Something was thrown that is not even an exception!\n // Try to stringify it.\n let excString: string;\n try {\n excString = e.toString();\n } catch (e) {\n // Something went horribly wrong.\n excString = \"can't stringify exception\";\n }\n const err = makeErrorDetail(\n KnownErrorCode.UNEXPECTED_EXCEPTION,\n {},\n `unexpected exception (not an exception, ${excString})`,\n );\n return err;\n}\n\nfunction getDefaultHint(code: number): string {\n const errName = KnownErrorCode[code];\n if (errName) {\n return `Error (${errName})`;\n } else {\n return `Error ()`;\n }\n}\n\nfunction makeErrorDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n): KnownErrorDetail {\n if (!hint && !(detail as any).hint) {\n hint = getDefaultHint(code);\n }\n const when = AbsoluteTime.now();\n return { code, when, hint, ...detail };\n}\n\n\n/**\n * Validate (the number part of) an amount. If needed,\n * replace comma with a dot. Returns 'false' whenever\n * the input is invalid, the valid amount otherwise.\n */\nconst amountRegex = /^[0-9]+(.[0-9]+)?$/;\nexport function validateAmount(\n maybeAmount: string | undefined,\n): string | undefined {\n if (!maybeAmount || !amountRegex.test(maybeAmount)) {\n return;\n }\n return maybeAmount;\n}\n\n/**\n * Extract IBAN from a Payto URI.\n */\nexport function getIbanFromPayto(url: string): string {\n const pathSplit = new URL(url).pathname.split(\"/\");\n let lastIndex = pathSplit.length - 1;\n // Happens if the path ends with \"/\".\n if (pathSplit[lastIndex] === \"\") lastIndex--;\n const iban = pathSplit[lastIndex];\n return iban;\n}\n\nexport function undefinedIfEmpty(obj: T): T | undefined {\n return Object.keys(obj).some(\n (k) => (obj as Record)[k] !== undefined,\n )\n ? obj\n : undefined;\n}\n\nexport type PartialButDefined = {\n [P in keyof T]: T[P] | undefined;\n};\n\n/**\n * every non-map field can be undefined\n */\nexport type RecursivePartial = {\n [P in keyof Type]?: Type[P] extends (infer U)[]\n ? RecursivePartial[]\n : Type[P] extends object\n ? RecursivePartial\n : Type[P];\n};\n\nexport enum TanChannel {\n SMS = \"sms\",\n EMAIL = \"email\",\n}\nexport enum CashoutStatus {\n // The payment was initiated after a valid\n // TAN was received by the bank.\n CONFIRMED = \"confirmed\",\n\n // The cashout was created and now waits\n // for the TAN by the author.\n PENDING = \"pending\",\n}\n\n\nexport const PAGINATED_LIST_SIZE = 5;\n// when doing paginated request, ask for one more\n// and use it to know if there are more to request\nexport const PAGINATED_LIST_REQUEST = PAGINATED_LIST_SIZE + 1;\n\n\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue: Type,\n): StorageState {\n\n const current = convert(localStorage.get(key.id), key, defaultValue);\n\n const [_, setStoredValue] = useState(AbsoluteTime.now().t_ms);\n\n useEffect(() => {\n return localStorage.onUpdate(key.id, () => {\n // const newValue = storage.get(key.id);\n setStoredValue(AbsoluteTime.now().t_ms);\n });\n }, [key.id]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n localStorage.delete(key.id);\n } else {\n localStorage.set(\n key.id,\n key.codec ? JSON.stringify(value) : (value as string),\n );\n }\n };\n\n return {\n value: current,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n\nfunction convert(updated: string | undefined, key: StorageKey, defaultValue: Type): Type {\n if (updated === undefined) return defaultValue; //optional\n try {\n return key.codec.decode(JSON.parse(updated));\n } catch (e) {\n //decode error\n return defaultValue;\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2018-2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type-safe codecs for converting from/to JSON.\n */\n\n/**\n * Error thrown when decoding fails.\n */\nexport class DecodingError extends Error {\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, DecodingError.prototype);\n this.name = \"DecodingError\";\n }\n}\n\n/**\n * Context information to show nicer error messages when decoding fails.\n */\nexport interface Context {\n readonly path?: string[];\n}\n\nexport function renderContext(c?: Context): string {\n const p = c?.path;\n if (p) {\n return p.join(\".\");\n } else {\n return \"(unknown)\";\n }\n}\n\nfunction joinContext(c: Context | undefined, part: string): Context {\n const path = c?.path ?? [];\n return {\n path: path.concat([part]),\n };\n}\n\n/**\n * A codec converts untyped JSON to a typed object.\n */\nexport interface Codec {\n /**\n * Decode untyped JSON to an object of type [[V]].\n */\n readonly decode: (x: any, c?: Context) => V;\n}\n\ntype SingletonRecord = { [Y in K]: V };\n\ninterface Prop {\n name: string;\n codec: Codec;\n}\n\ninterface Alternative {\n tagValue: any;\n codec: Codec;\n}\n\nclass ObjectCodecBuilder {\n private propList: Prop[] = [];\n\n /**\n * Define a property for the object.\n */\n property(\n x: K,\n codec: Codec,\n ): ObjectCodecBuilder> {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.propList.push({ name: x, codec: codec });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(objectDisplayName: string): Codec {\n const propList = this.propList;\n return {\n decode(x: any, c?: Context): PartialOutputType {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n if (typeof x !== \"object\") {\n throw new DecodingError(\n `expected object for ${objectDisplayName} at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n const obj: any = {};\n for (const prop of propList) {\n const propRawVal = x[prop.name];\n const propVal = prop.codec.decode(\n propRawVal,\n joinContext(c, prop.name),\n );\n obj[prop.name] = propVal;\n }\n return obj as PartialOutputType;\n },\n };\n }\n}\n\nclass UnionCodecBuilder<\n TargetType,\n TagPropertyLabel extends keyof TargetType,\n CommonBaseType,\n PartialTargetType,\n> {\n private alternatives = new Map();\n\n constructor(\n private discriminator: TagPropertyLabel,\n private baseCodec?: Codec,\n ) { }\n\n /**\n * Define a property for the object.\n */\n alternative(\n tagValue: TargetType[TagPropertyLabel],\n codec: Codec,\n ): UnionCodecBuilder<\n TargetType,\n TagPropertyLabel,\n CommonBaseType,\n PartialTargetType | V\n > {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.alternatives.set(tagValue, { codec, tagValue });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(\n objectDisplayName: string,\n ): Codec {\n const alternatives = this.alternatives;\n const discriminator = this.discriminator;\n const baseCodec = this.baseCodec;\n return {\n decode(x: any, c?: Context): R {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n const d = x[discriminator];\n if (d === undefined) {\n throw new DecodingError(\n `expected tag for ${objectDisplayName} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const alt = alternatives.get(d);\n if (!alt) {\n throw new DecodingError(\n `unknown tag for ${objectDisplayName} ${d} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const altDecoded = alt.codec.decode(x);\n if (baseCodec) {\n const baseDecoded = baseCodec.decode(x, c);\n return { ...baseDecoded, ...altDecoded };\n } else {\n return altDecoded;\n }\n },\n };\n }\n}\n\nexport class UnionCodecPreBuilder {\n discriminateOn(\n discriminator: D,\n baseCodec?: Codec,\n ): UnionCodecBuilder {\n return new UnionCodecBuilder(discriminator, baseCodec);\n }\n}\n\n/**\n * Return a builder for a codec that decodes an object with properties.\n */\nexport function buildCodecForObject(): ObjectCodecBuilder {\n return new ObjectCodecBuilder();\n}\n\nexport function buildCodecForUnion(): UnionCodecPreBuilder {\n return new UnionCodecPreBuilder();\n}\n\n/**\n * Return a codec for a mapping from a string to values described by the inner codec.\n */\nexport function codecForMap(\n innerCodec: Codec,\n): Codec<{ [x: string]: T }> {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): { [x: string]: T } {\n const map: { [x: string]: T } = {};\n if (typeof x !== \"object\") {\n throw new DecodingError(`expected object at ${renderContext(c)}`);\n }\n for (const i in x) {\n map[i] = innerCodec.decode(x[i], joinContext(c, `[${i}]`));\n }\n return map;\n },\n };\n}\n\n/**\n * Return a codec for a list, containing values described by the inner codec.\n */\nexport function codecForList(innerCodec: Codec): Codec {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): T[] {\n const arr: T[] = [];\n if (!Array.isArray(x)) {\n throw new DecodingError(`expected array at ${renderContext(c)}`);\n }\n for (const i in x) {\n arr.push(innerCodec.decode(x[i], joinContext(c, `[${i}]`)));\n }\n return arr;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForNumber(): Codec {\n return {\n decode(x: any, c?: Context): number {\n if (typeof x === \"number\") {\n return x;\n }\n throw new DecodingError(\n `expected number at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForBoolean(): Codec {\n return {\n decode(x: any, c?: Context): boolean {\n if (typeof x === \"boolean\") {\n return x;\n }\n throw new DecodingError(\n `expected boolean at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForString(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n return x;\n }\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForStringURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return x;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Codec that allows any value.\n */\nexport function codecForAny(): Codec {\n return {\n decode(x: any, c?: Context): any {\n return x;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForConstString(s: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === s) {\n return x;\n }\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got string value \"${x}\"`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstTrue(): Codec {\n return {\n decode(x: any, c?: Context): true {\n if (x === true) {\n return x;\n }\n throw new DecodingError(\n `expected boolean true at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstFalse(): Codec {\n return {\n decode(x: any, c?: Context): false {\n if (x === false) {\n return x;\n }\n throw new DecodingError(\n `expected boolean false at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a constant number.\n */\nexport function codecForConstNumber(n: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === n) {\n return x;\n }\n throw new DecodingError(\n `expected number constant \"${n}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n },\n };\n}\n\nexport function codecOptional(innerCodec: Codec): Codec {\n return {\n decode(x: any, c?: Context): V | undefined {\n if (x === undefined || x === null) {\n return undefined;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport type CodecType = T extends Codec ? X : any;\n\nexport function codecForEither>>(\n ...alts: [...T]\n): Codec> {\n return {\n decode(x: any, c?: Context): any {\n for (const alt of alts) {\n try {\n return alt.decode(x, c);\n } catch (e) {\n continue;\n }\n }\n throw new DecodingError(\n `No alternative matched at at ${renderContext(c)}`,\n );\n },\n };\n}\n\nconst x = codecForEither(codecForString(), codecForNumber());\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for relative and absolute time.\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, renderContext } from \"./codec.js\";\n\ndeclare const flavor_AbsoluteTime: unique symbol;\ndeclare const flavor_TalerProtocolTimestamp: unique symbol;\ndeclare const flavor_TalerPreciseTimestamp: unique symbol;\n\nconst opaque_AbsoluteTime: unique symbol = Symbol(\"opaque_AbsoluteTime\");\n\n// FIXME: Make this opaque!\nexport interface AbsoluteTime {\n /**\n * Timestamp in milliseconds.\n */\n readonly t_ms: number | \"never\";\n\n readonly _flavor?: typeof flavor_AbsoluteTime;\n\n // Make the type opaque, we only want our constructors\n // to able to create an AbsoluteTime value.\n [opaque_AbsoluteTime]: true;\n}\n\nexport interface TalerProtocolTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n readonly _flavor?: typeof flavor_TalerProtocolTimestamp;\n}\n\n/**\n * Precise timestamp, typically used in the wallet-core\n * API but not in other Taler APIs so far.\n */\nexport interface TalerPreciseTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n /**\n * Optional microsecond offset (non-negative integer).\n */\n readonly off_us?: number;\n\n readonly _flavor?: typeof flavor_TalerPreciseTimestamp;\n}\n\nexport namespace TalerPreciseTimestamp {\n export function now(): TalerPreciseTimestamp {\n const absNow = AbsoluteTime.now();\n return AbsoluteTime.toPreciseTimestamp(absNow);\n }\n\n export function round(t: TalerPreciseTimestamp): TalerProtocolTimestamp {\n return {\n t_s: t.t_s,\n };\n }\n\n export function fromSeconds(s: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(s),\n off_us: Math.floor((s - Math.floor(s)) / 1000 / 1000),\n };\n }\n\n export function fromMilliseconds(ms: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(ms / 1000),\n off_us: Math.floor((ms - Math.floor(ms / 1000) * 1000) * 1000),\n };\n }\n}\n\nexport namespace TalerProtocolTimestamp {\n export function now(): TalerProtocolTimestamp {\n return AbsoluteTime.toProtocolTimestamp(AbsoluteTime.now());\n }\n\n export function zero(): TalerProtocolTimestamp {\n return {\n t_s: 0,\n };\n }\n\n export function never(): TalerProtocolTimestamp {\n return {\n t_s: \"never\",\n };\n }\n\n export function isNever(t: TalerProtocolTimestamp): boolean {\n return t.t_s === \"never\";\n }\n\n export function fromSeconds(s: number): TalerProtocolTimestamp {\n return {\n t_s: s,\n };\n }\n\n export function min(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\") {\n return { t_s: t2.t_s };\n }\n if (t2.t_s === \"never\") {\n return { t_s: t1.t_s };\n }\n return { t_s: Math.min(t1.t_s, t2.t_s) };\n }\n export function max(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\" || t2.t_s === \"never\") {\n return { t_s: \"never\" };\n }\n return { t_s: Math.max(t1.t_s, t2.t_s) };\n }\n}\n\nexport interface Duration {\n /**\n * Duration in milliseconds.\n */\n readonly d_ms: number | \"forever\";\n}\n\nexport interface TalerProtocolDuration {\n readonly d_us: number | \"forever\";\n}\n\n/**\n * Timeshift in milliseconds.\n */\nlet timeshift = 0;\n\n/**\n * Set timetravel offset in milliseconds.\n *\n * Use carefully and only for testing.\n */\nexport function setDangerousTimetravel(dt: number): void {\n timeshift = dt;\n}\n\nexport namespace Duration {\n export function toMilliseconds(d: Duration): number {\n if (d.d_ms === \"forever\") {\n return Number.MAX_VALUE;\n }\n return d.d_ms;\n }\n export function getRemaining(\n deadline: AbsoluteTime,\n now = AbsoluteTime.now(),\n ): Duration {\n if (deadline.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (now.t_ms === \"never\") {\n throw Error(\"invalid argument for 'now'\");\n }\n if (deadline.t_ms < now.t_ms) {\n return { d_ms: 0 };\n }\n return { d_ms: deadline.t_ms - now.t_ms };\n }\n\n export function fromPrettyString(s: string): Duration {\n let dMs = 0;\n let currentNum = \"\";\n let parsingNum = true;\n for (let i = 0; i < s.length; i++) {\n const cc = s.charCodeAt(i);\n if (cc >= \"0\".charCodeAt(0) && cc <= \"9\".charCodeAt(0)) {\n if (!parsingNum) {\n throw Error(\"invalid duration, unexpected number\");\n }\n currentNum += s[i];\n continue;\n }\n if (s[i] == \" \") {\n if (currentNum != \"\") {\n parsingNum = false;\n }\n continue;\n }\n\n if (currentNum == \"\") {\n throw Error(\"invalid duration, missing number\");\n }\n\n if (s[i] === \"s\") {\n dMs += 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"m\") {\n dMs += 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"h\") {\n dMs += 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"d\") {\n dMs += 24 * 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else {\n throw Error(\"invalid duration, unsupported unit\");\n }\n currentNum = \"\";\n parsingNum = true;\n }\n return {\n d_ms: dMs,\n };\n }\n\n /**\n * Compare two durations. Returns 0 when equal, -1 when a < b\n * and +1 when a > b.\n */\n export function cmp(d1: Duration, d2: Duration): 1 | 0 | -1 {\n if (d1.d_ms === \"forever\") {\n if (d2.d_ms === \"forever\") {\n return 0;\n }\n return 1;\n }\n if (d2.d_ms === \"forever\") {\n return -1;\n }\n if (d1.d_ms == d2.d_ms) {\n return 0;\n }\n if (d1.d_ms > d2.d_ms) {\n return 1;\n }\n return -1;\n }\n\n export function max(d1: Duration, d2: Duration): Duration {\n return durationMax(d1, d2);\n }\n\n export function min(d1: Duration, d2: Duration): Duration {\n return durationMin(d1, d2);\n }\n\n export function multiply(d1: Duration, n: number): Duration {\n return durationMul(d1, n);\n }\n\n export function toIntegerYears(d: Duration): number {\n if (typeof d.d_ms !== \"number\") {\n throw Error(\"infinite duration\");\n }\n return Math.ceil(d.d_ms / 1000 / 60 / 60 / 24 / 365);\n }\n\n export function fromSpec(spec: {\n seconds?: number;\n minutes?: number;\n hours?: number;\n days?: number;\n months?: number;\n years?: number;\n }): Duration {\n let d_ms = 0;\n d_ms += (spec.seconds ?? 0) * SECONDS;\n d_ms += (spec.minutes ?? 0) * MINUTES;\n d_ms += (spec.hours ?? 0) * HOURS;\n d_ms += (spec.days ?? 0) * DAYS;\n d_ms += (spec.months ?? 0) * MONTHS;\n d_ms += (spec.years ?? 0) * YEARS;\n return { d_ms };\n }\n\n export function getForever(): Duration {\n return { d_ms: \"forever\" };\n }\n\n export function getZero(): Duration {\n return { d_ms: 0 };\n }\n\n export function fromTalerProtocolDuration(\n d: TalerProtocolDuration,\n ): Duration {\n if (d.d_us === \"forever\") {\n return {\n d_ms: \"forever\",\n };\n }\n return {\n d_ms: Math.floor(d.d_us / 1000),\n };\n }\n\n export function toTalerProtocolDuration(d: Duration): TalerProtocolDuration {\n if (d.d_ms === \"forever\") {\n return {\n d_us: \"forever\",\n };\n }\n return {\n d_us: d.d_ms * 1000,\n };\n }\n\n export function fromMilliseconds(ms: number): Duration {\n return {\n d_ms: ms,\n };\n }\n\n export function clamp(args: {\n lower: Duration;\n upper: Duration;\n value: Duration;\n }): Duration {\n return durationMax(durationMin(args.value, args.upper), args.lower);\n }\n}\n\nexport namespace AbsoluteTime {\n export function getStampMsNow(): number {\n return new Date().getTime();\n }\n\n export function getStampMsNever(): number {\n return Number.MAX_SAFE_INTEGER;\n }\n\n export function now(): AbsoluteTime {\n return {\n t_ms: new Date().getTime() + timeshift,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function never(): AbsoluteTime {\n return {\n t_ms: \"never\",\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromMilliseconds(ms: number): AbsoluteTime {\n return {\n t_ms: ms,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function cmp(t1: AbsoluteTime, t2: AbsoluteTime): number {\n if (t1.t_ms === \"never\") {\n if (t2.t_ms === \"never\") {\n return 0;\n }\n return 1;\n }\n if (t2.t_ms === \"never\") {\n return -1;\n }\n if (t1.t_ms == t2.t_ms) {\n return 0;\n }\n if (t1.t_ms > t2.t_ms) {\n return 1;\n }\n return -1;\n }\n\n export function min(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.min(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function max(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function difference(t1: AbsoluteTime, t2: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (t2.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.abs(t1.t_ms - t2.t_ms) };\n }\n\n export function isExpired(t: AbsoluteTime) {\n return cmp(t, now()) <= 0;\n }\n\n export function isNever(t: AbsoluteTime): boolean {\n return t.t_ms === \"never\";\n }\n\n export function fromProtocolTimestamp(\n t: TalerProtocolTimestamp,\n ): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return {\n t_ms: t.t_s * 1000,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromStampMs(stampMs: number): AbsoluteTime {\n return {\n t_ms: stampMs,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromPreciseTimestamp(t: TalerPreciseTimestamp): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n const offsetUs = t.off_us ?? 0;\n return {\n t_ms: t.t_s * 1000 + Math.floor(offsetUs / 1000),\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function toStampMs(at: AbsoluteTime): number {\n if (at.t_ms === \"never\") {\n return Number.MAX_SAFE_INTEGER;\n }\n return at.t_ms;\n }\n\n export function toPreciseTimestamp(at: AbsoluteTime): TalerPreciseTimestamp {\n if (at.t_ms == \"never\") {\n return {\n t_s: \"never\",\n };\n }\n const t_s = Math.floor(at.t_ms / 1000);\n const off_us = Math.floor(1000 * (at.t_ms - t_s * 1000));\n return {\n t_s,\n off_us,\n };\n }\n\n export function toProtocolTimestamp(\n at: AbsoluteTime,\n ): TalerProtocolTimestamp {\n if (at.t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n return {\n t_s: Math.floor(at.t_ms / 1000),\n };\n }\n\n export function isBetween(\n t: AbsoluteTime,\n start: AbsoluteTime,\n end: AbsoluteTime,\n ): boolean {\n if (cmp(t, start) < 0) {\n return false;\n }\n if (cmp(t, end) > 0) {\n return false;\n }\n return true;\n }\n\n export function toIsoString(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"\";\n } else {\n return new Date(t.t_ms).toISOString();\n }\n }\n\n export function addDuration(t1: AbsoluteTime, d: Duration): AbsoluteTime {\n if (t1.t_ms === \"never\" || d.d_ms === \"forever\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: t1.t_ms + d.d_ms, [opaque_AbsoluteTime]: true };\n }\n\n /**\n * Get the remaining duration until {@param t1}.\n *\n * If {@param t1} already happened, the remaining duration\n * is zero.\n */\n export function remaining(t1: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return Duration.getForever();\n }\n const stampNow = now();\n if (stampNow.t_ms === \"never\") {\n throw Error(\"invariant violated\");\n }\n return Duration.fromMilliseconds(Math.max(0, t1.t_ms - stampNow.t_ms));\n }\n\n export function subtractDuraction(\n t1: AbsoluteTime,\n d: Duration,\n ): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (d.d_ms === \"forever\") {\n return { t_ms: 0, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(0, t1.t_ms - d.d_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function stringify(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"never\";\n }\n return new Date(t.t_ms).toISOString();\n }\n}\n\nconst SECONDS = 1000;\nconst MINUTES = SECONDS * 60;\nconst HOURS = MINUTES * 60;\nconst DAYS = HOURS * 24;\nconst MONTHS = DAYS * 30;\nconst YEARS = DAYS * 365;\n\nexport function durationMin(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: d2.d_ms };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: d1.d_ms };\n }\n return { d_ms: Math.min(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMax(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.max(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMul(d: Duration, n: number): Duration {\n if (d.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.round(d.d_ms * n) };\n}\n\nexport function durationAdd(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\" || d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: d1.d_ms + d2.d_ms };\n}\n\nexport const codecForAbsoluteTime: Codec = {\n decode(x: any, c?: Context): AbsoluteTime {\n if (x === undefined) {\n throw Error(`got undefined and expected absolute time at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_ms, [opaque_AbsoluteTime]: true };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForTimestamp: Codec = {\n decode(x: any, c?: Context): TalerProtocolTimestamp {\n // Compatibility, should be removed soon.\n if (x === undefined) {\n throw Error(`got undefined and expected timestamp at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n const t_s = x.t_s;\n if (typeof t_s === \"string\") {\n if (t_s === \"never\") {\n return { t_s: \"never\" };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n }\n if (typeof t_s === \"number\") {\n return { t_s };\n }\n throw Error(`expected protocol timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForPreciseTimestamp: Codec = {\n decode(x: any, c?: Context): TalerPreciseTimestamp {\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n throw Error(`expected precise timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForDuration: Codec = {\n decode(x: any, c?: Context): TalerProtocolDuration {\n const d_us = x.d_us;\n if (typeof d_us === \"string\") {\n if (d_us === \"forever\") {\n return { d_us: \"forever\" };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n }\n if (typeof d_us === \"number\") {\n return { d_us };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n },\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\nimport { AppUiSettings } from \"../settings.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type Type = AppUiSettings;\n\nconst initial: AppUiSettings = {};\nconst Context = createContext(initial);\n\nexport const useSettingsContext = (): Type => useContext(Context);\n\nexport const SettingsProvider = ({\n children,\n value,\n}: {\n value: AppUiSettings;\n children: ComponentChildren;\n}): VNode => {\n return h(Context.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nexport interface StringsType {\n // X-Domain or 'messages'\n domain: string;\n lang: string;\n completeness: number;\n plural_forms: string;\n locale_data: {\n messages: Record;\n };\n}\nexport const strings: Record = {};\n\nstrings[\"it\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"it\",\n },\n \"Operation failed, please report\": [\"Registrazione\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"Show withdrawal confirmation\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"Ritira contante\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"Lista conti pubblici non trovata.\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"Prelevare\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"Chiudi il ritiro Taler\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\n \"La banca sta creando l'operazione...\",\n ],\n 'The destination account \"%1$s\" was not found.': [\n \"Lista conti pubblici non trovata.\",\n ],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\n \"Lista conti pubblici non trovata.\",\n ],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n subject: [\"Soggetto\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"Importo\"],\n \"amount to transfer\": [\"Somma da ritirare\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"Credenziali invalide.\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n Password: [\"\"],\n \"password of the account\": [\"Storico dei conti pubblici\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"Registrati\"],\n \"Wire transfer completed!\": [\"Bonifico\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"Conferma il ritiro\"],\n \"Wire transfer details\": [\"Bonifico\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"Questo ritiro \u00E8 stato annullato!\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"Registrazione\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"Ultime transazioni:\"],\n Date: [\"Data\"],\n Counterpart: [\"Controparte\"],\n Subject: [\"Soggetto\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"Storico dei conti pubblici\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"indirizzo Payto\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"Chiudi il bonifico\"],\n \"Wire transfer created!\": [\"Bonifico\"],\n Accounts: [\"Importo\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"Somma da ritirare\"],\n \"Amount to receive\": [\"Somma da ritirare\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"Credenziali invalide.\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"Lista conti pubblici non trovata.\"],\n \"Latest cashouts\": [\"Ultime transazioni:\"],\n Created: [\"\"],\n Confirmed: [\"Conferma\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"Annulla\"],\n Confirm: [\"Conferma\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\n \"Usa questo codice QR per ritirare contante nel tuo wallet:\",\n ],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"Conferma il ritiro\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"Prelevare\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"Ritira contante nel portafoglio Taler\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"Effettua un bonifico\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"Bonifico\"],\n Withdrawal: [\"Prelevare\"],\n \"Confirm the operation\": [\"Conferma il ritiro\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"it\",\n completeness: 14,\n};\n\nstrings[\"fr\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n > 1;\",\n lang: \"fr\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"\"],\n \"amount to transfer\": [\"\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"\"],\n Counterpart: [\"\"],\n Subject: [\"\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"\"],\n \"Confirm the operation\": [\"\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n > 1;\",\n lang: \"fr\",\n completeness: 0,\n};\n\nstrings[\"es\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"es\",\n },\n \"Operation failed, please report\": [\n \"La operaic\u00F3n fall\u00F3, por favor reportelo\",\n ],\n \"Request timeout\": [\"La petici\u00F3n al servidor agoto su tiempo\"],\n \"Request throttled\": [\"La petici\u00F3n al servidor interrumpida\"],\n \"Malformed response\": [\"Respuesta malformada\"],\n \"Network error\": [\"Error de conexi\u00F3n\"],\n \"Unexpected request error\": [\"Error de pedido inesperado\"],\n \"Unexpected error\": [\"Error inesperado\"],\n \"IBAN numbers usually have more that 4 digits\": [\n \"Los n\u00FAmeros IBAN usualmente tienen mas de 4 digitos\",\n ],\n \"IBAN numbers usually have less that 34 digits\": [\n \"Los n\u00FAmeros IBAN usualmente tienen menos de 34 digitos\",\n ],\n \"IBAN country code not found\": [\"C\u00F3digo de pais de IBAN no encontrado\"],\n \"IBAN number is not valid, checksum is wrong\": [\n \"El n\u00FAmero IBAN no es v\u00E1lido, fall\u00F3 la verificaci\u00F3n\",\n ],\n \"Max withdrawal amount\": [\"Monto m\u00E1ximo de extracci\u00F3n\"],\n \"Show withdrawal confirmation\": [\"Mostrar confirmaci\u00F3n de extracci\u00F3n\"],\n \"Show demo description\": [\"Mostrar descripci\u00F3n de demo\"],\n \"Show install wallet first\": [\"Mostrar instalar la billetera primero\"],\n \"Use fast withdrawal form\": [\"Usar formulario de extracci\u00F3n r\u00E1pida\"],\n \"Show debug info\": [\"Mostrar informaci\u00F3n de depuraci\u00F3n\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\n \"La operaci\u00F3n en la reserva ya ha sido confirmada previamente y no puede ser abortada\",\n ],\n \"The operation id is invalid.\": [\"El id de operaci\u00F3n es invalido.\"],\n \"The operation was not found.\": [\"La operaci\u00F3n no se encontr\u00F3.\"],\n \"If you have a Taler wallet installed in this device\": [\n \"Si tienes una billetera Taler instalada en este dispositivo\",\n ],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\n \"Veras los detalles de la operaci\u00F3n en tu billetera incluyendo comisiones (si aplic\u00E1n). Si todav\u00EDa no tienes una puedes instalarla siguiendo las instrucciones en\",\n ],\n \"this page\": [\"esta p\u00E1gina\"],\n Withdraw: [\"Retirar\"],\n \"Or if you have the wallet in another device\": [\n \"O si tienes la billetera en otro dispositivo\",\n ],\n \"Scan the QR below to start the withdrawal.\": [\n \"Escanea el QR debajo para comenzar la extracci\u00F3n.\",\n ],\n required: [\"requerido\"],\n \"IBAN should have just uppercased letters and numbers\": [\n \"IBAN deber\u00EDa tener letras may\u00FAsculas y n\u00FAmeros\",\n ],\n \"not valid\": [\"no v\u00E1lido\"],\n \"should be greater than 0\": [\"Deber\u00EDa ser mas grande que 0\"],\n \"balance is not enough\": [\"el saldo no es suficiente\"],\n \"does not follow the pattern\": [\"no tiene un patr\u00F3n valido\"],\n 'only \"IBAN\" target are supported': [\n 'solo cuentas \"IBAN\" son soportadas',\n ],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n 'usa el par\u00E1metro \"amount\" para indicar el monto a ser transferido',\n ],\n \"the amount is not valid\": [\"el monto no es v\u00E1lido\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\n 'usa el par\u00E1metro \"message\" para indicar un texto de referencia en la transferencia',\n ],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\n \"El pedido era inv\u00E1lido o el URI payto:// usado tiene caracter\u00EDsticas inaceptables.\",\n ],\n \"Not enough permission to complete the operation.\": [\n \"Sin permisos suficientes para completar la operaci\u00F3n.\",\n ],\n 'The destination account \"%1$s\" was not found.': [\n 'La cuenta de destino \"%1$s\" no fue encontrada.',\n ],\n \"The origin and the destination of the transfer can't be the same.\": [\n \"El origen y destino de la transferencia no puede ser la misma.\",\n ],\n \"Your balance is not enough.\": [\"El saldo no es suficiente.\"],\n 'The origin account \"%1$s\" was not found.': [\n 'La cuenta origen \"%1$s\" no fue encontrada.',\n ],\n \"Using a form\": [\"Usando un formulario\"],\n \"Import payto:// URI\": [\"Importando un URI payto://\"],\n Recipient: [\"Destinatario\"],\n \"IBAN of the recipient's account\": [\n \"Numero IBAN de la cuenta destinataria\",\n ],\n \"Transfer subject\": [\"Asunto de transferencia\"],\n subject: [\"asunto\"],\n \"some text to identify the transfer\": [\n \"alg\u00FAn texto para identificar la transferencia\",\n ],\n Amount: [\"Monto\"],\n \"amount to transfer\": [\"monto a transferir\"],\n \"payto URI:\": [\"payto URI:\"],\n \"uniform resource identifier of the target account\": [\n \"identificador de recurso uniforme de la cuenta destino\",\n ],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\n \"payto://iban/[iban-destinatario]?message=[asunto]&amount=[%1$s:X.Y]\",\n ],\n Cancel: [\"Cancelar\"],\n Send: [\"Env\u00EDar\"],\n \"Missing username\": [\"Falta nombre de usuario\"],\n \"Missing password\": [\"Falta contrase\u00F1a\"],\n 'Wrong credentials for \"%1$s\"': ['Credenciales incorrectas para \"%1$s\"'],\n \"Account not found\": [\"Cuenta no encontrada\"],\n Username: [\"Nombre de usuario\"],\n \"username of the account\": [\"nombre de usuario de la cuenta\"],\n Password: [\"Contrase\u00F1a\"],\n \"password of the account\": [\"contrase\u00F1a de la cuenta\"],\n Check: [\"Verificar\"],\n \"Log in\": [\"Acceso\"],\n Register: [\"Registrarse\"],\n \"Wire transfer completed!\": [\"Transferencia bancaria completada!\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\n \"La extracci\u00F3n fue abortada anteriormente y no puede ser confirmada\",\n ],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\n \"La operaci\u00F3n de extracci\u00F3n no puede ser confirmada antes de que una billetera acepte la transaccion.\",\n ],\n \"Your balance is not enough for the operation.\": [\n \"El saldo no es suficiente para la operaci\u00F3n.\",\n ],\n \"Confirm the withdrawal operation\": [\n \"Confirme la operaci\u00F3n de extracci\u00F3n\",\n ],\n \"Wire transfer details\": [\"Detalle de transferencia bancaria\"],\n \"Taler Exchange operator's account\": [\n \"Cuenta del operador del Taler Exchange\",\n ],\n \"Taler Exchange operator's name\": [\n \"Nombre del operador del Taler Exchange\",\n ],\n Transfer: [\"Transferencia\"],\n \"Authentication required\": [\"Autenticaci\u00F3n requerida\"],\n \"This operation was created with other username\": [\n \"Esta operaci\u00F3n fue creada con otro usuario\",\n ],\n \"Operation aborted\": [\"Operaci\u00F3n abortada\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\n \"La transferencia bancaria a la cuenta del operador del Taler Exchange fue abortada, su saldo no fue afectado.\",\n ],\n \"You can close this page now or continue to the account page.\": [\n \"Ya puedes cerrar esta pagina or continuar a la p\u00E1gina de estado de cuenta.\",\n ],\n Continue: [\"Continuar\"],\n \"Withdrawal confirmed\": [\"La extracci\u00F3n fue confirmada\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\n \"La transferencia bancaria al operador Taler fue iniciada. Pronto recibir\u00E1s el monto pedido en tu billetera Taler.\",\n ],\n Done: [\"Listo\"],\n \"Operation canceled\": [\"Operaci\u00F3n cancelada\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\n \"La operaci\u00F3n est\u00E1 marcada como 'seleccionada' pero algunos pasos en la extracci\u00F3n fallaron\",\n ],\n \"The account is selected but no withdrawal identification found.\": [\n \"La cuenta est\u00E1 seleccionada pero no se encontr\u00F3 el identificador de extracci\u00F3n.\",\n ],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\n \"Hay un identificador de extracci\u00F3n pero la cuenta no ha sido seleccionada o la selccionada es inv\u00E1lida.\",\n ],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\n \"No hay un identificador de extracci\u00F3n y ninguna cuenta a sido seleccionada o la seleccionada es inv\u00E1lida.\",\n ],\n \"Operation not found\": [\"Operaci\u00F3n no encontrada\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\n \"Esta operaci\u00F3n no es conocida por el servidor. El identificador de operaci\u00F3n es incorrecto o el server borr\u00F3 la informaci\u00F3n de la operaci\u00F3n antes de llegar hasta aqu\u00ED.\",\n ],\n \"Cotinue to dashboard\": [\"Continuar al panel\"],\n \"The Withdrawal URI is not valid\": [\"El URI de estracci\u00F3n no es v\u00E1lido\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\n 'El servidor de bank no esta spoportado. Version soportada \"%1$s\", version del server \"%2$s\"',\n ],\n \"Internal error, please report.\": [\n \"Error interno, por favor reporte el error.\",\n ],\n Preferences: [\"Preferencias\"],\n \"Welcome, %1$s\": [\"Bienvenido/a, %1$s\"],\n \"Latest transactions\": [\"\u00DAltimas transacciones\"],\n Date: [\"Fecha\"],\n Counterpart: [\"Contraparte\"],\n Subject: [\"Asunto\"],\n sent: [\"enviado\"],\n received: [\"recibido\"],\n \"invalid value\": [\"valor inv\u00E1lido\"],\n to: [\"hacia\"],\n from: [\"desde\"],\n \"First page\": [\"Primera p\u00E1gina\"],\n Next: [\"Siguiente\"],\n \"History of public accounts\": [\"Historial de cuentas p\u00FAblicas\"],\n \"Currently, the bank is not accepting new registrations!\": [\n \"Actualmente, el banco no est\u00E1 aceptado nuevos registros!\",\n ],\n \"Missing name\": [\"Falta nombre\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\n \"Solo use letras y n\u00FAmeros, y comience con una letra min\u00FAscula\",\n ],\n \"Passwords don't match\": [\"La contrase\u00F1a no coincide\"],\n \"Server replied with invalid phone or email.\": [\n \"El servidor repondio con tel\u00E9fono o direcci\u00F3n de correo inv\u00E1lido.\",\n ],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"El registro est\u00E1 deshabilitado porque el banco se qued\u00F3 sin cr\u00E9dito bonus.\",\n ],\n \"No enough permission to create that account.\": [\n \"Sin permisos suficientes para crear esa cuenta.\",\n ],\n \"That account id is already taken.\": [\n \"El identificador de cuenta ya est\u00E1 tomado.\",\n ],\n \"That username is already taken.\": [\n \"El nombre de usuario ya est\u00E1 tomado.\",\n ],\n \"That username can't be used because is reserved.\": [\n \"El nombre de usuario no puede ser usado porque esta reservado.\",\n ],\n \"Only admin is allow to set debt limit.\": [\n \"Solo el administrador tiene permitido cambiar el l\u00EDmite de deuda.\",\n ],\n \"No information for the selected authentication channel.\": [\n \"No hay informaci\u00F3n para el canal de autenticaci\u00F3n seleccionado.\",\n ],\n \"Authentication channel is not supported.\": [\n \"Canal de autenticaci\u00F3n no esta soportado.\",\n ],\n \"Only admin can create accounts with second factor authentication.\": [\n \"Solo el administrador puede crear cuentas con el segundo factor de autenticaci\u00F3n.\",\n ],\n \"Account registration\": [\"Registro de cuenta\"],\n \"Repeat password\": [\"Repita la contrase\u00F1a\"],\n Name: [\"Nombre\"],\n \"Create a random temporary user\": [\"Crear un usuario aleatorio temporal\"],\n \"Make a wire transfer\": [\"Hacer una transferencia bancaria\"],\n \"Wire transfer created!\": [\"Transferencia bancaria creada!\"],\n Accounts: [\"Cuentas\"],\n \"A list of all business account in the bank.\": [\n \"Una lista de todas las cuentas en el banco.\",\n ],\n \"Create account\": [\"Crear cuenta\"],\n Balance: [\"Saldo\"],\n Actions: [\"Acciones\"],\n unknown: [\"desconocido\"],\n \"change password\": [\"cambiar contrase\u00F1a\"],\n remove: [\"elimiar\"],\n \"Select a section\": [\"Seleccione una secci\u00F3n\"],\n \"Last hour\": [\"\u00DAltima hora\"],\n \"Last day\": [\"\u00DAltimo d\u00EDa\"],\n \"Last month\": [\"\u00DAltimo mes\"],\n \"Last year\": [\"\u00DAltimo a\u00F1o\"],\n \"Last Year\": [\"\u00DAltimo A\u00F1o\"],\n \"Trading volume on %1$s compared to %2$s\": [\n \"V\u00F3lumen de comercio en %1$s comparado con %2$s\",\n ],\n Cashin: [\"Ingreso\"],\n Cashout: [\"Egreso\"],\n Payin: [\"Envios de dinero\"],\n Payout: [\"Recibos de dinero\"],\n \"download stats as CSV\": [\"descargar estad\u00EDsticas en CSV\"],\n \"Descreased by\": [\"Descendiente por\"],\n \"Increased by\": [\"Ascendente por\"],\n \"Unable to create a cashout\": [\"Imposible crear un egreso\"],\n \"The bank configuration does not support cashout operations.\": [\n \"La configuraci\u00F3n del banco no soporta operaciones de egreso.\",\n ],\n invalid: [\"inv\u00E1lido\"],\n \"need to be higher due to fees\": [\n \"necesita ser mayor debido a las comisiones\",\n ],\n \"the total transfer at destination will be zero\": [\n \"el total de la transferencia en destino ser\u00E1 cero\",\n ],\n \"Cashout created\": [\"Egreso creado\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\n \"Se detect\u00F3 una petici\u00F3n duplicada, verifique si la operaci\u00F3n tuvo \u00E9xito o intente otra vez.\",\n ],\n \"The conversion rate was incorrectly applied\": [\n \"La tasa de conversi\u00F3n se aplic\u00F3 incorrectamente\",\n ],\n \"The account does not have sufficient funds\": [\n \"La cuenta no tiene fondos suficientes\",\n ],\n \"Cashouts are not supported\": [\"Egresos no est\u00E1n soportados\"],\n \"Missing cashout URI in the profile\": [\n \"Falta direcci\u00F3n de egreso en el perf\u00EDl\",\n ],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\n \"El env\u00EDo del mensaje de confirmaci\u00F3n fall\u00F3, intente mas tarde o contacte al administrador.\",\n ],\n \"Convertion rate\": [\"Tasa de conversi\u00F3n\"],\n Fee: [\"Comisi\u00F3n\"],\n \"To account\": [\"Hacia cuenta\"],\n \"No cashout account\": [\"No hay cuenta de egreso\"],\n \"Before doing a cashout you need to complete your profile\": [\n \"Antes de hacer un egreso necesita completar su perf\u00EDl\",\n ],\n \"Amount to send\": [\"Monto a enviar\"],\n \"Amount to receive\": [\"Monto a recibir\"],\n \"Total cost\": [\"Costo total\"],\n \"Balance left\": [\"Saldo remanente\"],\n \"Before fee\": [\"Antes de comisi\u00F3n\"],\n \"Total cashout transfer\": [\"Total de egreso\"],\n \"No cashout channel available\": [\"No hay canal de egreso disponible\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\n \"Antes de hacer un egreso el servidor necesita proveer un segundo canal para confirmar la operaci\u00F3n\",\n ],\n \"Second factor authentication\": [\"Segundo factor de autenticaci\u00F3n\"],\n Email: [\"Correo eletr\u00F3nico\"],\n \"add a email in your profile to enable this option\": [\n \"agrege un correo en su perf\u00EDl para habilitar esta opci\u00F3n\",\n ],\n SMS: [\"SMS\"],\n \"add a phone number in your profile to enable this option\": [\n \"agregue un n\u00FAmero de tel\u00E9fono para habilitar esta opci\u00F3n\",\n ],\n Details: [\"Detalles\"],\n Delete: [\"Borrar\"],\n Credentials: [\"Credenciales\"],\n Cashouts: [\"Egresos\"],\n \"it doesnt have the pattern of an IBAN number\": [\n \"no tiene el patr\u00F3n de un n\u00FAmero IBAN\",\n ],\n \"it doesnt have the pattern of an email\": [\n \"no tiene el patr\u00F3n de un correo electr\u00F3nico\",\n ],\n \"should start with +\": [\"deber\u00EDa comenzar con un +\"],\n \"phone number can't have other than numbers\": [\n \"n\u00FAmero de tel\u00E9fono no puede tener otra cosa que numeros\",\n ],\n \"account identification in the bank\": [\n \"identificador de cuenta en el banco\",\n ],\n \"name of the person owner the account\": [\n \"nombre de la persona due\u00F1a de la cuenta\",\n ],\n \"Internal IBAN\": [\"IBAN interno\"],\n \"if empty a random account number will be assigned\": [\n \"si est\u00E1 vac\u00EDo un n\u00FAmero de cuenta aleatorio ser\u00E1 asignado\",\n ],\n \"account identification for bank transfer\": [\n \"identificador de cuenta para transferencia bancaria\",\n ],\n Phone: [\"Tel\u00E9fono\"],\n \"Cashout IBAN\": [\"IBAN de egreso\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\n \"numero de cuenta donde el dinero ser\u00E1 enviado cuando se ejecuten egresos\",\n ],\n \"Max debt\": [\"M\u00E1xima deuda\"],\n \"how much is user able to transfer after zero balance\": [\n \"cuanto tiene habilitado a transferir despues de un saldo en cero\",\n ],\n \"Is this a Taler Exchange?\": [\"Es un Taler Exchange?\"],\n \"This server doesn't support second factor authentication.\": [\n \"Este servidor no tiene soporte para segundo factor de autenticaci\u00F3n.\",\n ],\n \"Enable second factor authentication\": [\n \"H\u00E1bilitar segundo factor de autenticaci\u00F3n\",\n ],\n \"Using email\": [\"Usando correo eletr\u00F3nico\"],\n \"Using SMS\": [\"Usando SMS\"],\n \"Is this account public?\": [\"Es una cuenta p\u00FAblica?\"],\n \"public accounts have their balance publicly accesible\": [\n \"las cuentas p\u00FAblicas tienen su saldo accesible al p\u00FAblico\",\n ],\n \"Account updated\": [\"Cuenta actualizada\"],\n \"The rights to change the account are not sufficient\": [\n \"Los permisos para cambiar la cuenta no son suficientes\",\n ],\n \"The username was not found\": [\"El nombre de usaurio no se encontr\u00F3\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\n \"No puede cambiar el nombre legal, por favor contacte el administrador de la cuenta.\",\n ],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\n \"No puede cambiar el l\u00EDmite de deuda, por favor contacte el administrador de la cuenta.\",\n ],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\n \"No puede cambiar la direcci\u00F3n de egreso, por favor contacte al administrador de la cuenta.\",\n ],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\n \"No puede cambiar los datos de contacto, por favor contacte al administrador de la cuenta.\",\n ],\n 'Account \"%1$s\"': ['Cuenta \"%1$s\"'],\n \"Change details\": [\"Cambiar detalles\"],\n Update: [\"Actualizar\"],\n \"password doesn't match\": [\"la contrase\u00F1a no coincide\"],\n \"Password changed\": [\"La contrase\u00F1a cambi\u00F3\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"No est\u00E1 autorizado a cambiar el password, quiz\u00E1 la sesi\u00F3n es invalida.\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\n \"Se necesita el password viejo para cambiar la contrase\u00F1a. Si no lo tiene contacte a su administrador.\",\n ],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"Su actual contrase\u00F1a no coincide, no puede cambiar a una nueva contrase\u00F1a.\",\n ],\n \"Update password\": [\"Actualizar contrase\u00F1a\"],\n \"New password\": [\"Nueva contrase\u00F1a\"],\n \"Type it again\": [\"Escribalo otra vez\"],\n \"repeat the same password\": [\"repita la misma contrase\u00F1a\"],\n \"Current password\": [\"Contrase\u00F1a actual\"],\n \"your current password, for security\": [\n \"su actual contrase\u00F1a, por seguridad\",\n ],\n Change: [\"Cambiar\"],\n \"Can't delete the account\": [\"No se puede eliminar la cuenta\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\n \"La cuenta no puede ser eliminada mientras tiene saldo. Primero asegures\u00E9 que el due\u00F1o haga un egreso completo.\",\n ],\n \"Account removed\": [\"Cuenta eliminada\"],\n \"No enough permission to delete the account.\": [\n \"No tiene permisos suficientes para eliminar la cuenta.\",\n ],\n \"The username was not found.\": [\"El nombr ede usuario no se encontr\u00F3.\"],\n \"Can't delete a reserved username.\": [\n \"No se puede eliminar un nombre de usuario reservado.\",\n ],\n \"Can't delete an account with balance different than zero.\": [\n \"No se puede eliminar una cuenta con saldo diferente a cero.\",\n ],\n \"name doesn't match\": [\"el nombre no coincide\"],\n \"You are going to remove the account\": [\"Est\u00E1 por eliminar la cuenta\"],\n \"This step can't be undone.\": [\"Este paso no puede ser deshecho.\"],\n 'Deleting account \"%1$s\"': ['Borrando cuenta \"%1$s\"'],\n Verification: [\"Verificaci\u00F3n\"],\n \"enter the account name that is going to be deleted\": [\n \"ingrese el nombre de cuenta que ser\u00E1 eliminado\",\n ],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\n 'Cuenta creada con contrase\u00F1a \"%1$s\". El usuario debe cambiar la contrase\u00F1a en el siguiente ingreso.',\n ],\n \"Server replied that phone or email is invalid\": [\n \"El servidor respondi\u00F3 que el tel\u00E9fono o correo eletr\u00F3nico es invalido\",\n ],\n \"The rights to perform the operation are not sufficient\": [\n \"Los permisos para ejecutar la operaci\u00F3n no son suficientes\",\n ],\n \"Account username is already taken\": [\n \"El nombre del usuario ya est\u00E1 tomado\",\n ],\n \"Account id is already taken\": [\"El id de cuenta ya est\u00E1 tomado\"],\n \"Bank ran out of bonus credit.\": [\n \"El banco no tiene mas cr\u00E9dito de bonus.\",\n ],\n \"Account username can't be used because is reserved\": [\n \"El nombre de usuario de la cuenta no puede userse porque est\u00E1 reservado\",\n ],\n \"Can't create accounts\": [\"No puede crear cuentas\"],\n \"Only system admin can create accounts.\": [\n \"Solo los administradores del sistema pueden crear cuentas.\",\n ],\n \"New business account\": [\"Nueva cuenta\"],\n Create: [\"Crear\"],\n \"Cashout not supported.\": [\"Egreso no soportado.\"],\n \"Account not found.\": [\"Cuenta no encontrada.\"],\n \"Latest cashouts\": [\"\u00DAltimos egresos\"],\n Created: [\"Creado\"],\n Confirmed: [\"Confirmado\"],\n \"Total debit\": [\"D\u00E9bito total\"],\n \"Total credit\": [\"Cr\u00E9dito total\"],\n Status: [\"Estado\"],\n never: [\"nunca\"],\n \"Cashout for account %1$s\": [\"Egreso para cuenta %1$s\"],\n \"This cashout not found. Maybe already aborted.\": [\n \"Este egreso no se encontr\u00F3. Quiz\u00E1 fue abortado.\",\n ],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"Egreso no econtrado. Tambi\u00E9n puede significar que ya ha sido abortado.\",\n ],\n \"Cashout was already confimed.\": [\"Egreso ya fue confirmado.\"],\n \"Cashout operation is not supported.\": [\n \"Operaci\u00F3n de egreso no soportada.\",\n ],\n \"The cashout operation is already aborted.\": [\n \"La operaci\u00F3n de egreso ya est\u00E1 abortada.\",\n ],\n \"Missing destination account.\": [\"Falta cuenta destino.\"],\n \"Too many failed attempts.\": [\"Demasiados intentos fallidos.\"],\n \"The code for this cashout is invalid.\": [\n \"El c\u00F3digo para este egreso es invalido.\",\n ],\n \"Cashout detail\": [\"Detalles de egreso\"],\n Debited: [\"Debitado\"],\n Credited: [\"Acreditado\"],\n \"Enter the confirmation code\": [\"Ingresar el c\u00F3digo de confirmaci\u00F3n\"],\n Abort: [\"Abortar\"],\n Confirm: [\"Confirmar\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\n \"No autorizado para hacer la operaci\u00F3n, quiz\u00E1 la sesi\u00F3n haya expirado or cambi\u00F3 la contrase\u00F1a.\",\n ],\n \"The operation was rejected due to insufficient funds.\": [\n \"La operaci\u00F3n fue rechazada debido a saldo insuficiente.\",\n ],\n \"Do not show this again\": [\"No mostrar otra vez\"],\n Close: [\"Cerrar\"],\n \"On this device\": [\"En este dispositivo\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\n 'Si esta usando un explorador web de escritorio deber\u00EDas acceder ahora a tu billletera con la GNU Taler WebExtension o hacer click en el link si tu extensi\u00F3n tiene la configuraci\u00F3n \"Inyectar soporte para Taler\" habilitada.',\n ],\n Start: [\"Comenzar\"],\n \"On a mobile phone\": [\"En un dispotivo mobile\"],\n \"Scan the QR code with your mobile device.\": [\n \"Escanear el c\u00F3digo QR con tu dispotivo m\u00F3vil.\",\n ],\n \"There is an operation already\": [\"Ya hay una operaci\u00F3n\"],\n \"Complete or cancel the operation in\": [\n \"Completa o cancela la operaci\u00F3n en\",\n ],\n \"Server responded with an invalid withdraw URI\": [\n \"El servidor respondi\u00F3 con una URI de extracci\u00F3n inv\u00E1lida\",\n ],\n \"Withdraw URI: %1$s\": [\"URI de extracci\u00F3n: %1$s\"],\n \"The operation was rejected due to insufficient funds\": [\n \"La operaci\u00F3n fue rechazada debido a fundos insuficientes\",\n ],\n \"Prepare your wallet\": [\"Prepare su billetera\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\n \"Despues de usar tu billetera necesitar\u00E1s confirmar o cancelar la operaci\u00F3n en este sitio.\",\n ],\n \"You need a GNU Taler Wallet\": [\"Necesitas una GNU Taler Wallet\"],\n \"If you don't have one yet you can follow the instruction in\": [\n \"Si no tienes una todav\u00EDa puedes seguir las instrucciones en\",\n ],\n \"Send money\": [\"Enviar dinero\"],\n \"to a %1$s wallet\": [\"a una billetera %1$s\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"Extraer dinero digital a tu billetera m\u00F3vil o extesi\u00F3n web\",\n ],\n \"operation ready\": [\"operaci\u00F3n lista\"],\n \"to another bank account\": [\"a otra cuenta bancaria\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"Hacer una transferencia bancaria a una cuenta con un n\u00FAmero de cuenta conocido.\",\n ],\n \"Transfer details\": [\"Detalles de transferencia\"],\n \"This is a demo bank\": [\"Este es un banco de demostraci\u00F3n\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\n \"Esta parte de la demostraci\u00F3n muestra c\u00F3mo funciona un banco que soporta Taler directamente. Adem\u00E1s de usar tu propia cuenta de banco, tambi\u00E9n podr\u00E1s ver el historial de transacciones de algunas %1$s.\",\n ],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\n \"Esta parte de la demostraci\u00F3n muetra como un banco que soporta Taler directamente funcionar\u00EDa.\",\n ],\n \"Pending account delete operation\": [\n \"Operaci\u00F3n pendiente de eliminaci\u00F3n de cuenta\",\n ],\n \"Pending account update operation\": [\n \"Operaci\u00F3n pendiente de actualizaci\u00F3n de cuenta\",\n ],\n \"Pending password update operation\": [\n \"Operaci\u00F3n pendiente de actualizaci\u00F3n de password\",\n ],\n \"Pending transaction operation\": [\"Operaci\u00F3n pendiente de transacci\u00F3n\"],\n \"Pending withdrawal operation\": [\"Operaci\u00F3n pendiente de extracci\u00F3n\"],\n \"Pending cashout operation\": [\"Operaci\u00F3n pendiente de egreso\"],\n \"You can complete or cancel the operation in\": [\n \"Puedes completar o cancelar la operaci\u00F3n en\",\n ],\n \"Download bank stats\": [\"Descargar estad\u00EDsticas del banco\"],\n \"Include hour metric\": [\"Incluir m\u00E9trica horaria\"],\n \"Include day metric\": [\"Incluir m\u00E9trica diaria\"],\n \"Include month metric\": [\"Incluir m\u00E9trica mensual\"],\n \"Include year metric\": [\"Incluir m\u00E9trica anual\"],\n \"Include table header\": [\"Incluir encabezado de tabla\"],\n \"Add previous metric for compare\": [\n \"Agregar m\u00E9trica previa para comparar\",\n ],\n \"Fail on first error\": [\"Fallar en el primer error\"],\n Download: [\"Descargar\"],\n \"downloading... %1$s\": [\"descargando... %1$s\"],\n \"Download completed\": [\"Descarga completada\"],\n \"click here to save the file in your computer\": [\n \"click aqu\u00ED para guardar el archivo en su computadora\",\n ],\n \"Challenge not found.\": [\"Desaf\u00EDo no encontrado.\"],\n \"This user is not authorized to complete this challenge.\": [\n \"Este usuario no est\u00E1 autorizado para completar este desaf\u00EDo.\",\n ],\n \"Too many attemps, try another code.\": [\n \"Demasiados intentos, intente otro c\u00F3digo.\",\n ],\n \"The confirmation code is wrong, try again.\": [\n \"El c\u00F3digo de confirmaci\u00F3n es erroneo, intente otra vez.\",\n ],\n \"The operation expired.\": [\"La operaci\u00F3n expir\u00F3.\"],\n \"The operation failed.\": [\"La operaci\u00F3n fall\u00F3.\"],\n \"The operation needs another confirmation to complete.\": [\n \"La operaci\u00F3n necesita otra confirmaci\u00F3n para completar.\",\n ],\n \"Account delete\": [\"Eliminaci\u00F3n de cuenta\"],\n \"Account update\": [\"Actualizaci\u00F3n de cuenta\"],\n \"Password update\": [\"Actualizaci\u00F3n de contrase\u00F1a\"],\n \"Wire transfer\": [\"Transferencia bancaria\"],\n Withdrawal: [\"Extracci\u00F3n\"],\n \"Confirm the operation\": [\"Confirmar la operaci\u00F3n\"],\n \"Send again\": [\"Enviar otra vez\"],\n \"Send code\": [\"Enviar c\u00F3digo\"],\n \"Operation details\": [\"Detalles de operaci\u00F3n\"],\n \"Challenge details\": [\"Detalles del desaf\u00EDo\"],\n \"Sent at\": [\"Enviado a\"],\n \"To phone\": [\"Al tel\u00E9fono\"],\n \"To email\": [\"Al email\"],\n \"Welcome to %1$s!\": [\"Bienvenido a %1$s!\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"es\",\n completeness: 100,\n};\n\nstrings[\"en\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=(n != 1);\",\n lang: \"en\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"\"],\n \"amount to transfer\": [\"\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"\"],\n Counterpart: [\"\"],\n Subject: [\"\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"\"],\n \"Confirm the operation\": [\"\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=(n != 1);\",\n lang: \"en\",\n completeness: 100,\n};\n\nstrings[\"de\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"de\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"Verwendungszweck\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"Betrag\"],\n \"amount to transfer\": [\"Betrag\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"Buchungen auf \u00F6ffentlich sichtbaren Konten\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"Abhebung best\u00E4tigen\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"Datum\"],\n Counterpart: [\"Empf\u00E4nger\"],\n Subject: [\"Verwendungszweck\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\n \"Buchungen auf \u00F6ffentlich sichtbaren Konten\",\n ],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"Betrag\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"Betrag\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"Best\u00E4tigen\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"Best\u00E4tigen\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"Abhebung best\u00E4tigen\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"Abhebung best\u00E4tigen\"],\n \"Confirm the operation\": [\"Abhebung best\u00E4tigen\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"de\",\n completeness: 4,\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Codec, buildCodecForObject, codecForBoolean, codecForMap, codecForString, codecOptional } from \"./codec.js\";\nimport { canonicalizeBaseUrl } from \"./utils.js\";\n\nexport interface AppUiSettings {\n // Where libeufin backend is localted\n // default: window.origin without \"webui/\"\n backendBaseURL?: string;\n // Shows a button \"create random account\" in the registration form\n // Useful for testing\n // default: false\n allowRandomAccountCreation?: boolean;\n // Create all random accounts with password \"123\"\n // Useful for testing\n // default: false\n simplePasswordForRandomAccounts?: boolean;\n // URL where the user is going to be redirected after\n // clicking in Taler Logo\n // default: home page\n iconLinkURL?: string;\n // Mapping for every link shown in the top navitation bar\n // - key: link label, what the user will read\n // - value: link target, where the user is going to be redirected\n // default: empty list\n topNavSites?: Record;\n}\n\n/**\n * Global settings for the UI.\n */\nconst defaultSettings: AppUiSettings = {\n backendBaseURL: buildDefaultBackendBaseURL(),\n iconLinkURL: undefined,\n simplePasswordForRandomAccounts: false,\n allowRandomAccountCreation: false,\n topNavSites: {},\n};\n\nconst codecForAppUiSettings = (): Codec =>\n buildCodecForObject()\n .property(\"backendBaseURL\", codecOptional(codecForString()))\n .property(\"allowRandomAccountCreation\", codecOptional(codecForBoolean()))\n .property(\n \"simplePasswordForRandomAccounts\",\n codecOptional(codecForBoolean()),\n )\n .property(\"iconLinkURL\", codecOptional(codecForString()))\n .property(\"topNavSites\", codecOptional(codecForMap(codecForString())))\n .build(\"AppUiSettings\");\n\nfunction removeUndefineField(obj: T): T {\n const keys = Object.keys(obj) as Array;\n return keys.reduce((prev, cur) => {\n if (typeof prev[cur] === \"undefined\") {\n delete prev[cur];\n }\n return prev;\n }, obj);\n}\n\nexport function fetchSettings(listener: (s: AppUiSettings) => void): void {\n fetch(\"./settings.json\")\n .then((resp) => resp.json())\n .then((json) => codecForAppUiSettings().decode(json))\n .then((result) =>\n listener({\n ...defaultSettings,\n ...removeUndefineField(result),\n }),\n )\n .catch((e) => {\n console.log(\"failed to fetch settings\", e);\n listener(defaultSettings);\n });\n}\n\nfunction buildDefaultBackendBaseURL(): string | undefined {\n if (typeof window !== \"undefined\") {\n const currentLocation = new URL(\n window.location.pathname,\n window.location.origin,\n ).href;\n /**\n * By default, backend serves the html content\n * from the /webui root.\n */\n return canonicalizeBaseUrl(currentLocation.replace(\"/webui\", \"\"));\n }\n throw Error(\"No default URL\");\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { App } from \"./app.js\";\nimport { h, render } from \"preact\";\nimport \"./scss/main.css\";\n\nconst app = document.getElementById(\"app\");\n\nif (app) {\n render(, app);\n} else {\n console.error(\"HTML element with id 'app' not found.\");\n}\n"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,QAAI,SAAU,SAAUA,YAAW;AAC/B;AAEA,UAAI,OAAO,KACP,WAAW,GACX,UAAU,kBACV,cAAc,aAAa,OAAO,GAClC,mBAAmB;AAEvB,UAAI,uBAAuB,OAAO,WAAW;AAE7C,eAAS,QAAQC,IAAG,OAAO,UAAU,eAAe;AAChD,YAAI,OAAOA,OAAM;AAAa,iBAAO,QAAQ,CAAC;AAC9C,YAAI,OAAO,UAAU;AAAa,iBAAO,CAAC,UAAU,MAAM,CAAC,WAAW,WAAWA,EAAC,IAAI,UAAUA,IAAG,OAAO,UAAU,aAAa;AACjI,eAAO,WAAWA,EAAC;AAAA,MACvB;AAEA,eAAS,WAAW,OAAOC,OAAM;AAC7B,aAAK,QAAQ;AACb,aAAK,OAAOA;AACZ,aAAK,UAAU;AAAA,MACnB;AACA,iBAAW,YAAY,OAAO,OAAO,QAAQ,SAAS;AAEtD,eAAS,aAAa,OAAO;AAC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5C,UAAM,WAAW,KAAK,UAAU,MAAM,KAAKA,KAAI,QAAQ,CAAC,CAAC;AACzD,iBAAa,QAAQ,aAAa,QAAQ;AAAA,EAC5C,CAAC;AACD,SAAOA;AACT;;;AwYnFA;AAGA,IAAM,MAAM,SAAS,eAAe,KAAK;AAEzC,IAAI,KAAK;AACP,IAAO,kBAAC,SAAI,GAAI,GAAG;AACrB,OAAO;AACL,UAAQ,MAAM,uCAAuC;AACvD;", + "sourcesContent": ["var bigInt = (function (undefined) {\r\n \"use strict\";\r\n\r\n var BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_INT = 9007199254740992,\r\n MAX_INT_ARR = smallToArray(MAX_INT),\r\n DEFAULT_ALPHABET = \"0123456789abcdefghijklmnopqrstuvwxyz\";\r\n\r\n var supportsNativeBigInt = typeof BigInt === \"function\";\r\n\r\n function Integer(v, radix, alphabet, caseSensitive) {\r\n if (typeof v === \"undefined\") return Integer[0];\r\n if (typeof radix !== \"undefined\") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);\r\n return parseValue(v);\r\n }\r\n\r\n function BigInteger(value, sign) {\r\n this.value = value;\r\n this.sign = sign;\r\n this.isSmall = false;\r\n }\r\n BigInteger.prototype = Object.create(Integer.prototype);\r\n\r\n function SmallInteger(value) {\r\n this.value = value;\r\n this.sign = value < 0;\r\n this.isSmall = true;\r\n }\r\n SmallInteger.prototype = Object.create(Integer.prototype);\r\n\r\n function NativeBigInt(value) {\r\n this.value = value;\r\n }\r\n NativeBigInt.prototype = Object.create(Integer.prototype);\r\n\r\n function isPrecise(n) {\r\n return -MAX_INT < n && n < MAX_INT;\r\n }\r\n\r\n function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes\r\n if (n < 1e7)\r\n return [n];\r\n if (n < 1e14)\r\n return [n % 1e7, Math.floor(n / 1e7)];\r\n return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];\r\n }\r\n\r\n function arrayToSmall(arr) { // If BASE changes this function may need to change\r\n trim(arr);\r\n var length = arr.length;\r\n if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {\r\n switch (length) {\r\n case 0: return 0;\r\n case 1: return arr[0];\r\n case 2: return arr[0] + arr[1] * BASE;\r\n default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n function trim(v) {\r\n var i = v.length;\r\n while (v[--i] === 0);\r\n v.length = i + 1;\r\n }\r\n\r\n function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger\r\n var x = new Array(length);\r\n var i = -1;\r\n while (++i < length) {\r\n x[i] = 0;\r\n }\r\n return x;\r\n }\r\n\r\n function truncate(n) {\r\n if (n > 0) return Math.floor(n);\r\n return Math.ceil(n);\r\n }\r\n\r\n function add(a, b) { // assumes a and b are arrays with a.length >= b.length\r\n var l_a = a.length,\r\n l_b = b.length,\r\n r = new Array(l_a),\r\n carry = 0,\r\n base = BASE,\r\n sum, i;\r\n for (i = 0; i < l_b; i++) {\r\n sum = a[i] + b[i] + carry;\r\n carry = sum >= base ? 1 : 0;\r\n r[i] = sum - carry * base;\r\n }\r\n while (i < l_a) {\r\n sum = a[i] + carry;\r\n carry = sum === base ? 1 : 0;\r\n r[i++] = sum - carry * base;\r\n }\r\n if (carry > 0) r.push(carry);\r\n return r;\r\n }\r\n\r\n function addAny(a, b) {\r\n if (a.length >= b.length) return add(a, b);\r\n return add(b, a);\r\n }\r\n\r\n function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT\r\n var l = a.length,\r\n r = new Array(l),\r\n base = BASE,\r\n sum, i;\r\n for (i = 0; i < l; i++) {\r\n sum = a[i] - base + carry;\r\n carry = Math.floor(sum / base);\r\n r[i] = sum - carry * base;\r\n carry += 1;\r\n }\r\n while (carry > 0) {\r\n r[i++] = carry % base;\r\n carry = Math.floor(carry / base);\r\n }\r\n return r;\r\n }\r\n\r\n BigInteger.prototype.add = function (v) {\r\n var n = parseValue(v);\r\n if (this.sign !== n.sign) {\r\n return this.subtract(n.negate());\r\n }\r\n var a = this.value, b = n.value;\r\n if (n.isSmall) {\r\n return new BigInteger(addSmall(a, Math.abs(b)), this.sign);\r\n }\r\n return new BigInteger(addAny(a, b), this.sign);\r\n };\r\n BigInteger.prototype.plus = BigInteger.prototype.add;\r\n\r\n SmallInteger.prototype.add = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value;\r\n if (a < 0 !== n.sign) {\r\n return this.subtract(n.negate());\r\n }\r\n var b = n.value;\r\n if (n.isSmall) {\r\n if (isPrecise(a + b)) return new SmallInteger(a + b);\r\n b = smallToArray(Math.abs(b));\r\n }\r\n return new BigInteger(addSmall(b, Math.abs(a)), a < 0);\r\n };\r\n SmallInteger.prototype.plus = SmallInteger.prototype.add;\r\n\r\n NativeBigInt.prototype.add = function (v) {\r\n return new NativeBigInt(this.value + parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.plus = NativeBigInt.prototype.add;\r\n\r\n function subtract(a, b) { // assumes a and b are arrays with a >= b\r\n var a_l = a.length,\r\n b_l = b.length,\r\n r = new Array(a_l),\r\n borrow = 0,\r\n base = BASE,\r\n i, difference;\r\n for (i = 0; i < b_l; i++) {\r\n difference = a[i] - borrow - b[i];\r\n if (difference < 0) {\r\n difference += base;\r\n borrow = 1;\r\n } else borrow = 0;\r\n r[i] = difference;\r\n }\r\n for (i = b_l; i < a_l; i++) {\r\n difference = a[i] - borrow;\r\n if (difference < 0) difference += base;\r\n else {\r\n r[i++] = difference;\r\n break;\r\n }\r\n r[i] = difference;\r\n }\r\n for (; i < a_l; i++) {\r\n r[i] = a[i];\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n function subtractAny(a, b, sign) {\r\n var value;\r\n if (compareAbs(a, b) >= 0) {\r\n value = subtract(a, b);\r\n } else {\r\n value = subtract(b, a);\r\n sign = !sign;\r\n }\r\n value = arrayToSmall(value);\r\n if (typeof value === \"number\") {\r\n if (sign) value = -value;\r\n return new SmallInteger(value);\r\n }\r\n return new BigInteger(value, sign);\r\n }\r\n\r\n function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT\r\n var l = a.length,\r\n r = new Array(l),\r\n carry = -b,\r\n base = BASE,\r\n i, difference;\r\n for (i = 0; i < l; i++) {\r\n difference = a[i] + carry;\r\n carry = Math.floor(difference / base);\r\n difference %= base;\r\n r[i] = difference < 0 ? difference + base : difference;\r\n }\r\n r = arrayToSmall(r);\r\n if (typeof r === \"number\") {\r\n if (sign) r = -r;\r\n return new SmallInteger(r);\r\n } return new BigInteger(r, sign);\r\n }\r\n\r\n BigInteger.prototype.subtract = function (v) {\r\n var n = parseValue(v);\r\n if (this.sign !== n.sign) {\r\n return this.add(n.negate());\r\n }\r\n var a = this.value, b = n.value;\r\n if (n.isSmall)\r\n return subtractSmall(a, Math.abs(b), this.sign);\r\n return subtractAny(a, b, this.sign);\r\n };\r\n BigInteger.prototype.minus = BigInteger.prototype.subtract;\r\n\r\n SmallInteger.prototype.subtract = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value;\r\n if (a < 0 !== n.sign) {\r\n return this.add(n.negate());\r\n }\r\n var b = n.value;\r\n if (n.isSmall) {\r\n return new SmallInteger(a - b);\r\n }\r\n return subtractSmall(b, Math.abs(a), a >= 0);\r\n };\r\n SmallInteger.prototype.minus = SmallInteger.prototype.subtract;\r\n\r\n NativeBigInt.prototype.subtract = function (v) {\r\n return new NativeBigInt(this.value - parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;\r\n\r\n BigInteger.prototype.negate = function () {\r\n return new BigInteger(this.value, !this.sign);\r\n };\r\n SmallInteger.prototype.negate = function () {\r\n var sign = this.sign;\r\n var small = new SmallInteger(-this.value);\r\n small.sign = !sign;\r\n return small;\r\n };\r\n NativeBigInt.prototype.negate = function () {\r\n return new NativeBigInt(-this.value);\r\n }\r\n\r\n BigInteger.prototype.abs = function () {\r\n return new BigInteger(this.value, false);\r\n };\r\n SmallInteger.prototype.abs = function () {\r\n return new SmallInteger(Math.abs(this.value));\r\n };\r\n NativeBigInt.prototype.abs = function () {\r\n return new NativeBigInt(this.value >= 0 ? this.value : -this.value);\r\n }\r\n\r\n\r\n function multiplyLong(a, b) {\r\n var a_l = a.length,\r\n b_l = b.length,\r\n l = a_l + b_l,\r\n r = createArray(l),\r\n base = BASE,\r\n product, carry, i, a_i, b_j;\r\n for (i = 0; i < a_l; ++i) {\r\n a_i = a[i];\r\n for (var j = 0; j < b_l; ++j) {\r\n b_j = b[j];\r\n product = a_i * b_j + r[i + j];\r\n carry = Math.floor(product / base);\r\n r[i + j] = product - carry * base;\r\n r[i + j + 1] += carry;\r\n }\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE\r\n var l = a.length,\r\n r = new Array(l),\r\n base = BASE,\r\n carry = 0,\r\n product, i;\r\n for (i = 0; i < l; i++) {\r\n product = a[i] * b + carry;\r\n carry = Math.floor(product / base);\r\n r[i] = product - carry * base;\r\n }\r\n while (carry > 0) {\r\n r[i++] = carry % base;\r\n carry = Math.floor(carry / base);\r\n }\r\n return r;\r\n }\r\n\r\n function shiftLeft(x, n) {\r\n var r = [];\r\n while (n-- > 0) r.push(0);\r\n return r.concat(x);\r\n }\r\n\r\n function multiplyKaratsuba(x, y) {\r\n var n = Math.max(x.length, y.length);\r\n\r\n if (n <= 30) return multiplyLong(x, y);\r\n n = Math.ceil(n / 2);\r\n\r\n var b = x.slice(n),\r\n a = x.slice(0, n),\r\n d = y.slice(n),\r\n c = y.slice(0, n);\r\n\r\n var ac = multiplyKaratsuba(a, c),\r\n bd = multiplyKaratsuba(b, d),\r\n abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));\r\n\r\n var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));\r\n trim(product);\r\n return product;\r\n }\r\n\r\n // The following function is derived from a surface fit of a graph plotting the performance difference\r\n // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.\r\n function useKaratsuba(l1, l2) {\r\n return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;\r\n }\r\n\r\n BigInteger.prototype.multiply = function (v) {\r\n var n = parseValue(v),\r\n a = this.value, b = n.value,\r\n sign = this.sign !== n.sign,\r\n abs;\r\n if (n.isSmall) {\r\n if (b === 0) return Integer[0];\r\n if (b === 1) return this;\r\n if (b === -1) return this.negate();\r\n abs = Math.abs(b);\r\n if (abs < BASE) {\r\n return new BigInteger(multiplySmall(a, abs), sign);\r\n }\r\n b = smallToArray(abs);\r\n }\r\n if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes\r\n return new BigInteger(multiplyKaratsuba(a, b), sign);\r\n return new BigInteger(multiplyLong(a, b), sign);\r\n };\r\n\r\n BigInteger.prototype.times = BigInteger.prototype.multiply;\r\n\r\n function multiplySmallAndArray(a, b, sign) { // a >= 0\r\n if (a < BASE) {\r\n return new BigInteger(multiplySmall(b, a), sign);\r\n }\r\n return new BigInteger(multiplyLong(b, smallToArray(a)), sign);\r\n }\r\n SmallInteger.prototype._multiplyBySmall = function (a) {\r\n if (isPrecise(a.value * this.value)) {\r\n return new SmallInteger(a.value * this.value);\r\n }\r\n return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);\r\n };\r\n BigInteger.prototype._multiplyBySmall = function (a) {\r\n if (a.value === 0) return Integer[0];\r\n if (a.value === 1) return this;\r\n if (a.value === -1) return this.negate();\r\n return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);\r\n };\r\n SmallInteger.prototype.multiply = function (v) {\r\n return parseValue(v)._multiplyBySmall(this);\r\n };\r\n SmallInteger.prototype.times = SmallInteger.prototype.multiply;\r\n\r\n NativeBigInt.prototype.multiply = function (v) {\r\n return new NativeBigInt(this.value * parseValue(v).value);\r\n }\r\n NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;\r\n\r\n function square(a) {\r\n //console.assert(2 * BASE * BASE < MAX_INT);\r\n var l = a.length,\r\n r = createArray(l + l),\r\n base = BASE,\r\n product, carry, i, a_i, a_j;\r\n for (i = 0; i < l; i++) {\r\n a_i = a[i];\r\n carry = 0 - a_i * a_i;\r\n for (var j = i; j < l; j++) {\r\n a_j = a[j];\r\n product = 2 * (a_i * a_j) + r[i + j] + carry;\r\n carry = Math.floor(product / base);\r\n r[i + j] = product - carry * base;\r\n }\r\n r[i + l] = carry;\r\n }\r\n trim(r);\r\n return r;\r\n }\r\n\r\n BigInteger.prototype.square = function () {\r\n return new BigInteger(square(this.value), false);\r\n };\r\n\r\n SmallInteger.prototype.square = function () {\r\n var value = this.value * this.value;\r\n if (isPrecise(value)) return new SmallInteger(value);\r\n return new BigInteger(square(smallToArray(Math.abs(this.value))), false);\r\n };\r\n\r\n NativeBigInt.prototype.square = function (v) {\r\n return new NativeBigInt(this.value * this.value);\r\n }\r\n\r\n function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.\r\n var a_l = a.length,\r\n b_l = b.length,\r\n base = BASE,\r\n result = createArray(b.length),\r\n divisorMostSignificantDigit = b[b_l - 1],\r\n // normalization\r\n lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),\r\n remainder = multiplySmall(a, lambda),\r\n divisor = multiplySmall(b, lambda),\r\n quotientDigit, shift, carry, borrow, i, l, q;\r\n if (remainder.length <= a_l) remainder.push(0);\r\n divisor.push(0);\r\n divisorMostSignificantDigit = divisor[b_l - 1];\r\n for (shift = a_l - b_l; shift >= 0; shift--) {\r\n quotientDigit = base - 1;\r\n if (remainder[shift + b_l] !== divisorMostSignificantDigit) {\r\n quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);\r\n }\r\n // quotientDigit <= base - 1\r\n carry = 0;\r\n borrow = 0;\r\n l = divisor.length;\r\n for (i = 0; i < l; i++) {\r\n carry += quotientDigit * divisor[i];\r\n q = Math.floor(carry / base);\r\n borrow += remainder[shift + i] - (carry - q * base);\r\n carry = q;\r\n if (borrow < 0) {\r\n remainder[shift + i] = borrow + base;\r\n borrow = -1;\r\n } else {\r\n remainder[shift + i] = borrow;\r\n borrow = 0;\r\n }\r\n }\r\n while (borrow !== 0) {\r\n quotientDigit -= 1;\r\n carry = 0;\r\n for (i = 0; i < l; i++) {\r\n carry += remainder[shift + i] - base + divisor[i];\r\n if (carry < 0) {\r\n remainder[shift + i] = carry + base;\r\n carry = 0;\r\n } else {\r\n remainder[shift + i] = carry;\r\n carry = 1;\r\n }\r\n }\r\n borrow += carry;\r\n }\r\n result[shift] = quotientDigit;\r\n }\r\n // denormalization\r\n remainder = divModSmall(remainder, lambda)[0];\r\n return [arrayToSmall(result), arrayToSmall(remainder)];\r\n }\r\n\r\n function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/\r\n // Performs faster than divMod1 on larger input sizes.\r\n var a_l = a.length,\r\n b_l = b.length,\r\n result = [],\r\n part = [],\r\n base = BASE,\r\n guess, xlen, highx, highy, check;\r\n while (a_l) {\r\n part.unshift(a[--a_l]);\r\n trim(part);\r\n if (compareAbs(part, b) < 0) {\r\n result.push(0);\r\n continue;\r\n }\r\n xlen = part.length;\r\n highx = part[xlen - 1] * base + part[xlen - 2];\r\n highy = b[b_l - 1] * base + b[b_l - 2];\r\n if (xlen > b_l) {\r\n highx = (highx + 1) * base;\r\n }\r\n guess = Math.ceil(highx / highy);\r\n do {\r\n check = multiplySmall(b, guess);\r\n if (compareAbs(check, part) <= 0) break;\r\n guess--;\r\n } while (guess);\r\n result.push(guess);\r\n part = subtract(part, check);\r\n }\r\n result.reverse();\r\n return [arrayToSmall(result), arrayToSmall(part)];\r\n }\r\n\r\n function divModSmall(value, lambda) {\r\n var length = value.length,\r\n quotient = createArray(length),\r\n base = BASE,\r\n i, q, remainder, divisor;\r\n remainder = 0;\r\n for (i = length - 1; i >= 0; --i) {\r\n divisor = remainder * base + value[i];\r\n q = truncate(divisor / lambda);\r\n remainder = divisor - q * lambda;\r\n quotient[i] = q | 0;\r\n }\r\n return [quotient, remainder | 0];\r\n }\r\n\r\n function divModAny(self, v) {\r\n var value, n = parseValue(v);\r\n if (supportsNativeBigInt) {\r\n return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];\r\n }\r\n var a = self.value, b = n.value;\r\n var quotient;\r\n if (b === 0) throw new Error(\"Cannot divide by zero\");\r\n if (self.isSmall) {\r\n if (n.isSmall) {\r\n return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];\r\n }\r\n return [Integer[0], self];\r\n }\r\n if (n.isSmall) {\r\n if (b === 1) return [self, Integer[0]];\r\n if (b == -1) return [self.negate(), Integer[0]];\r\n var abs = Math.abs(b);\r\n if (abs < BASE) {\r\n value = divModSmall(a, abs);\r\n quotient = arrayToSmall(value[0]);\r\n var remainder = value[1];\r\n if (self.sign) remainder = -remainder;\r\n if (typeof quotient === \"number\") {\r\n if (self.sign !== n.sign) quotient = -quotient;\r\n return [new SmallInteger(quotient), new SmallInteger(remainder)];\r\n }\r\n return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];\r\n }\r\n b = smallToArray(abs);\r\n }\r\n var comparison = compareAbs(a, b);\r\n if (comparison === -1) return [Integer[0], self];\r\n if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];\r\n\r\n // divMod1 is faster on smaller input sizes\r\n if (a.length + b.length <= 200)\r\n value = divMod1(a, b);\r\n else value = divMod2(a, b);\r\n\r\n quotient = value[0];\r\n var qSign = self.sign !== n.sign,\r\n mod = value[1],\r\n mSign = self.sign;\r\n if (typeof quotient === \"number\") {\r\n if (qSign) quotient = -quotient;\r\n quotient = new SmallInteger(quotient);\r\n } else quotient = new BigInteger(quotient, qSign);\r\n if (typeof mod === \"number\") {\r\n if (mSign) mod = -mod;\r\n mod = new SmallInteger(mod);\r\n } else mod = new BigInteger(mod, mSign);\r\n return [quotient, mod];\r\n }\r\n\r\n BigInteger.prototype.divmod = function (v) {\r\n var result = divModAny(this, v);\r\n return {\r\n quotient: result[0],\r\n remainder: result[1]\r\n };\r\n };\r\n NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;\r\n\r\n\r\n BigInteger.prototype.divide = function (v) {\r\n return divModAny(this, v)[0];\r\n };\r\n NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {\r\n return new NativeBigInt(this.value / parseValue(v).value);\r\n };\r\n SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;\r\n\r\n BigInteger.prototype.mod = function (v) {\r\n return divModAny(this, v)[1];\r\n };\r\n NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {\r\n return new NativeBigInt(this.value % parseValue(v).value);\r\n };\r\n SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;\r\n\r\n BigInteger.prototype.pow = function (v) {\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value,\r\n value, x, y;\r\n if (b === 0) return Integer[1];\r\n if (a === 0) return Integer[0];\r\n if (a === 1) return Integer[1];\r\n if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];\r\n if (n.sign) {\r\n return Integer[0];\r\n }\r\n if (!n.isSmall) throw new Error(\"The exponent \" + n.toString() + \" is too large.\");\r\n if (this.isSmall) {\r\n if (isPrecise(value = Math.pow(a, b)))\r\n return new SmallInteger(truncate(value));\r\n }\r\n x = this;\r\n y = Integer[1];\r\n while (true) {\r\n if (b & 1 === 1) {\r\n y = y.times(x);\r\n --b;\r\n }\r\n if (b === 0) break;\r\n b /= 2;\r\n x = x.square();\r\n }\r\n return y;\r\n };\r\n SmallInteger.prototype.pow = BigInteger.prototype.pow;\r\n\r\n NativeBigInt.prototype.pow = function (v) {\r\n var n = parseValue(v);\r\n var a = this.value, b = n.value;\r\n var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);\r\n if (b === _0) return Integer[1];\r\n if (a === _0) return Integer[0];\r\n if (a === _1) return Integer[1];\r\n if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];\r\n if (n.isNegative()) return new NativeBigInt(_0);\r\n var x = this;\r\n var y = Integer[1];\r\n while (true) {\r\n if ((b & _1) === _1) {\r\n y = y.times(x);\r\n --b;\r\n }\r\n if (b === _0) break;\r\n b /= _2;\r\n x = x.square();\r\n }\r\n return y;\r\n }\r\n\r\n BigInteger.prototype.modPow = function (exp, mod) {\r\n exp = parseValue(exp);\r\n mod = parseValue(mod);\r\n if (mod.isZero()) throw new Error(\"Cannot take modPow with modulus 0\");\r\n var r = Integer[1],\r\n base = this.mod(mod);\r\n if (exp.isNegative()) {\r\n exp = exp.multiply(Integer[-1]);\r\n base = base.modInv(mod);\r\n }\r\n while (exp.isPositive()) {\r\n if (base.isZero()) return Integer[0];\r\n if (exp.isOdd()) r = r.multiply(base).mod(mod);\r\n exp = exp.divide(2);\r\n base = base.square().mod(mod);\r\n }\r\n return r;\r\n };\r\n NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;\r\n\r\n function compareAbs(a, b) {\r\n if (a.length !== b.length) {\r\n return a.length > b.length ? 1 : -1;\r\n }\r\n for (var i = a.length - 1; i >= 0; i--) {\r\n if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;\r\n }\r\n return 0;\r\n }\r\n\r\n BigInteger.prototype.compareAbs = function (v) {\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (n.isSmall) return 1;\r\n return compareAbs(a, b);\r\n };\r\n SmallInteger.prototype.compareAbs = function (v) {\r\n var n = parseValue(v),\r\n a = Math.abs(this.value),\r\n b = n.value;\r\n if (n.isSmall) {\r\n b = Math.abs(b);\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n return -1;\r\n };\r\n NativeBigInt.prototype.compareAbs = function (v) {\r\n var a = this.value;\r\n var b = parseValue(v).value;\r\n a = a >= 0 ? a : -a;\r\n b = b >= 0 ? b : -b;\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n\r\n BigInteger.prototype.compare = function (v) {\r\n // See discussion about comparison with Infinity:\r\n // https://github.com/peterolson/BigInteger.js/issues/61\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (this.sign !== n.sign) {\r\n return n.sign ? 1 : -1;\r\n }\r\n if (n.isSmall) {\r\n return this.sign ? -1 : 1;\r\n }\r\n return compareAbs(a, b) * (this.sign ? -1 : 1);\r\n };\r\n BigInteger.prototype.compareTo = BigInteger.prototype.compare;\r\n\r\n SmallInteger.prototype.compare = function (v) {\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n\r\n var n = parseValue(v),\r\n a = this.value,\r\n b = n.value;\r\n if (n.isSmall) {\r\n return a == b ? 0 : a > b ? 1 : -1;\r\n }\r\n if (a < 0 !== n.sign) {\r\n return a < 0 ? -1 : 1;\r\n }\r\n return a < 0 ? 1 : -1;\r\n };\r\n SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;\r\n\r\n NativeBigInt.prototype.compare = function (v) {\r\n if (v === Infinity) {\r\n return -1;\r\n }\r\n if (v === -Infinity) {\r\n return 1;\r\n }\r\n var a = this.value;\r\n var b = parseValue(v).value;\r\n return a === b ? 0 : a > b ? 1 : -1;\r\n }\r\n NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;\r\n\r\n BigInteger.prototype.equals = function (v) {\r\n return this.compare(v) === 0;\r\n };\r\n NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;\r\n\r\n BigInteger.prototype.notEquals = function (v) {\r\n return this.compare(v) !== 0;\r\n };\r\n NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;\r\n\r\n BigInteger.prototype.greater = function (v) {\r\n return this.compare(v) > 0;\r\n };\r\n NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;\r\n\r\n BigInteger.prototype.lesser = function (v) {\r\n return this.compare(v) < 0;\r\n };\r\n NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;\r\n\r\n BigInteger.prototype.greaterOrEquals = function (v) {\r\n return this.compare(v) >= 0;\r\n };\r\n NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;\r\n\r\n BigInteger.prototype.lesserOrEquals = function (v) {\r\n return this.compare(v) <= 0;\r\n };\r\n NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;\r\n\r\n BigInteger.prototype.isEven = function () {\r\n return (this.value[0] & 1) === 0;\r\n };\r\n SmallInteger.prototype.isEven = function () {\r\n return (this.value & 1) === 0;\r\n };\r\n NativeBigInt.prototype.isEven = function () {\r\n return (this.value & BigInt(1)) === BigInt(0);\r\n }\r\n\r\n BigInteger.prototype.isOdd = function () {\r\n return (this.value[0] & 1) === 1;\r\n };\r\n SmallInteger.prototype.isOdd = function () {\r\n return (this.value & 1) === 1;\r\n };\r\n NativeBigInt.prototype.isOdd = function () {\r\n return (this.value & BigInt(1)) === BigInt(1);\r\n }\r\n\r\n BigInteger.prototype.isPositive = function () {\r\n return !this.sign;\r\n };\r\n SmallInteger.prototype.isPositive = function () {\r\n return this.value > 0;\r\n };\r\n NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;\r\n\r\n BigInteger.prototype.isNegative = function () {\r\n return this.sign;\r\n };\r\n SmallInteger.prototype.isNegative = function () {\r\n return this.value < 0;\r\n };\r\n NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;\r\n\r\n BigInteger.prototype.isUnit = function () {\r\n return false;\r\n };\r\n SmallInteger.prototype.isUnit = function () {\r\n return Math.abs(this.value) === 1;\r\n };\r\n NativeBigInt.prototype.isUnit = function () {\r\n return this.abs().value === BigInt(1);\r\n }\r\n\r\n BigInteger.prototype.isZero = function () {\r\n return false;\r\n };\r\n SmallInteger.prototype.isZero = function () {\r\n return this.value === 0;\r\n };\r\n NativeBigInt.prototype.isZero = function () {\r\n return this.value === BigInt(0);\r\n }\r\n\r\n BigInteger.prototype.isDivisibleBy = function (v) {\r\n var n = parseValue(v);\r\n if (n.isZero()) return false;\r\n if (n.isUnit()) return true;\r\n if (n.compareAbs(2) === 0) return this.isEven();\r\n return this.mod(n).isZero();\r\n };\r\n NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;\r\n\r\n function isBasicPrime(v) {\r\n var n = v.abs();\r\n if (n.isUnit()) return false;\r\n if (n.equals(2) || n.equals(3) || n.equals(5)) return true;\r\n if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;\r\n if (n.lesser(49)) return true;\r\n // we don't know if it's prime: let the other functions figure it out\r\n }\r\n\r\n function millerRabinTest(n, a) {\r\n var nPrev = n.prev(),\r\n b = nPrev,\r\n r = 0,\r\n d, t, i, x;\r\n while (b.isEven()) b = b.divide(2), r++;\r\n next: for (i = 0; i < a.length; i++) {\r\n if (n.lesser(a[i])) continue;\r\n x = bigInt(a[i]).modPow(b, n);\r\n if (x.isUnit() || x.equals(nPrev)) continue;\r\n for (d = r - 1; d != 0; d--) {\r\n x = x.square().mod(n);\r\n if (x.isUnit()) return false;\r\n if (x.equals(nPrev)) continue next;\r\n }\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n // Set \"strict\" to true to force GRH-supported lower bound of 2*log(N)^2\r\n BigInteger.prototype.isPrime = function (strict) {\r\n var isPrime = isBasicPrime(this);\r\n if (isPrime !== undefined) return isPrime;\r\n var n = this.abs();\r\n var bits = n.bitLength();\r\n if (bits <= 64)\r\n return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);\r\n var logN = Math.log(2) * bits.toJSNumber();\r\n var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);\r\n for (var a = [], i = 0; i < t; i++) {\r\n a.push(bigInt(i + 2));\r\n }\r\n return millerRabinTest(n, a);\r\n };\r\n NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;\r\n\r\n BigInteger.prototype.isProbablePrime = function (iterations, rng) {\r\n var isPrime = isBasicPrime(this);\r\n if (isPrime !== undefined) return isPrime;\r\n var n = this.abs();\r\n var t = iterations === undefined ? 5 : iterations;\r\n for (var a = [], i = 0; i < t; i++) {\r\n a.push(bigInt.randBetween(2, n.minus(2), rng));\r\n }\r\n return millerRabinTest(n, a);\r\n };\r\n NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;\r\n\r\n BigInteger.prototype.modInv = function (n) {\r\n var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;\r\n while (!newR.isZero()) {\r\n q = r.divide(newR);\r\n lastT = t;\r\n lastR = r;\r\n t = newT;\r\n r = newR;\r\n newT = lastT.subtract(q.multiply(newT));\r\n newR = lastR.subtract(q.multiply(newR));\r\n }\r\n if (!r.isUnit()) throw new Error(this.toString() + \" and \" + n.toString() + \" are not co-prime\");\r\n if (t.compare(0) === -1) {\r\n t = t.add(n);\r\n }\r\n if (this.isNegative()) {\r\n return t.negate();\r\n }\r\n return t;\r\n };\r\n\r\n NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;\r\n\r\n BigInteger.prototype.next = function () {\r\n var value = this.value;\r\n if (this.sign) {\r\n return subtractSmall(value, 1, this.sign);\r\n }\r\n return new BigInteger(addSmall(value, 1), this.sign);\r\n };\r\n SmallInteger.prototype.next = function () {\r\n var value = this.value;\r\n if (value + 1 < MAX_INT) return new SmallInteger(value + 1);\r\n return new BigInteger(MAX_INT_ARR, false);\r\n };\r\n NativeBigInt.prototype.next = function () {\r\n return new NativeBigInt(this.value + BigInt(1));\r\n }\r\n\r\n BigInteger.prototype.prev = function () {\r\n var value = this.value;\r\n if (this.sign) {\r\n return new BigInteger(addSmall(value, 1), true);\r\n }\r\n return subtractSmall(value, 1, this.sign);\r\n };\r\n SmallInteger.prototype.prev = function () {\r\n var value = this.value;\r\n if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);\r\n return new BigInteger(MAX_INT_ARR, true);\r\n };\r\n NativeBigInt.prototype.prev = function () {\r\n return new NativeBigInt(this.value - BigInt(1));\r\n }\r\n\r\n var powersOfTwo = [1];\r\n while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);\r\n var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];\r\n\r\n function shift_isSmall(n) {\r\n return Math.abs(n) <= BASE;\r\n }\r\n\r\n BigInteger.prototype.shiftLeft = function (v) {\r\n var n = parseValue(v).toJSNumber();\r\n if (!shift_isSmall(n)) {\r\n throw new Error(String(n) + \" is too large for shifting.\");\r\n }\r\n if (n < 0) return this.shiftRight(-n);\r\n var result = this;\r\n if (result.isZero()) return result;\r\n while (n >= powers2Length) {\r\n result = result.multiply(highestPower2);\r\n n -= powers2Length - 1;\r\n }\r\n return result.multiply(powersOfTwo[n]);\r\n };\r\n NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;\r\n\r\n BigInteger.prototype.shiftRight = function (v) {\r\n var remQuo;\r\n var n = parseValue(v).toJSNumber();\r\n if (!shift_isSmall(n)) {\r\n throw new Error(String(n) + \" is too large for shifting.\");\r\n }\r\n if (n < 0) return this.shiftLeft(-n);\r\n var result = this;\r\n while (n >= powers2Length) {\r\n if (result.isZero() || (result.isNegative() && result.isUnit())) return result;\r\n remQuo = divModAny(result, highestPower2);\r\n result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r\n n -= powers2Length - 1;\r\n }\r\n remQuo = divModAny(result, powersOfTwo[n]);\r\n return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];\r\n };\r\n NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;\r\n\r\n function bitwise(x, y, fn) {\r\n y = parseValue(y);\r\n var xSign = x.isNegative(), ySign = y.isNegative();\r\n var xRem = xSign ? x.not() : x,\r\n yRem = ySign ? y.not() : y;\r\n var xDigit = 0, yDigit = 0;\r\n var xDivMod = null, yDivMod = null;\r\n var result = [];\r\n while (!xRem.isZero() || !yRem.isZero()) {\r\n xDivMod = divModAny(xRem, highestPower2);\r\n xDigit = xDivMod[1].toJSNumber();\r\n if (xSign) {\r\n xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers\r\n }\r\n\r\n yDivMod = divModAny(yRem, highestPower2);\r\n yDigit = yDivMod[1].toJSNumber();\r\n if (ySign) {\r\n yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers\r\n }\r\n\r\n xRem = xDivMod[0];\r\n yRem = yDivMod[0];\r\n result.push(fn(xDigit, yDigit));\r\n }\r\n var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);\r\n for (var i = result.length - 1; i >= 0; i -= 1) {\r\n sum = sum.multiply(highestPower2).add(bigInt(result[i]));\r\n }\r\n return sum;\r\n }\r\n\r\n BigInteger.prototype.not = function () {\r\n return this.negate().prev();\r\n };\r\n NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;\r\n\r\n BigInteger.prototype.and = function (n) {\r\n return bitwise(this, n, function (a, b) { return a & b; });\r\n };\r\n NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;\r\n\r\n BigInteger.prototype.or = function (n) {\r\n return bitwise(this, n, function (a, b) { return a | b; });\r\n };\r\n NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;\r\n\r\n BigInteger.prototype.xor = function (n) {\r\n return bitwise(this, n, function (a, b) { return a ^ b; });\r\n };\r\n NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;\r\n\r\n var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;\r\n function roughLOB(n) { // get lowestOneBit (rough)\r\n // SmallInteger: return Min(lowestOneBit(n), 1 << 30)\r\n // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]\r\n var v = n.value,\r\n x = typeof v === \"number\" ? v | LOBMASK_I :\r\n typeof v === \"bigint\" ? v | BigInt(LOBMASK_I) :\r\n v[0] + v[1] * BASE | LOBMASK_BI;\r\n return x & -x;\r\n }\r\n\r\n function integerLogarithm(value, base) {\r\n if (base.compareTo(value) <= 0) {\r\n var tmp = integerLogarithm(value, base.square(base));\r\n var p = tmp.p;\r\n var e = tmp.e;\r\n var t = p.multiply(base);\r\n return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };\r\n }\r\n return { p: bigInt(1), e: 0 };\r\n }\r\n\r\n BigInteger.prototype.bitLength = function () {\r\n var n = this;\r\n if (n.compareTo(bigInt(0)) < 0) {\r\n n = n.negate().subtract(bigInt(1));\r\n }\r\n if (n.compareTo(bigInt(0)) === 0) {\r\n return bigInt(0);\r\n }\r\n return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));\r\n }\r\n NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;\r\n\r\n function max(a, b) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n return a.greater(b) ? a : b;\r\n }\r\n function min(a, b) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n return a.lesser(b) ? a : b;\r\n }\r\n function gcd(a, b) {\r\n a = parseValue(a).abs();\r\n b = parseValue(b).abs();\r\n if (a.equals(b)) return a;\r\n if (a.isZero()) return b;\r\n if (b.isZero()) return a;\r\n var c = Integer[1], d, t;\r\n while (a.isEven() && b.isEven()) {\r\n d = min(roughLOB(a), roughLOB(b));\r\n a = a.divide(d);\r\n b = b.divide(d);\r\n c = c.multiply(d);\r\n }\r\n while (a.isEven()) {\r\n a = a.divide(roughLOB(a));\r\n }\r\n do {\r\n while (b.isEven()) {\r\n b = b.divide(roughLOB(b));\r\n }\r\n if (a.greater(b)) {\r\n t = b; b = a; a = t;\r\n }\r\n b = b.subtract(a);\r\n } while (!b.isZero());\r\n return c.isUnit() ? a : a.multiply(c);\r\n }\r\n function lcm(a, b) {\r\n a = parseValue(a).abs();\r\n b = parseValue(b).abs();\r\n return a.divide(gcd(a, b)).multiply(b);\r\n }\r\n function randBetween(a, b, rng) {\r\n a = parseValue(a);\r\n b = parseValue(b);\r\n var usedRNG = rng || Math.random;\r\n var low = min(a, b), high = max(a, b);\r\n var range = high.subtract(low).add(1);\r\n if (range.isSmall) return low.add(Math.floor(usedRNG() * range));\r\n var digits = toBase(range, BASE).value;\r\n var result = [], restricted = true;\r\n for (var i = 0; i < digits.length; i++) {\r\n var top = restricted ? digits[i] + (i + 1 < digits.length ? digits[i + 1] / BASE : 0) : BASE;\r\n var digit = truncate(usedRNG() * top);\r\n result.push(digit);\r\n if (digit < digits[i]) restricted = false;\r\n }\r\n return low.add(Integer.fromArray(result, BASE, false));\r\n }\r\n\r\n var parseBase = function (text, base, alphabet, caseSensitive) {\r\n alphabet = alphabet || DEFAULT_ALPHABET;\r\n text = String(text);\r\n if (!caseSensitive) {\r\n text = text.toLowerCase();\r\n alphabet = alphabet.toLowerCase();\r\n }\r\n var length = text.length;\r\n var i;\r\n var absBase = Math.abs(base);\r\n var alphabetValues = {};\r\n for (i = 0; i < alphabet.length; i++) {\r\n alphabetValues[alphabet[i]] = i;\r\n }\r\n for (i = 0; i < length; i++) {\r\n var c = text[i];\r\n if (c === \"-\") continue;\r\n if (c in alphabetValues) {\r\n if (alphabetValues[c] >= absBase) {\r\n if (c === \"1\" && absBase === 1) continue;\r\n throw new Error(c + \" is not a valid digit in base \" + base + \".\");\r\n }\r\n }\r\n }\r\n base = parseValue(base);\r\n var digits = [];\r\n var isNegative = text[0] === \"-\";\r\n for (i = isNegative ? 1 : 0; i < text.length; i++) {\r\n var c = text[i];\r\n if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));\r\n else if (c === \"<\") {\r\n var start = i;\r\n do { i++; } while (text[i] !== \">\" && i < text.length);\r\n digits.push(parseValue(text.slice(start + 1, i)));\r\n }\r\n else throw new Error(c + \" is not a valid character\");\r\n }\r\n return parseBaseFromArray(digits, base, isNegative);\r\n };\r\n\r\n function parseBaseFromArray(digits, base, isNegative) {\r\n var val = Integer[0], pow = Integer[1], i;\r\n for (i = digits.length - 1; i >= 0; i--) {\r\n val = val.add(digits[i].times(pow));\r\n pow = pow.times(base);\r\n }\r\n return isNegative ? val.negate() : val;\r\n }\r\n\r\n function stringify(digit, alphabet) {\r\n alphabet = alphabet || DEFAULT_ALPHABET;\r\n if (digit < alphabet.length) {\r\n return alphabet[digit];\r\n }\r\n return \"<\" + digit + \">\";\r\n }\r\n\r\n function toBase(n, base) {\r\n base = bigInt(base);\r\n if (base.isZero()) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n throw new Error(\"Cannot convert nonzero numbers to base 0.\");\r\n }\r\n if (base.equals(-1)) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n if (n.isNegative())\r\n return {\r\n value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))\r\n .map(Array.prototype.valueOf, [1, 0])\r\n ),\r\n isNegative: false\r\n };\r\n\r\n var arr = Array.apply(null, Array(n.toJSNumber() - 1))\r\n .map(Array.prototype.valueOf, [0, 1]);\r\n arr.unshift([1]);\r\n return {\r\n value: [].concat.apply([], arr),\r\n isNegative: false\r\n };\r\n }\r\n\r\n var neg = false;\r\n if (n.isNegative() && base.isPositive()) {\r\n neg = true;\r\n n = n.abs();\r\n }\r\n if (base.isUnit()) {\r\n if (n.isZero()) return { value: [0], isNegative: false };\r\n\r\n return {\r\n value: Array.apply(null, Array(n.toJSNumber()))\r\n .map(Number.prototype.valueOf, 1),\r\n isNegative: neg\r\n };\r\n }\r\n var out = [];\r\n var left = n, divmod;\r\n while (left.isNegative() || left.compareAbs(base) >= 0) {\r\n divmod = left.divmod(base);\r\n left = divmod.quotient;\r\n var digit = divmod.remainder;\r\n if (digit.isNegative()) {\r\n digit = base.minus(digit).abs();\r\n left = left.next();\r\n }\r\n out.push(digit.toJSNumber());\r\n }\r\n out.push(left.toJSNumber());\r\n return { value: out.reverse(), isNegative: neg };\r\n }\r\n\r\n function toBaseString(n, base, alphabet) {\r\n var arr = toBase(n, base);\r\n return (arr.isNegative ? \"-\" : \"\") + arr.value.map(function (x) {\r\n return stringify(x, alphabet);\r\n }).join('');\r\n }\r\n\r\n BigInteger.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n SmallInteger.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n NativeBigInt.prototype.toArray = function (radix) {\r\n return toBase(this, radix);\r\n };\r\n\r\n BigInteger.prototype.toString = function (radix, alphabet) {\r\n if (radix === undefined) radix = 10;\r\n if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet);\r\n var v = this.value, l = v.length, str = String(v[--l]), zeros = \"0000000\", digit;\r\n while (--l >= 0) {\r\n digit = String(v[l]);\r\n str += zeros.slice(digit.length) + digit;\r\n }\r\n var sign = this.sign ? \"-\" : \"\";\r\n return sign + str;\r\n };\r\n\r\n SmallInteger.prototype.toString = function (radix, alphabet) {\r\n if (radix === undefined) radix = 10;\r\n if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet);\r\n return String(this.value);\r\n };\r\n\r\n NativeBigInt.prototype.toString = SmallInteger.prototype.toString;\r\n\r\n NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }\r\n\r\n BigInteger.prototype.valueOf = function () {\r\n return parseInt(this.toString(), 10);\r\n };\r\n BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;\r\n\r\n SmallInteger.prototype.valueOf = function () {\r\n return this.value;\r\n };\r\n SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;\r\n NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {\r\n return parseInt(this.toString(), 10);\r\n }\r\n\r\n function parseStringValue(v) {\r\n if (isPrecise(+v)) {\r\n var x = +v;\r\n if (x === truncate(x))\r\n return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);\r\n throw new Error(\"Invalid integer: \" + v);\r\n }\r\n var sign = v[0] === \"-\";\r\n if (sign) v = v.slice(1);\r\n var split = v.split(/e/i);\r\n if (split.length > 2) throw new Error(\"Invalid integer: \" + split.join(\"e\"));\r\n if (split.length === 2) {\r\n var exp = split[1];\r\n if (exp[0] === \"+\") exp = exp.slice(1);\r\n exp = +exp;\r\n if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error(\"Invalid integer: \" + exp + \" is not a valid exponent.\");\r\n var text = split[0];\r\n var decimalPlace = text.indexOf(\".\");\r\n if (decimalPlace >= 0) {\r\n exp -= text.length - decimalPlace - 1;\r\n text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);\r\n }\r\n if (exp < 0) throw new Error(\"Cannot include negative exponent part for integers\");\r\n text += (new Array(exp + 1)).join(\"0\");\r\n v = text;\r\n }\r\n var isValid = /^([0-9][0-9]*)$/.test(v);\r\n if (!isValid) throw new Error(\"Invalid integer: \" + v);\r\n if (supportsNativeBigInt) {\r\n return new NativeBigInt(BigInt(sign ? \"-\" + v : v));\r\n }\r\n var r = [], max = v.length, l = LOG_BASE, min = max - l;\r\n while (max > 0) {\r\n r.push(+v.slice(min, max));\r\n min -= l;\r\n if (min < 0) min = 0;\r\n max -= l;\r\n }\r\n trim(r);\r\n return new BigInteger(r, sign);\r\n }\r\n\r\n function parseNumberValue(v) {\r\n if (supportsNativeBigInt) {\r\n return new NativeBigInt(BigInt(v));\r\n }\r\n if (isPrecise(v)) {\r\n if (v !== truncate(v)) throw new Error(v + \" is not an integer.\");\r\n return new SmallInteger(v);\r\n }\r\n return parseStringValue(v.toString());\r\n }\r\n\r\n function parseValue(v) {\r\n if (typeof v === \"number\") {\r\n return parseNumberValue(v);\r\n }\r\n if (typeof v === \"string\") {\r\n return parseStringValue(v);\r\n }\r\n if (typeof v === \"bigint\") {\r\n return new NativeBigInt(v);\r\n }\r\n return v;\r\n }\r\n // Pre-define numbers in range [-999,999]\r\n for (var i = 0; i < 1000; i++) {\r\n Integer[i] = parseValue(i);\r\n if (i > 0) Integer[-i] = parseValue(-i);\r\n }\r\n // Backwards compatibility\r\n Integer.one = Integer[1];\r\n Integer.zero = Integer[0];\r\n Integer.minusOne = Integer[-1];\r\n Integer.max = max;\r\n Integer.min = min;\r\n Integer.gcd = gcd;\r\n Integer.lcm = lcm;\r\n Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };\r\n Integer.randBetween = randBetween;\r\n\r\n Integer.fromArray = function (digits, base, isNegative) {\r\n return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);\r\n };\r\n\r\n return Integer;\r\n})();\r\n\r\n// Node.js check\r\nif (typeof module !== \"undefined\" && module.hasOwnProperty(\"exports\")) {\r\n module.exports = bigInt;\r\n}\r\n\r\n//amd check\r\nif (typeof define === \"function\" && define.amd) {\r\n define( function () {\r\n return bigInt;\r\n });\r\n}\r\n", "/**\n * @preserve jed.js https://github.com/SlexAxton/Jed\n */\n/*\n-----------\nA gettext compatible i18n library for modern JavaScript Applications\n\nby Alex Sexton - AlexSexton [at] gmail - @SlexAxton\n\nMIT License\n\nA jQuery Foundation project - requires CLA to contribute -\nhttps://contribute.jquery.org/CLA/\n\n\n\nJed offers the entire applicable GNU gettext spec'd set of\nfunctions, but also offers some nicer wrappers around them.\nThe api for gettext was written for a language with no function\noverloading, so Jed allows a little more of that.\n\nMany thanks to Joshua I. Miller - unrtst@cpan.org - who wrote\ngettext.js back in 2008. I was able to vet a lot of my ideas\nagainst his. I also made sure Jed passed against his tests\nin order to offer easy upgrades -- jsgettext.berlios.de\n*/\n(function (root, undef) {\n\n // Set up some underscore-style functions, if you already have\n // underscore, feel free to delete this section, and use it\n // directly, however, the amount of functions used doesn't\n // warrant having underscore as a full dependency.\n // Underscore 1.3.0 was used to port and is licensed\n // under the MIT License by Jeremy Ashkenas.\n var ArrayProto = Array.prototype,\n ObjProto = Object.prototype,\n slice = ArrayProto.slice,\n hasOwnProp = ObjProto.hasOwnProperty,\n nativeForEach = ArrayProto.forEach,\n breaker = {};\n\n // We're not using the OOP style _ so we don't need the\n // extra level of indirection. This still means that you\n // sub out for real `_` though.\n var _ = {\n forEach : function( obj, iterator, context ) {\n var i, l, key;\n if ( obj === null ) {\n return;\n }\n\n if ( nativeForEach && obj.forEach === nativeForEach ) {\n obj.forEach( iterator, context );\n }\n else if ( obj.length === +obj.length ) {\n for ( i = 0, l = obj.length; i < l; i++ ) {\n if ( i in obj && iterator.call( context, obj[i], i, obj ) === breaker ) {\n return;\n }\n }\n }\n else {\n for ( key in obj) {\n if ( hasOwnProp.call( obj, key ) ) {\n if ( iterator.call (context, obj[key], key, obj ) === breaker ) {\n return;\n }\n }\n }\n }\n },\n extend : function( obj ) {\n this.forEach( slice.call( arguments, 1 ), function ( source ) {\n for ( var prop in source ) {\n obj[prop] = source[prop];\n }\n });\n return obj;\n }\n };\n // END Miniature underscore impl\n\n // Jed is a constructor function\n var Jed = function ( options ) {\n // Some minimal defaults\n this.defaults = {\n \"locale_data\" : {\n \"messages\" : {\n \"\" : {\n \"domain\" : \"messages\",\n \"lang\" : \"en\",\n \"plural_forms\" : \"nplurals=2; plural=(n != 1);\"\n }\n // There are no default keys, though\n }\n },\n // The default domain if one is missing\n \"domain\" : \"messages\",\n // enable debug mode to log untranslated strings to the console\n \"debug\" : false\n };\n\n // Mix in the sent options with the default options\n this.options = _.extend( {}, this.defaults, options );\n this.textdomain( this.options.domain );\n\n if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {\n throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');\n }\n };\n\n // The gettext spec sets this character as the default\n // delimiter for context lookups.\n // e.g.: context\\u0004key\n // If your translation company uses something different,\n // just change this at any time and it will use that instead.\n Jed.context_delimiter = String.fromCharCode( 4 );\n\n function getPluralFormFunc ( plural_form_string ) {\n return Jed.PF.compile( plural_form_string || \"nplurals=2; plural=(n != 1);\");\n }\n\n function Chain( key, i18n ){\n this._key = key;\n this._i18n = i18n;\n }\n\n // Create a chainable api for adding args prettily\n _.extend( Chain.prototype, {\n onDomain : function ( domain ) {\n this._domain = domain;\n return this;\n },\n withContext : function ( context ) {\n this._context = context;\n return this;\n },\n ifPlural : function ( num, pkey ) {\n this._val = num;\n this._pkey = pkey;\n return this;\n },\n fetch : function ( sArr ) {\n if ( {}.toString.call( sArr ) != '[object Array]' ) {\n sArr = [].slice.call(arguments, 0);\n }\n return ( sArr && sArr.length ? Jed.sprintf : function(x){ return x; } )(\n this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),\n sArr\n );\n }\n });\n\n // Add functions to the Jed prototype.\n // These will be the functions on the object that's returned\n // from creating a `new Jed()`\n // These seem redundant, but they gzip pretty well.\n _.extend( Jed.prototype, {\n // The sexier api start point\n translate : function ( key ) {\n return new Chain( key, this );\n },\n\n textdomain : function ( domain ) {\n if ( ! domain ) {\n return this._textdomain;\n }\n this._textdomain = domain;\n },\n\n gettext : function ( key ) {\n return this.dcnpgettext.call( this, undef, undef, key );\n },\n\n dgettext : function ( domain, key ) {\n return this.dcnpgettext.call( this, domain, undef, key );\n },\n\n dcgettext : function ( domain , key /*, category */ ) {\n // Ignores the category anyways\n return this.dcnpgettext.call( this, domain, undef, key );\n },\n\n ngettext : function ( skey, pkey, val ) {\n return this.dcnpgettext.call( this, undef, undef, skey, pkey, val );\n },\n\n dngettext : function ( domain, skey, pkey, val ) {\n return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );\n },\n\n dcngettext : function ( domain, skey, pkey, val/*, category */) {\n return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );\n },\n\n pgettext : function ( context, key ) {\n return this.dcnpgettext.call( this, undef, context, key );\n },\n\n dpgettext : function ( domain, context, key ) {\n return this.dcnpgettext.call( this, domain, context, key );\n },\n\n dcpgettext : function ( domain, context, key/*, category */) {\n return this.dcnpgettext.call( this, domain, context, key );\n },\n\n npgettext : function ( context, skey, pkey, val ) {\n return this.dcnpgettext.call( this, undef, context, skey, pkey, val );\n },\n\n dnpgettext : function ( domain, context, skey, pkey, val ) {\n return this.dcnpgettext.call( this, domain, context, skey, pkey, val );\n },\n\n // The most fully qualified gettext function. It has every option.\n // Since it has every option, we can use it from every other method.\n // This is the bread and butter.\n // Technically there should be one more argument in this function for 'Category',\n // but since we never use it, we might as well not waste the bytes to define it.\n dcnpgettext : function ( domain, context, singular_key, plural_key, val ) {\n // Set some defaults\n\n plural_key = plural_key || singular_key;\n\n // Use the global domain default if one\n // isn't explicitly passed in\n domain = domain || this._textdomain;\n\n var fallback;\n\n // Handle special cases\n\n // No options found\n if ( ! this.options ) {\n // There's likely something wrong, but we'll return the correct key for english\n // We do this by instantiating a brand new Jed instance with the default set\n // for everything that could be broken.\n fallback = new Jed();\n return fallback.dcnpgettext.call( fallback, undefined, undefined, singular_key, plural_key, val );\n }\n\n // No translation data provided\n if ( ! this.options.locale_data ) {\n throw new Error('No locale data provided.');\n }\n\n if ( ! this.options.locale_data[ domain ] ) {\n throw new Error('Domain `' + domain + '` was not found.');\n }\n\n if ( ! this.options.locale_data[ domain ][ \"\" ] ) {\n throw new Error('No locale meta information provided.');\n }\n\n // Make sure we have a truthy key. Otherwise we might start looking\n // into the empty string key, which is the options for the locale\n // data.\n if ( ! singular_key ) {\n throw new Error('No translation key found.');\n }\n\n var key = context ? context + Jed.context_delimiter + singular_key : singular_key,\n locale_data = this.options.locale_data,\n dict = locale_data[ domain ],\n defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[\"\"],\n pluralForms = dict[\"\"].plural_forms || dict[\"\"][\"Plural-Forms\"] || dict[\"\"][\"plural-forms\"] || defaultConf.plural_forms || defaultConf[\"Plural-Forms\"] || defaultConf[\"plural-forms\"],\n val_list,\n res;\n\n var val_idx;\n if (val === undefined) {\n // No value passed in; assume singular key lookup.\n val_idx = 0;\n\n } else {\n // Value has been passed in; use plural-forms calculations.\n\n // Handle invalid numbers, but try casting strings for good measure\n if ( typeof val != 'number' ) {\n val = parseInt( val, 10 );\n\n if ( isNaN( val ) ) {\n throw new Error('The number that was passed in is not a number.');\n }\n }\n\n val_idx = getPluralFormFunc(pluralForms)(val);\n }\n\n // Throw an error if a domain isn't found\n if ( ! dict ) {\n throw new Error('No domain named `' + domain + '` could be found.');\n }\n\n val_list = dict[ key ];\n\n // If there is no match, then revert back to\n // english style singular/plural with the keys passed in.\n if ( ! val_list || val_idx > val_list.length ) {\n if (this.options.missing_key_callback) {\n this.options.missing_key_callback(key, domain);\n }\n res = [ singular_key, plural_key ];\n\n // collect untranslated strings\n if (this.options.debug===true) {\n console.log(res[ getPluralFormFunc(pluralForms)( val ) ]);\n }\n return res[ getPluralFormFunc()( val ) ];\n }\n\n res = val_list[ val_idx ];\n\n // This includes empty strings on purpose\n if ( ! res ) {\n res = [ singular_key, plural_key ];\n return res[ getPluralFormFunc()( val ) ];\n }\n return res;\n }\n });\n\n\n // We add in sprintf capabilities for post translation value interolation\n // This is not internally used, so you can remove it if you have this\n // available somewhere else, or want to use a different system.\n\n // We _slightly_ modify the normal sprintf behavior to more gracefully handle\n // undefined values.\n\n /**\n sprintf() for JavaScript 0.7-beta1\n http://www.diveintojavascript.com/projects/javascript-sprintf\n\n Copyright (c) Alexandru Marasteanu \n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of sprintf() for JavaScript nor the\n names of its contributors may be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n var sprintf = (function() {\n function get_type(variable) {\n return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();\n }\n function str_repeat(input, multiplier) {\n for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}\n return output.join('');\n }\n\n var str_format = function() {\n if (!str_format.cache.hasOwnProperty(arguments[0])) {\n str_format.cache[arguments[0]] = str_format.parse(arguments[0]);\n }\n return str_format.format.call(null, str_format.cache[arguments[0]], arguments);\n };\n\n str_format.format = function(parse_tree, argv) {\n var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;\n for (i = 0; i < tree_length; i++) {\n node_type = get_type(parse_tree[i]);\n if (node_type === 'string') {\n output.push(parse_tree[i]);\n }\n else if (node_type === 'array') {\n match = parse_tree[i]; // convenience purposes only\n if (match[2]) { // keyword argument\n arg = argv[cursor];\n for (k = 0; k < match[2].length; k++) {\n if (!arg.hasOwnProperty(match[2][k])) {\n throw(sprintf('[sprintf] property \"%s\" does not exist', match[2][k]));\n }\n arg = arg[match[2][k]];\n }\n }\n else if (match[1]) { // positional argument (explicit)\n arg = argv[match[1]];\n }\n else { // positional argument (implicit)\n arg = argv[cursor++];\n }\n\n if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {\n throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));\n }\n\n // Jed EDIT\n if ( typeof arg == 'undefined' || arg === null ) {\n arg = '';\n }\n // Jed EDIT\n\n switch (match[8]) {\n case 'b': arg = arg.toString(2); break;\n case 'c': arg = String.fromCharCode(arg); break;\n case 'd': arg = parseInt(arg, 10); break;\n case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;\n case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;\n case 'o': arg = arg.toString(8); break;\n case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;\n case 'u': arg = Math.abs(arg); break;\n case 'x': arg = arg.toString(16); break;\n case 'X': arg = arg.toString(16).toUpperCase(); break;\n }\n arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);\n pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';\n pad_length = match[6] - String(arg).length;\n pad = match[6] ? str_repeat(pad_character, pad_length) : '';\n output.push(match[5] ? arg + pad : pad + arg);\n }\n }\n return output.join('');\n };\n\n str_format.cache = {};\n\n str_format.parse = function(fmt) {\n var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;\n while (_fmt) {\n if ((match = /^[^\\x25]+/.exec(_fmt)) !== null) {\n parse_tree.push(match[0]);\n }\n else if ((match = /^\\x25{2}/.exec(_fmt)) !== null) {\n parse_tree.push('%');\n }\n else if ((match = /^\\x25(?:([1-9]\\d*)\\$|\\(([^\\)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {\n if (match[2]) {\n arg_names |= 1;\n var field_list = [], replacement_field = match[2], field_match = [];\n if ((field_match = /^([a-z_][a-z_\\d]*)/i.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n if ((field_match = /^\\.([a-z_][a-z_\\d]*)/i.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else if ((field_match = /^\\[(\\d+)\\]/.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else {\n throw('[sprintf] huh?');\n }\n }\n }\n else {\n throw('[sprintf] huh?');\n }\n match[2] = field_list;\n }\n else {\n arg_names |= 2;\n }\n if (arg_names === 3) {\n throw('[sprintf] mixing positional and named placeholders is not (yet) supported');\n }\n parse_tree.push(match);\n }\n else {\n throw('[sprintf] huh?');\n }\n _fmt = _fmt.substring(match[0].length);\n }\n return parse_tree;\n };\n\n return str_format;\n })();\n\n var vsprintf = function(fmt, argv) {\n argv.unshift(fmt);\n return sprintf.apply(null, argv);\n };\n\n Jed.parse_plural = function ( plural_forms, n ) {\n plural_forms = plural_forms.replace(/n/g, n);\n return Jed.parse_expression(plural_forms);\n };\n\n Jed.sprintf = function ( fmt, args ) {\n if ( {}.toString.call( args ) == '[object Array]' ) {\n return vsprintf( fmt, [].slice.call(args) );\n }\n return sprintf.apply(this, [].slice.call(arguments) );\n };\n\n Jed.prototype.sprintf = function () {\n return Jed.sprintf.apply(this, arguments);\n };\n // END sprintf Implementation\n\n // Start the Plural forms section\n // This is a full plural form expression parser. It is used to avoid\n // running 'eval' or 'new Function' directly against the plural\n // forms.\n //\n // This can be important if you get translations done through a 3rd\n // party vendor. I encourage you to use this instead, however, I\n // also will provide a 'precompiler' that you can use at build time\n // to output valid/safe function representations of the plural form\n // expressions. This means you can build this code out for the most\n // part.\n Jed.PF = {};\n\n Jed.PF.parse = function ( p ) {\n var plural_str = Jed.PF.extractPluralExpr( p );\n return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);\n };\n\n Jed.PF.compile = function ( p ) {\n // Handle trues and falses as 0 and 1\n function imply( val ) {\n return (val === true ? 1 : val ? val : 0);\n }\n\n var ast = Jed.PF.parse( p );\n return function ( n ) {\n return imply( Jed.PF.interpreter( ast )( n ) );\n };\n };\n\n Jed.PF.interpreter = function ( ast ) {\n return function ( n ) {\n var res;\n switch ( ast.type ) {\n case 'GROUP':\n return Jed.PF.interpreter( ast.expr )( n );\n case 'TERNARY':\n if ( Jed.PF.interpreter( ast.expr )( n ) ) {\n return Jed.PF.interpreter( ast.truthy )( n );\n }\n return Jed.PF.interpreter( ast.falsey )( n );\n case 'OR':\n return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );\n case 'AND':\n return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );\n case 'LT':\n return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );\n case 'GT':\n return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );\n case 'LTE':\n return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );\n case 'GTE':\n return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );\n case 'EQ':\n return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );\n case 'NEQ':\n return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );\n case 'MOD':\n return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );\n case 'VAR':\n return n;\n case 'NUM':\n return ast.val;\n default:\n throw new Error(\"Invalid Token found.\");\n }\n };\n };\n\n Jed.PF.extractPluralExpr = function ( p ) {\n // trim first\n p = p.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\n if (! /;\\s*$/.test(p)) {\n p = p.concat(';');\n }\n\n var nplurals_re = /nplurals\\=(\\d+);/,\n plural_re = /plural\\=(.*);/,\n nplurals_matches = p.match( nplurals_re ),\n res = {},\n plural_matches;\n\n // Find the nplurals number\n if ( nplurals_matches.length > 1 ) {\n res.nplurals = nplurals_matches[1];\n }\n else {\n throw new Error('nplurals not found in plural_forms string: ' + p );\n }\n\n // remove that data to get to the formula\n p = p.replace( nplurals_re, \"\" );\n plural_matches = p.match( plural_re );\n\n if (!( plural_matches && plural_matches.length > 1 ) ) {\n throw new Error('`plural` expression not found: ' + p);\n }\n return plural_matches[ 1 ];\n };\n\n /* Jison generated parser */\n Jed.PF.parser = (function(){\n\nvar parser = {trace: function trace() { },\nyy: {},\nsymbols_: {\"error\":2,\"expressions\":3,\"e\":4,\"EOF\":5,\"?\":6,\":\":7,\"||\":8,\"&&\":9,\"<\":10,\"<=\":11,\">\":12,\">=\":13,\"!=\":14,\"==\":15,\"%\":16,\"(\":17,\")\":18,\"n\":19,\"NUMBER\":20,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",5:\"EOF\",6:\"?\",7:\":\",8:\"||\",9:\"&&\",10:\"<\",11:\"<=\",12:\">\",13:\">=\",14:\"!=\",15:\"==\",16:\"%\",17:\"(\",18:\")\",19:\"n\",20:\"NUMBER\"},\nproductions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],\nperformAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 1: return { type : 'GROUP', expr: $$[$0-1] };\nbreak;\ncase 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };\nbreak;\ncase 3:this.$ = { type: \"OR\", left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 4:this.$ = { type: \"AND\", left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };\nbreak;\ncase 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };\nbreak;\ncase 13:this.$ = { type: 'VAR' };\nbreak;\ncase 14:this.$ = { type: 'NUM', val: Number(yytext) };\nbreak;\n}\n},\ntable: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],\ndefaultActions: {6:[2,1]},\nparseError: function parseError(str, hash) {\n throw new Error(str);\n},\nparse: function parse(input) {\n var self = this,\n stack = [0],\n vstack = [null], // semantic value stack\n lstack = [], // location stack\n table = this.table,\n yytext = '',\n yylineno = 0,\n yyleng = 0,\n recovering = 0,\n TERROR = 2,\n EOF = 1;\n\n //this.reductionCount = this.shiftCount = 0;\n\n this.lexer.setInput(input);\n this.lexer.yy = this.yy;\n this.yy.lexer = this.lexer;\n if (typeof this.lexer.yylloc == 'undefined')\n this.lexer.yylloc = {};\n var yyloc = this.lexer.yylloc;\n lstack.push(yyloc);\n\n if (typeof this.yy.parseError === 'function')\n this.parseError = this.yy.parseError;\n\n function popStack (n) {\n stack.length = stack.length - 2*n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n\n function lex() {\n var token;\n token = self.lexer.lex() || 1; // $end = 1\n // if token isn't its numeric value, convert\n if (typeof token !== 'number') {\n token = self.symbols_[token] || token;\n }\n return token;\n }\n\n var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;\n while (true) {\n // retreive state number from top of stack\n state = stack[stack.length-1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol == null)\n symbol = lex();\n // read action for current state and first input\n action = table[state] && table[state][symbol];\n }\n\n // handle parse error\n _handle_error:\n if (typeof action === 'undefined' || !action.length || !action[0]) {\n\n if (!recovering) {\n // Report error\n expected = [];\n for (p in table[state]) if (this.terminals_[p] && p > 2) {\n expected.push(\"'\"+this.terminals_[p]+\"'\");\n }\n var errStr = '';\n if (this.lexer.showPosition) {\n errStr = 'Parse error on line '+(yylineno+1)+\":\\n\"+this.lexer.showPosition()+\"\\nExpecting \"+expected.join(', ') + \", got '\" + this.terminals_[symbol]+ \"'\";\n } else {\n errStr = 'Parse error on line '+(yylineno+1)+\": Unexpected \" +\n (symbol == 1 /*EOF*/ ? \"end of input\" :\n (\"'\"+(this.terminals_[symbol] || symbol)+\"'\"));\n }\n this.parseError(errStr,\n {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});\n }\n\n // just recovered from another error\n if (recovering == 3) {\n if (symbol == EOF) {\n throw new Error(errStr || 'Parsing halted.');\n }\n\n // discard current lookahead and grab another\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n symbol = lex();\n }\n\n // try to recover from error\n while (1) {\n // check for error recovery rule in this state\n if ((TERROR.toString()) in table[state]) {\n break;\n }\n if (state == 0) {\n throw new Error(errStr || 'Parsing halted.');\n }\n popStack(1);\n state = stack[stack.length-1];\n }\n\n preErrorSymbol = symbol; // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n state = stack[stack.length-1];\n action = table[state] && table[state][TERROR];\n recovering = 3; // allow 3 real symbols to be shifted before reporting a new error\n }\n\n // this shouldn't happen, unless resolve defaults are off\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);\n }\n\n switch (action[0]) {\n\n case 1: // shift\n //this.shiftCount++;\n\n stack.push(symbol);\n vstack.push(this.lexer.yytext);\n lstack.push(this.lexer.yylloc);\n stack.push(action[1]); // push state\n symbol = null;\n if (!preErrorSymbol) { // normal execution/no error\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n if (recovering > 0)\n recovering--;\n } else { // error just occurred, resume old lookahead f/ before error\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n\n case 2: // reduce\n //this.reductionCount++;\n\n len = this.productions_[action[1]][1];\n\n // perform semantic action\n yyval.$ = vstack[vstack.length-len]; // default to $$ = $1\n // default location, uses first token for firsts, last for lasts\n yyval._$ = {\n first_line: lstack[lstack.length-(len||1)].first_line,\n last_line: lstack[lstack.length-1].last_line,\n first_column: lstack[lstack.length-(len||1)].first_column,\n last_column: lstack[lstack.length-1].last_column\n };\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);\n\n if (typeof r !== 'undefined') {\n return r;\n }\n\n // pop off stack\n if (len) {\n stack = stack.slice(0,-1*len*2);\n vstack = vstack.slice(0, -1*len);\n lstack = lstack.slice(0, -1*len);\n }\n\n stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[stack[stack.length-2]][stack[stack.length-1]];\n stack.push(newState);\n break;\n\n case 3: // accept\n return true;\n }\n\n }\n\n return true;\n}};/* Jison generated lexer */\nvar lexer = (function(){\n\nvar lexer = ({EOF:1,\nparseError:function parseError(str, hash) {\n if (this.yy.parseError) {\n this.yy.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\nsetInput:function (input) {\n this._input = input;\n this._more = this._less = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};\n return this;\n },\ninput:function () {\n var ch = this._input[0];\n this.yytext+=ch;\n this.yyleng++;\n this.match+=ch;\n this.matched+=ch;\n var lines = ch.match(/\\n/);\n if (lines) this.yylineno++;\n this._input = this._input.slice(1);\n return ch;\n },\nunput:function (ch) {\n this._input = ch + this._input;\n return this;\n },\nmore:function () {\n this._more = true;\n return this;\n },\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\\n/g, \"\");\n },\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c+\"^\";\n },\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) this.done = true;\n\n var token,\n match,\n col,\n lines;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i=0;i < rules.length; i++) {\n match = this._input.match(this.rules[rules[i]]);\n if (match) {\n lines = match[0].match(/\\n.*/g);\n if (lines) this.yylineno += lines.length;\n this.yylloc = {first_line: this.yylloc.last_line,\n last_line: this.yylineno+1,\n first_column: this.yylloc.last_column,\n last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n this._more = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);\n if (token) return token;\n else return;\n }\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\\n'+this.showPosition(),\n {text: \"\", token: null, line: this.yylineno});\n }\n },\nlex:function lex() {\n var r = this.next();\n if (typeof r !== 'undefined') {\n return r;\n } else {\n return this.lex();\n }\n },\nbegin:function begin(condition) {\n this.conditionStack.push(condition);\n },\npopState:function popState() {\n return this.conditionStack.pop();\n },\n_currentRules:function _currentRules() {\n return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;\n },\ntopState:function () {\n return this.conditionStack[this.conditionStack.length-2];\n },\npushState:function begin(condition) {\n this.begin(condition);\n }});\nlexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\n\nvar YYSTATE=YY_START;\nswitch($avoiding_name_collisions) {\ncase 0:/* skip whitespace */\nbreak;\ncase 1:return 20\nbreak;\ncase 2:return 19\nbreak;\ncase 3:return 8\nbreak;\ncase 4:return 9\nbreak;\ncase 5:return 6\nbreak;\ncase 6:return 7\nbreak;\ncase 7:return 11\nbreak;\ncase 8:return 13\nbreak;\ncase 9:return 10\nbreak;\ncase 10:return 12\nbreak;\ncase 11:return 14\nbreak;\ncase 12:return 15\nbreak;\ncase 13:return 16\nbreak;\ncase 14:return 17\nbreak;\ncase 15:return 18\nbreak;\ncase 16:return 5\nbreak;\ncase 17:return 'INVALID'\nbreak;\n}\n};\nlexer.rules = [/^\\s+/,/^[0-9]+(\\.[0-9]+)?\\b/,/^n\\b/,/^\\|\\|/,/^&&/,/^\\?/,/^:/,/^<=/,/^>=/,/^/,/^!=/,/^==/,/^%/,/^\\(/,/^\\)/,/^$/,/^./];\nlexer.conditions = {\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],\"inclusive\":true}};return lexer;})()\nparser.lexer = lexer;\nreturn parser;\n})();\n// End parser\n\n // Handle node, amd, and global systems\n if (typeof exports !== 'undefined') {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = Jed;\n }\n exports.Jed = Jed;\n }\n else {\n if (typeof define === 'function' && define.amd) {\n define(function() {\n return Jed;\n });\n }\n // Leak a global regardless of module system\n root['Jed'] = Jed;\n }\n\n})(this);\n", "import { EMPTY_ARR } from \"./constants\";\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-ignore We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n", "import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n", "import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array} [children] The children of the virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is import('./internal').VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor === undefined;\n", "import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nComponent.prototype.setState = function(update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.prototype.forceUpdate = function(callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || setTimeout)(process);\n\t}\n}\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet queue;\n\twhile ((process._rerenderCount = rerenderQueue.length)) {\n\t\tqueue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);\n\t\trerenderQueue = [];\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\tqueue.some(c => {\n\t\t\tif (c._dirty) renderComponent(c);\n\t\t});\n\t}\n}\n\nprocess._rerenderCount = 0;\n", "import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.shouldComponentUpdate = function(_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tsubs.some(enqueueRender);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType = context);\n}\n", "export const EMPTY_OBJ = {};\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\n\t\tchildVNode = renderResult[i];\n\n\t\tif (childVNode == null || typeof childVNode == 'boolean') {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g.
    {reuse}{reuse}
    ) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t} else if (Array.isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse =
    \n\t\t\t//
    {reuse}{reuse}
    \n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : null,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(parentDom, vnode, vnode, c, vnode._dom, oldDom);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (Array.isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname !== 'href' &&\n\t\t\tname !== 'list' &&\n\t\t\tname !== 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname !== 'tabIndex' &&\n\t\t\tname !== 'download' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// ARIA-attributes have a different notion of boolean values.\n\t\t// The value `false` is different from the attribute not\n\t\t// existing on the DOM, so we can't remove it. For non-boolean\n\t\t// ARIA-attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost us too many bytes. On top of\n\t\t// that other VDOM frameworks also always stringify `false`.\n\n\t\tif (typeof value === 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != null && (value !== false || name.indexOf('-') != -1)) {\n\t\t\tdom.setAttribute(name, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\tthis._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\tthis._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n", "import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, setProperty } from './props';\nimport { assign, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\tnewVNode._original === oldVNode._original\n\t\t\t\t) {\n\t\t\t\t\tc.props = newProps;\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) c._dirty = false;\n\t\t\t\t\tc._vnode = newVNode;\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._vnode = newVNode;\n\t\t\tc._parentDom = parentDom;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (!isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tArray.isArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._hydrating = null;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-ignore See above ts-ignore on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\n\t\t}\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tArray.isArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// (as above, don't diff props during hydration)\n\t\tif (!isHydrating) {\n\t\t\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the -element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix \n\t\tif (\n\t\t\ttype == 'select' &&\n\t\t\tnormalizedProps.multiple &&\n\t\t\tArray.isArray(normalizedProps.value)\n\t\t) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (type == 'select' && normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvnode.props = normalizedProps;\n\n\t\tif (props.class != props.className) {\n\t\t\tclassNameDescriptor.enumerable = 'className' in props;\n\t\t\tif (props.className != null) normalizedProps.class = props.className;\n\t\t\tObject.defineProperty(normalizedProps, 'className', classNameDescriptor);\n\t\t}\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function(vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection. So far\n// only `react-relay` makes use of it. It uses it to read the\n// context value.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t}\n\t\t}\n\t}\n};\n", "import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport { is } from './util';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '17.0.2'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender. It's\n * implmented here as a no-op.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional arugment that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => callback(arg);\n\n/**\n * Strict Mode is not implemented in Preact, so we provide a stand-in for it\n * that just renders its children without imposing any restrictions.\n */\nconst StrictMode = Fragment;\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (!is(_instance._value, getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n", "/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n", "// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\n// TypeScript port in 2019 by Florian Dold.\n// Public domain.\n//\n// Implementation derived from TweetNaCl version 20140427.\n// See for details: http://tweetnacl.cr.yp.to/\n\nconst gf = function (init: number[] = []): Float64Array {\n const r = new Float64Array(16);\n if (init) for (let i = 0; i < init.length; i++) r[i] = init[i];\n return r;\n};\n\n// Pluggable, initialized in high-level API below.\nlet randombytes = function (x: Uint8Array, n: number): void {\n throw new Error(\"no PRNG\");\n};\n\nconst _9 = new Uint8Array(32);\n_9[0] = 9;\n\n// prettier-ignore\nconst gf0 = gf();\nconst gf1 = gf([1]);\nconst _121665 = gf([0xdb41, 1]);\nconst D = gf([\n 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898,\n 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203,\n]);\nconst D2 = gf([\n 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130,\n 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406,\n]);\nconst X = gf([\n 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c,\n 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169,\n]);\nconst Y = gf([\n 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,\n 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,\n]);\nconst I = gf([\n 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7,\n 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83,\n]);\n\nfunction ts64(x: Uint8Array, i: number, h: number, l: number): void {\n x[i] = (h >> 24) & 0xff;\n x[i + 1] = (h >> 16) & 0xff;\n x[i + 2] = (h >> 8) & 0xff;\n x[i + 3] = h & 0xff;\n x[i + 4] = (l >> 24) & 0xff;\n x[i + 5] = (l >> 16) & 0xff;\n x[i + 6] = (l >> 8) & 0xff;\n x[i + 7] = l & 0xff;\n}\n\nfunction vn(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n n: number,\n): number {\n let i,\n d = 0;\n for (i = 0; i < n; i++) d |= x[xi + i] ^ y[yi + i];\n return (1 & ((d - 1) >>> 8)) - 1;\n}\n\nfunction crypto_verify_16(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n) {\n return vn(x, xi, y, yi, 16);\n}\n\nfunction crypto_verify_32(\n x: Uint8Array,\n xi: number,\n y: Uint8Array,\n yi: number,\n): number {\n return vn(x, xi, y, yi, 32);\n}\n\nfunction core_salsa20(\n o: Uint8Array,\n p: Uint8Array,\n k: Uint8Array,\n c: Uint8Array,\n) {\n var j0 =\n (c[0] & 0xff) |\n ((c[1] & 0xff) << 8) |\n ((c[2] & 0xff) << 16) |\n ((c[3] & 0xff) << 24),\n j1 =\n (k[0] & 0xff) |\n ((k[1] & 0xff) << 8) |\n ((k[2] & 0xff) << 16) |\n ((k[3] & 0xff) << 24),\n j2 =\n (k[4] & 0xff) |\n ((k[5] & 0xff) << 8) |\n ((k[6] & 0xff) << 16) |\n ((k[7] & 0xff) << 24),\n j3 =\n (k[8] & 0xff) |\n ((k[9] & 0xff) << 8) |\n ((k[10] & 0xff) << 16) |\n ((k[11] & 0xff) << 24),\n j4 =\n (k[12] & 0xff) |\n ((k[13] & 0xff) << 8) |\n ((k[14] & 0xff) << 16) |\n ((k[15] & 0xff) << 24),\n j5 =\n (c[4] & 0xff) |\n ((c[5] & 0xff) << 8) |\n ((c[6] & 0xff) << 16) |\n ((c[7] & 0xff) << 24),\n j6 =\n (p[0] & 0xff) |\n ((p[1] & 0xff) << 8) |\n ((p[2] & 0xff) << 16) |\n ((p[3] & 0xff) << 24),\n j7 =\n (p[4] & 0xff) |\n ((p[5] & 0xff) << 8) |\n ((p[6] & 0xff) << 16) |\n ((p[7] & 0xff) << 24),\n j8 =\n (p[8] & 0xff) |\n ((p[9] & 0xff) << 8) |\n ((p[10] & 0xff) << 16) |\n ((p[11] & 0xff) << 24),\n j9 =\n (p[12] & 0xff) |\n ((p[13] & 0xff) << 8) |\n ((p[14] & 0xff) << 16) |\n ((p[15] & 0xff) << 24),\n j10 =\n (c[8] & 0xff) |\n ((c[9] & 0xff) << 8) |\n ((c[10] & 0xff) << 16) |\n ((c[11] & 0xff) << 24),\n j11 =\n (k[16] & 0xff) |\n ((k[17] & 0xff) << 8) |\n ((k[18] & 0xff) << 16) |\n ((k[19] & 0xff) << 24),\n j12 =\n (k[20] & 0xff) |\n ((k[21] & 0xff) << 8) |\n ((k[22] & 0xff) << 16) |\n ((k[23] & 0xff) << 24),\n j13 =\n (k[24] & 0xff) |\n ((k[25] & 0xff) << 8) |\n ((k[26] & 0xff) << 16) |\n ((k[27] & 0xff) << 24),\n j14 =\n (k[28] & 0xff) |\n ((k[29] & 0xff) << 8) |\n ((k[30] & 0xff) << 16) |\n ((k[31] & 0xff) << 24),\n j15 =\n (c[12] & 0xff) |\n ((c[13] & 0xff) << 8) |\n ((c[14] & 0xff) << 16) |\n ((c[15] & 0xff) << 24);\n\n var x0 = j0,\n x1 = j1,\n x2 = j2,\n x3 = j3,\n x4 = j4,\n x5 = j5,\n x6 = j6,\n x7 = j7,\n x8 = j8,\n x9 = j9,\n x10 = j10,\n x11 = j11,\n x12 = j12,\n x13 = j13,\n x14 = j14,\n x15 = j15,\n u;\n\n for (var i = 0; i < 20; i += 2) {\n u = (x0 + x12) | 0;\n x4 ^= (u << 7) | (u >>> (32 - 7));\n u = (x4 + x0) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x4) | 0;\n x12 ^= (u << 13) | (u >>> (32 - 13));\n u = (x12 + x8) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x1) | 0;\n x9 ^= (u << 7) | (u >>> (32 - 7));\n u = (x9 + x5) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x9) | 0;\n x1 ^= (u << 13) | (u >>> (32 - 13));\n u = (x1 + x13) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x6) | 0;\n x14 ^= (u << 7) | (u >>> (32 - 7));\n u = (x14 + x10) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x14) | 0;\n x6 ^= (u << 13) | (u >>> (32 - 13));\n u = (x6 + x2) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x11) | 0;\n x3 ^= (u << 7) | (u >>> (32 - 7));\n u = (x3 + x15) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x3) | 0;\n x11 ^= (u << 13) | (u >>> (32 - 13));\n u = (x11 + x7) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x0 + x3) | 0;\n x1 ^= (u << 7) | (u >>> (32 - 7));\n u = (x1 + x0) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x1) | 0;\n x3 ^= (u << 13) | (u >>> (32 - 13));\n u = (x3 + x2) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x4) | 0;\n x6 ^= (u << 7) | (u >>> (32 - 7));\n u = (x6 + x5) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x6) | 0;\n x4 ^= (u << 13) | (u >>> (32 - 13));\n u = (x4 + x7) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x9) | 0;\n x11 ^= (u << 7) | (u >>> (32 - 7));\n u = (x11 + x10) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x11) | 0;\n x9 ^= (u << 13) | (u >>> (32 - 13));\n u = (x9 + x8) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x14) | 0;\n x12 ^= (u << 7) | (u >>> (32 - 7));\n u = (x12 + x15) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x12) | 0;\n x14 ^= (u << 13) | (u >>> (32 - 13));\n u = (x14 + x13) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n }\n x0 = (x0 + j0) | 0;\n x1 = (x1 + j1) | 0;\n x2 = (x2 + j2) | 0;\n x3 = (x3 + j3) | 0;\n x4 = (x4 + j4) | 0;\n x5 = (x5 + j5) | 0;\n x6 = (x6 + j6) | 0;\n x7 = (x7 + j7) | 0;\n x8 = (x8 + j8) | 0;\n x9 = (x9 + j9) | 0;\n x10 = (x10 + j10) | 0;\n x11 = (x11 + j11) | 0;\n x12 = (x12 + j12) | 0;\n x13 = (x13 + j13) | 0;\n x14 = (x14 + j14) | 0;\n x15 = (x15 + j15) | 0;\n\n o[0] = (x0 >>> 0) & 0xff;\n o[1] = (x0 >>> 8) & 0xff;\n o[2] = (x0 >>> 16) & 0xff;\n o[3] = (x0 >>> 24) & 0xff;\n\n o[4] = (x1 >>> 0) & 0xff;\n o[5] = (x1 >>> 8) & 0xff;\n o[6] = (x1 >>> 16) & 0xff;\n o[7] = (x1 >>> 24) & 0xff;\n\n o[8] = (x2 >>> 0) & 0xff;\n o[9] = (x2 >>> 8) & 0xff;\n o[10] = (x2 >>> 16) & 0xff;\n o[11] = (x2 >>> 24) & 0xff;\n\n o[12] = (x3 >>> 0) & 0xff;\n o[13] = (x3 >>> 8) & 0xff;\n o[14] = (x3 >>> 16) & 0xff;\n o[15] = (x3 >>> 24) & 0xff;\n\n o[16] = (x4 >>> 0) & 0xff;\n o[17] = (x4 >>> 8) & 0xff;\n o[18] = (x4 >>> 16) & 0xff;\n o[19] = (x4 >>> 24) & 0xff;\n\n o[20] = (x5 >>> 0) & 0xff;\n o[21] = (x5 >>> 8) & 0xff;\n o[22] = (x5 >>> 16) & 0xff;\n o[23] = (x5 >>> 24) & 0xff;\n\n o[24] = (x6 >>> 0) & 0xff;\n o[25] = (x6 >>> 8) & 0xff;\n o[26] = (x6 >>> 16) & 0xff;\n o[27] = (x6 >>> 24) & 0xff;\n\n o[28] = (x7 >>> 0) & 0xff;\n o[29] = (x7 >>> 8) & 0xff;\n o[30] = (x7 >>> 16) & 0xff;\n o[31] = (x7 >>> 24) & 0xff;\n\n o[32] = (x8 >>> 0) & 0xff;\n o[33] = (x8 >>> 8) & 0xff;\n o[34] = (x8 >>> 16) & 0xff;\n o[35] = (x8 >>> 24) & 0xff;\n\n o[36] = (x9 >>> 0) & 0xff;\n o[37] = (x9 >>> 8) & 0xff;\n o[38] = (x9 >>> 16) & 0xff;\n o[39] = (x9 >>> 24) & 0xff;\n\n o[40] = (x10 >>> 0) & 0xff;\n o[41] = (x10 >>> 8) & 0xff;\n o[42] = (x10 >>> 16) & 0xff;\n o[43] = (x10 >>> 24) & 0xff;\n\n o[44] = (x11 >>> 0) & 0xff;\n o[45] = (x11 >>> 8) & 0xff;\n o[46] = (x11 >>> 16) & 0xff;\n o[47] = (x11 >>> 24) & 0xff;\n\n o[48] = (x12 >>> 0) & 0xff;\n o[49] = (x12 >>> 8) & 0xff;\n o[50] = (x12 >>> 16) & 0xff;\n o[51] = (x12 >>> 24) & 0xff;\n\n o[52] = (x13 >>> 0) & 0xff;\n o[53] = (x13 >>> 8) & 0xff;\n o[54] = (x13 >>> 16) & 0xff;\n o[55] = (x13 >>> 24) & 0xff;\n\n o[56] = (x14 >>> 0) & 0xff;\n o[57] = (x14 >>> 8) & 0xff;\n o[58] = (x14 >>> 16) & 0xff;\n o[59] = (x14 >>> 24) & 0xff;\n\n o[60] = (x15 >>> 0) & 0xff;\n o[61] = (x15 >>> 8) & 0xff;\n o[62] = (x15 >>> 16) & 0xff;\n o[63] = (x15 >>> 24) & 0xff;\n}\n\nfunction core_hsalsa20(\n o: Uint8Array,\n p: Uint8Array,\n k: Uint8Array,\n c: Uint8Array,\n) {\n var j0 =\n (c[0] & 0xff) |\n ((c[1] & 0xff) << 8) |\n ((c[2] & 0xff) << 16) |\n ((c[3] & 0xff) << 24),\n j1 =\n (k[0] & 0xff) |\n ((k[1] & 0xff) << 8) |\n ((k[2] & 0xff) << 16) |\n ((k[3] & 0xff) << 24),\n j2 =\n (k[4] & 0xff) |\n ((k[5] & 0xff) << 8) |\n ((k[6] & 0xff) << 16) |\n ((k[7] & 0xff) << 24),\n j3 =\n (k[8] & 0xff) |\n ((k[9] & 0xff) << 8) |\n ((k[10] & 0xff) << 16) |\n ((k[11] & 0xff) << 24),\n j4 =\n (k[12] & 0xff) |\n ((k[13] & 0xff) << 8) |\n ((k[14] & 0xff) << 16) |\n ((k[15] & 0xff) << 24),\n j5 =\n (c[4] & 0xff) |\n ((c[5] & 0xff) << 8) |\n ((c[6] & 0xff) << 16) |\n ((c[7] & 0xff) << 24),\n j6 =\n (p[0] & 0xff) |\n ((p[1] & 0xff) << 8) |\n ((p[2] & 0xff) << 16) |\n ((p[3] & 0xff) << 24),\n j7 =\n (p[4] & 0xff) |\n ((p[5] & 0xff) << 8) |\n ((p[6] & 0xff) << 16) |\n ((p[7] & 0xff) << 24),\n j8 =\n (p[8] & 0xff) |\n ((p[9] & 0xff) << 8) |\n ((p[10] & 0xff) << 16) |\n ((p[11] & 0xff) << 24),\n j9 =\n (p[12] & 0xff) |\n ((p[13] & 0xff) << 8) |\n ((p[14] & 0xff) << 16) |\n ((p[15] & 0xff) << 24),\n j10 =\n (c[8] & 0xff) |\n ((c[9] & 0xff) << 8) |\n ((c[10] & 0xff) << 16) |\n ((c[11] & 0xff) << 24),\n j11 =\n (k[16] & 0xff) |\n ((k[17] & 0xff) << 8) |\n ((k[18] & 0xff) << 16) |\n ((k[19] & 0xff) << 24),\n j12 =\n (k[20] & 0xff) |\n ((k[21] & 0xff) << 8) |\n ((k[22] & 0xff) << 16) |\n ((k[23] & 0xff) << 24),\n j13 =\n (k[24] & 0xff) |\n ((k[25] & 0xff) << 8) |\n ((k[26] & 0xff) << 16) |\n ((k[27] & 0xff) << 24),\n j14 =\n (k[28] & 0xff) |\n ((k[29] & 0xff) << 8) |\n ((k[30] & 0xff) << 16) |\n ((k[31] & 0xff) << 24),\n j15 =\n (c[12] & 0xff) |\n ((c[13] & 0xff) << 8) |\n ((c[14] & 0xff) << 16) |\n ((c[15] & 0xff) << 24);\n\n var x0 = j0,\n x1 = j1,\n x2 = j2,\n x3 = j3,\n x4 = j4,\n x5 = j5,\n x6 = j6,\n x7 = j7,\n x8 = j8,\n x9 = j9,\n x10 = j10,\n x11 = j11,\n x12 = j12,\n x13 = j13,\n x14 = j14,\n x15 = j15,\n u;\n\n for (var i = 0; i < 20; i += 2) {\n u = (x0 + x12) | 0;\n x4 ^= (u << 7) | (u >>> (32 - 7));\n u = (x4 + x0) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x4) | 0;\n x12 ^= (u << 13) | (u >>> (32 - 13));\n u = (x12 + x8) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x1) | 0;\n x9 ^= (u << 7) | (u >>> (32 - 7));\n u = (x9 + x5) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x9) | 0;\n x1 ^= (u << 13) | (u >>> (32 - 13));\n u = (x1 + x13) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x6) | 0;\n x14 ^= (u << 7) | (u >>> (32 - 7));\n u = (x14 + x10) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x14) | 0;\n x6 ^= (u << 13) | (u >>> (32 - 13));\n u = (x6 + x2) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x11) | 0;\n x3 ^= (u << 7) | (u >>> (32 - 7));\n u = (x3 + x15) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x3) | 0;\n x11 ^= (u << 13) | (u >>> (32 - 13));\n u = (x11 + x7) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x0 + x3) | 0;\n x1 ^= (u << 7) | (u >>> (32 - 7));\n u = (x1 + x0) | 0;\n x2 ^= (u << 9) | (u >>> (32 - 9));\n u = (x2 + x1) | 0;\n x3 ^= (u << 13) | (u >>> (32 - 13));\n u = (x3 + x2) | 0;\n x0 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x5 + x4) | 0;\n x6 ^= (u << 7) | (u >>> (32 - 7));\n u = (x6 + x5) | 0;\n x7 ^= (u << 9) | (u >>> (32 - 9));\n u = (x7 + x6) | 0;\n x4 ^= (u << 13) | (u >>> (32 - 13));\n u = (x4 + x7) | 0;\n x5 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x10 + x9) | 0;\n x11 ^= (u << 7) | (u >>> (32 - 7));\n u = (x11 + x10) | 0;\n x8 ^= (u << 9) | (u >>> (32 - 9));\n u = (x8 + x11) | 0;\n x9 ^= (u << 13) | (u >>> (32 - 13));\n u = (x9 + x8) | 0;\n x10 ^= (u << 18) | (u >>> (32 - 18));\n\n u = (x15 + x14) | 0;\n x12 ^= (u << 7) | (u >>> (32 - 7));\n u = (x12 + x15) | 0;\n x13 ^= (u << 9) | (u >>> (32 - 9));\n u = (x13 + x12) | 0;\n x14 ^= (u << 13) | (u >>> (32 - 13));\n u = (x14 + x13) | 0;\n x15 ^= (u << 18) | (u >>> (32 - 18));\n }\n\n o[0] = (x0 >>> 0) & 0xff;\n o[1] = (x0 >>> 8) & 0xff;\n o[2] = (x0 >>> 16) & 0xff;\n o[3] = (x0 >>> 24) & 0xff;\n\n o[4] = (x5 >>> 0) & 0xff;\n o[5] = (x5 >>> 8) & 0xff;\n o[6] = (x5 >>> 16) & 0xff;\n o[7] = (x5 >>> 24) & 0xff;\n\n o[8] = (x10 >>> 0) & 0xff;\n o[9] = (x10 >>> 8) & 0xff;\n o[10] = (x10 >>> 16) & 0xff;\n o[11] = (x10 >>> 24) & 0xff;\n\n o[12] = (x15 >>> 0) & 0xff;\n o[13] = (x15 >>> 8) & 0xff;\n o[14] = (x15 >>> 16) & 0xff;\n o[15] = (x15 >>> 24) & 0xff;\n\n o[16] = (x6 >>> 0) & 0xff;\n o[17] = (x6 >>> 8) & 0xff;\n o[18] = (x6 >>> 16) & 0xff;\n o[19] = (x6 >>> 24) & 0xff;\n\n o[20] = (x7 >>> 0) & 0xff;\n o[21] = (x7 >>> 8) & 0xff;\n o[22] = (x7 >>> 16) & 0xff;\n o[23] = (x7 >>> 24) & 0xff;\n\n o[24] = (x8 >>> 0) & 0xff;\n o[25] = (x8 >>> 8) & 0xff;\n o[26] = (x8 >>> 16) & 0xff;\n o[27] = (x8 >>> 24) & 0xff;\n\n o[28] = (x9 >>> 0) & 0xff;\n o[29] = (x9 >>> 8) & 0xff;\n o[30] = (x9 >>> 16) & 0xff;\n o[31] = (x9 >>> 24) & 0xff;\n}\n\nvar sigma = new Uint8Array([\n 101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107,\n]);\n// \"expand 32-byte k\"\n\nfunction crypto_stream_salsa20_xor(\n c: Uint8Array,\n cpos: number,\n m: Uint8Array,\n mpos: number,\n b: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var z = new Uint8Array(16),\n x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < 64; i++) c[cpos + i] = m[mpos + i] ^ x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = (u + (z[i] & 0xff)) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n mpos += 64;\n }\n if (b > 0) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < b; i++) c[cpos + i] = m[mpos + i] ^ x[i];\n }\n return 0;\n}\n\nfunction crypto_stream_salsa20(\n c: Uint8Array,\n cpos: number,\n b: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var z = new Uint8Array(16),\n x = new Uint8Array(64);\n var u, i;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < 64; i++) c[cpos + i] = x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = (u + (z[i] & 0xff)) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n }\n if (b > 0) {\n core_salsa20(x, z, k, sigma);\n for (i = 0; i < b; i++) c[cpos + i] = x[i];\n }\n return 0;\n}\n\nfunction crypto_stream(\n c: Uint8Array,\n cpos: number,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var s = new Uint8Array(32);\n core_hsalsa20(s, n, k, sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i + 16];\n return crypto_stream_salsa20(c, cpos, d, sn, s);\n}\n\nfunction crypto_stream_xor(\n c: Uint8Array,\n cpos: number,\n m: Uint8Array,\n mpos: number,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n) {\n var s = new Uint8Array(32);\n core_hsalsa20(s, n, k, sigma);\n var sn = new Uint8Array(8);\n for (var i = 0; i < 8; i++) sn[i] = n[i + 16];\n return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, sn, s);\n}\n\n/*\n * Port of Andrew Moon's Poly1305-donna-16. Public domain.\n * https://github.com/floodyberry/poly1305-donna\n */\n\nclass poly1305 {\n buffer = new Uint8Array(16);\n r = new Uint16Array(10);\n h = new Uint16Array(10);\n pad = new Uint16Array(8);\n leftover = 0;\n fin = 0;\n\n constructor(key: Uint8Array) {\n var t0, t1, t2, t3, t4, t5, t6, t7;\n\n t0 = (key[0] & 0xff) | ((key[1] & 0xff) << 8);\n this.r[0] = t0 & 0x1fff;\n t1 = (key[2] & 0xff) | ((key[3] & 0xff) << 8);\n this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = (key[4] & 0xff) | ((key[5] & 0xff) << 8);\n this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n t3 = (key[6] & 0xff) | ((key[7] & 0xff) << 8);\n this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = (key[8] & 0xff) | ((key[9] & 0xff) << 8);\n this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this.r[5] = (t4 >>> 1) & 0x1ffe;\n t5 = (key[10] & 0xff) | ((key[11] & 0xff) << 8);\n this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = (key[12] & 0xff) | ((key[13] & 0xff) << 8);\n this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n t7 = (key[14] & 0xff) | ((key[15] & 0xff) << 8);\n this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this.r[9] = (t7 >>> 5) & 0x007f;\n\n this.pad[0] = (key[16] & 0xff) | ((key[17] & 0xff) << 8);\n this.pad[1] = (key[18] & 0xff) | ((key[19] & 0xff) << 8);\n this.pad[2] = (key[20] & 0xff) | ((key[21] & 0xff) << 8);\n this.pad[3] = (key[22] & 0xff) | ((key[23] & 0xff) << 8);\n this.pad[4] = (key[24] & 0xff) | ((key[25] & 0xff) << 8);\n this.pad[5] = (key[26] & 0xff) | ((key[27] & 0xff) << 8);\n this.pad[6] = (key[28] & 0xff) | ((key[29] & 0xff) << 8);\n this.pad[7] = (key[30] & 0xff) | ((key[31] & 0xff) << 8);\n }\n\n blocks(m: Uint8Array, mpos: number, bytes: number) {\n var hibit = this.fin ? 0 : 1 << 11;\n var t0, t1, t2, t3, t4, t5, t6, t7, c;\n var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;\n\n var h0 = this.h[0],\n h1 = this.h[1],\n h2 = this.h[2],\n h3 = this.h[3],\n h4 = this.h[4],\n h5 = this.h[5],\n h6 = this.h[6],\n h7 = this.h[7],\n h8 = this.h[8],\n h9 = this.h[9];\n\n var r0 = this.r[0],\n r1 = this.r[1],\n r2 = this.r[2],\n r3 = this.r[3],\n r4 = this.r[4],\n r5 = this.r[5],\n r6 = this.r[6],\n r7 = this.r[7],\n r8 = this.r[8],\n r9 = this.r[9];\n\n while (bytes >= 16) {\n t0 = (m[mpos + 0] & 0xff) | ((m[mpos + 1] & 0xff) << 8);\n h0 += t0 & 0x1fff;\n t1 = (m[mpos + 2] & 0xff) | ((m[mpos + 3] & 0xff) << 8);\n h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n t2 = (m[mpos + 4] & 0xff) | ((m[mpos + 5] & 0xff) << 8);\n h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;\n t3 = (m[mpos + 6] & 0xff) | ((m[mpos + 7] & 0xff) << 8);\n h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n t4 = (m[mpos + 8] & 0xff) | ((m[mpos + 9] & 0xff) << 8);\n h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;\n h5 += (t4 >>> 1) & 0x1fff;\n t5 = (m[mpos + 10] & 0xff) | ((m[mpos + 11] & 0xff) << 8);\n h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n t6 = (m[mpos + 12] & 0xff) | ((m[mpos + 13] & 0xff) << 8);\n h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;\n t7 = (m[mpos + 14] & 0xff) | ((m[mpos + 15] & 0xff) << 8);\n h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n h9 += (t7 >>> 5) | hibit;\n\n c = 0;\n\n d0 = c;\n d0 += h0 * r0;\n d0 += h1 * (5 * r9);\n d0 += h2 * (5 * r8);\n d0 += h3 * (5 * r7);\n d0 += h4 * (5 * r6);\n c = d0 >>> 13;\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5);\n d0 += h6 * (5 * r4);\n d0 += h7 * (5 * r3);\n d0 += h8 * (5 * r2);\n d0 += h9 * (5 * r1);\n c += d0 >>> 13;\n d0 &= 0x1fff;\n\n d1 = c;\n d1 += h0 * r1;\n d1 += h1 * r0;\n d1 += h2 * (5 * r9);\n d1 += h3 * (5 * r8);\n d1 += h4 * (5 * r7);\n c = d1 >>> 13;\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6);\n d1 += h6 * (5 * r5);\n d1 += h7 * (5 * r4);\n d1 += h8 * (5 * r3);\n d1 += h9 * (5 * r2);\n c += d1 >>> 13;\n d1 &= 0x1fff;\n\n d2 = c;\n d2 += h0 * r2;\n d2 += h1 * r1;\n d2 += h2 * r0;\n d2 += h3 * (5 * r9);\n d2 += h4 * (5 * r8);\n c = d2 >>> 13;\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7);\n d2 += h6 * (5 * r6);\n d2 += h7 * (5 * r5);\n d2 += h8 * (5 * r4);\n d2 += h9 * (5 * r3);\n c += d2 >>> 13;\n d2 &= 0x1fff;\n\n d3 = c;\n d3 += h0 * r3;\n d3 += h1 * r2;\n d3 += h2 * r1;\n d3 += h3 * r0;\n d3 += h4 * (5 * r9);\n c = d3 >>> 13;\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8);\n d3 += h6 * (5 * r7);\n d3 += h7 * (5 * r6);\n d3 += h8 * (5 * r5);\n d3 += h9 * (5 * r4);\n c += d3 >>> 13;\n d3 &= 0x1fff;\n\n d4 = c;\n d4 += h0 * r4;\n d4 += h1 * r3;\n d4 += h2 * r2;\n d4 += h3 * r1;\n d4 += h4 * r0;\n c = d4 >>> 13;\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9);\n d4 += h6 * (5 * r8);\n d4 += h7 * (5 * r7);\n d4 += h8 * (5 * r6);\n d4 += h9 * (5 * r5);\n c += d4 >>> 13;\n d4 &= 0x1fff;\n\n d5 = c;\n d5 += h0 * r5;\n d5 += h1 * r4;\n d5 += h2 * r3;\n d5 += h3 * r2;\n d5 += h4 * r1;\n c = d5 >>> 13;\n d5 &= 0x1fff;\n d5 += h5 * r0;\n d5 += h6 * (5 * r9);\n d5 += h7 * (5 * r8);\n d5 += h8 * (5 * r7);\n d5 += h9 * (5 * r6);\n c += d5 >>> 13;\n d5 &= 0x1fff;\n\n d6 = c;\n d6 += h0 * r6;\n d6 += h1 * r5;\n d6 += h2 * r4;\n d6 += h3 * r3;\n d6 += h4 * r2;\n c = d6 >>> 13;\n d6 &= 0x1fff;\n d6 += h5 * r1;\n d6 += h6 * r0;\n d6 += h7 * (5 * r9);\n d6 += h8 * (5 * r8);\n d6 += h9 * (5 * r7);\n c += d6 >>> 13;\n d6 &= 0x1fff;\n\n d7 = c;\n d7 += h0 * r7;\n d7 += h1 * r6;\n d7 += h2 * r5;\n d7 += h3 * r4;\n d7 += h4 * r3;\n c = d7 >>> 13;\n d7 &= 0x1fff;\n d7 += h5 * r2;\n d7 += h6 * r1;\n d7 += h7 * r0;\n d7 += h8 * (5 * r9);\n d7 += h9 * (5 * r8);\n c += d7 >>> 13;\n d7 &= 0x1fff;\n\n d8 = c;\n d8 += h0 * r8;\n d8 += h1 * r7;\n d8 += h2 * r6;\n d8 += h3 * r5;\n d8 += h4 * r4;\n c = d8 >>> 13;\n d8 &= 0x1fff;\n d8 += h5 * r3;\n d8 += h6 * r2;\n d8 += h7 * r1;\n d8 += h8 * r0;\n d8 += h9 * (5 * r9);\n c += d8 >>> 13;\n d8 &= 0x1fff;\n\n d9 = c;\n d9 += h0 * r9;\n d9 += h1 * r8;\n d9 += h2 * r7;\n d9 += h3 * r6;\n d9 += h4 * r5;\n c = d9 >>> 13;\n d9 &= 0x1fff;\n d9 += h5 * r4;\n d9 += h6 * r3;\n d9 += h7 * r2;\n d9 += h8 * r1;\n d9 += h9 * r0;\n c += d9 >>> 13;\n d9 &= 0x1fff;\n\n c = ((c << 2) + c) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = c >>> 13;\n d1 += c;\n\n h0 = d0;\n h1 = d1;\n h2 = d2;\n h3 = d3;\n h4 = d4;\n h5 = d5;\n h6 = d6;\n h7 = d7;\n h8 = d8;\n h9 = d9;\n\n mpos += 16;\n bytes -= 16;\n }\n this.h[0] = h0;\n this.h[1] = h1;\n this.h[2] = h2;\n this.h[3] = h3;\n this.h[4] = h4;\n this.h[5] = h5;\n this.h[6] = h6;\n this.h[7] = h7;\n this.h[8] = h8;\n this.h[9] = h9;\n }\n\n finish(mac: Uint8Array, macpos: number) {\n var g = new Uint16Array(10);\n var c, mask, f, i;\n\n if (this.leftover) {\n i = this.leftover;\n this.buffer[i++] = 1;\n for (; i < 16; i++) this.buffer[i] = 0;\n this.fin = 1;\n this.blocks(this.buffer, 0, 16);\n }\n\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n for (i = 2; i < 10; i++) {\n this.h[i] += c;\n c = this.h[i] >>> 13;\n this.h[i] &= 0x1fff;\n }\n this.h[0] += c * 5;\n c = this.h[0] >>> 13;\n this.h[0] &= 0x1fff;\n this.h[1] += c;\n c = this.h[1] >>> 13;\n this.h[1] &= 0x1fff;\n this.h[2] += c;\n\n g[0] = this.h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (i = 1; i < 10; i++) {\n g[i] = this.h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= 1 << 13;\n\n mask = (c ^ 1) - 1;\n for (i = 0; i < 10; i++) g[i] &= mask;\n mask = ~mask;\n for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];\n\n this.h[0] = (this.h[0] | (this.h[1] << 13)) & 0xffff;\n this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10)) & 0xffff;\n this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7)) & 0xffff;\n this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4)) & 0xffff;\n this.h[4] =\n ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;\n this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11)) & 0xffff;\n this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8)) & 0xffff;\n this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5)) & 0xffff;\n\n f = this.h[0] + this.pad[0];\n this.h[0] = f & 0xffff;\n for (i = 1; i < 8; i++) {\n f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;\n this.h[i] = f & 0xffff;\n }\n\n mac[macpos + 0] = (this.h[0] >>> 0) & 0xff;\n mac[macpos + 1] = (this.h[0] >>> 8) & 0xff;\n mac[macpos + 2] = (this.h[1] >>> 0) & 0xff;\n mac[macpos + 3] = (this.h[1] >>> 8) & 0xff;\n mac[macpos + 4] = (this.h[2] >>> 0) & 0xff;\n mac[macpos + 5] = (this.h[2] >>> 8) & 0xff;\n mac[macpos + 6] = (this.h[3] >>> 0) & 0xff;\n mac[macpos + 7] = (this.h[3] >>> 8) & 0xff;\n mac[macpos + 8] = (this.h[4] >>> 0) & 0xff;\n mac[macpos + 9] = (this.h[4] >>> 8) & 0xff;\n mac[macpos + 10] = (this.h[5] >>> 0) & 0xff;\n mac[macpos + 11] = (this.h[5] >>> 8) & 0xff;\n mac[macpos + 12] = (this.h[6] >>> 0) & 0xff;\n mac[macpos + 13] = (this.h[6] >>> 8) & 0xff;\n mac[macpos + 14] = (this.h[7] >>> 0) & 0xff;\n mac[macpos + 15] = (this.h[7] >>> 8) & 0xff;\n }\n\n update(m: Uint8Array, mpos: number, bytes: number) {\n let i: number;\n let want: number;\n if (this.leftover) {\n want = 16 - this.leftover;\n if (want > bytes) want = bytes;\n for (i = 0; i < want; i++) this.buffer[this.leftover + i] = m[mpos + i];\n bytes -= want;\n mpos += want;\n this.leftover += want;\n if (this.leftover < 16) return;\n this.blocks(this.buffer, 0, 16);\n this.leftover = 0;\n }\n\n if (bytes >= 16) {\n want = bytes - (bytes % 16);\n this.blocks(m, mpos, want);\n mpos += want;\n bytes -= want;\n }\n\n if (bytes) {\n for (i = 0; i < bytes; i++) this.buffer[this.leftover + i] = m[mpos + i];\n this.leftover += bytes;\n }\n }\n}\n\nfunction crypto_onetimeauth(\n out: Uint8Array,\n outpos: number,\n m: any,\n mpos: number,\n n: number,\n k: Uint8Array,\n) {\n var s = new poly1305(k);\n s.update(m, mpos, n);\n s.finish(out, outpos);\n return 0;\n}\n\nfunction crypto_onetimeauth_verify(\n h: Uint8Array,\n hpos: number,\n m: any,\n mpos: number,\n n: number,\n k: Uint8Array,\n) {\n var x = new Uint8Array(16);\n crypto_onetimeauth(x, 0, m, mpos, n, k);\n return crypto_verify_16(h, hpos, x, 0);\n}\n\nfunction crypto_secretbox(\n c: Uint8Array,\n m: Uint8Array,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n): number {\n var i;\n if (d < 32) return -1;\n crypto_stream_xor(c, 0, m, 0, d, n, k);\n crypto_onetimeauth(c, 16, c, 32, d - 32, c);\n for (i = 0; i < 16; i++) c[i] = 0;\n return 0;\n}\n\nfunction crypto_secretbox_open(\n m: Uint8Array,\n c: Uint8Array,\n d: number,\n n: Uint8Array,\n k: Uint8Array,\n): number {\n var i;\n var x = new Uint8Array(32);\n if (d < 32) return -1;\n crypto_stream(x, 0, 32, n, k);\n if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) return -1;\n crypto_stream_xor(m, 0, c, 0, d, n, k);\n for (i = 0; i < 32; i++) m[i] = 0;\n return 0;\n}\n\nfunction set25519(r: Float64Array, a: Float64Array): void {\n let i;\n for (i = 0; i < 16; i++) r[i] = a[i] | 0;\n}\n\nfunction car25519(o: Float64Array): void {\n let i,\n v,\n c = 1;\n for (i = 0; i < 16; i++) {\n v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c - 1 + 37 * (c - 1);\n}\n\nfunction sel25519(p: Float64Array, q: Float64Array, b: number): void {\n let t;\n const c = ~(b - 1);\n for (let i = 0; i < 16; i++) {\n t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\n\nfunction pack25519(o: Uint8Array, n: Float64Array): void {\n let i, j, b;\n const m = gf(),\n t = gf();\n for (i = 0; i < 16; i++) t[i] = n[i];\n car25519(t);\n car25519(t);\n car25519(t);\n for (j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);\n m[i - 1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);\n b = (m[15] >> 16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1 - b);\n }\n for (i = 0; i < 16; i++) {\n o[2 * i] = t[i] & 0xff;\n o[2 * i + 1] = t[i] >> 8;\n }\n}\n\nfunction neq25519(a: Float64Array, b: Float64Array): number {\n const c = new Uint8Array(32),\n d = new Uint8Array(32);\n pack25519(c, a);\n pack25519(d, b);\n return crypto_verify_32(c, 0, d, 0);\n}\n\nfunction par25519(a: Float64Array): number {\n const d = new Uint8Array(32);\n pack25519(d, a);\n return d[0] & 1;\n}\n\nfunction unpack25519(o: Float64Array, n: Uint8Array): void {\n let i;\n for (i = 0; i < 16; i++) o[i] = n[2 * i] + (n[2 * i + 1] << 8);\n o[15] &= 0x7fff;\n}\n\nfunction A(o: Float64Array, a: Float64Array, b: Float64Array): void {\n for (let i = 0; i < 16; i++) o[i] = a[i] + b[i];\n}\n\nfunction Z(o: Float64Array, a: Float64Array, b: Float64Array): void {\n for (let i = 0; i < 16; i++) o[i] = a[i] - b[i];\n}\n\nfunction M(o: Float64Array, a: Float64Array, b: Float64Array): void {\n let v,\n c,\n t0 = 0,\n t1 = 0,\n t2 = 0,\n t3 = 0,\n t4 = 0,\n t5 = 0,\n t6 = 0,\n t7 = 0,\n t8 = 0,\n t9 = 0,\n t10 = 0,\n t11 = 0,\n t12 = 0,\n t13 = 0,\n t14 = 0,\n t15 = 0,\n t16 = 0,\n t17 = 0,\n t18 = 0,\n t19 = 0,\n t20 = 0,\n t21 = 0,\n t22 = 0,\n t23 = 0,\n t24 = 0,\n t25 = 0,\n t26 = 0,\n t27 = 0,\n t28 = 0,\n t29 = 0,\n t30 = 0;\n const b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11],\n b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n\n // first car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n\n // second car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n\n o[0] = t0;\n o[1] = t1;\n o[2] = t2;\n o[3] = t3;\n o[4] = t4;\n o[5] = t5;\n o[6] = t6;\n o[7] = t7;\n o[8] = t8;\n o[9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\n\nfunction S(o: Float64Array, a: Float64Array): void {\n M(o, a, a);\n}\n\nfunction inv25519(o: Float64Array, i: Float64Array): void {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 253; a >= 0; a--) {\n S(c, c);\n if (a !== 2 && a !== 4) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction pow2523(o: Float64Array, i: Float64Array): void {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 250; a >= 0; a--) {\n S(c, c);\n if (a !== 1) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction crypto_scalarmult(\n q: Uint8Array,\n n: Uint8Array,\n p: Uint8Array,\n): number {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n let r;\n let i;\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n z[31] = (n[31] & 127) | 64;\n z[0] &= 248;\n unpack25519(x, p);\n for (i = 0; i < 16; i++) {\n b[i] = x[i];\n d[i] = a[i] = c[i] = 0;\n }\n a[0] = d[0] = 1;\n for (i = 254; i >= 0; --i) {\n r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n A(e, a, c);\n Z(a, a, c);\n A(c, b, d);\n Z(b, b, d);\n S(d, e);\n S(f, a);\n M(a, c, a);\n M(c, b, e);\n A(e, a, c);\n Z(a, a, c);\n S(b, a);\n Z(c, d, f);\n M(a, c, _121665);\n A(a, a, d);\n M(c, c, a);\n M(a, d, f);\n M(d, b, x);\n S(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n M(x16, x16, x32);\n pack25519(q, x16);\n return 0;\n}\n\nfunction crypto_scalarmult_base(q: Uint8Array, n: Uint8Array): number {\n return crypto_scalarmult(q, n, _9);\n}\n\nexport function crypto_scalarmult_noclamp(\n q: Uint8Array,\n n: Uint8Array,\n p: Uint8Array,\n): number {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n let r;\n let i;\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n unpack25519(x, p);\n for (i = 0; i < 16; i++) {\n b[i] = x[i];\n d[i] = a[i] = c[i] = 0;\n }\n a[0] = d[0] = 1;\n for (i = 254; i >= 0; --i) {\n r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n A(e, a, c);\n Z(a, a, c);\n A(c, b, d);\n Z(b, b, d);\n S(d, e);\n S(f, a);\n M(a, c, a);\n M(c, b, e);\n A(e, a, c);\n Z(a, a, c);\n S(b, a);\n Z(c, d, f);\n M(a, c, _121665);\n A(a, a, d);\n M(c, c, a);\n M(a, d, f);\n M(d, b, x);\n S(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n M(x16, x16, x32);\n pack25519(q, x16);\n return 0;\n}\n\nexport function crypto_scalarmult_base_noclamp(\n q: Uint8Array,\n n: Uint8Array,\n): number {\n return crypto_scalarmult_noclamp(q, n, _9);\n}\n\n// prettier-ignore\nconst K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction crypto_hashblocks_hl(\n hh: Int32Array,\n hl: Int32Array,\n m: Uint8Array,\n n: number,\n): number {\n const wh = new Int32Array(16),\n wl = new Int32Array(16);\n let bh0,\n bh1,\n bh2,\n bh3,\n bh4,\n bh5,\n bh6,\n bh7,\n bl0,\n bl1,\n bl2,\n bl3,\n bl4,\n bl5,\n bl6,\n bl7,\n th,\n tl,\n i,\n j,\n h,\n l,\n a,\n b,\n c,\n d;\n\n let ah0 = hh[0],\n ah1 = hh[1],\n ah2 = hh[2],\n ah3 = hh[3],\n ah4 = hh[4],\n ah5 = hh[5],\n ah6 = hh[6],\n ah7 = hh[7],\n al0 = hl[0],\n al1 = hl[1],\n al2 = hl[2],\n al3 = hl[3],\n al4 = hl[4],\n al5 = hl[5],\n al6 = hl[6],\n al7 = hl[7];\n\n let pos = 0;\n while (n >= 128) {\n for (i = 0; i < 16; i++) {\n j = 8 * i + pos;\n wh[i] = (m[j + 0] << 24) | (m[j + 1] << 16) | (m[j + 2] << 8) | m[j + 3];\n wl[i] = (m[j + 4] << 24) | (m[j + 5] << 16) | (m[j + 6] << 8) | m[j + 7];\n }\n for (i = 0; i < 80; i++) {\n bh0 = ah0;\n bh1 = ah1;\n bh2 = ah2;\n bh3 = ah3;\n bh4 = ah4;\n bh5 = ah5;\n bh6 = ah6;\n bh7 = ah7;\n\n bl0 = al0;\n bl1 = al1;\n bl2 = al2;\n bl3 = al3;\n bl4 = al4;\n bl5 = al5;\n bl6 = al6;\n bl7 = al7;\n\n // add\n h = ah7;\n l = al7;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n // Sigma1\n h =\n ((ah4 >>> 14) | (al4 << (32 - 14))) ^\n ((ah4 >>> 18) | (al4 << (32 - 18))) ^\n ((al4 >>> (41 - 32)) | (ah4 << (32 - (41 - 32))));\n l =\n ((al4 >>> 14) | (ah4 << (32 - 14))) ^\n ((al4 >>> 18) | (ah4 << (32 - 18))) ^\n ((ah4 >>> (41 - 32)) | (al4 << (32 - (41 - 32))));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // Ch\n h = (ah4 & ah5) ^ (~ah4 & ah6);\n l = (al4 & al5) ^ (~al4 & al6);\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // K\n h = K[i * 2];\n l = K[i * 2 + 1];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // w\n h = wh[i % 16];\n l = wl[i % 16];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n th = (c & 0xffff) | (d << 16);\n tl = (a & 0xffff) | (b << 16);\n\n // add\n h = th;\n l = tl;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n // Sigma0\n h =\n ((ah0 >>> 28) | (al0 << (32 - 28))) ^\n ((al0 >>> (34 - 32)) | (ah0 << (32 - (34 - 32)))) ^\n ((al0 >>> (39 - 32)) | (ah0 << (32 - (39 - 32))));\n l =\n ((al0 >>> 28) | (ah0 << (32 - 28))) ^\n ((ah0 >>> (34 - 32)) | (al0 << (32 - (34 - 32)))) ^\n ((ah0 >>> (39 - 32)) | (al0 << (32 - (39 - 32))));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // Maj\n h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);\n l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh7 = (c & 0xffff) | (d << 16);\n bl7 = (a & 0xffff) | (b << 16);\n\n // add\n h = bh3;\n l = bl3;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = th;\n l = tl;\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n bh3 = (c & 0xffff) | (d << 16);\n bl3 = (a & 0xffff) | (b << 16);\n\n ah1 = bh0;\n ah2 = bh1;\n ah3 = bh2;\n ah4 = bh3;\n ah5 = bh4;\n ah6 = bh5;\n ah7 = bh6;\n ah0 = bh7;\n\n al1 = bl0;\n al2 = bl1;\n al3 = bl2;\n al4 = bl3;\n al5 = bl4;\n al6 = bl5;\n al7 = bl6;\n al0 = bl7;\n\n if (i % 16 === 15) {\n for (j = 0; j < 16; j++) {\n // add\n h = wh[j];\n l = wl[j];\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = wh[(j + 9) % 16];\n l = wl[(j + 9) % 16];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // sigma0\n th = wh[(j + 1) % 16];\n tl = wl[(j + 1) % 16];\n h =\n ((th >>> 1) | (tl << (32 - 1))) ^\n ((th >>> 8) | (tl << (32 - 8))) ^\n (th >>> 7);\n l =\n ((tl >>> 1) | (th << (32 - 1))) ^\n ((tl >>> 8) | (th << (32 - 8))) ^\n ((tl >>> 7) | (th << (32 - 7)));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n // sigma1\n th = wh[(j + 14) % 16];\n tl = wl[(j + 14) % 16];\n h =\n ((th >>> 19) | (tl << (32 - 19))) ^\n ((tl >>> (61 - 32)) | (th << (32 - (61 - 32)))) ^\n (th >>> 6);\n l =\n ((tl >>> 19) | (th << (32 - 19))) ^\n ((th >>> (61 - 32)) | (tl << (32 - (61 - 32)))) ^\n ((tl >>> 6) | (th << (32 - 6)));\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n wh[j] = (c & 0xffff) | (d << 16);\n wl[j] = (a & 0xffff) | (b << 16);\n }\n }\n }\n\n // add\n h = ah0;\n l = al0;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[0];\n l = hl[0];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[0] = ah0 = (c & 0xffff) | (d << 16);\n hl[0] = al0 = (a & 0xffff) | (b << 16);\n\n h = ah1;\n l = al1;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[1];\n l = hl[1];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[1] = ah1 = (c & 0xffff) | (d << 16);\n hl[1] = al1 = (a & 0xffff) | (b << 16);\n\n h = ah2;\n l = al2;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[2];\n l = hl[2];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[2] = ah2 = (c & 0xffff) | (d << 16);\n hl[2] = al2 = (a & 0xffff) | (b << 16);\n\n h = ah3;\n l = al3;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[3];\n l = hl[3];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[3] = ah3 = (c & 0xffff) | (d << 16);\n hl[3] = al3 = (a & 0xffff) | (b << 16);\n\n h = ah4;\n l = al4;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[4];\n l = hl[4];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[4] = ah4 = (c & 0xffff) | (d << 16);\n hl[4] = al4 = (a & 0xffff) | (b << 16);\n\n h = ah5;\n l = al5;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[5];\n l = hl[5];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[5] = ah5 = (c & 0xffff) | (d << 16);\n hl[5] = al5 = (a & 0xffff) | (b << 16);\n\n h = ah6;\n l = al6;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[6];\n l = hl[6];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[6] = ah6 = (c & 0xffff) | (d << 16);\n hl[6] = al6 = (a & 0xffff) | (b << 16);\n\n h = ah7;\n l = al7;\n\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n\n h = hh[7];\n l = hl[7];\n\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n\n hh[7] = ah7 = (c & 0xffff) | (d << 16);\n hl[7] = al7 = (a & 0xffff) | (b << 16);\n\n pos += 128;\n n -= 128;\n }\n\n return n;\n}\n\nfunction crypto_hash(out: Uint8Array, m: Uint8Array, n: number): number {\n const hh = new Int32Array(8);\n const hl = new Int32Array(8);\n const x = new Uint8Array(256);\n const b = n;\n\n hh[0] = 0x6a09e667;\n hh[1] = 0xbb67ae85;\n hh[2] = 0x3c6ef372;\n hh[3] = 0xa54ff53a;\n hh[4] = 0x510e527f;\n hh[5] = 0x9b05688c;\n hh[6] = 0x1f83d9ab;\n hh[7] = 0x5be0cd19;\n\n hl[0] = 0xf3bcc908;\n hl[1] = 0x84caa73b;\n hl[2] = 0xfe94f82b;\n hl[3] = 0x5f1d36f1;\n hl[4] = 0xade682d1;\n hl[5] = 0x2b3e6c1f;\n hl[6] = 0xfb41bd6b;\n hl[7] = 0x137e2179;\n\n crypto_hashblocks_hl(hh, hl, m, n);\n n %= 128;\n\n for (let i = 0; i < n; i++) x[i] = m[b - n + i];\n x[n] = 128;\n\n n = 256 - 128 * (n < 112 ? 1 : 0);\n x[n - 9] = 0;\n ts64(x, n - 8, (b / 0x20000000) | 0, b << 3);\n crypto_hashblocks_hl(hh, hl, x, n);\n\n for (let i = 0; i < 8; i++) ts64(out, 8 * i, hh[i], hl[i]);\n\n return 0;\n}\n\n/**\n * Incremental version of crypto_hash.\n */\nexport class HashState {\n private hh = new Int32Array(8);\n private hl = new Int32Array(8);\n\n private next = new Uint8Array(128);\n private p = 0;\n private total = 0;\n\n constructor() {\n this.hh[0] = 0x6a09e667;\n this.hh[1] = 0xbb67ae85;\n this.hh[2] = 0x3c6ef372;\n this.hh[3] = 0xa54ff53a;\n this.hh[4] = 0x510e527f;\n this.hh[5] = 0x9b05688c;\n this.hh[6] = 0x1f83d9ab;\n this.hh[7] = 0x5be0cd19;\n\n this.hl[0] = 0xf3bcc908;\n this.hl[1] = 0x84caa73b;\n this.hl[2] = 0xfe94f82b;\n this.hl[3] = 0x5f1d36f1;\n this.hl[4] = 0xade682d1;\n this.hl[5] = 0x2b3e6c1f;\n this.hl[6] = 0xfb41bd6b;\n this.hl[7] = 0x137e2179;\n }\n\n update(data: Uint8Array): HashState {\n this.total += data.length;\n let i = 0;\n while (i < data.length) {\n const r = 128 - this.p;\n if (r > data.length - i) {\n for (let j = 0; i + j < data.length; j++) {\n this.next[this.p + j] = data[i + j];\n }\n this.p += data.length - i;\n break;\n } else {\n for (let j = 0; this.p + j < 128; j++) {\n this.next[this.p + j] = data[i + j];\n }\n crypto_hashblocks_hl(this.hh, this.hl, this.next, 128);\n i += 128 - this.p;\n this.p = 0;\n }\n }\n return this;\n }\n\n finish(): Uint8Array {\n const out = new Uint8Array(64);\n let n = this.p;\n const x = new Uint8Array(256);\n const b = this.total;\n for (let i = 0; i < n; i++) x[i] = this.next[i];\n x[n] = 128;\n\n n = 256 - 128 * (n < 112 ? 1 : 0);\n x[n - 9] = 0;\n ts64(x, n - 8, (b / 0x20000000) | 0, b << 3);\n crypto_hashblocks_hl(this.hh, this.hl, x, n);\n\n for (let i = 0; i < 8; i++) ts64(out, 8 * i, this.hh[i], this.hl[i]);\n return out;\n }\n}\n\nfunction add(p: Float64Array[], q: Float64Array[]): void {\n const a = gf(),\n b = gf(),\n c = gf(),\n d = gf(),\n e = gf(),\n f = gf(),\n g = gf(),\n h = gf(),\n t = gf();\n\n Z(a, p[1], p[0]);\n Z(t, q[1], q[0]);\n M(a, a, t);\n A(b, p[0], p[1]);\n A(t, q[0], q[1]);\n M(b, b, t);\n M(c, p[3], q[3]);\n M(c, c, D2);\n M(d, p[2], q[2]);\n A(d, d, d);\n Z(e, b, a);\n Z(f, d, c);\n A(g, d, c);\n A(h, b, a);\n\n M(p[0], e, f);\n M(p[1], h, g);\n M(p[2], g, f);\n M(p[3], e, h);\n}\n\nfunction cswap(p: Float64Array[], q: Float64Array[], b: number): void {\n let i;\n for (i = 0; i < 4; i++) {\n sel25519(p[i], q[i], b);\n }\n}\n\nfunction pack(r: Uint8Array, p: Float64Array[]): void {\n const tx = gf(),\n ty = gf(),\n zi = gf();\n inv25519(zi, p[2]);\n M(tx, p[0], zi);\n M(ty, p[1], zi);\n pack25519(r, ty);\n r[31] ^= par25519(tx) << 7;\n}\n\n/**\n * Ed25519 scalar multiplication\n */\nfunction scalarmult(p: Float64Array[], q: Float64Array[], s: Uint8Array): void {\n let b, i;\n set25519(p[0], gf0);\n set25519(p[1], gf1);\n set25519(p[2], gf1);\n set25519(p[3], gf0);\n for (i = 255; i >= 0; --i) {\n b = (s[(i / 8) | 0] >> (i & 7)) & 1;\n cswap(p, q, b);\n add(q, p);\n add(p, p);\n cswap(p, q, b);\n }\n}\n\nfunction scalarbase(p: Float64Array[], s: Uint8Array): void {\n const q = [gf(), gf(), gf(), gf()];\n set25519(q[0], X);\n set25519(q[1], Y);\n set25519(q[2], gf1);\n M(q[3], X, Y);\n scalarmult(p, q, s);\n}\n\nfunction crypto_sign_keypair(\n pk: Uint8Array,\n sk: Uint8Array,\n seeded: boolean,\n): number {\n const d = new Uint8Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n if (!seeded) randombytes(sk, 32);\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n for (let i = 0; i < 32; i++) sk[i + 32] = pk[i];\n return 0;\n}\n\nexport const L = new Float64Array([\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde,\n 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,\n]);\n\nfunction modL(r: Uint8Array, x: Float64Array): void {\n let carry, i, j, k;\n for (i = 63; i >= 32; --i) {\n carry = 0;\n for (j = i - 32, k = i - 12; j < k; ++j) {\n x[j] += carry - 16 * x[i] * L[j - (i - 32)];\n carry = Math.floor((x[j] + 128) / 256);\n x[j] -= carry * 256;\n }\n x[j] += carry;\n x[i] = 0;\n }\n carry = 0;\n for (j = 0; j < 32; j++) {\n x[j] += carry - (x[31] >> 4) * L[j];\n carry = x[j] >> 8;\n x[j] &= 255;\n }\n for (j = 0; j < 32; j++) x[j] -= carry * L[j];\n for (i = 0; i < 32; i++) {\n x[i + 1] += x[i] >> 8;\n r[i] = x[i] & 255;\n }\n}\n\nfunction reduce(r: Uint8Array): void {\n const x = new Float64Array(64);\n for (let i = 0; i < 64; i++) x[i] = r[i];\n for (let i = 0; i < 64; i++) r[i] = 0;\n modL(r, x);\n}\n\n// Note: difference from C - smlen returned, not passed as argument.\nfunction crypto_sign(\n sm: Uint8Array,\n m: Uint8Array,\n n: number,\n sk: Uint8Array,\n): number {\n const d = new Uint8Array(64),\n h = new Uint8Array(64),\n r = new Uint8Array(64);\n let i, j;\n const x = new Float64Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n const smlen = n + 64;\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];\n\n crypto_hash(r, sm.subarray(32), n + 32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = sk[i];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i + j] += h[i] * d[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return smlen;\n}\n\nfunction unpackpos(r: Float64Array[], p: Uint8Array): number {\n // FIXME: implement directly\n const q = [gf(), gf(), gf(), gf()];\n if (unpackneg(q, p)) return -1;\n const scalar0 = new Uint8Array(32);\n const scalar1 = new Uint8Array(32);\n scalar1[0] = 1;\n const scalarNeg1 = crypto_core_ed25519_scalar_sub(scalar0, scalar1);\n scalarmult(r, q, scalarNeg1);\n return 0;\n}\n\nfunction unpackneg(r: Float64Array[], p: Uint8Array): number {\n const t = gf();\n const chk = gf();\n const num = gf();\n const den = gf();\n const den2 = gf();\n const den4 = gf();\n const den6 = gf();\n\n set25519(r[2], gf1);\n unpack25519(r[1], p);\n S(num, r[1]);\n M(den, num, D);\n Z(num, num, r[2]);\n A(den, r[2], den);\n\n S(den2, den);\n S(den4, den2);\n M(den6, den4, den2);\n M(t, den6, num);\n M(t, t, den);\n\n pow2523(t, t);\n M(t, t, num);\n M(t, t, den);\n M(t, t, den);\n M(r[0], t, den);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) M(r[0], r[0], I);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) return -1;\n\n if (par25519(r[0]) === p[31] >> 7) Z(r[0], gf0, r[0]);\n\n M(r[3], r[0], r[1]);\n return 0;\n}\n\nexport function crypto_scalarmult_ed25519_base_noclamp(\n s: Uint8Array,\n): Uint8Array {\n const r = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n\n scalarbase(p, s);\n pack(r, p);\n return r;\n}\n\nexport function crypto_scalarmult_ed25519_noclamp(\n s: Uint8Array,\n q: Uint8Array,\n): Uint8Array {\n const r = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n const ql = [gf(), gf(), gf(), gf()];\n\n if (unpackpos(ql, q)) throw new Error();\n scalarmult(p, ql, s);\n pack(r, p);\n return r;\n}\n\nexport function crypto_core_ed25519_add(\n p1: Uint8Array,\n p2: Uint8Array,\n): Uint8Array {\n const q1 = [gf(), gf(), gf(), gf()];\n const q2 = [gf(), gf(), gf(), gf()];\n const res = new Uint8Array(32);\n if (unpackpos(q1, p1)) throw new Error();\n if (unpackpos(q2, p2)) throw new Error();\n add(q1, q2);\n pack(res, q1);\n return res;\n}\n\nfunction crypto_sign_open(\n m: Uint8Array,\n sm: Uint8Array,\n n: number,\n pk: Uint8Array,\n): number {\n let i, mlen;\n const t = new Uint8Array(32),\n h = new Uint8Array(64);\n const p = [gf(), gf(), gf(), gf()],\n q = [gf(), gf(), gf(), gf()];\n\n mlen = -1;\n if (n < 64) return -1;\n\n if (unpackneg(q, pk)) return -1;\n\n for (i = 0; i < n; i++) m[i] = sm[i];\n for (i = 0; i < 32; i++) m[i + 32] = pk[i];\n crypto_hash(h, m, n);\n reduce(h);\n scalarmult(p, q, h);\n\n scalarbase(q, sm.subarray(32));\n add(p, q);\n pack(t, p);\n\n n -= 64;\n if (crypto_verify_32(sm, 0, t, 0)) {\n for (i = 0; i < n; i++) m[i] = 0;\n return -1;\n }\n\n for (i = 0; i < n; i++) m[i] = sm[i + 64];\n mlen = n;\n return mlen;\n}\n\nconst crypto_secretbox_KEYBYTES = 32;\nconst crypto_secretbox_NONCEBYTES = 24;\nconst crypto_secretbox_ZEROBYTES = 32;\nconst crypto_secretbox_BOXZEROBYTES = 16;\nconst crypto_scalarmult_BYTES = 32;\nconst crypto_scalarmult_SCALARBYTES = 32;\nconst crypto_sign_BYTES = 64;\nconst crypto_sign_PUBLICKEYBYTES = 32;\nconst crypto_sign_SECRETKEYBYTES = 64;\nconst crypto_sign_SEEDBYTES = 32;\nconst crypto_hash_BYTES = 64;\n\n/* High-level API */\n\nfunction checkLengths(k: Uint8Array, n: Uint8Array) {\n if (k.length !== crypto_secretbox_KEYBYTES) throw new Error(\"bad key size\");\n if (n.length !== crypto_secretbox_NONCEBYTES)\n throw new Error(\"bad nonce size\");\n}\n\nfunction checkArrayTypes(...args: Uint8Array[]): void {\n for (let i = 0; i < args.length; i++) {\n if (!(args[i] instanceof Uint8Array))\n throw new TypeError(\"unexpected type, use Uint8Array\");\n }\n}\n\nexport function randomBytes(n: number): Uint8Array {\n const b = new Uint8Array(n);\n randombytes(b, n);\n return b;\n}\n\nexport function scalarMult(n: Uint8Array, p: Uint8Array): Uint8Array {\n checkArrayTypes(n, p);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\"bad n size\");\n if (p.length !== crypto_scalarmult_BYTES) throw new Error(\"bad p size\");\n const q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult(q, n, p);\n return q;\n}\n\nexport function scalarMult_base(n: Uint8Array): Uint8Array {\n checkArrayTypes(n);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\"bad n size\");\n const q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult_base(q, n);\n return q;\n}\n\nexport const scalarMult_scalarLength = crypto_scalarmult_SCALARBYTES;\nexport const scalarMult_groupElementLength = crypto_scalarmult_BYTES;\n\nexport function sign(msg: Uint8Array, secretKey: Uint8Array): Uint8Array {\n checkArrayTypes(msg, secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\"bad secret key size\");\n const signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length);\n crypto_sign(signedMsg, msg, msg.length, secretKey);\n return signedMsg;\n}\n\nexport function sign_open(\n signedMsg: Uint8Array,\n publicKey: Uint8Array,\n): Uint8Array | null {\n checkArrayTypes(signedMsg, publicKey);\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const tmp = new Uint8Array(signedMsg.length);\n const mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);\n if (mlen < 0) return null;\n const m = new Uint8Array(mlen);\n for (let i = 0; i < m.length; i++) m[i] = tmp[i];\n return m;\n}\n\nexport function sign_detached(\n msg: Uint8Array,\n secretKey: Uint8Array,\n): Uint8Array {\n const signedMsg = sign(msg, secretKey);\n const sig = new Uint8Array(crypto_sign_BYTES);\n for (let i = 0; i < sig.length; i++) sig[i] = signedMsg[i];\n return sig;\n}\n\nexport function sign_detached_verify(\n msg: Uint8Array,\n sig: Uint8Array,\n publicKey: Uint8Array,\n): boolean {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES) throw new Error(\"bad signature size\");\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n const m = new Uint8Array(crypto_sign_BYTES + msg.length);\n let i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i];\n return crypto_sign_open(m, sm, sm.length, publicKey) >= 0;\n}\n\nexport function sign_keyPair(): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n const sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n crypto_sign_keypair(pk, sk, false);\n return { publicKey: pk, secretKey: sk };\n}\n\nexport function x25519_edwards_keyPair_fromSecretKey(\n secretKey: Uint8Array,\n): Uint8Array {\n const p = [gf(), gf(), gf(), gf()];\n const pk = new Uint8Array(32);\n\n const d = new Uint8Array(64);\n if (secretKey.length != 32) {\n throw new Error(\"bad secret key size\");\n }\n d.set(secretKey, 0);\n\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n return pk;\n}\n\nexport function crypto_sign_keyPair_fromSecretKey(secretKey: Uint8Array): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\"bad secret key size\");\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n for (let i = 0; i < pk.length; i++) pk[i] = secretKey[32 + i];\n return { publicKey: pk, secretKey: new Uint8Array(secretKey) };\n}\n\nexport function crypto_sign_keyPair_fromSeed(seed: Uint8Array): {\n publicKey: Uint8Array;\n secretKey: Uint8Array;\n} {\n checkArrayTypes(seed);\n if (seed.length !== crypto_sign_SEEDBYTES)\n throw new Error(`bad seed size: ${seed.length}`);\n const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n const sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n for (let i = 0; i < 32; i++) sk[i] = seed[i];\n crypto_sign_keypair(pk, sk, true);\n return { publicKey: pk, secretKey: sk };\n}\n\nexport const sign_publicKeyLength = crypto_sign_PUBLICKEYBYTES;\nexport const sign_secretKeyLength = crypto_sign_SECRETKEYBYTES;\nexport const sign_seedLength = crypto_sign_SEEDBYTES;\nexport const sign_signatureLength = crypto_sign_BYTES;\n\nexport function hash(msg: Uint8Array): Uint8Array {\n checkArrayTypes(msg);\n const h = new Uint8Array(crypto_hash_BYTES);\n crypto_hash(h, msg, msg.length);\n return h;\n}\n\nexport const hash_hashLength = crypto_hash_BYTES;\n\nexport function verify(x: Uint8Array, y: Uint8Array): boolean {\n checkArrayTypes(x, y);\n // Zero length arguments are considered not equal.\n if (x.length === 0 || y.length === 0) return false;\n if (x.length !== y.length) return false;\n return vn(x, 0, y, 0, x.length) === 0 ? true : false;\n}\n\nexport function setPRNG(fn: (x: Uint8Array, n: number) => void): void {\n randombytes = fn;\n}\n\nexport function sign_ed25519_pk_to_curve25519(\n ed25519_pk: Uint8Array,\n): Uint8Array {\n const ge_a = [gf(), gf(), gf(), gf()];\n const x = gf();\n const one_minus_y = gf();\n const x25519_pk = new Uint8Array(32);\n\n if (unpackneg(ge_a, ed25519_pk)) {\n throw Error(\"invalid public key\");\n }\n\n set25519(one_minus_y, gf1);\n Z(one_minus_y, one_minus_y, ge_a[1]);\n\n set25519(x, gf1);\n A(x, x, ge_a[1]);\n\n inv25519(one_minus_y, one_minus_y);\n M(x, x, one_minus_y);\n pack25519(x25519_pk, x);\n\n return x25519_pk;\n}\n\nexport function secretbox(\n msg: Uint8Array,\n nonce: Uint8Array,\n key: Uint8Array,\n): Uint8Array {\n checkArrayTypes(msg, nonce, key);\n checkLengths(key, nonce);\n var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);\n var c = new Uint8Array(m.length);\n for (var i = 0; i < msg.length; i++)\n m[i + crypto_secretbox_ZEROBYTES] = msg[i];\n crypto_secretbox(c, m, m.length, nonce, key);\n return c.subarray(crypto_secretbox_BOXZEROBYTES);\n}\n\nexport function secretbox_open(\n box: Uint8Array,\n nonce: Uint8Array,\n key: Uint8Array,\n): Uint8Array | undefined {\n checkArrayTypes(box, nonce, key);\n checkLengths(key, nonce);\n var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);\n var m = new Uint8Array(c.length);\n for (var i = 0; i < box.length; i++)\n c[i + crypto_secretbox_BOXZEROBYTES] = box[i];\n if (c.length < 32) return undefined;\n if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return undefined;\n return m.subarray(crypto_secretbox_ZEROBYTES);\n}\n\nexport function crypto_core_ed25519_scalar_add(\n x: Uint8Array,\n y: Uint8Array,\n): Uint8Array {\n const z = new Float64Array(64);\n for (let i = 0; i < 32; i++) {\n z[i] = x[i] + y[i];\n }\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\n/**\n * Reduce a scalar \"s\" to \"s mod L\". The input can be up to 64 bytes long.\n */\nexport function crypto_core_ed25519_scalar_reduce(x: Uint8Array): Uint8Array {\n const len = x.length;\n const z = new Float64Array(64);\n for (let i = 0; i < len; i++) z[i] = x[i];\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\nexport function crypto_core_ed25519_scalar_sub(\n x: Uint8Array,\n y: Uint8Array,\n): Uint8Array {\n const z = new Float64Array(64);\n for (let i = 0; i < 32; i++) {\n z[i] = x[i] - y[i];\n }\n const o = new Uint8Array(32);\n modL(o, z);\n return o;\n}\n\nexport function crypto_edx25519_private_key_create(): Uint8Array {\n const seed = new Uint8Array(32);\n randombytes(seed, 32);\n return crypto_edx25519_private_key_create_from_seed(seed);\n}\n\nexport function crypto_edx25519_private_key_create_from_seed(\n seed: Uint8Array,\n): Uint8Array {\n const pk = hash(seed);\n pk[0] &= 248;\n pk[31] &= 127;\n pk[31] |= 64;\n return pk;\n}\n\nexport function crypto_edx25519_get_public(priv: Uint8Array): Uint8Array {\n return crypto_scalarmult_ed25519_base_noclamp(priv.subarray(0, 32));\n}\n\nexport function crypto_edx25519_sign_detached(\n m: Uint8Array,\n skx: Uint8Array,\n pkx: Uint8Array,\n): Uint8Array {\n const n: number = m.length;\n const h = new Uint8Array(64);\n const r = new Uint8Array(64);\n let i, j;\n const x = new Float64Array(64);\n const p = [gf(), gf(), gf(), gf()];\n\n const sm = new Uint8Array(n + 64);\n\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = skx[32 + i];\n\n crypto_hash(r, sm.subarray(32), n + 32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = pkx[i - 32];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i + j] += h[i] * skx[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return sm.subarray(0, 64);\n}\n\nexport function crypto_edx25519_sign_detached_verify(\n msg: Uint8Array,\n sig: Uint8Array,\n publicKey: Uint8Array,\n): boolean {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES) throw new Error(\"bad signature size\");\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\"bad public key size\");\n const sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n const m = new Uint8Array(crypto_sign_BYTES + msg.length);\n let i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i];\n return crypto_sign_open(m, sm, sm.length, publicKey) >= 0;\n}\n", "import { setPRNG } from \"./nacl-fast.js\";\n\nexport function loadBrowserPrng() {\n // Initialize PRNG if environment provides CSPRNG.\n // If not, methods calling randombytes will throw.\n // @ts-ignore-error\n const cr = typeof self !== \"undefined\" ? self.crypto || self.msCrypto : null;\n\n const QUOTA = 65536;\n setPRNG(function (x: Uint8Array, n: number) {\n let i;\n const v = new Uint8Array(n);\n for (i = 0; i < n; i += QUOTA) {\n cr.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));\n }\n for (i = 0; i < n; i++) x[i] = v[i];\n for (i = 0; i < v.length; i++) v[i] = 0;\n });\n}\n", "/*\n This file is part of GNU Taler\n Copyright (C) 2012-2020 Taler Systems SA\n\n GNU Taler is free software: you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as published\n by the Free Software Foundation, either version 3 of the License,\n or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see .\n\n SPDX-License-Identifier: LGPL3.0-or-later\n\n Note: the LGPL does not apply to all components of GNU Taler,\n but it does apply to this file.\n */\n\nexport enum TalerErrorCode {\n\n\n /**\n * Special code to indicate success (no error).\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n NONE = 0,\n\n\n /**\n * An error response did not include an error code in the format expected by the client. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n INVALID = 1,\n\n\n /**\n * An internal failure happened on the client side. Details should be in the local logs. Check if you are using the latest available version or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CLIENT_INTERNAL_ERROR = 2,\n\n\n /**\n * The client does not support the protocol version advertised by the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION = 3,\n\n\n /**\n * The response we got from the server was not in the expected format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_INVALID_RESPONSE = 10,\n\n\n /**\n * The operation timed out. Trying again might help. Check the network connection.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TIMEOUT = 11,\n\n\n /**\n * The protocol version given by the server does not follow the required format. Most likely, the server does not speak the GNU Taler protocol. Check the URL and/or the network connection to the server.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_VERSION_MALFORMED = 12,\n\n\n /**\n * The service responded with a reply that was in the right data format, but the content did not satisfy the protocol. Please file a bug report.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_REPLY_MALFORMED = 13,\n\n\n /**\n * There is an error in the client-side configuration, for example an option is set to an invalid value. Check the logs and fix the local configuration.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CONFIGURATION_INVALID = 14,\n\n\n /**\n * The client made a request to a service, but received an error response it does not know how to handle. Please file a bug report.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UNEXPECTED_REQUEST_ERROR = 15,\n\n\n /**\n * The token used by the client to authorize the request does not grant the required permissions for the request. Check the requirements and obtain a suitable authorization token to proceed.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_PERMISSION_INSUFFICIENT = 16,\n\n\n /**\n * The HTTP method used is invalid for this endpoint. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_METHOD_INVALID = 20,\n\n\n /**\n * There is no endpoint defined for the URL provided by the client. Check if you used the correct URL and/or file a report with the developers of the client software.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_ENDPOINT_UNKNOWN = 21,\n\n\n /**\n * The JSON in the client's request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_JSON_INVALID = 22,\n\n\n /**\n * Some of the HTTP headers provided by the client were malformed and caused the server to not be able to handle the request. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_HTTP_HEADERS_MALFORMED = 23,\n\n\n /**\n * The payto:// URI provided by the client is malformed. Check that you are using the correct syntax as of RFC 8905 and/or that you entered the bank account number correctly.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PAYTO_URI_MALFORMED = 24,\n\n\n /**\n * A required parameter in the request was missing. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARAMETER_MISSING = 25,\n\n\n /**\n * A parameter in the request was malformed. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARAMETER_MALFORMED = 26,\n\n\n /**\n * The reserve public key was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_RESERVE_PUB_MALFORMED = 27,\n\n\n /**\n * The body in the request could not be decompressed by the server. This is likely a bug in the client implementation. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_COMPRESSION_INVALID = 28,\n\n\n /**\n * A segment in the path of the URL provided by the client is malformed. Check that you are using the correct encoding for the URL.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PATH_SEGMENT_MALFORMED = 29,\n\n\n /**\n * The currency involved in the operation is not acceptable for this server. Check your configuration and make sure the currency specified for a given service provider is one of the currencies supported by that provider.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CURRENCY_MISMATCH = 30,\n\n\n /**\n * The URI is longer than the longest URI the HTTP server is willing to parse. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit.\n * Returned with an HTTP status code of #MHD_HTTP_URI_TOO_LONG (414).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_URI_TOO_LONG = 31,\n\n\n /**\n * The body is too large to be permissible for the endpoint. If you believe this was a legitimate request, contact the server administrators and/or the software developers to increase the limit.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UPLOAD_EXCEEDS_LIMIT = 32,\n\n\n /**\n * The service refused the request due to lack of proper authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_UNAUTHORIZED = 40,\n\n\n /**\n * The service refused the request as the given authorization token is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_UNKNOWN = 41,\n\n\n /**\n * The service refused the request as the given authorization token expired.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_EXPIRED = 42,\n\n\n /**\n * The service refused the request as the given authorization token is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_TOKEN_MALFORMED = 43,\n\n\n /**\n * The service refused the request due to lack of proper rights on the resource.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FORBIDDEN = 44,\n\n\n /**\n * The service failed initialize its connection to the database. The system administrator should check that the service has permissions to access the database and that the database is running.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_SETUP_FAILED = 50,\n\n\n /**\n * The service encountered an error event to just start the database transaction. The system administrator should check that the database is running.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_START_FAILED = 51,\n\n\n /**\n * The service failed to store information in its database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_STORE_FAILED = 52,\n\n\n /**\n * The service failed to fetch information from its database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_FETCH_FAILED = 53,\n\n\n /**\n * The service encountered an unrecoverable error trying to commit a transaction to the database. The system administrator should check that the database is running and review the service logs.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_COMMIT_FAILED = 54,\n\n\n /**\n * The service encountered an error event to commit the database transaction, even after repeatedly retrying it there was always a conflicting transaction. This indicates a repeated serialization error; it should only happen if some client maliciously tries to create conflicting concurrent transactions. It could also be a sign of a missing index. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_SOFT_FAILURE = 55,\n\n\n /**\n * The service's database is inconsistent and violates service-internal invariants. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_DB_INVARIANT_FAILURE = 56,\n\n\n /**\n * The HTTP server experienced an internal invariant failure (bug). Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_INTERNAL_INVARIANT_FAILURE = 60,\n\n\n /**\n * The service could not compute a cryptographic hash over some JSON value. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_COMPUTE_JSON_HASH = 61,\n\n\n /**\n * The service could not compute an amount. Check if you are using the latest available version and/or file a report with the developers.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_COMPUTE_AMOUNT = 62,\n\n\n /**\n * The HTTP server had insufficient memory to parse the request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_PARSER_OUT_OF_MEMORY = 70,\n\n\n /**\n * The HTTP server failed to allocate memory. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_ALLOCATION_FAILURE = 71,\n\n\n /**\n * The HTTP server failed to allocate memory for building JSON reply. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_JSON_ALLOCATION_FAILURE = 72,\n\n\n /**\n * The HTTP server failed to allocate memory for making a CURL request. Restarting services periodically can help, especially if Postgres is using excessive amounts of memory. Check with the system administrator to investigate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_CURL_ALLOCATION_FAILURE = 73,\n\n\n /**\n * The backend could not locate a required template to generate an HTML reply. The system administrator should check if the resource files are installed in the correct location and are readable to the service.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_ACCEPTABLE (406).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_TO_LOAD_TEMPLATE = 74,\n\n\n /**\n * The backend could not expand the template to generate an HTML reply. The system administrator should investigate the logs and check if the templates are well-formed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n GENERIC_FAILED_TO_EXPAND_TEMPLATE = 75,\n\n\n /**\n * Exchange is badly configured and thus cannot operate.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_BAD_CONFIGURATION = 1000,\n\n\n /**\n * Operation specified unknown for this endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_OPERATION_UNKNOWN = 1001,\n\n\n /**\n * The number of segments included in the URI does not match the number of segments expected by the endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 1002,\n\n\n /**\n * The same coin was already used with a different denomination previously.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY = 1003,\n\n\n /**\n * The public key of given to a \"/coins/\" endpoint of the exchange was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB = 1004,\n\n\n /**\n * The exchange is not aware of the denomination key the wallet requested for the operation.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN = 1005,\n\n\n /**\n * The signature of the denomination key over the coin is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_SIGNATURE_INVALID = 1006,\n\n\n /**\n * The exchange failed to perform the operation as it could not find the private keys. This is a problem with the exchange setup, not with the client's request.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KEYS_MISSING = 1007,\n\n\n /**\n * Validity period of the denomination lies in the future.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE = 1008,\n\n\n /**\n * Denomination key of the coin is past its expiration time for the requested operation.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_EXPIRED = 1009,\n\n\n /**\n * Denomination key of the coin has been revoked.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_DENOMINATION_REVOKED = 1010,\n\n\n /**\n * An operation where the exchange interacted with a security module timed out.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_SECMOD_TIMEOUT = 1011,\n\n\n /**\n * The respective coin did not have sufficient residual value for the operation. The \"history\" in this response provides the \"residual_value\" of the coin, which may be less than its \"original_value\".\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_INSUFFICIENT_FUNDS = 1012,\n\n\n /**\n * The exchange had an internal error reconstructing the transaction history of the coin that was being processed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_HISTORY_COMPUTATION_FAILED = 1013,\n\n\n /**\n * The exchange failed to obtain the transaction history of the given coin from the database while generating an insufficient funds errors.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1014,\n\n\n /**\n * The same coin was already used with a different age hash previously.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH = 1015,\n\n\n /**\n * The requested operation is not valid for the cipher used by the selected denomination.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_INVALID_DENOMINATION_CIPHER_FOR_OPERATION = 1016,\n\n\n /**\n * The provided arguments for the operation use inconsistent ciphers.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_CIPHER_MISMATCH = 1017,\n\n\n /**\n * The number of denominations specified in the request exceeds the limit of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE = 1018,\n\n\n /**\n * The coin is not known to the exchange (yet).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_COIN_UNKNOWN = 1019,\n\n\n /**\n * The time at the server is too far off from the time specified in the request. Most likely the client system time is wrong.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_CLOCK_SKEW = 1020,\n\n\n /**\n * The specified amount for the coin is higher than the value of the denomination of the coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AMOUNT_EXCEEDS_DENOMINATION_VALUE = 1021,\n\n\n /**\n * The exchange was not properly configured with global fees.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_GLOBAL_FEES_MISSING = 1022,\n\n\n /**\n * The exchange was not properly configured with wire fees.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_WIRE_FEES_MISSING = 1023,\n\n\n /**\n * The purse public key was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_PUB_MALFORMED = 1024,\n\n\n /**\n * The purse is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_UNKNOWN = 1025,\n\n\n /**\n * The purse has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_EXPIRED = 1026,\n\n\n /**\n * The exchange has no information about the \"reserve_pub\" that was given.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_RESERVE_UNKNOWN = 1027,\n\n\n /**\n * The exchange is not allowed to proceed with the operation until the client has satisfied a KYC check.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KYC_REQUIRED = 1028,\n\n\n /**\n * Inconsistency between provided age commitment and attest: either none or both must be provided\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_CONFLICTING_ATTEST_VS_AGE_COMMITMENT = 1029,\n\n\n /**\n * The provided attestation for the minimum age couldn't be verified by the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_AGE_ATTESTATION_FAILURE = 1030,\n\n\n /**\n * The purse was deleted.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_PURSE_DELETED = 1031,\n\n\n /**\n * The public key of the AML officer in the URL was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_PUB_MALFORMED = 1032,\n\n\n /**\n * The signature affirming the GET request of the AML officer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID = 1033,\n\n\n /**\n * The specified AML officer does not have access at this time.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_OFFICER_ACCESS_DENIED = 1034,\n\n\n /**\n * The requested operation is denied pending the resolution of an anti-money laundering investigation by the exchange operator. This is a manual process, please wait and retry later.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_PENDING = 1035,\n\n\n /**\n * The requested operation is denied as the account was frozen on suspicion of money laundering. Please contact the exchange operator.\n * Returned with an HTTP status code of #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_AML_FROZEN = 1036,\n\n\n /**\n * The exchange failed to start a KYC attribute conversion helper process. It is likely configured incorrectly.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GENERIC_KYC_CONVERTER_FAILED = 1037,\n\n\n /**\n * The exchange did not find information about the specified transaction in the database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_NOT_FOUND = 1100,\n\n\n /**\n * The wire hash of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE = 1101,\n\n\n /**\n * The merchant key of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB = 1102,\n\n\n /**\n * The hash of the contract terms given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS = 1103,\n\n\n /**\n * The coin public key of given to a \"/deposits/\" handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB = 1104,\n\n\n /**\n * The signature returned by the exchange in a /deposits/ request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1105,\n\n\n /**\n * The signature of the merchant is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID = 1106,\n\n\n /**\n * The provided policy data was not accepted\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED = 1107,\n\n\n /**\n * The given reserve does not have sufficient funds to admit the requested withdraw operation at this time. The response includes the current \"balance\" of the reserve as well as the transaction \"history\" that lead to this balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS = 1150,\n\n\n /**\n * The given reserve does not have sufficient funds to admit the requested age-withdraw operation at this time. The response includes the current \"balance\" of the reserve as well as the transaction \"history\" that lead to this balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS = 1151,\n\n\n /**\n * The amount to withdraw together with the fee exceeds the numeric range for Taler amounts. This is not a client failure, as the coin value and fees come from the exchange's configuration.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW = 1152,\n\n\n /**\n * The exchange failed to create the signature using the denomination key.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_SIGNATURE_FAILED = 1153,\n\n\n /**\n * The signature of the reserve is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID = 1154,\n\n\n /**\n * When computing the reserve history, we ended up with a negative overall balance, which should be impossible.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS = 1155,\n\n\n /**\n * The reserve did not have sufficient funds in it to pay for a full reserve history statement.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE = 1156,\n\n\n /**\n * Withdraw period of the coin to be withdrawn is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST = 1158,\n\n\n /**\n * The client failed to unblind the blind signature.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_UNBLIND_FAILURE = 1159,\n\n\n /**\n * The client re-used a withdraw nonce, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_NONCE_REUSE = 1160,\n\n\n /**\n * The client provided an unknown commitment for an age-withdraw request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN = 1161,\n\n\n /**\n * The total sum of amounts from the denominations did overflow.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_AMOUNT_OVERFLOW = 1162,\n\n\n /**\n * The total sum of value and fees from the denominations differs from the committed amount with fees.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_AMOUNT_INCORRECT = 1163,\n\n\n /**\n * The original commitment differs from the calculated hash\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH = 1164,\n\n\n /**\n * The maximum age in the commitment is too large for the reserve\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE = 1165,\n\n\n /**\n * The batch withdraw included a planchet that was already withdrawn. This is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WITHDRAW_BATCH_IDEMPOTENT_PLANCHET = 1175,\n\n\n /**\n * The signature made by the coin over the deposit permission is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID = 1205,\n\n\n /**\n * The same coin was already deposited for the same merchant and contract with other details.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT = 1206,\n\n\n /**\n * The stated value of the coin after the deposit fee is subtracted would be negative.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE = 1207,\n\n\n /**\n * The stated refund deadline is after the wire deadline.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE = 1208,\n\n\n /**\n * The stated wire deadline is \"never\", which makes no sense.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER = 1209,\n\n\n /**\n * The exchange failed to canonicalize and hash the given wire format. For example, the merchant failed to provide the \"salt\" or a valid payto:// URI in the wire details. Note that while the exchange will do some basic sanity checking on the wire details, it cannot warrant that the banking system will ultimately be able to route to the specified address, even if this check passed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON = 1210,\n\n\n /**\n * The hash of the given wire address does not match the wire hash specified in the proposal data.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT = 1211,\n\n\n /**\n * The signature provided by the exchange is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE = 1221,\n\n\n /**\n * The deposited amount is smaller than the deposit fee, which would result in a negative contribution.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DEPOSIT_FEE_ABOVE_AMOUNT = 1222,\n\n\n /**\n * The proof of policy fulfillment was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_EXTENSIONS_INVALID_FULFILLMENT = 1240,\n\n\n /**\n * The coin history was requested with a bad signature.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_COIN_HISTORY_BAD_SIGNATURE = 1251,\n\n\n /**\n * The reserve history was requested with a bad signature.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE = 1252,\n\n\n /**\n * The exchange encountered melt fees exceeding the melted coin's contribution.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION = 1302,\n\n\n /**\n * The signature made with the coin to be melted is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_COIN_SIGNATURE_INVALID = 1303,\n\n\n /**\n * The denomination of the given coin has past its expiration date and it is also not a valid zombie (that is, was not refreshed with the fresh coin being subjected to recoup).\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE = 1305,\n\n\n /**\n * The signature returned by the exchange in a melt request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE = 1306,\n\n\n /**\n * The provided transfer keys do not match up with the original commitment. Information about the original commitment is included in the response.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION = 1353,\n\n\n /**\n * Failed to produce the blinded signatures over the coins to be returned.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR = 1354,\n\n\n /**\n * The exchange is unaware of the refresh session specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN = 1355,\n\n\n /**\n * The size of the cut-and-choose dimension of the private transfer keys request does not match #TALER_CNC_KAPPA - 1.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1356,\n\n\n /**\n * The number of envelopes given does not match the number of denomination keys given.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH = 1358,\n\n\n /**\n * The exchange encountered a numeric overflow totaling up the cost for the refresh operation.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW = 1359,\n\n\n /**\n * The exchange's cost calculation shows that the melt amount is below the costs of the transaction.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT = 1360,\n\n\n /**\n * The signature made with the coin over the link data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID = 1361,\n\n\n /**\n * The refresh session hash given to a /refreshes/ handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_INVALID_RCH = 1362,\n\n\n /**\n * Operation specified invalid for this endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID = 1363,\n\n\n /**\n * The client provided age commitment data, but age restriction is not supported on this server.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_NOT_SUPPORTED = 1364,\n\n\n /**\n * The client provided invalid age commitment data: missing, not an array, or array of invalid size.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID = 1365,\n\n\n /**\n * The coin specified in the link request is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_LINK_COIN_UNKNOWN = 1400,\n\n\n /**\n * The public key of given to a /transfers/ handler was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WTID_MALFORMED = 1450,\n\n\n /**\n * The exchange did not find information about the specified wire transfer identifier in the database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND = 1451,\n\n\n /**\n * The exchange did not find information about the wire transfer fees it charged.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND = 1452,\n\n\n /**\n * The exchange found a wire fee that was above the total transfer value (and thus could not have been charged).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT = 1453,\n\n\n /**\n * The wait target of the URL was not in the set of expected values.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSES_INVALID_WAIT_TARGET = 1475,\n\n\n /**\n * The signature on the purse status returned by the exchange was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSES_GET_INVALID_SIGNATURE_BY_EXCHANGE = 1476,\n\n\n /**\n * The exchange knows literally nothing about the coin we were asked to refund. But without a transaction history, we cannot issue a refund. This is kind-of OK, the owner should just refresh it directly without executing the refund.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_COIN_NOT_FOUND = 1500,\n\n\n /**\n * We could not process the refund request as the coin's transaction history does not permit the requested refund because then refunds would exceed the deposit amount. The \"history\" in the response proves this.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT = 1501,\n\n\n /**\n * The exchange knows about the coin we were asked to refund, but not about the specific /deposit operation. Hence, we cannot issue a refund (as we do not know if this merchant public key is authorized to do a refund).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_DEPOSIT_NOT_FOUND = 1502,\n\n\n /**\n * The exchange can no longer refund the customer/coin as the money was already transferred (paid out) to the merchant. (It should be past the refund deadline.)\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_ALREADY_PAID = 1503,\n\n\n /**\n * The refund fee specified for the request is lower than the refund fee charged by the exchange for the given denomination key of the refunded coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_FEE_TOO_LOW = 1504,\n\n\n /**\n * The refunded amount is smaller than the refund fee, which would result in a negative refund.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_FEE_ABOVE_AMOUNT = 1505,\n\n\n /**\n * The signature of the merchant is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID = 1506,\n\n\n /**\n * Merchant backend failed to create the refund confirmation signature.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_MERCHANT_SIGNING_FAILED = 1507,\n\n\n /**\n * The signature returned by the exchange in a refund request was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE = 1508,\n\n\n /**\n * The failure proof returned by the exchange is incorrect.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE = 1509,\n\n\n /**\n * Conflicting refund granted before with different amount but same refund transaction ID.\n * Returned with an HTTP status code of #MHD_HTTP_FAILED_DEPENDENCY (424).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_REFUND_INCONSISTENT_AMOUNT = 1510,\n\n\n /**\n * The given coin signature is invalid for the request.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_SIGNATURE_INVALID = 1550,\n\n\n /**\n * The exchange could not find the corresponding withdraw operation. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND = 1551,\n\n\n /**\n * The coin's remaining balance is zero. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_COIN_BALANCE_ZERO = 1552,\n\n\n /**\n * The exchange failed to reproduce the coin's blinding.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_BLINDING_FAILED = 1553,\n\n\n /**\n * The coin's remaining balance is zero. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE = 1554,\n\n\n /**\n * The coin's denomination has not been revoked yet.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_NOT_ELIGIBLE = 1555,\n\n\n /**\n * The given coin signature is invalid for the request.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_SIGNATURE_INVALID = 1575,\n\n\n /**\n * The exchange could not find the corresponding melt operation. The request is denied.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_MELT_NOT_FOUND = 1576,\n\n\n /**\n * The exchange failed to reproduce the coin's blinding.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED = 1578,\n\n\n /**\n * The coin's denomination has not been revoked yet.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RECOUP_REFRESH_NOT_ELIGIBLE = 1580,\n\n\n /**\n * This exchange does not allow clients to request /keys for times other than the current (exchange) time.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN = 1600,\n\n\n /**\n * A signature in the server's response was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_SIGNATURE_INVALID = 1650,\n\n\n /**\n * No bank accounts are enabled for the exchange. The administrator should enable-account using the taler-exchange-offline tool.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_NO_ACCOUNTS_CONFIGURED = 1651,\n\n\n /**\n * The payto:// URI stored in the exchange database for its bank account is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_INVALID_PAYTO_CONFIGURED = 1652,\n\n\n /**\n * No wire fees are configured for an enabled wire method of the exchange. The administrator must set the wire-fee using the taler-exchange-offline tool.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_WIRE_FEES_NOT_CONFIGURED = 1653,\n\n\n /**\n * This purse was previously created with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA = 1675,\n\n\n /**\n * This purse was previously merged with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_MERGE_CONFLICTING_META_DATA = 1676,\n\n\n /**\n * The reserve has insufficient funds to create another purse.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS = 1677,\n\n\n /**\n * The purse fee specified for the request is lower than the purse fee charged by the exchange at this time.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW = 1678,\n\n\n /**\n * The payment request cannot be deleted anymore, as it either already completed or timed out.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DELETE_ALREADY_DECIDED = 1679,\n\n\n /**\n * The signature affirming the purse deletion is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID = 1680,\n\n\n /**\n * Withdrawal from the reserve requires age restriction to be set.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED = 1681,\n\n\n /**\n * The exchange failed to talk to the process responsible for its private denomination keys or the helpers had no denominations (properly) configured.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE = 1700,\n\n\n /**\n * The response from the denomination key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_BUG = 1701,\n\n\n /**\n * The helper refuses to sign with the key, because it is too early: the validity period has not yet started.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_DENOMINATION_HELPER_TOO_EARLY = 1702,\n\n\n /**\n * The signature of the exchange on the reply was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_EXCHANGE_SIGNATURE_INVALID = 1725,\n\n\n /**\n * The exchange failed to talk to the process responsible for its private signing keys.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE = 1750,\n\n\n /**\n * The response from the online signing key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_BUG = 1751,\n\n\n /**\n * The helper refuses to sign with the key, because it is too early: the validity period has not yet started.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_SIGNKEY_HELPER_TOO_EARLY = 1752,\n\n\n /**\n * The purse expiration time is in the past at the time of its creation.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW = 1775,\n\n\n /**\n * The purse expiration time is set to never, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER = 1776,\n\n\n /**\n * The signature affirming the merge of the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID = 1777,\n\n\n /**\n * The signature by the reserve affirming the merge is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID = 1778,\n\n\n /**\n * The signature by the reserve affirming the open operation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE = 1785,\n\n\n /**\n * The signature by the reserve affirming the close operation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE = 1786,\n\n\n /**\n * The signature by the reserve affirming the attestion request is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE = 1787,\n\n\n /**\n * The exchange does not know an origin account to which the remaining reserve balance could be wired to, and the wallet failed to provide one.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT = 1788,\n\n\n /**\n * The reserve balance is insufficient to pay for the open operation.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS = 1789,\n\n\n /**\n * The auditor that was supposed to be disabled is unknown to this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND = 1800,\n\n\n /**\n * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT = 1801,\n\n\n /**\n * The signature to add or enable the auditor does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID = 1802,\n\n\n /**\n * The signature to disable the auditor does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID = 1803,\n\n\n /**\n * The signature to revoke the denomination does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID = 1804,\n\n\n /**\n * The signature to revoke the online signing key does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID = 1805,\n\n\n /**\n * The exchange has a more recently signed conflicting instruction and is thus refusing the current change (replay detected).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT = 1806,\n\n\n /**\n * The signingkey specified is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN = 1807,\n\n\n /**\n * The signature to publish wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID = 1808,\n\n\n /**\n * The signature to add the wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID = 1809,\n\n\n /**\n * The signature to disable the wire account does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID = 1810,\n\n\n /**\n * The wire account to be disabled is unknown to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND = 1811,\n\n\n /**\n * The signature to affirm wire fees does not validate.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID = 1812,\n\n\n /**\n * The signature conflicts with a previous signature affirming different fees.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH = 1813,\n\n\n /**\n * The signature affirming the denomination key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID = 1814,\n\n\n /**\n * The signature affirming the signing key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID = 1815,\n\n\n /**\n * The signature conflicts with a previous signature affirming different fees.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_GLOBAL_FEE_MISMATCH = 1816,\n\n\n /**\n * The signature affirming the fee structure is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_GLOBAL_FEE_SIGNATURE_INVALID = 1817,\n\n\n /**\n * The signature affirming the profit drain is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_DRAIN_PROFITS_SIGNATURE_INVALID = 1818,\n\n\n /**\n * The signature affirming the AML decision is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_ADD_SIGNATURE_INVALID = 1825,\n\n\n /**\n * The AML officer specified is not allowed to make AML decisions right now.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_INVALID_OFFICER = 1826,\n\n\n /**\n * There is a more recent AML decision on file. The decision was rejected as timestamps of AML decisions must be monotonically increasing.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT = 1827,\n\n\n /**\n * There AML decision would impose an AML check of a type that is not provided by any KYC provider known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AML_DECISION_UNKNOWN_CHECK = 1828,\n\n\n /**\n * The signature affirming the change in the AML officer status is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_UPDATE_AML_OFFICER_SIGNATURE_INVALID = 1830,\n\n\n /**\n * A more recent decision about the AML officer status is known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_AML_OFFICERS_MORE_RECENT_PRESENT = 1831,\n\n\n /**\n * The purse was previously created with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA = 1850,\n\n\n /**\n * The purse was previously created with a different contract.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_CONFLICTING_CONTRACT_STORED = 1851,\n\n\n /**\n * A coin signature for a deposit into the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_COIN_SIGNATURE_INVALID = 1852,\n\n\n /**\n * The purse expiration time is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW = 1853,\n\n\n /**\n * The purse expiration time is \"never\".\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER = 1854,\n\n\n /**\n * The purse signature over the purse meta data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID = 1855,\n\n\n /**\n * The signature over the encrypted contract is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID = 1856,\n\n\n /**\n * The signature from the exchange over the confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_CREATE_EXCHANGE_SIGNATURE_INVALID = 1857,\n\n\n /**\n * The coin was previously deposited with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA = 1858,\n\n\n /**\n * The encrypted contract was previously uploaded with different meta data.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA = 1859,\n\n\n /**\n * The deposited amount is less than the purse fee.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CREATE_PURSE_NEGATIVE_VALUE_AFTER_FEE = 1860,\n\n\n /**\n * The signature using the merge key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE = 1876,\n\n\n /**\n * The signature using the reserve key is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE = 1877,\n\n\n /**\n * The targeted purse is not yet full and thus cannot be merged. Retrying the request later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_NOT_FULL = 1878,\n\n\n /**\n * The signature from the exchange over the confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_MERGE_EXCHANGE_SIGNATURE_INVALID = 1879,\n\n\n /**\n * The exchange of the target account is not a partner of this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN = 1880,\n\n\n /**\n * The signature affirming the new partner is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_ADD_PARTNER_SIGNATURE_INVALID = 1890,\n\n\n /**\n * Conflicting data for the partner already exists with the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_MANAGEMENT_ADD_PARTNER_DATA_CONFLICT = 1891,\n\n\n /**\n * The auditor signature over the denomination meta data is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID = 1900,\n\n\n /**\n * The auditor that was specified is unknown to this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_UNKNOWN = 1901,\n\n\n /**\n * The auditor that was specified is no longer used by this exchange.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_AUDITORS_AUDITOR_INACTIVE = 1902,\n\n\n /**\n * The signature affirming the wallet's KYC request was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_WALLET_SIGNATURE_INVALID = 1925,\n\n\n /**\n * The exchange received an unexpected malformed response from its KYC backend.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE = 1926,\n\n\n /**\n * The backend signaled an unexpected failure.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_ERROR = 1927,\n\n\n /**\n * The backend signaled an authorization failure.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_BACKEND_AUTHORIZATION_FAILED = 1928,\n\n\n /**\n * The exchange is unaware of having made an the authorization request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN = 1929,\n\n\n /**\n * The KYC authorization signature was invalid. Hence the request was denied.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED = 1930,\n\n\n /**\n * The request used a logic specifier that is not known to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN = 1931,\n\n\n /**\n * The request requires a logic which is no longer configured at the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_GONE = 1932,\n\n\n /**\n * The logic plugin had a bug in its interaction with the KYC provider.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_LOGIC_BUG = 1933,\n\n\n /**\n * The exchange could not process the request with its KYC provider because the provider refused access to the service. This indicates some configuration issue at the Taler exchange operator.\n * Returned with an HTTP status code of #MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED (511).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_ACCESS_REFUSED = 1934,\n\n\n /**\n * There was a timeout in the interaction between the exchange and the KYC provider. The most likely cause is some networking problem. Trying again later might succeed.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_TIMEOUT = 1935,\n\n\n /**\n * The KYC provider responded with a status that was completely unexpected by the KYC logic of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY = 1936,\n\n\n /**\n * The rate limit of the exchange at the KYC provider has been exceeded. Trying much later might work.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_GENERIC_PROVIDER_RATE_LIMIT_EXCEEDED = 1937,\n\n\n /**\n * The request to the webhook lacked proper authorization or authentication data.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_WEBHOOK_UNAUTHORIZED = 1938,\n\n\n /**\n * The exchange is unaware of the given requirement row.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN = 1939,\n\n\n /**\n * The exchange has no account public key to check the KYC authorization signature against. Hence the request was denied. The user should do a wire transfer to the exchange with the KYC authorization key in the subject.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN = 1940,\n\n\n /**\n * The form has been previously uploaded, and may only be filed once. The user should be redirected to their main KYC page and see if any other steps need to be taken.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_FORM_ALREADY_UPLOADED = 1941,\n\n\n /**\n * The internal state of the exchange specifying KYC measures is malformed. Please contact technical support.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_MEASURES_MALFORMED = 1942,\n\n\n /**\n * The specified index does not refer to a valid KYC measure. Please check the URL.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_MEASURE_INDEX_INVALID = 1943,\n\n\n /**\n * The operation is not supported by the selected KYC logic. This is either caused by a configuration change or some invalid use of the API. Please contact technical support.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_KYC_INVALID_LOGIC_TO_CHECK = 1944,\n\n\n /**\n * The exchange does not know a contract under the given contract public key.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_UNKNOWN = 1950,\n\n\n /**\n * The URL does not encode a valid exchange public key in its path.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_INVALID_CONTRACT_PUB = 1951,\n\n\n /**\n * The returned encrypted contract did not decrypt.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_DECRYPTION_FAILED = 1952,\n\n\n /**\n * The signature on the encrypted contract did not validate.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_SIGNATURE_INVALID = 1953,\n\n\n /**\n * The decrypted contract was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_CONTRACTS_DECODING_FAILED = 1954,\n\n\n /**\n * A coin signature for a deposit into the purse is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_COIN_SIGNATURE_INVALID = 1975,\n\n\n /**\n * It is too late to deposit coins into the purse.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY = 1976,\n\n\n /**\n * TOTP key is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n EXCHANGE_TOTP_KEY_INVALID = 1980,\n\n\n /**\n * The backend could not find the merchant instance specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_INSTANCE_UNKNOWN = 2000,\n\n\n /**\n * The start and end-times in the wire fee structure leave a hole. This is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE = 2001,\n\n\n /**\n * The merchant was unable to obtain a valid answer to /wire from the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED = 2002,\n\n\n /**\n * The product category is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CATEGORY_UNKNOWN = 2003,\n\n\n /**\n * The proposal is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_ORDER_UNKNOWN = 2005,\n\n\n /**\n * The order provided to the backend could not be completed, because a product to be completed via inventory data is not actually in our inventory.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_PRODUCT_UNKNOWN = 2006,\n\n\n /**\n * The reward ID is unknown. This could happen if the reward has expired.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_REWARD_ID_UNKNOWN = 2007,\n\n\n /**\n * The contract obtained from the merchant backend was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID = 2008,\n\n\n /**\n * The order we found does not match the provided contract hash.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER = 2009,\n\n\n /**\n * The exchange failed to provide a valid response to the merchant's /keys request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE = 2010,\n\n\n /**\n * The exchange failed to respond to the merchant on time.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_TIMEOUT = 2011,\n\n\n /**\n * The merchant failed to talk to the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE = 2012,\n\n\n /**\n * The exchange returned a maformed response.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_REPLY_MALFORMED = 2013,\n\n\n /**\n * The exchange returned an unexpected response status.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_EXCHANGE_UNEXPECTED_STATUS = 2014,\n\n\n /**\n * The merchant refused the request due to lack of authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_UNAUTHORIZED = 2015,\n\n\n /**\n * The merchant instance specified in the request was deleted.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_INSTANCE_DELETED = 2016,\n\n\n /**\n * The backend could not find the inbound wire transfer specified in the request.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_TRANSFER_UNKNOWN = 2017,\n\n\n /**\n * The backend could not find the template(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_TEMPLATE_UNKNOWN = 2018,\n\n\n /**\n * The backend could not find the webhook(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_WEBHOOK_UNKNOWN = 2019,\n\n\n /**\n * The backend could not find the webhook(serial) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_PENDING_WEBHOOK_UNKNOWN = 2020,\n\n\n /**\n * The backend could not find the OTP device(id) because it is not exist.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_OTP_DEVICE_UNKNOWN = 2021,\n\n\n /**\n * The account is not known to the backend.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_ACCOUNT_UNKNOWN = 2022,\n\n\n /**\n * The wire hash was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_H_WIRE_MALFORMED = 2023,\n\n\n /**\n * The currency specified in the operation does not work with the current state of the given resource.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GENERIC_CURRENCY_MISMATCH = 2024,\n\n\n /**\n * The exchange failed to provide a valid answer to the tracking request, thus those details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE = 2100,\n\n\n /**\n * The merchant backend failed to construct the request for tracking to the exchange, thus tracking details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE = 2103,\n\n\n /**\n * The merchant backend failed trying to contact the exchange for tracking details, thus those details are not in the response.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE = 2104,\n\n\n /**\n * The claim token used to authenticate the client is invalid for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_INVALID_TOKEN = 2105,\n\n\n /**\n * The contract terms hash used to authenticate the client is invalid for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_HASH = 2106,\n\n\n /**\n * The exchange responded saying that funds were insufficient (for example, due to double-spending).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS = 2150,\n\n\n /**\n * The denomination key used for payment is not listed among the denomination keys of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND = 2151,\n\n\n /**\n * The denomination key used for payment is not audited by an auditor approved by the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_AUDITOR_FAILURE = 2152,\n\n\n /**\n * There was an integer overflow totaling up the amounts or deposit fees in the payment.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AMOUNT_OVERFLOW = 2153,\n\n\n /**\n * The deposit fees exceed the total value of the payment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_FEES_EXCEED_PAYMENT = 2154,\n\n\n /**\n * After considering deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract. The client should revisit the logic used to calculate fees it must cover.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_DUE_TO_FEES = 2155,\n\n\n /**\n * Even if we do not consider deposit and wire fees, the payment is insufficient to satisfy the required amount for the contract.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_PAYMENT_INSUFFICIENT = 2156,\n\n\n /**\n * The signature over the contract of one of the coins was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_COIN_SIGNATURE_INVALID = 2157,\n\n\n /**\n * When we tried to find information about the exchange to issue the deposit, we failed. This usually only happens if the merchant backend is somehow unable to get its own HTTP client logic to work.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_LOOKUP_FAILED = 2158,\n\n\n /**\n * The refund deadline in the contract is after the transfer deadline.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUND_DEADLINE_PAST_WIRE_TRANSFER_DEADLINE = 2159,\n\n\n /**\n * The order was already paid (maybe by another wallet).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_ALREADY_PAID = 2160,\n\n\n /**\n * The payment is too late, the offer has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_OFFER_EXPIRED = 2161,\n\n\n /**\n * The \"merchant\" field is missing in the proposal data. This is an internal error as the proposal is from the merchant's own database at this point.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_MERCHANT_FIELD_MISSING = 2162,\n\n\n /**\n * Failed to locate merchant's account information matching the wire hash given in the proposal.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_WIRE_HASH_UNKNOWN = 2163,\n\n\n /**\n * The deposit time for the denomination has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_DEPOSIT_EXPIRED = 2165,\n\n\n /**\n * The exchange of the deposited coin charges a wire fee that could not be added to the total (total amount too high).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_WIRE_FEE_ADDITION_FAILED = 2166,\n\n\n /**\n * The contract was not fully paid because of refunds. Note that clients MAY treat this as paid if, for example, contracts must be executed despite of refunds.\n * Returned with an HTTP status code of #MHD_HTTP_PAYMENT_REQUIRED (402).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUNDED = 2167,\n\n\n /**\n * According to our database, we have refunded more than we were paid (which should not be possible).\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_REFUNDS_EXCEED_PAYMENTS = 2168,\n\n\n /**\n * Legacy stuff. Remove me with protocol v1.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DEAD_QQQ_PAY_MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2169,\n\n\n /**\n * The payment failed at the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_FAILED = 2170,\n\n\n /**\n * The payment required a minimum age but one of the coins (of a denomination with support for age restriction) did not provide any age_commitment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_MISSING = 2171,\n\n\n /**\n * The payment required a minimum age but one of the coins provided an age_commitment that contained a wrong number of public keys compared to the number of age groups defined in the denomination of the coin.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_SIZE_MISMATCH = 2172,\n\n\n /**\n * The payment required a minimum age but one of the coins provided a minimum_age_sig that couldn't be verified with the given age_commitment for that particular minimum age.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_VERIFICATION_FAILED = 2173,\n\n\n /**\n * The payment required no minimum age but one of the coins (of a denomination with support for age restriction) did not provide the required h_age_commitment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_HASH_MISSING = 2174,\n\n\n /**\n * The exchange does not support the selected bank account of the merchant. Likely the merchant had stale data on the bank accounts of the exchange and thus selected an inappropriate exchange when making the offer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_WIRE_METHOD_UNSUPPORTED = 2175,\n\n\n /**\n * The payment requires the wallet to select a choice from the choices array and pass it in the 'choice_index' field of the request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING = 2176,\n\n\n /**\n * The 'choice_index' field is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS = 2177,\n\n\n /**\n * The provided 'tokens' array does not match with the required input tokens of the order.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_INPUT_TOKENS_MISMATCH = 2178,\n\n\n /**\n * Invalid token issue signature (blindly signed by merchant) for provided token.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID = 2179,\n\n\n /**\n * Invalid token use signature (EdDSA, signed by wallet) for provided token.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID = 2180,\n\n\n /**\n * The provided number of tokens does not match the required number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH = 2181,\n\n\n /**\n * The provided number of token envelopes does not match the specified number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH = 2182,\n\n\n /**\n * Invalid token because it was already used, is expired or not yet valid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAY_TOKEN_INVALID = 2183,\n\n\n /**\n * The contract hash does not match the given order ID.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAID_CONTRACT_HASH_MISMATCH = 2200,\n\n\n /**\n * The signature of the merchant is not valid for the given contract hash.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_PAID_COIN_SIGNATURE_INVALID = 2201,\n\n\n /**\n * A token family with this ID but conflicting data exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_TOKEN_FAMILY_CONFLICT = 2225,\n\n\n /**\n * The backend is unaware of a token family with the given ID.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PATCH_TOKEN_FAMILY_NOT_FOUND = 2226,\n\n\n /**\n * The merchant failed to send the exchange the refund request.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_REFUND_FAILED = 2251,\n\n\n /**\n * The merchant failed to find the exchange to process the lookup.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_LOOKUP_FAILED = 2252,\n\n\n /**\n * The merchant could not find the contract.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_NOT_FOUND = 2253,\n\n\n /**\n * The payment was already completed and thus cannot be aborted anymore.\n * Returned with an HTTP status code of #MHD_HTTP_PRECONDITION_FAILED (412).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2254,\n\n\n /**\n * The hash provided by the wallet does not match the order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_HASH_MISSMATCH = 2255,\n\n\n /**\n * The array of coins cannot be empty.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_ABORT_COINS_ARRAY_EMPTY = 2256,\n\n\n /**\n * We are waiting for the exchange to provide us with key material before checking the wire transfer.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_AWAITING_KEYS = 2258,\n\n\n /**\n * We are waiting for the exchange to provide us with the list of aggregated transactions.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_AWAITING_LIST = 2259,\n\n\n /**\n * The endpoint indicated in the wire transfer does not belong to a GNU Taler exchange.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_FATAL_NO_EXCHANGE = 2260,\n\n\n /**\n * The exchange indicated in the wire transfer claims to know nothing about the wire transfer.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_FATAL_NOT_FOUND = 2261,\n\n\n /**\n * The interaction with the exchange is delayed due to rate limiting.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_RATE_LIMITED = 2262,\n\n\n /**\n * We experienced a transient failure in our interaction with the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_ACCEPTED (202).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_TRANSIENT_FAILURE = 2263,\n\n\n /**\n * The response from the exchange was unacceptable and should be reviewed with an auditor.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_HARD_FAILURE = 2264,\n\n\n /**\n * We could not claim the order because the backend is unaware of it.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_NOT_FOUND = 2300,\n\n\n /**\n * We could not claim the order because someone else claimed it first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_ALREADY_CLAIMED = 2301,\n\n\n /**\n * The client-side experienced an internal failure.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE = 2302,\n\n\n /**\n * The backend failed to sign the refund request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_ORDERS_ID_REFUND_SIGNATURE_FAILED = 2350,\n\n\n /**\n * The client failed to unblind the signature returned by the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_UNBLIND_FAILURE = 2400,\n\n\n /**\n * The exchange returned a failure code for the withdraw operation.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_EXCHANGE_ERROR = 2403,\n\n\n /**\n * The merchant failed to add up the amounts to compute the pick up value.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_SUMMATION_FAILED = 2404,\n\n\n /**\n * The reward expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_HAS_EXPIRED = 2405,\n\n\n /**\n * The requested withdraw amount exceeds the amount remaining to be picked up.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING = 2406,\n\n\n /**\n * The merchant did not find the specified denomination key in the exchange's key set.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_REWARD_PICKUP_DENOMINATION_UNKNOWN = 2407,\n\n\n /**\n * The merchant instance has no active bank accounts configured. However, at least one bank account must be available to create new orders.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE = 2500,\n\n\n /**\n * The proposal had no timestamp and the merchant backend failed to obtain the current local time.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME = 2501,\n\n\n /**\n * The order provided to the backend could not be parsed; likely some required fields were missing or ill-formed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR = 2502,\n\n\n /**\n * A conflicting order (sharing the same order identifier) already exists at this merchant backend instance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS = 2503,\n\n\n /**\n * The order creation request is invalid because the given wire deadline is before the refund deadline.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE = 2504,\n\n\n /**\n * The order creation request is invalid because the delivery date given is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_DELIVERY_DATE_IN_PAST = 2505,\n\n\n /**\n * The order creation request is invalid because a wire deadline of \"never\" is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_WIRE_DEADLINE_IS_NEVER = 2506,\n\n\n /**\n * The order creation request is invalid because the given payment deadline is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_PAY_DEADLINE_IN_PAST = 2507,\n\n\n /**\n * The order creation request is invalid because the given refund deadline is in the past.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_REFUND_DEADLINE_IN_PAST = 2508,\n\n\n /**\n * The backend does not trust any exchange that would allow funds to be wired to any bank account of this instance using the wire method specified with the order. Note that right now, we do not support the use of exchange bank accounts with mandatory currency conversion.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_NO_EXCHANGES_FOR_WIRE_METHOD = 2509,\n\n\n /**\n * One of the paths to forget is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_SYNTAX_INCORRECT = 2510,\n\n\n /**\n * One of the paths to forget was not marked as forgettable.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE = 2511,\n\n\n /**\n * The order provided to the backend could not be deleted, our offer is still valid and awaiting payment. Deletion may work later after the offer has expired if it remains unpaid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_ORDERS_AWAITING_PAYMENT = 2520,\n\n\n /**\n * The order provided to the backend could not be deleted as the order was already paid.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_ORDERS_ALREADY_PAID = 2521,\n\n\n /**\n * The amount to be refunded is inconsistent: either is lower than the previous amount being awarded, or it exceeds the original price paid by the customer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_INCONSISTENT_AMOUNT = 2530,\n\n\n /**\n * Only paid orders can be refunded, and the frontend specified an unpaid order to issue a refund for.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID = 2531,\n\n\n /**\n * The refund delay was set to 0 and thus no refunds are ever allowed for this order.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT = 2532,\n\n\n /**\n * The token family slug provided in this order could not be found in the merchant database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_SLUG_UNKNOWN = 2533,\n\n\n /**\n * A token family referenced in this order is either expired or not valid yet.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID = 2534,\n\n\n /**\n * The exchange says it does not know this transfer.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_EXCHANGE_UNKNOWN = 2550,\n\n\n /**\n * We internally failed to execute the /track/transfer request.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_REQUEST_ERROR = 2551,\n\n\n /**\n * The amount transferred differs between what was submitted and what the exchange claimed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_TRANSFERS = 2552,\n\n\n /**\n * The exchange gave conflicting information about a coin which has been wire transferred.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS = 2553,\n\n\n /**\n * The exchange charged a different wire fee than what it originally advertised, and it is higher.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE = 2554,\n\n\n /**\n * We did not find the account that the transfer was made to.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_ACCOUNT_NOT_FOUND = 2555,\n\n\n /**\n * The backend could not delete the transfer as the echange already replied to our inquiry about it and we have integrated the result.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_TRANSFERS_ALREADY_CONFIRMED = 2556,\n\n\n /**\n * The backend was previously informed about a wire transfer with the same ID but a different amount. Multiple wire transfers with the same ID are not allowed. If the new amount is correct, the old transfer should first be deleted.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_SUBMISSION = 2557,\n\n\n /**\n * The amount transferred differs between what was submitted and what the exchange claimed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_EXCHANGE_TRANSFERS_CONFLICTING_TRANSFERS = 2563,\n\n\n /**\n * The merchant backend cannot create an instance under the given identifier as one already exists. Use PATCH to modify the existing entry.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS = 2600,\n\n\n /**\n * The merchant backend cannot create an instance because the authentication configuration field is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_BAD_AUTH = 2601,\n\n\n /**\n * The merchant backend cannot update an instance's authentication settings because the provided authentication settings are malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCE_AUTH_BAD_AUTH = 2602,\n\n\n /**\n * The merchant backend cannot create an instance under the given identifier, the previous one was deleted but must be purged first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED = 2603,\n\n\n /**\n * The merchant backend cannot update an instance under the given identifier, the previous one was deleted but must be purged first.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_INSTANCES_PURGE_REQUIRED = 2625,\n\n\n /**\n * The bank account referenced in the requested operation was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_ACCOUNT_DELETE_UNKNOWN_ACCOUNT = 2626,\n\n\n /**\n * The bank account specified in the request already exists at the merchant.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_ACCOUNT_EXISTS = 2627,\n\n\n /**\n * The product ID exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PRODUCTS_CONFLICT_PRODUCT_EXISTS = 2650,\n\n\n /**\n * A category with the same name exists already.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS = 2651,\n\n\n /**\n * The update would have reduced the total amount of product lost, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_REDUCED = 2660,\n\n\n /**\n * The update would have mean that more stocks were lost than what remains from total inventory after sales, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_EXCEEDS_STOCKS = 2661,\n\n\n /**\n * The update would have reduced the total amount of product in stock, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_STOCKED_REDUCED = 2662,\n\n\n /**\n * The update would have reduced the total amount of product sold, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_SOLD_REDUCED = 2663,\n\n\n /**\n * The lock request is for more products than we have left (unlocked) in stock.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS = 2670,\n\n\n /**\n * The deletion request is for a product that is locked.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_PRODUCTS_CONFLICTING_LOCK = 2680,\n\n\n /**\n * The requested wire method is not supported by the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD = 2700,\n\n\n /**\n * The requested exchange does not allow rewards.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_RESERVES_REWARDS_NOT_ALLOWED = 2701,\n\n\n /**\n * The reserve could not be deleted because it is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE = 2710,\n\n\n /**\n * The reserve that was used to fund the rewards has expired.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED = 2750,\n\n\n /**\n * The reserve that was used to fund the rewards was not found in the DB.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_UNKNOWN = 2751,\n\n\n /**\n * The backend knows the instance that was supposed to support the reward, and it was configured for rewardping. However, the funds remaining are insufficient to cover the reward, and the merchant should top up the reserve.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS = 2752,\n\n\n /**\n * The backend failed to find a reserve needed to authorize the reward.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND = 2753,\n\n\n /**\n * The merchant backend encountered a failure in computing the deposit total.\n * Returned with an HTTP status code of #MHD_HTTP_OK (200).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE = 2800,\n\n\n /**\n * The template ID already exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS = 2850,\n\n\n /**\n * The OTP device ID already exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_OTP_DEVICES_CONFLICT_OTP_DEVICE_EXISTS = 2851,\n\n\n /**\n * Amount given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT = 2860,\n\n\n /**\n * Subject given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT = 2861,\n\n\n /**\n * Amount not given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT = 2862,\n\n\n /**\n * Subject not given in the using template and in the template contract. There is a conflict.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY = 2863,\n\n\n /**\n * The webhook ID elready exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS = 2900,\n\n\n /**\n * The webhook serial elready exists.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n MERCHANT_PRIVATE_POST_PENDING_WEBHOOKS_CONFLICT_PENDING_WEBHOOK_EXISTS = 2910,\n\n\n /**\n * The auditor refused the connection due to a lack of authorization.\n * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_GENERIC_UNAUTHORIZED = 3001,\n\n\n /**\n * This method is not allowed here.\n * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_GENERIC_METHOD_NOT_ALLOWED = 3002,\n\n\n /**\n * The signature from the exchange on the deposit confirmation is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID = 3100,\n\n\n /**\n * The exchange key used for the signature on the deposit confirmation was revoked.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED = 3101,\n\n\n /**\n * The requested resource could not be found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_RESOURCE_NOT_FOUND = 3102,\n\n\n /**\n * The URI is missing a path component.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n AUDITOR_URI_MISSING_PATH_COMPONENT = 3103,\n\n\n /**\n * Wire transfer attempted with credit and debit party being the same bank account.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_SAME_ACCOUNT = 5101,\n\n\n /**\n * Wire transfer impossible, due to financial limitation of the party that attempted the payment.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNALLOWED_DEBIT = 5102,\n\n\n /**\n * Negative numbers are not allowed (as value and/or fraction) to instantiate an amount object.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NEGATIVE_NUMBER_AMOUNT = 5103,\n\n\n /**\n * A too big number was used (as value and/or fraction) to instantiate an amount object.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NUMBER_TOO_BIG = 5104,\n\n\n /**\n * The bank account referenced in the requested operation was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_ACCOUNT = 5106,\n\n\n /**\n * The transaction referenced in the requested operation (typically a reject operation), was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TRANSACTION_NOT_FOUND = 5107,\n\n\n /**\n * Bank received a malformed amount string.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_BAD_FORMAT_AMOUNT = 5108,\n\n\n /**\n * The client does not own the account credited by the transaction which is to be rejected, so it has no rights do reject it.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REJECT_NO_RIGHTS = 5109,\n\n\n /**\n * This error code is returned when no known exception types captured the exception.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNMANAGED_EXCEPTION = 5110,\n\n\n /**\n * This error code is used for all those exceptions that do not really need a specific error code to return to the client. Used for example when a client is trying to register with a unavailable username.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_SOFT_EXCEPTION = 5111,\n\n\n /**\n * The request UID for a request to transfer funds has already been used, but with different details for the transfer.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TRANSFER_REQUEST_UID_REUSED = 5112,\n\n\n /**\n * The withdrawal operation already has a reserve selected. The current request conflicts with the existing selection.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT = 5113,\n\n\n /**\n * The wire transfer subject duplicates an existing reserve public key. But wire transfer subjects must be unique.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_DUPLICATE_RESERVE_PUB_SUBJECT = 5114,\n\n\n /**\n * The client requested a transaction that is so far in the past, that it has been forgotten by the bank.\n * Returned with an HTTP status code of #MHD_HTTP_GONE (410).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ANCIENT_TRANSACTION_GONE = 5115,\n\n\n /**\n * The client attempted to abort a transaction that was already confirmed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ABORT_CONFIRM_CONFLICT = 5116,\n\n\n /**\n * The client attempted to confirm a transaction that was already aborted.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONFIRM_ABORT_CONFLICT = 5117,\n\n\n /**\n * The client attempted to register an account with the same name.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_CONFLICT = 5118,\n\n\n /**\n * The client attempted to confirm a withdrawal operation before the wallet posted the required details.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_POST_WITHDRAWAL_OPERATION_REQUIRED = 5119,\n\n\n /**\n * The client tried to register a new account under a reserved username (like 'admin' for example).\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_RESERVED_USERNAME_CONFLICT = 5120,\n\n\n /**\n * The client tried to register a new account with an username already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_USERNAME_REUSE = 5121,\n\n\n /**\n * The client tried to register a new account with a payto:// URI already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_REGISTER_PAYTO_URI_REUSE = 5122,\n\n\n /**\n * The client tried to delete an account with a non null balance.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_BALANCE_NOT_ZERO = 5123,\n\n\n /**\n * The client tried to create a transaction or an operation that credit an unknown account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_CREDITOR = 5124,\n\n\n /**\n * The client tried to create a transaction or an operation that debit an unknown account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_UNKNOWN_DEBTOR = 5125,\n\n\n /**\n * The client tried to perform an action prohibited for exchange accounts.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_IS_EXCHANGE = 5126,\n\n\n /**\n * The client tried to perform an action reserved for exchange accounts.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ACCOUNT_IS_NOT_EXCHANGE = 5127,\n\n\n /**\n * Received currency conversion is wrong.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_BAD_CONVERSION = 5128,\n\n\n /**\n * The account referenced in this operation is missing tan info for the chosen channel.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_MISSING_TAN_INFO = 5129,\n\n\n /**\n * The client attempted to confirm a transaction with incomplete info.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONFIRM_INCOMPLETE = 5130,\n\n\n /**\n * The request rate is too high. The server is refusing requests to guard against brute-force attacks.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_RATE_LIMITED = 5131,\n\n\n /**\n * This TAN channel is not supported.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHANNEL_NOT_SUPPORTED = 5132,\n\n\n /**\n * Failed to send TAN using the helper script. Either script is not found, or script timeout, or script terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHANNEL_SCRIPT_FAILED = 5133,\n\n\n /**\n * The client's response to the challenge was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHALLENGE_FAILED = 5134,\n\n\n /**\n * A non-admin user has tried to change their legal name.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_LEGAL_NAME = 5135,\n\n\n /**\n * A non-admin user has tried to change their debt limit.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_DEBT_LIMIT = 5136,\n\n\n /**\n * A non-admin user has tried to change their password whihout providing the current one.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD = 5137,\n\n\n /**\n * Provided old password does not match current password.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_PATCH_BAD_OLD_PASSWORD = 5138,\n\n\n /**\n * An admin user has tried to become an exchange.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_PATCH_ADMIN_EXCHANGE = 5139,\n\n\n /**\n * A non-admin user has tried to change their cashout account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_CASHOUT = 5140,\n\n\n /**\n * A non-admin user has tried to change their contact info.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_PATCH_CONTACT = 5141,\n\n\n /**\n * The client tried to create a transaction that credit the admin account.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_ADMIN_CREDITOR = 5142,\n\n\n /**\n * The referenced challenge was not found.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CHALLENGE_NOT_FOUND = 5143,\n\n\n /**\n * The referenced challenge has expired.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_TAN_CHALLENGE_EXPIRED = 5144,\n\n\n /**\n * A non-admin user has tried to create an account with 2fa.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_SET_TAN_CHANNEL = 5145,\n\n\n /**\n * A non-admin user has tried to set their minimum cashout amount.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_NON_ADMIN_SET_MIN_CASHOUT = 5146,\n\n\n /**\n * Amount of currency conversion it less than the minimum allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_CONVERSION_AMOUNT_TO_SMALL = 5147,\n\n\n /**\n * Specified amount will not work for this withdrawal.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_AMOUNT_DIFFERS = 5148,\n\n\n /**\n * The backend requires an amount to be specified.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n BANK_AMOUNT_REQUIRED = 5149,\n\n\n /**\n * The sync service failed find the account in its database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_ACCOUNT_UNKNOWN = 6100,\n\n\n /**\n * The SHA-512 hash provided in the If-None-Match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_IF_NONE_MATCH = 6101,\n\n\n /**\n * The SHA-512 hash provided in the If-Match header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_IF_MATCH = 6102,\n\n\n /**\n * The signature provided in the \"Sync-Signature\" header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_BAD_SYNC_SIGNATURE = 6103,\n\n\n /**\n * The signature provided in the \"Sync-Signature\" header does not match the account, old or new Etags.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_INVALID_SIGNATURE = 6104,\n\n\n /**\n * The \"Content-length\" field for the upload is not a number.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_MALFORMED_CONTENT_LENGTH = 6105,\n\n\n /**\n * The \"Content-length\" field for the upload is too big based on the server's terms of service.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_EXCESSIVE_CONTENT_LENGTH = 6106,\n\n\n /**\n * The server is out of memory to handle the upload. Trying again later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 6107,\n\n\n /**\n * The uploaded data does not match the Etag.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_INVALID_UPLOAD = 6108,\n\n\n /**\n * HTTP server experienced a timeout while awaiting promised payment.\n * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PAYMENT_GENERIC_TIMEOUT = 6109,\n\n\n /**\n * Sync could not setup the payment request with its own backend.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PAYMENT_CREATE_BACKEND_ERROR = 6110,\n\n\n /**\n * The sync service failed find the backup to be updated in its database.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_PREVIOUS_BACKUP_UNKNOWN = 6111,\n\n\n /**\n * The \"Content-length\" field for the upload is missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_MISSING_CONTENT_LENGTH = 6112,\n\n\n /**\n * Sync had problems communicating with its payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_GENERIC_BACKEND_ERROR = 6113,\n\n\n /**\n * Sync experienced a timeout communicating with its payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n SYNC_GENERIC_BACKEND_TIMEOUT = 6114,\n\n\n /**\n * The wallet does not implement a version of the exchange protocol that is compatible with the protocol version of the exchange.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_IMPLEMENTED (501).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE = 7000,\n\n\n /**\n * The wallet encountered an unexpected exception. This is likely a bug in the wallet implementation.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_UNEXPECTED_EXCEPTION = 7001,\n\n\n /**\n * The wallet received a response from a server, but the response can't be parsed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_RECEIVED_MALFORMED_RESPONSE = 7002,\n\n\n /**\n * The wallet tried to make a network request, but it received no response.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_NETWORK_ERROR = 7003,\n\n\n /**\n * The wallet tried to make a network request, but it was throttled.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_HTTP_REQUEST_THROTTLED = 7004,\n\n\n /**\n * The wallet made a request to a service, but received an error response it does not know how to handle.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_UNEXPECTED_REQUEST_ERROR = 7005,\n\n\n /**\n * The denominations offered by the exchange are insufficient. Likely the exchange is badly configured or not maintained.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT = 7006,\n\n\n /**\n * The wallet does not support the operation requested by a client.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_API_OPERATION_UNKNOWN = 7007,\n\n\n /**\n * The given taler://pay URI is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_INVALID_TALER_PAY_URI = 7008,\n\n\n /**\n * The signature on a coin by the exchange's denomination key is invalid after unblinding it.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_COIN_SIGNATURE_INVALID = 7009,\n\n\n /**\n * The exchange does not know about the reserve (yet), and thus withdrawal can't progress.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN_AT_EXCHANGE = 7010,\n\n\n /**\n * The wallet core service is not available.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_NOT_AVAILABLE = 7011,\n\n\n /**\n * The bank has aborted a withdrawal operation, and thus a withdrawal can't complete.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK = 7012,\n\n\n /**\n * An HTTP request made by the wallet timed out.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_HTTP_REQUEST_GENERIC_TIMEOUT = 7013,\n\n\n /**\n * The order has already been claimed by another wallet.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_ORDER_ALREADY_CLAIMED = 7014,\n\n\n /**\n * A group of withdrawal operations (typically for the same reserve at the same exchange) has errors and will be tried again later.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_GROUP_INCOMPLETE = 7015,\n\n\n /**\n * The signature on a coin by the exchange's denomination key (obtained through the merchant via a reward) is invalid after unblinding it.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_REWARD_COIN_SIGNATURE_INVALID = 7016,\n\n\n /**\n * The wallet does not implement a version of the bank integration API that is compatible with the version offered by the bank.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE = 7017,\n\n\n /**\n * The wallet processed a taler://pay URI, but the merchant base URL in the downloaded contract terms does not match the merchant base URL derived from the URI.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH = 7018,\n\n\n /**\n * The merchant's signature on the contract terms is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_SIGNATURE_INVALID = 7019,\n\n\n /**\n * The contract terms given by the merchant are malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CONTRACT_TERMS_MALFORMED = 7020,\n\n\n /**\n * A pending operation failed, and thus the request can't be completed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PENDING_OPERATION_FAILED = 7021,\n\n\n /**\n * A payment was attempted, but the merchant had an internal server error (5xx).\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PAY_MERCHANT_SERVER_ERROR = 7022,\n\n\n /**\n * The crypto worker failed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CRYPTO_WORKER_ERROR = 7023,\n\n\n /**\n * The crypto worker received a bad request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CRYPTO_WORKER_BAD_REQUEST = 7024,\n\n\n /**\n * A KYC step is required before withdrawal can proceed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_WITHDRAWAL_KYC_REQUIRED = 7025,\n\n\n /**\n * The wallet does not have sufficient balance to create a deposit group.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE = 7026,\n\n\n /**\n * The wallet does not have sufficient balance to create a peer push payment.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE = 7027,\n\n\n /**\n * The wallet does not have sufficient balance to pay for an invoice.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE = 7028,\n\n\n /**\n * A group of refresh operations has errors and will be tried again later.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_REFRESH_GROUP_INCOMPLETE = 7029,\n\n\n /**\n * The exchange's self-reported base URL does not match the one that the wallet is using.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_BASE_URL_MISMATCH = 7030,\n\n\n /**\n * The order has already been paid by another wallet.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_ORDER_ALREADY_PAID = 7031,\n\n\n /**\n * An exchange that is required for some request is currently not available.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_UNAVAILABLE = 7032,\n\n\n /**\n * An exchange entry is still used by the exchange, thus it can't be deleted without purging.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_USED = 7033,\n\n\n /**\n * The wallet database is unavailable and the wallet thus is not operational.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_DB_UNAVAILABLE = 7034,\n\n\n /**\n * A taler:// URI is malformed and can't be parsed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_TALER_URI_MALFORMED = 7035,\n\n\n /**\n * A wallet-core request was cancelled and thus can't provide a response.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_CORE_REQUEST_CANCELLED = 7036,\n\n\n /**\n * A wallet-core request failed because the user needs to first accept the exchange's terms of service.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_TOS_NOT_ACCEPTED = 7037,\n\n\n /**\n * An exchange entry could not be updated, as the exchange's new details conflict with the new details.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT = 7038,\n\n\n /**\n * The wallet's information about the exchange is outdated.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n WALLET_EXCHANGE_ENTRY_OUTDATED = 7039,\n\n\n /**\n * We encountered a timeout with our payment backend.\n * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_BACKEND_TIMEOUT = 8000,\n\n\n /**\n * The backend requested payment, but the request is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_INVALID_PAYMENT_REQUEST = 8001,\n\n\n /**\n * The backend got an unexpected reply from the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_BACKEND_ERROR = 8002,\n\n\n /**\n * The \"Content-length\" field for the upload is missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_MISSING_CONTENT_LENGTH = 8003,\n\n\n /**\n * The \"Content-length\" field for the upload is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_MALFORMED_CONTENT_LENGTH = 8004,\n\n\n /**\n * The backend failed to setup an order with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_ORDER_CREATE_BACKEND_ERROR = 8005,\n\n\n /**\n * The backend was not authorized to check for payment with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED = 8006,\n\n\n /**\n * The backend could not check payment status with the payment processor.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PAYMENT_CHECK_START_FAILED = 8007,\n\n\n /**\n * The Anastasis provider could not be reached.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_GENERIC_PROVIDER_UNREACHABLE = 8008,\n\n\n /**\n * HTTP server experienced a timeout while awaiting promised payment.\n * Returned with an HTTP status code of #MHD_HTTP_REQUEST_TIMEOUT (408).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_PAYMENT_GENERIC_TIMEOUT = 8009,\n\n\n /**\n * The key share is unknown to the provider.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UNKNOWN = 8108,\n\n\n /**\n * The authorization method used for the key share is no longer supported by the provider.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_AUTHORIZATION_METHOD_NO_LONGER_SUPPORTED = 8109,\n\n\n /**\n * The client needs to respond to the challenge.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED = 8110,\n\n\n /**\n * The client's response to the challenge was invalid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_FAILED = 8111,\n\n\n /**\n * The backend is not aware of having issued the provided challenge code. Either this is the wrong code, or it has expired.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_UNKNOWN = 8112,\n\n\n /**\n * The backend failed to initiate the authorization process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_AUTHORIZATION_START_FAILED = 8114,\n\n\n /**\n * The authorization succeeded, but the key share is no longer available.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_KEY_SHARE_GONE = 8115,\n\n\n /**\n * The backend forgot the order we asked the client to pay for\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_ORDER_DISAPPEARED = 8116,\n\n\n /**\n * The backend itself reported a bad exchange interaction.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_BACKEND_EXCHANGE_BAD = 8117,\n\n\n /**\n * The backend reported a payment status we did not expect.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UNEXPECTED_PAYMENT_STATUS = 8118,\n\n\n /**\n * The backend failed to setup the order for payment.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR = 8119,\n\n\n /**\n * The decryption of the key share failed with the provided key.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_DECRYPTION_FAILED = 8120,\n\n\n /**\n * The request rate is too high. The server is refusing requests to guard against brute-force attacks.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_RATE_LIMITED = 8121,\n\n\n /**\n * A request to issue a challenge is not valid for this authentication method.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_CHALLENGE_WRONG_METHOD = 8123,\n\n\n /**\n * The backend failed to store the key share because the UUID is already in use.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS = 8150,\n\n\n /**\n * The backend failed to store the key share because the authorization method is not supported.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED = 8151,\n\n\n /**\n * The provided phone number is not an acceptable number.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_PHONE_INVALID = 8200,\n\n\n /**\n * Failed to run the SMS transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_HELPER_EXEC_FAILED = 8201,\n\n\n /**\n * Provider failed to send SMS. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_SMS_HELPER_COMMAND_FAILED = 8202,\n\n\n /**\n * The provided email address is not an acceptable address.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_INVALID = 8210,\n\n\n /**\n * Failed to run the E-mail transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_HELPER_EXEC_FAILED = 8211,\n\n\n /**\n * Provider failed to send E-mail. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_EMAIL_HELPER_COMMAND_FAILED = 8212,\n\n\n /**\n * The provided postal address is not an acceptable address.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_INVALID = 8220,\n\n\n /**\n * Failed to run the mail transmission helper process.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_HELPER_EXEC_FAILED = 8221,\n\n\n /**\n * Provider failed to send mail. Helper terminated with a non-successful result.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POST_HELPER_COMMAND_FAILED = 8222,\n\n\n /**\n * The provided IBAN address is not an acceptable IBAN.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_IBAN_INVALID = 8230,\n\n\n /**\n * The provider has not yet received the IBAN wire transfer authorizing the disclosure of the key share.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_IBAN_MISSING_TRANSFER = 8231,\n\n\n /**\n * The backend did not find a TOTP key in the data provided.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TOTP_KEY_MISSING = 8240,\n\n\n /**\n * The key provided does not satisfy the format restrictions for an Anastasis TOTP key.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_TOTP_KEY_INVALID = 8241,\n\n\n /**\n * The given if-none-match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_IF_NONE_MATCH = 8301,\n\n\n /**\n * The server is out of memory to handle the upload. Trying again later may succeed.\n * Returned with an HTTP status code of #MHD_HTTP_CONTENT_TOO_LARGE (413).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_OUT_OF_MEMORY_ON_CONTENT_LENGTH = 8304,\n\n\n /**\n * The signature provided in the \"Anastasis-Policy-Signature\" header is malformed or missing.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_SIGNATURE = 8305,\n\n\n /**\n * The given if-match header is malformed.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_BAD_IF_MATCH = 8306,\n\n\n /**\n * The uploaded data does not match the Etag.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_INVALID_UPLOAD = 8307,\n\n\n /**\n * The provider is unaware of the requested policy.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_POLICY_NOT_FOUND = 8350,\n\n\n /**\n * The given action is invalid for the current state of the reducer.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_ACTION_INVALID = 8400,\n\n\n /**\n * The given state of the reducer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_STATE_INVALID = 8401,\n\n\n /**\n * The given input to the reducer is invalid.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_INVALID = 8402,\n\n\n /**\n * The selected authentication method does not work for the Anastasis provider.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED = 8403,\n\n\n /**\n * The given input and action do not work for the current state.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_INVALID_FOR_STATE = 8404,\n\n\n /**\n * We experienced an unexpected failure interacting with the backend.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_BACKEND_FAILURE = 8405,\n\n\n /**\n * The contents of a resource file did not match our expectations.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_RESOURCE_MALFORMED = 8406,\n\n\n /**\n * A required resource file is missing.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_RESOURCE_MISSING = 8407,\n\n\n /**\n * An input did not match the regular expression.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_REGEX_FAILED = 8408,\n\n\n /**\n * An input did not match the custom validation logic.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INPUT_VALIDATION_FAILED = 8409,\n\n\n /**\n * Our attempts to download the recovery document failed with all providers. Most likely the personal information you entered differs from the information you provided during the backup process and you should go back to the previous step. Alternatively, if you used a backup provider that is unknown to this application, you should add that provider manually.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED = 8410,\n\n\n /**\n * Anastasis provider reported a fatal failure.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_BACKUP_PROVIDER_FAILED = 8411,\n\n\n /**\n * Anastasis provider failed to respond to the configuration request.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED = 8412,\n\n\n /**\n * The policy we downloaded is malformed. Must have been a client error while creating the backup.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_POLICY_MALFORMED = 8413,\n\n\n /**\n * We failed to obtain the policy, likely due to a network issue.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_NETWORK_FAILED = 8414,\n\n\n /**\n * The recovered secret did not match the required syntax.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_SECRET_MALFORMED = 8415,\n\n\n /**\n * The challenge data provided is too large for the available providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_CHALLENGE_DATA_TOO_BIG = 8416,\n\n\n /**\n * The provided core secret is too large for some of the providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_SECRET_TOO_BIG = 8417,\n\n\n /**\n * The provider returned in invalid configuration.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG = 8418,\n\n\n /**\n * The reducer encountered an internal error, likely a bug that needs to be reported.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_INTERNAL_ERROR = 8419,\n\n\n /**\n * The reducer already synchronized with all providers.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED = 8420,\n\n\n /**\n * The Donau failed to perform the operation as it could not find the private keys. This is a problem with the Donau setup, not with the client's request.\n * Returned with an HTTP status code of #MHD_HTTP_SERVICE_UNAVAILABLE (503).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_KEYS_MISSING = 8607,\n\n\n /**\n * The signature of the charity key is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_CHARITY_SIGNATURE_INVALID = 8608,\n\n\n /**\n * The charity is unknown.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_CHARITY_NOT_FOUND = 8609,\n\n\n /**\n * The donation amount specified in the request exceeds the limit of the charity.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_EXCEEDING_DONATION_LIMIT = 8610,\n\n\n /**\n * The Donau is not aware of the donation unit requested for the operation.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_DONATION_UNIT_UNKNOWN = 8611,\n\n\n /**\n * The Donau failed to talk to the process responsible for its private donation unit keys or the helpers had no donation units (properly) configured.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONATION_UNIT_HELPER_UNAVAILABLE = 8612,\n\n\n /**\n * The Donau failed to talk to the process responsible for its private signing keys.\n * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_SIGNKEY_HELPER_UNAVAILABLE = 8613,\n\n\n /**\n * The response from the online signing key helper process was malformed.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_SIGNKEY_HELPER_BUG = 8614,\n\n\n /**\n * The number of segments included in the URI does not match the number of segments expected by the endpoint.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 8615,\n\n\n /**\n * The signature of the donation receipt is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONATION_RECEIPT_SIGNATURE_INVALID = 8616,\n\n\n /**\n * The client re-used a unique donor identifier nonce, which is not allowed.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n DONAU_DONOR_IDENTIFIER_NONCE_REUSE = 8617,\n\n\n /**\n * A generic error happened in the LibEuFin nexus. See the enclose details JSON for more information.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_NEXUS_GENERIC_ERROR = 9000,\n\n\n /**\n * An uncaught exception happened in the LibEuFin nexus service.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_NEXUS_UNCAUGHT_EXCEPTION = 9001,\n\n\n /**\n * A generic error happened in the LibEuFin sandbox. See the enclose details JSON for more information.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_SANDBOX_GENERIC_ERROR = 9500,\n\n\n /**\n * An uncaught exception happened in the LibEuFin sandbox service.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n LIBEUFIN_SANDBOX_UNCAUGHT_EXCEPTION = 9501,\n\n\n /**\n * This validation method is not supported by the service.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n TALDIR_METHOD_NOT_SUPPORTED = 9600,\n\n\n /**\n * Number of allowed attempts for initiating a challenge exceeded.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n TALDIR_REGISTER_RATE_LIMITED = 9601,\n\n\n /**\n * The client is unknown or unauthorized.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_CLIENT_UNKNOWN = 9750,\n\n\n /**\n * The client is not authorized to use the given redirect URI.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_CLIENT_FORBIDDEN_BAD_REDIRECT_URI = 9751,\n\n\n /**\n * The service failed to execute its helper process to send the challenge.\n * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_HELPER_EXEC_FAILED = 9752,\n\n\n /**\n * The grant is unknown to the service (it could also have expired).\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GRANT_UNKNOWN = 9753,\n\n\n /**\n * The code given is not even well-formed.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_CLIENT_FORBIDDEN_BAD_CODE = 9754,\n\n\n /**\n * The service is not aware of the referenced validation process.\n * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_GENERIC_VALIDATION_UNKNOWN = 9755,\n\n\n /**\n * The code given is not valid.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_CLIENT_FORBIDDEN_INVALID_CODE = 9756,\n\n\n /**\n * Too many attempts have been made, validation is temporarily disabled for this address.\n * Returned with an HTTP status code of #MHD_HTTP_TOO_MANY_REQUESTS (429).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_TOO_MANY_ATTEMPTS = 9757,\n\n\n /**\n * The PIN code provided is incorrect.\n * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_INVALID_PIN = 9758,\n\n\n /**\n * The token cannot be valid as no address was ever provided by the client.\n * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).\n * (A value of 0 indicates that the error is generated client-side).\n */\n CHALLENGER_MISSING_ADDRESS = 9759,\n\n\n /**\n * End of error code range.\n * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).\n * (A value of 0 indicates that the error is generated client-side).\n */\n END = 9999,\n\n\n}\n", "/*\nMIT License\n\nCopyright (c) 2017 Conrad Reuter\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nconst NOOP = () => {};\n\n/**\n * A token that can be passed around to inform consumers of the token that a\n * certain operation has been cancelled.\n */\nclass CancellationToken {\n private _reason: any;\n private _callbacks?: Set<(reason?: any) => void> = new Set();\n\n /**\n * A cancellation token that is already cancelled.\n */\n public static readonly CANCELLED: CancellationToken = new CancellationToken(\n true,\n true,\n );\n\n /**\n * A cancellation token that is never cancelled.\n */\n public static readonly CONTINUE: CancellationToken = new CancellationToken(\n false,\n false,\n );\n\n /**\n * Whether the token has been cancelled.\n */\n public get isCancelled(): boolean {\n return this._isCancelled;\n }\n\n /**\n * Whether the token can be cancelled.\n */\n public get canBeCancelled(): boolean {\n return this._canBeCancelled;\n }\n\n /**\n * Why this token has been cancelled.\n */\n public get reason(): any {\n if (this.isCancelled) {\n return this._reason;\n } else {\n throw new Error(\"This token is not cancelled.\");\n }\n }\n\n /**\n * Make a promise that resolves when the async operation resolves,\n * or rejects when the operation is rejected or this token is cancelled.\n */\n public racePromise(asyncOperation: Promise): Promise {\n if (!this.canBeCancelled) {\n return asyncOperation;\n }\n return new Promise((resolve, reject) => {\n // we could use Promise.finally here as soon as it's implemented in the major browsers\n const unregister = this.onCancelled((reason) =>\n reject(new CancellationToken.CancellationError(reason)),\n );\n asyncOperation.then(\n (value) => {\n resolve(value);\n unregister();\n },\n (err) => {\n reject(err);\n unregister();\n },\n );\n });\n }\n\n /**\n * Throw a {CancellationToken.CancellationError} if this token is cancelled.\n */\n public throwIfCancelled(): void {\n if (this._isCancelled) {\n throw new CancellationToken.CancellationError(this._reason);\n }\n }\n\n /**\n * Invoke the callback when this token is cancelled.\n * If this token is already cancelled, the callback is invoked immediately.\n * Returns a function that unregisters the cancellation callback.\n */\n public onCancelled(cb: (reason?: any) => void): () => void {\n if (!this.canBeCancelled) {\n return NOOP;\n }\n if (this.isCancelled) {\n cb(this.reason);\n return NOOP;\n }\n\n /* istanbul ignore next */\n this._callbacks?.add(cb);\n return () => this._callbacks?.delete(cb);\n }\n\n private constructor(\n /**\n * Whether the token is already cancelled.\n */\n private _isCancelled: boolean,\n /**\n * Whether the token can be cancelled.\n */\n private _canBeCancelled: boolean,\n ) {}\n\n /**\n * Create a {CancellationTokenSource}.\n */\n public static create(): CancellationToken.Source {\n const token = new CancellationToken(false, true);\n\n const cancel = (reason?: any) => {\n if (token._isCancelled) return;\n token._isCancelled = true;\n token._reason = reason;\n token._callbacks?.forEach((cb) => cb(reason));\n dispose();\n };\n\n const dispose = () => {\n token._canBeCancelled = token.isCancelled;\n delete token._callbacks; // release memory\n };\n\n return { token, cancel, dispose };\n }\n\n /**\n * Create a {CancellationTokenSource}.\n * The token will be cancelled automatically after the specified timeout in milliseconds.\n */\n public static timeout(ms: number): CancellationToken.Source {\n const {\n token,\n cancel: originalCancel,\n dispose: originalDispose,\n } = CancellationToken.create();\n\n let timer: NodeJS.Timeout | null;\n timer = setTimeout(() => originalCancel(`CancellationToken.timeout ${ms}`), ms);\n const disposeTimer = () => {\n if (timer == null) return;\n clearTimeout(timer);\n timer = null;\n };\n\n const cancel = (reason?: any) => {\n disposeTimer();\n originalCancel(reason);\n };\n\n /* istanbul ignore next */\n const dispose = () => {\n disposeTimer();\n originalDispose();\n };\n\n return { token, cancel, dispose };\n }\n\n /**\n * Create a {CancellationToken} that is cancelled when all of the given tokens are cancelled.\n *\n * This is like {Promise.all} for {CancellationToken}s.\n */\n public static all(...tokens: CancellationToken[]): CancellationToken {\n // If *any* of the tokens cannot be cancelled, then the token we return can never be.\n if (tokens.some((token) => !token.canBeCancelled)) {\n return CancellationToken.CONTINUE;\n }\n\n const combined = CancellationToken.create();\n let countdown = tokens.length;\n const handleNextTokenCancelled = () => {\n if (--countdown === 0) {\n const reasons = tokens.map((token) => token._reason);\n combined.cancel(reasons);\n }\n };\n tokens.forEach((token) => token.onCancelled(handleNextTokenCancelled));\n return combined.token;\n }\n\n /**\n * Create a {CancellationToken} that is cancelled when at least one of the given tokens is cancelled.\n *\n * This is like {Promise.race} for {CancellationToken}s.\n */\n public static race(...tokens: CancellationToken[]): CancellationToken {\n // If *any* of the tokens is already cancelled, immediately return that token.\n for (const token of tokens) {\n if (token._isCancelled) {\n return token;\n }\n }\n\n const combined = CancellationToken.create();\n let unregistrations: (() => void)[];\n const handleAnyTokenCancelled = (reason?: any) => {\n unregistrations.forEach((unregister) => unregister()); // release memory\n combined.cancel(reason);\n };\n unregistrations = tokens.map((token) =>\n token.onCancelled(handleAnyTokenCancelled),\n );\n return combined.token;\n }\n}\n\n/* istanbul ignore next */\nnamespace CancellationToken {\n /**\n * Provides a {CancellationToken}, along with some methods to operate on it.\n */\n export interface Source {\n /**\n * The token provided by this source.\n */\n token: CancellationToken;\n\n /**\n * Cancel the provided token with the given reason.\n * Do nothing if the provided token cannot be cancelled or is already cancelled.\n */\n cancel(reason?: any): void;\n\n /**\n * Dispose of the token and this source and release memory.\n */\n dispose(): void;\n }\n\n /**\n * The error that is thrown when a {CancellationToken} has been cancelled and a\n * consumer of the token calls {CancellationToken.throwIfCancelled} on it.\n */\n export class CancellationError extends Error {\n public constructor(\n /**\n * The reason why the token was cancelled.\n */\n public readonly reason: any,\n ) {\n super(\"Operation cancelled\");\n Object.setPrototypeOf(this, CancellationError.prototype);\n }\n }\n}\n\nexport { CancellationToken };\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Types and helper functions for dealing with Taler amounts.\n */\n\n/**\n * Imports.\n */\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n codecForNumber,\n codecForString,\n renderContext,\n} from \"./codec.js\";\nimport { CurrencySpecification } from \"./index.js\";\nimport { AmountString } from \"./types-taler-common.js\";\n\n/**\n * Number of fractional units that one value unit represents.\n */\nexport const amountFractionalBase = 1e8;\n\n/**\n * How many digits behind the comma are required to represent the\n * fractional value in human readable decimal format? Must match\n * lg(fractionalBase)\n */\nexport const amountFractionalLength = 8;\n\n/**\n * Maximum allowed value field of an amount.\n */\nexport const amountMaxValue = 2 ** 52;\n\n/**\n * Separator character between integer and fractional\n */\nexport const FRAC_SEPARATOR = \".\";\n\n/**\n * Non-negative financial amount. Fractional values are expressed as multiples\n * of 1e-8.\n */\nexport interface AmountJson {\n /**\n * Value, must be an integer.\n */\n readonly value: number;\n\n /**\n * Fraction, must be an integer. Represent 1/1e8 of a unit.\n */\n readonly fraction: number;\n\n /**\n * Currency of the amount.\n */\n readonly currency: string;\n}\n\n/**\n * Immutable amount.\n */\nexport class Amount {\n static from(a: AmountLike): Amount {\n return new Amount(Amounts.parseOrThrow(a), 0);\n }\n\n static zeroOfCurrency(currency: string): Amount {\n return new Amount(Amounts.zeroOfCurrency(currency), 0);\n }\n\n add(...a: AmountLike[]): Amount {\n if (this.saturated) {\n return this;\n }\n const r = Amounts.add(this.val, ...a);\n return new Amount(r.amount, r.saturated ? 1 : 0);\n }\n\n mult(n: number): Amount {\n if (this.saturated) {\n return this;\n }\n const r = Amounts.mult(this, n);\n return new Amount(r.amount, r.saturated ? 1 : 0);\n }\n\n toJson(): AmountJson {\n return { ...this.val };\n }\n\n toString(): AmountString {\n return Amounts.stringify(this.val);\n }\n\n private constructor(\n private val: AmountJson,\n private saturated: number,\n ) {}\n}\n\nexport const codecForAmountJson = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"value\", codecForNumber())\n .property(\"fraction\", codecForNumber())\n .build(\"AmountJson\");\n\nexport function codecForAmountString(): Codec {\n return {\n decode(x: any, c?: Context): AmountString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (Amounts.parse(x) === undefined) {\n throw new DecodingError(\n `invalid amount at ${renderContext(c)} got \"${x}\"`,\n );\n }\n return x as AmountString;\n },\n };\n}\n\n/**\n * Result of a possibly overflowing operation.\n */\nexport interface Result {\n /**\n * Resulting, possibly saturated amount.\n */\n amount: AmountJson;\n /**\n * Was there an over-/underflow?\n */\n saturated: boolean;\n}\n\n/**\n * Type for things that are treated like amounts.\n */\nexport type AmountLike = string | AmountString | AmountJson | Amount;\n\nexport interface DivmodResult {\n quotient: number;\n remainder: AmountJson;\n}\n\n/**\n * Helper class for dealing with amounts.\n */\nexport class Amounts {\n private constructor() {\n throw Error(\"not instantiable\");\n }\n\n static currencyOf(amount: AmountLike) {\n const amt = Amounts.parseOrThrow(amount);\n return amt.currency;\n }\n\n static zeroOfAmount(amount: AmountLike): AmountJson {\n const amt = Amounts.parseOrThrow(amount);\n return {\n currency: amt.currency,\n fraction: 0,\n value: 0,\n };\n }\n\n /**\n * Get an amount that represents zero units of a currency.\n */\n static zeroOfCurrency(currency: string): AmountJson {\n return {\n currency,\n fraction: 0,\n value: 0,\n };\n }\n\n static jsonifyAmount(amt: AmountLike): AmountJson {\n if (typeof amt === \"string\") {\n return Amounts.parseOrThrow(amt);\n }\n if (amt instanceof Amount) {\n return amt.toJson();\n }\n return amt;\n }\n\n static divmod(a1: AmountLike, a2: AmountLike): DivmodResult {\n const am1 = Amounts.jsonifyAmount(a1);\n const am2 = Amounts.jsonifyAmount(a2);\n if (am1.currency != am2.currency) {\n throw Error(`incompatible currency (${am1.currency} vs${am2.currency})`);\n }\n\n const x1 =\n BigInt(am1.value) * BigInt(amountFractionalBase) + BigInt(am1.fraction);\n const x2 =\n BigInt(am2.value) * BigInt(amountFractionalBase) + BigInt(am2.fraction);\n\n const quotient = x1 / x2;\n const remainderScaled = x1 % x2;\n\n return {\n quotient: Number(quotient),\n remainder: {\n currency: am1.currency,\n value: Number(remainderScaled / BigInt(amountFractionalBase)),\n fraction: Number(remainderScaled % BigInt(amountFractionalBase)),\n },\n };\n }\n\n static sum(amounts: AmountLike[]): Result {\n if (amounts.length <= 0) {\n throw Error(\"can't sum zero amounts\");\n }\n const jsonAmounts = amounts.map((x) => Amounts.jsonifyAmount(x));\n return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));\n }\n\n static sumOrZero(currency: string, amounts: AmountLike[]): Result {\n if (amounts.length <= 0) {\n return {\n amount: Amounts.zeroOfCurrency(currency),\n saturated: false,\n };\n }\n const jsonAmounts = amounts.map((x) => Amounts.jsonifyAmount(x));\n return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));\n }\n\n /**\n * Add two amounts. Return the result and whether\n * the addition overflowed. The overflow is always handled\n * by saturating and never by wrapping.\n *\n * Throws when currencies don't match.\n */\n static add(first: AmountLike, ...rest: AmountLike[]): Result {\n const firstJ = Amounts.jsonifyAmount(first);\n const currency = firstJ.currency;\n let value =\n firstJ.value + Math.floor(firstJ.fraction / amountFractionalBase);\n if (value > amountMaxValue) {\n return {\n amount: {\n currency,\n value: amountMaxValue,\n fraction: amountFractionalBase - 1,\n },\n saturated: true,\n };\n }\n let fraction = firstJ.fraction % amountFractionalBase;\n for (const x of rest) {\n const xJ = Amounts.jsonifyAmount(x);\n if (xJ.currency.toUpperCase() !== currency.toUpperCase()) {\n throw Error(`Mismatched currency: ${xJ.currency} and ${currency}`);\n }\n\n value =\n value +\n xJ.value +\n Math.floor((fraction + xJ.fraction) / amountFractionalBase);\n fraction = Math.floor((fraction + xJ.fraction) % amountFractionalBase);\n if (value > amountMaxValue) {\n return {\n amount: {\n currency,\n value: amountMaxValue,\n fraction: amountFractionalBase - 1,\n },\n saturated: true,\n };\n }\n }\n return { amount: { currency, value, fraction }, saturated: false };\n }\n\n /**\n * Subtract two amounts. Return the result and whether\n * the subtraction overflowed. The overflow is always handled\n * by saturating and never by wrapping.\n *\n * Throws when currencies don't match.\n */\n static sub(a: AmountLike, ...rest: AmountLike[]): Result {\n const aJ = Amounts.jsonifyAmount(a);\n const currency = aJ.currency;\n let value = aJ.value;\n let fraction = aJ.fraction;\n\n for (const b of rest) {\n const bJ = Amounts.jsonifyAmount(b);\n if (bJ.currency.toUpperCase() !== aJ.currency.toUpperCase()) {\n throw Error(`Mismatched currency: ${bJ.currency} and ${currency}`);\n }\n if (fraction < bJ.fraction) {\n if (value < 1) {\n return {\n amount: { currency, value: 0, fraction: 0 },\n saturated: true,\n };\n }\n value--;\n fraction += amountFractionalBase;\n }\n console.assert(fraction >= bJ.fraction);\n fraction -= bJ.fraction;\n if (value < bJ.value) {\n return { amount: { currency, value: 0, fraction: 0 }, saturated: true };\n }\n value -= bJ.value;\n }\n\n return { amount: { currency, value, fraction }, saturated: false };\n }\n\n /**\n * Compare two amounts. Returns 0 when equal, -1 when a < b\n * and +1 when a > b. Throws when currencies don't match.\n */\n static cmp(a: AmountLike, b: AmountLike): -1 | 0 | 1 {\n a = Amounts.jsonifyAmount(a);\n b = Amounts.jsonifyAmount(b);\n if (a.currency !== b.currency) {\n throw Error(`Mismatched currency: ${a.currency} and ${b.currency}`);\n }\n const av = a.value + Math.floor(a.fraction / amountFractionalBase);\n const af = a.fraction % amountFractionalBase;\n const bv = b.value + Math.floor(b.fraction / amountFractionalBase);\n const bf = b.fraction % amountFractionalBase;\n switch (true) {\n case av < bv:\n return -1;\n case av > bv:\n return 1;\n case af < bf:\n return -1;\n case af > bf:\n return 1;\n case af === bf:\n return 0;\n default:\n throw Error(\"assertion failed\");\n }\n }\n\n /**\n * Create a copy of an amount.\n */\n static copy(a: AmountJson): AmountJson {\n return {\n currency: a.currency,\n fraction: a.fraction,\n value: a.value,\n };\n }\n\n /**\n * Divide an amount. Throws on division by zero.\n */\n static divide(a: AmountJson, n: number): AmountJson {\n if (n === 0) {\n throw Error(`Division by 0`);\n }\n if (n === 1) {\n return { value: a.value, fraction: a.fraction, currency: a.currency };\n }\n const r = a.value % n;\n return {\n currency: a.currency,\n fraction: Math.floor((r * amountFractionalBase + a.fraction) / n),\n value: Math.floor(a.value / n),\n };\n }\n\n /**\n * Check if an amount is non-zero.\n */\n static isNonZero(a: AmountLike): boolean {\n a = Amounts.jsonifyAmount(a);\n return a.value > 0 || a.fraction > 0;\n }\n\n static isZero(a: AmountLike): boolean {\n a = Amounts.jsonifyAmount(a);\n return a.value === 0 && a.fraction === 0;\n }\n\n /**\n * Check whether a string is a valid currency for a Taler amount.\n */\n static isCurrency(s: string): boolean {\n return /^[a-zA-Z]{1,11}$/.test(s);\n }\n\n /**\n * Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct.\n *\n * Currency name size limit is 11 of ASCII letters\n * Fraction size limit is 8\n */\n static parse(s: string): AmountJson | undefined {\n const res = s.match(/^([a-zA-Z]{1,11}):([0-9]+)([.][0-9]{1,8})?$/);\n if (!res) {\n return undefined;\n }\n const tail = res[3] || FRAC_SEPARATOR + \"0\";\n if (tail.length > amountFractionalLength + 1) {\n return undefined;\n }\n const value = Number.parseInt(res[2]);\n if (value > amountMaxValue) {\n return undefined;\n }\n return {\n currency: res[1].toUpperCase(),\n fraction: Math.round(amountFractionalBase * Number.parseFloat(tail)),\n value,\n };\n }\n\n /**\n * Parse amount in standard string form (like 'EUR:20.5'),\n * throw if the input is not a valid amount.\n */\n static parseOrThrow(s: AmountLike): AmountJson {\n if (s instanceof Amount) {\n return s.toJson();\n }\n if (typeof s === \"object\") {\n if (typeof s.currency !== \"string\") {\n throw Error(\"invalid amount object\");\n }\n if (typeof s.value !== \"number\") {\n throw Error(\"invalid amount object\");\n }\n if (typeof s.fraction !== \"number\") {\n throw Error(\"invalid amount object\");\n }\n return { currency: s.currency, value: s.value, fraction: s.fraction };\n } else if (typeof s === \"string\") {\n const res = Amounts.parse(s);\n if (!res) {\n throw Error(`Can't parse amount: \"${s}\"`);\n }\n return res;\n } else {\n throw Error(\"invalid amount (illegal type)\");\n }\n }\n\n static min(a: AmountLike, b: AmountLike): AmountJson {\n const cr = Amounts.cmp(a, b);\n if (cr >= 0) {\n return Amounts.jsonifyAmount(b);\n } else {\n return Amounts.jsonifyAmount(a);\n }\n }\n\n static max(a: AmountLike, b: AmountLike): AmountJson {\n const cr = Amounts.cmp(a, b);\n if (cr >= 0) {\n return Amounts.jsonifyAmount(a);\n } else {\n return Amounts.jsonifyAmount(b);\n }\n }\n\n static mult(a: AmountLike, n: number): Result {\n a = this.jsonifyAmount(a);\n if (!Number.isInteger(n)) {\n throw Error(\"amount can only be multiplied by an integer\");\n }\n if (n < 0) {\n throw Error(\"amount can only be multiplied by a positive integer\");\n }\n if (n == 0) {\n return {\n amount: Amounts.zeroOfCurrency(a.currency),\n saturated: false,\n };\n }\n let x = a;\n let acc = Amounts.zeroOfCurrency(a.currency);\n while (n > 1) {\n if (n % 2 == 0) {\n n = n / 2;\n } else {\n n = (n - 1) / 2;\n const r2 = Amounts.add(acc, x);\n if (r2.saturated) {\n return r2;\n }\n acc = r2.amount;\n }\n const r2 = Amounts.add(x, x);\n if (r2.saturated) {\n return r2;\n }\n x = r2.amount;\n }\n return Amounts.add(acc, x);\n }\n\n /**\n * Check if the argument is a valid amount in string form.\n */\n static check(a: any): boolean {\n if (typeof a !== \"string\") {\n return false;\n }\n try {\n const parsedAmount = Amounts.parse(a);\n return !!parsedAmount;\n } catch {\n return false;\n }\n }\n\n /**\n * Convert to standard human-readable string representation that's\n * also used in JSON formats.\n */\n static stringify(a: AmountLike): AmountString {\n a = Amounts.jsonifyAmount(a);\n const s = this.stringifyValue(a);\n\n return `${a.currency}:${s}` as AmountString;\n }\n\n static amountHasSameCurrency(a1: AmountLike, a2: AmountLike): boolean {\n const x1 = this.jsonifyAmount(a1);\n const x2 = this.jsonifyAmount(a2);\n return x1.currency.toUpperCase() === x2.currency.toUpperCase();\n }\n\n static isSameCurrency(curr1: string, curr2: string): boolean {\n return curr1.toLowerCase() === curr2.toLowerCase();\n }\n\n static stringifyValue(a: AmountLike, minFractional = 0): string {\n const aJ = Amounts.jsonifyAmount(a);\n const av = aJ.value + Math.floor(aJ.fraction / amountFractionalBase);\n const af = aJ.fraction % amountFractionalBase;\n let s = av.toString();\n\n if (af || minFractional) {\n s = s + FRAC_SEPARATOR;\n let n = af;\n for (let i = 0; i < amountFractionalLength; i++) {\n if (!n && i >= minFractional) {\n break;\n }\n s = s + Math.floor((n / amountFractionalBase) * 10).toString();\n n = (n * 10) % amountFractionalBase;\n }\n }\n\n return s;\n }\n\n /**\n * Number of fractional digits needed to fully represent the amount\n * @param a amount\n * @returns\n */\n static maxFractionalDigits(a: AmountJson): number {\n if (a.fraction === 0) return 0;\n if (a.fraction < 0) {\n console.error(\"amount fraction can not be negative\", a);\n return 0;\n }\n let i = 0;\n let check = true;\n let rest = a.fraction;\n while (rest > 0 && check) {\n check = rest % 10 === 0;\n rest = rest / 10;\n i++;\n }\n return amountFractionalLength - i + 1;\n }\n\n static stringifyValueWithSpec(\n value: AmountJson,\n spec: CurrencySpecification,\n ): { currency: string; normal: string; small?: string } {\n const strValue = Amounts.stringifyValue(value);\n const pos = strValue.indexOf(FRAC_SEPARATOR);\n const originalPosition = pos < 0 ? strValue.length : pos;\n\n let currency = value.currency;\n const names = Object.keys(spec.alt_unit_names);\n let FRAC_POS_NEW_POSITION = originalPosition;\n //find symbol\n //FIXME: this should be based on a cache to speed up\n if (names.length > 0) {\n let unitIndex: string = \"0\"; //default entry by DD51\n names.forEach((index) => {\n const i = Number.parseInt(index, 10);\n if (Number.isNaN(i)) return; //skip\n if (originalPosition - i <= 0) return; //too big\n if (originalPosition - i < FRAC_POS_NEW_POSITION) {\n FRAC_POS_NEW_POSITION = originalPosition - i;\n unitIndex = index;\n }\n });\n currency = spec.alt_unit_names[unitIndex];\n }\n\n if (originalPosition === FRAC_POS_NEW_POSITION) {\n const { normal, small } = splitNormalAndSmall(\n strValue,\n originalPosition,\n spec,\n );\n return { currency, normal, small };\n }\n\n const intPart = strValue.substring(0, originalPosition);\n const fracPArt = strValue.substring(originalPosition + 1);\n //indexSize is always smaller than originalPosition\n const newValue =\n intPart.substring(0, FRAC_POS_NEW_POSITION) +\n FRAC_SEPARATOR +\n intPart.substring(FRAC_POS_NEW_POSITION) +\n fracPArt;\n const { normal, small } = splitNormalAndSmall(\n newValue,\n FRAC_POS_NEW_POSITION,\n spec,\n );\n return { currency, normal, small };\n }\n}\n\nfunction splitNormalAndSmall(\n decimal: string,\n fracSeparatorIndex: number,\n spec: CurrencySpecification,\n): { normal: string; small?: string } {\n let normal: string;\n let small: string | undefined;\n if (\n decimal.length - fracSeparatorIndex - 1 >\n spec.num_fractional_normal_digits\n ) {\n const limit = fracSeparatorIndex + spec.num_fractional_normal_digits + 1;\n normal = decimal.substring(0, limit);\n small = decimal.substring(limit);\n } else {\n normal = decimal;\n small = undefined;\n }\n return { normal, small };\n}\n", "/*\nCopyright Mathias Bynens \nCopyright (c) 2022 Taler Systems S.A.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = \"-\"; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n overflow: \"Overflow: input needs wider integers to process\",\n \"not-basic\": \"Illegal input >= 0x80 (not a basic code point)\",\n \"invalid-input\": \"Invalid input\",\n} as { [x: string]: string };\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type: string) {\n throw new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array: any[], fn: (arg0: any) => any) {\n const result = [];\n let length = array.length;\n while (length--) {\n result[length] = fn(array[length]);\n }\n return result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(\n string: string,\n fn: { (string: any): any; (string: any): any; (arg0: any): any },\n) {\n const parts = string.split(\"@\");\n let result = \"\";\n if (parts.length > 1) {\n // In email addresses, only the domain name should be punycoded. Leave\n // the local part (i.e. everything up to `@`) intact.\n result = parts[0] + \"@\";\n string = parts[1];\n }\n // Avoid `split(regex)` for IE8 compatibility. See #17.\n string = string.replace(regexSeparators, \"\\x2E\");\n const labels = string.split(\".\");\n const encoded = map(labels, fn).join(\".\");\n return result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string: string) {\n const output = [];\n let counter = 0;\n const length = string.length;\n while (counter < length) {\n const value = string.charCodeAt(counter++);\n if (value >= 0xd800 && value <= 0xdbff && counter < length) {\n // It's a high surrogate, and there is a next character.\n const extra = string.charCodeAt(counter++);\n if ((extra & 0xfc00) == 0xdc00) {\n // Low surrogate.\n output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);\n } else {\n // It's an unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair.\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n return output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = (array: any): string => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function (codePoint: number) {\n if (codePoint - 0x30 < 0x0a) {\n return codePoint - 0x16;\n }\n if (codePoint - 0x41 < 0x1a) {\n return codePoint - 0x41;\n }\n if (codePoint - 0x61 < 0x1a) {\n return codePoint - 0x61;\n }\n return base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function (digit: number, flag: number) {\n // 0..25 map to ASCII a..z or A..Z\n // 26..35 map to ASCII 0..9\n return digit + 22 + 75 * Number(digit < 26) - (Number(flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function (delta: number, numPoints: number, firstTime: boolean) {\n let k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n for (\n ;\n /* no initialization */ delta > (baseMinusTMin * tMax) >> 1;\n k += base\n ) {\n delta = floor(delta / baseMinusTMin);\n }\n return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function (input: string) {\n // Don't use UCS-2.\n const output = [];\n const inputLength = input.length;\n let i = 0;\n let n = initialN;\n let bias = initialBias;\n\n // Handle the basic code points: let `basic` be the number of input code\n // points before the last delimiter, or `0` if there is none, then copy\n // the first basic code points to the output.\n\n let basic = input.lastIndexOf(delimiter);\n if (basic < 0) {\n basic = 0;\n }\n\n for (let j = 0; j < basic; ++j) {\n // if it's not a basic code point\n if (input.charCodeAt(j) >= 0x80) {\n error(\"not-basic\");\n }\n output.push(input.charCodeAt(j));\n }\n\n // Main decoding loop: start just after the last delimiter if any basic code\n // points were copied; start at the beginning otherwise.\n\n for (\n let index = basic > 0 ? basic + 1 : 0;\n index < inputLength /* no final expression */;\n\n ) {\n // `index` is the index of the next character to be consumed.\n // Decode a generalized variable-length integer into `delta`,\n // which gets added to `i`. The overflow checking is easier\n // if we increase `i` as we go, then subtract off its starting\n // value at the end to obtain `delta`.\n let oldi = i;\n for (let w = 1, k = base /* no condition */; ; k += base) {\n if (index >= inputLength) {\n error(\"invalid-input\");\n }\n\n const digit = basicToDigit(input.charCodeAt(index++));\n\n if (digit >= base || digit > floor((maxInt - i) / w)) {\n error(\"overflow\");\n }\n\n i += digit * w;\n const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (digit < t) {\n break;\n }\n\n const baseMinusT = base - t;\n if (w > floor(maxInt / baseMinusT)) {\n error(\"overflow\");\n }\n\n w *= baseMinusT;\n }\n\n const out = output.length + 1;\n bias = adapt(i - oldi, out, oldi == 0);\n\n // `i` was supposed to wrap around from `out` to `0`,\n // incrementing `n` each time, so we'll fix that now:\n if (floor(i / out) > maxInt - n) {\n error(\"overflow\");\n }\n\n n += floor(i / out);\n i %= out;\n\n // Insert `n` at position `i` of the output.\n output.splice(i++, 0, n);\n }\n\n return String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function (inputArg: string) {\n const output = [];\n\n // Convert the input in UCS-2 to an array of Unicode code points.\n let input = ucs2decode(inputArg);\n\n // Cache the length.\n let inputLength = input.length;\n\n // Initialize the state.\n let n = initialN;\n let delta = 0;\n let bias = initialBias;\n\n // Handle the basic code points.\n for (const currentValue of input) {\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n let basicLength = output.length;\n let handledCPCount = basicLength;\n\n // `handledCPCount` is the number of code points that have been handled;\n // `basicLength` is the number of basic code points.\n\n // Finish the basic string with a delimiter unless it's empty.\n if (basicLength) {\n output.push(delimiter);\n }\n\n // Main encoding loop:\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next\n // larger one:\n let m = maxInt;\n for (const currentValue of input) {\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n }\n\n // Increase `delta` enough to advance the decoder's state to ,\n // but guard against overflow.\n const handledCPCountPlusOne = handledCPCount + 1;\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n error(\"overflow\");\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (const currentValue of input) {\n if (currentValue < n && ++delta > maxInt) {\n error(\"overflow\");\n }\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer.\n let q = delta;\n for (let k = base /* no condition */; ; k += base) {\n const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n if (q < t) {\n break;\n }\n const qMinusT = q - t;\n const baseMinusT = base - t;\n output.push(\n stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)),\n );\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q, 0)));\n bias = adapt(\n delta,\n handledCPCountPlusOne,\n handledCPCount == basicLength,\n );\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n return output.join(\"\");\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function (input: string) {\n return mapDomain(input, function (string) {\n return regexPunycode.test(string)\n ? decode(string.slice(4).toLowerCase())\n : string;\n });\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function (input: string) {\n return mapDomain(input, function (string) {\n return regexNonASCII.test(string) ? \"xn--\" + encode(string) : string;\n });\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nexport const punycode = {\n /**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n version: \"2.1.0\",\n /**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n ucs2: {\n decode: ucs2decode,\n encode: ucs2encode,\n },\n decode: decode,\n encode: encode,\n toASCII: toASCII,\n toUnicode: toUnicode,\n};\n", "/*\nThe MIT License (MIT)\n\nCopyright (c) Sebastian Mayr\nCopyright (c) 2022 Taler Systems S.A.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// Vendored with modifications (TypeScript etc.) from https://github.com/jsdom/whatwg-url\n\nconst utf8Encoder = new TextEncoder();\nconst utf8Decoder = new TextDecoder(\"utf-8\", { ignoreBOM: true });\n\nfunction utf8Encode(string: string | undefined) {\n return utf8Encoder.encode(string);\n}\n\nfunction utf8DecodeWithoutBOM(\n bytes: DataView | ArrayBuffer | null | undefined,\n) {\n return utf8Decoder.decode(bytes);\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-parser\nfunction parseUrlencoded(input: Uint8Array) {\n const sequences = strictlySplitByteSequence(input, p(\"&\"));\n const output = [];\n for (const bytes of sequences) {\n if (bytes.length === 0) {\n continue;\n }\n\n let name, value;\n const indexOfEqual = bytes.indexOf(p(\"=\")!);\n\n if (indexOfEqual >= 0) {\n name = bytes.slice(0, indexOfEqual);\n value = bytes.slice(indexOfEqual + 1);\n } else {\n name = bytes;\n value = new Uint8Array(0);\n }\n\n name = replaceByteInByteSequence(name, 0x2b, 0x20);\n value = replaceByteInByteSequence(value, 0x2b, 0x20);\n\n const nameString = utf8DecodeWithoutBOM(percentDecodeBytes(name));\n const valueString = utf8DecodeWithoutBOM(percentDecodeBytes(value));\n\n output.push([nameString, valueString]);\n }\n return output;\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-string-parser\nfunction parseUrlencodedString(input: string | undefined) {\n return parseUrlencoded(utf8Encode(input));\n}\n\n// https://url.spec.whatwg.org/#concept-urlencoded-serializer\nfunction serializeUrlencoded(tuples: any[], encodingOverride = undefined) {\n let encoding = \"utf-8\";\n if (encodingOverride !== undefined) {\n // TODO \"get the output encoding\", i.e. handle encoding labels vs. names.\n encoding = encodingOverride;\n }\n\n let output = \"\";\n for (const [i, tuple] of tuples.entries()) {\n // TODO: handle encoding override\n\n const name = utf8PercentEncodeString(\n tuple[0],\n isURLEncodedPercentEncode,\n true,\n );\n\n let value = tuple[1];\n if (tuple.length > 2 && tuple[2] !== undefined) {\n if (tuple[2] === \"hidden\" && name === \"_charset_\") {\n value = encoding;\n } else if (tuple[2] === \"file\") {\n // value is a File object\n value = value.name;\n }\n }\n\n value = utf8PercentEncodeString(value, isURLEncodedPercentEncode, true);\n\n if (i !== 0) {\n output += \"&\";\n }\n output += `${name}=${value}`;\n }\n return output;\n}\n\nfunction strictlySplitByteSequence(buf: Uint8Array, cp: any) {\n const list = [];\n let last = 0;\n let i = buf.indexOf(cp);\n while (i >= 0) {\n list.push(buf.slice(last, i));\n last = i + 1;\n i = buf.indexOf(cp, last);\n }\n if (last !== buf.length) {\n list.push(buf.slice(last));\n }\n return list;\n}\n\nfunction replaceByteInByteSequence(buf: Uint8Array, from: number, to: number) {\n let i = buf.indexOf(from);\n while (i >= 0) {\n buf[i] = to;\n i = buf.indexOf(from, i + 1);\n }\n return buf;\n}\n\nfunction p(char: string) {\n return char.codePointAt(0);\n}\n\n// https://url.spec.whatwg.org/#percent-encode\nfunction percentEncode(c: number) {\n let hex = c.toString(16).toUpperCase();\n if (hex.length === 1) {\n hex = `0${hex}`;\n }\n\n return `%${hex}`;\n}\n\n// https://url.spec.whatwg.org/#percent-decode\nfunction percentDecodeBytes(input: Uint8Array) {\n const output = new Uint8Array(input.byteLength);\n let outputIndex = 0;\n for (let i = 0; i < input.byteLength; ++i) {\n const byte = input[i];\n if (byte !== 0x25) {\n output[outputIndex++] = byte;\n } else if (\n byte === 0x25 &&\n (!isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2]))\n ) {\n output[outputIndex++] = byte;\n } else {\n const bytePoint = parseInt(\n String.fromCodePoint(input[i + 1], input[i + 2]),\n 16,\n );\n output[outputIndex++] = bytePoint;\n i += 2;\n }\n }\n\n return output.slice(0, outputIndex);\n}\n\n// https://url.spec.whatwg.org/#string-percent-decode\nfunction percentDecodeString(input: string) {\n const bytes = utf8Encode(input);\n return percentDecodeBytes(bytes);\n}\n\n// https://url.spec.whatwg.org/#c0-control-percent-encode-set\nfunction isC0ControlPercentEncode(c: number) {\n return c <= 0x1f || c > 0x7e;\n}\n\n// https://url.spec.whatwg.org/#fragment-percent-encode-set\nconst extraFragmentPercentEncodeSet = new Set([\n p(\" \"),\n p('\"'),\n p(\"<\"),\n p(\">\"),\n p(\"`\"),\n]);\n\nfunction isFragmentPercentEncode(c: number) {\n return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#query-percent-encode-set\nconst extraQueryPercentEncodeSet = new Set([\n p(\" \"),\n p('\"'),\n p(\"#\"),\n p(\"<\"),\n p(\">\"),\n]);\n\nfunction isQueryPercentEncode(c: number) {\n return isC0ControlPercentEncode(c) || extraQueryPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#special-query-percent-encode-set\nfunction isSpecialQueryPercentEncode(c: number) {\n return isQueryPercentEncode(c) || c === p(\"'\");\n}\n\n// https://url.spec.whatwg.org/#path-percent-encode-set\nconst extraPathPercentEncodeSet = new Set([p(\"?\"), p(\"`\"), p(\"{\"), p(\"}\")]);\nfunction isPathPercentEncode(c: number) {\n return isQueryPercentEncode(c) || extraPathPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#userinfo-percent-encode-set\nconst extraUserinfoPercentEncodeSet = new Set([\n p(\"/\"),\n p(\":\"),\n p(\";\"),\n p(\"=\"),\n p(\"@\"),\n p(\"[\"),\n p(\"\\\\\"),\n p(\"]\"),\n p(\"^\"),\n p(\"|\"),\n]);\nfunction isUserinfoPercentEncode(c: number) {\n return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#component-percent-encode-set\nconst extraComponentPercentEncodeSet = new Set([\n p(\"$\"),\n p(\"%\"),\n p(\"&\"),\n p(\"+\"),\n p(\",\"),\n]);\nfunction isComponentPercentEncode(c: number) {\n return isUserinfoPercentEncode(c) || extraComponentPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set\nconst extraURLEncodedPercentEncodeSet = new Set([\n p(\"!\"),\n p(\"'\"),\n p(\"(\"),\n p(\")\"),\n p(\"~\"),\n]);\n\nfunction isURLEncodedPercentEncode(c: number) {\n return isComponentPercentEncode(c) || extraURLEncodedPercentEncodeSet.has(c);\n}\n\n// https://url.spec.whatwg.org/#code-point-percent-encode-after-encoding\n// https://url.spec.whatwg.org/#utf-8-percent-encode\n// Assuming encoding is always utf-8 allows us to trim one of the logic branches. TODO: support encoding.\n// The \"-Internal\" variant here has code points as JS strings. The external version used by other files has code points\n// as JS numbers, like the rest of the codebase.\nfunction utf8PercentEncodeCodePointInternal(\n codePoint: string,\n percentEncodePredicate: (arg0: number) => any,\n) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}\n\nfunction utf8PercentEncodeCodePoint(\n codePoint: number,\n percentEncodePredicate: (arg0: number) => any,\n) {\n return utf8PercentEncodeCodePointInternal(\n String.fromCodePoint(codePoint),\n percentEncodePredicate,\n );\n}\n\n// https://url.spec.whatwg.org/#string-percent-encode-after-encoding\n// https://url.spec.whatwg.org/#string-utf-8-percent-encode\nfunction utf8PercentEncodeString(\n input: string,\n percentEncodePredicate: {\n (c: number): boolean;\n (c: number): boolean;\n (arg0: number): any;\n },\n spaceAsPlus = false,\n) {\n let output = \"\";\n for (const codePoint of input) {\n if (spaceAsPlus && codePoint === \" \") {\n output += \"+\";\n } else {\n output += utf8PercentEncodeCodePointInternal(\n codePoint,\n percentEncodePredicate,\n );\n }\n }\n return output;\n}\n\n// Note that we take code points as JS numbers, not JS strings.\n\nfunction isASCIIDigit(c: number) {\n return c >= 0x30 && c <= 0x39;\n}\n\nfunction isASCIIAlpha(c: number) {\n return (c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a);\n}\n\nfunction isASCIIAlphanumeric(c: number) {\n return isASCIIAlpha(c) || isASCIIDigit(c);\n}\n\nfunction isASCIIHex(c: number) {\n return (\n isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66)\n );\n}\n\nexport class URLSearchParamsImpl {\n _list: any[];\n _url: any;\n constructor(init: any, { doNotStripQMark = false }: any = {}) {\n this._list = [];\n this._url = null;\n\n if (!doNotStripQMark && typeof init === \"string\" && init[0] === \"?\") {\n init = init.slice(1);\n }\n\n if (Array.isArray(init)) {\n for (const pair of init) {\n if (pair.length !== 2) {\n throw new TypeError(\n \"Failed to construct 'URLSearchParams': parameter 1 sequence's element does not \" +\n \"contain exactly two elements.\",\n );\n }\n this._list.push([pair[0], pair[1]]);\n }\n } else if (\n typeof init === \"object\" &&\n Object.getPrototypeOf(init) === null\n ) {\n for (const name of Object.keys(init)) {\n const value = init[name];\n this._list.push([name, value]);\n }\n } else {\n this._list = parseUrlencodedString(init);\n }\n }\n\n _updateSteps() {\n if (this._url !== null) {\n let query: string | null = serializeUrlencoded(this._list);\n if (query === \"\") {\n query = null;\n }\n this._url._url.query = query;\n }\n }\n\n append(name: string, value: string) {\n this._list.push([name, value]);\n this._updateSteps();\n }\n\n delete(name: string) {\n let i = 0;\n while (i < this._list.length) {\n if (this._list[i][0] === name) {\n this._list.splice(i, 1);\n } else {\n i++;\n }\n }\n this._updateSteps();\n }\n\n get(name: string) {\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n return tuple[1];\n }\n }\n return null;\n }\n\n getAll(name: string) {\n const output = [];\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n output.push(tuple[1]);\n }\n }\n return output;\n }\n\n entries() {\n return [...this._list.map(x => [x[0], x[1]])];\n }\n\n forEach(\n callbackfn: (\n value: string,\n key: string,\n parent: URLSearchParamsImpl,\n ) => void,\n thisArg?: any,\n ): void {\n for (const tuple of this._list) {\n callbackfn.call(thisArg, tuple[1], tuple[0], this);\n }\n }\n\n has(name: string) {\n for (const tuple of this._list) {\n if (tuple[0] === name) {\n return true;\n }\n }\n return false;\n }\n\n set(name: string, value: string) {\n let found = false;\n let i = 0;\n while (i < this._list.length) {\n if (this._list[i][0] === name) {\n if (found) {\n this._list.splice(i, 1);\n } else {\n found = true;\n this._list[i][1] = value;\n i++;\n }\n } else {\n i++;\n }\n }\n if (!found) {\n this._list.push([name, value]);\n }\n this._updateSteps();\n }\n\n sort() {\n this._list.sort((a, b) => {\n if (a[0] < b[0]) {\n return -1;\n }\n if (a[0] > b[0]) {\n return 1;\n }\n return 0;\n });\n\n this._updateSteps();\n }\n\n [Symbol.iterator]() {\n return this._list[Symbol.iterator]();\n }\n\n toString() {\n return serializeUrlencoded(this._list);\n }\n}\n\nconst specialSchemes = {\n ftp: 21,\n file: null,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443,\n} as { [x: string]: number | null };\n\nconst failure = Symbol(\"failure\");\n\nfunction countSymbols(str: any) {\n return [...str].length;\n}\n\nfunction at(input: any, idx: any) {\n const c = input[idx];\n return isNaN(c) ? undefined : String.fromCodePoint(c);\n}\n\nfunction isSingleDot(buffer: string) {\n return buffer === \".\" || buffer.toLowerCase() === \"%2e\";\n}\n\nfunction isDoubleDot(buffer: string) {\n buffer = buffer.toLowerCase();\n return (\n buffer === \"..\" ||\n buffer === \"%2e.\" ||\n buffer === \".%2e\" ||\n buffer === \"%2e%2e\"\n );\n}\n\nfunction isWindowsDriveLetterCodePoints(cp1: number, cp2: number) {\n return isASCIIAlpha(cp1) && (cp2 === p(\":\") || cp2 === p(\"|\"));\n}\n\nfunction isWindowsDriveLetterString(string: string) {\n return (\n string.length === 2 &&\n isASCIIAlpha(string.codePointAt(0)!) &&\n (string[1] === \":\" || string[1] === \"|\")\n );\n}\n\nfunction isNormalizedWindowsDriveLetterString(string: string) {\n return (\n string.length === 2 &&\n isASCIIAlpha(string.codePointAt(0)!) &&\n string[1] === \":\"\n );\n}\n\nfunction containsForbiddenHostCodePoint(string: string) {\n return (\n string.search(\n /\\u0000|\\u0009|\\u000A|\\u000D|\\u0020|#|\\/|:|<|>|\\?|@|\\[|\\\\|\\]|\\^|\\|/u,\n ) !== -1\n );\n}\n\nfunction containsForbiddenDomainCodePoint(string: string) {\n return (\n containsForbiddenHostCodePoint(string) ||\n string.search(/[\\u0000-\\u001F]|%|\\u007F/u) !== -1\n );\n}\n\nfunction isSpecialScheme(scheme: string) {\n return specialSchemes[scheme] !== undefined;\n}\n\nfunction isSpecial(url: any) {\n return isSpecialScheme(url.scheme);\n}\n\nfunction isNotSpecial(url: UrlObj) {\n return !isSpecialScheme(url.scheme);\n}\n\nfunction defaultPort(scheme: string) {\n return specialSchemes[scheme];\n}\n\nfunction parseIPv4Number(input: string) {\n if (input === \"\") {\n return failure;\n }\n\n let R = 10;\n\n if (\n input.length >= 2 &&\n input.charAt(0) === \"0\" &&\n input.charAt(1).toLowerCase() === \"x\"\n ) {\n input = input.substring(2);\n R = 16;\n } else if (input.length >= 2 && input.charAt(0) === \"0\") {\n input = input.substring(1);\n R = 8;\n }\n\n if (input === \"\") {\n return 0;\n }\n\n let regex = /[^0-7]/u;\n if (R === 10) {\n regex = /[^0-9]/u;\n }\n if (R === 16) {\n regex = /[^0-9A-Fa-f]/u;\n }\n\n if (regex.test(input)) {\n return failure;\n }\n\n return parseInt(input, R);\n}\n\nfunction parseIPv4(input: string) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length > 1) {\n parts.pop();\n }\n }\n\n if (parts.length > 4) {\n return failure;\n }\n\n const numbers = [];\n for (const part of parts) {\n const n = parseIPv4Number(part);\n if (n === failure) {\n return failure;\n }\n\n numbers.push(n);\n }\n\n for (let i = 0; i < numbers.length - 1; ++i) {\n if (numbers[i] > 255) {\n return failure;\n }\n }\n if (numbers[numbers.length - 1] >= 256 ** (5 - numbers.length)) {\n return failure;\n }\n\n let ipv4 = numbers.pop();\n let counter = 0;\n\n for (const n of numbers) {\n ipv4! += n * 256 ** (3 - counter);\n ++counter;\n }\n\n return ipv4;\n}\n\nfunction serializeIPv4(address: number) {\n let output = \"\";\n let n = address;\n\n for (let i = 1; i <= 4; ++i) {\n output = String(n % 256) + output;\n if (i !== 4) {\n output = `.${output}`;\n }\n n = Math.floor(n / 256);\n }\n\n return output;\n}\n\nfunction parseIPv6(inputArg: string) {\n const address = [0, 0, 0, 0, 0, 0, 0, 0];\n let pieceIndex = 0;\n let compress = null;\n let pointer = 0;\n\n const input = Array.from(inputArg, (c) => c.codePointAt(0));\n\n if (input[pointer] === p(\":\")) {\n if (input[pointer + 1] !== p(\":\")) {\n return failure;\n }\n\n pointer += 2;\n ++pieceIndex;\n compress = pieceIndex;\n }\n\n while (pointer < input.length) {\n if (pieceIndex === 8) {\n return failure;\n }\n\n if (input[pointer] === p(\":\")) {\n if (compress !== null) {\n return failure;\n }\n ++pointer;\n ++pieceIndex;\n compress = pieceIndex;\n continue;\n }\n\n let value = 0;\n let length = 0;\n\n while (length < 4 && isASCIIHex(input[pointer]!)) {\n value = value * 0x10 + parseInt(at(input, pointer)!, 16);\n ++pointer;\n ++length;\n }\n\n if (input[pointer] === p(\".\")) {\n if (length === 0) {\n return failure;\n }\n\n pointer -= length;\n\n if (pieceIndex > 6) {\n return failure;\n }\n\n let numbersSeen = 0;\n\n while (input[pointer] !== undefined) {\n let ipv4Piece = null;\n\n if (numbersSeen > 0) {\n if (input[pointer] === p(\".\") && numbersSeen < 4) {\n ++pointer;\n } else {\n return failure;\n }\n }\n\n if (!isASCIIDigit(input[pointer]!)) {\n return failure;\n }\n\n while (isASCIIDigit(input[pointer]!)) {\n const number = parseInt(at(input, pointer)!);\n if (ipv4Piece === null) {\n ipv4Piece = number;\n } else if (ipv4Piece === 0) {\n return failure;\n } else {\n ipv4Piece = ipv4Piece * 10 + number;\n }\n if (ipv4Piece > 255) {\n return failure;\n }\n ++pointer;\n }\n\n address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece!;\n\n ++numbersSeen;\n\n if (numbersSeen === 2 || numbersSeen === 4) {\n ++pieceIndex;\n }\n }\n\n if (numbersSeen !== 4) {\n return failure;\n }\n\n break;\n } else if (input[pointer] === p(\":\")) {\n ++pointer;\n if (input[pointer] === undefined) {\n return failure;\n }\n } else if (input[pointer] !== undefined) {\n return failure;\n }\n\n address[pieceIndex] = value;\n ++pieceIndex;\n }\n\n if (compress !== null) {\n let swaps = pieceIndex - compress;\n pieceIndex = 7;\n while (pieceIndex !== 0 && swaps > 0) {\n const temp = address[compress + swaps - 1];\n address[compress + swaps - 1] = address[pieceIndex];\n address[pieceIndex] = temp;\n --pieceIndex;\n --swaps;\n }\n } else if (compress === null && pieceIndex !== 8) {\n return failure;\n }\n\n return address;\n}\n\nfunction serializeIPv6(address: any[]) {\n let output = \"\";\n const compress = findLongestZeroSequence(address);\n let ignore0 = false;\n\n for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {\n if (ignore0 && address[pieceIndex] === 0) {\n continue;\n } else if (ignore0) {\n ignore0 = false;\n }\n\n if (compress === pieceIndex) {\n const separator = pieceIndex === 0 ? \"::\" : \":\";\n output += separator;\n ignore0 = true;\n continue;\n }\n\n output += address[pieceIndex].toString(16);\n\n if (pieceIndex !== 7) {\n output += \":\";\n }\n }\n\n return output;\n}\n\nfunction parseHost(input: string, isNotSpecialArg = false) {\n if (input[0] === \"[\") {\n if (input[input.length - 1] !== \"]\") {\n return failure;\n }\n\n return parseIPv6(input.substring(1, input.length - 1));\n }\n\n if (isNotSpecialArg) {\n return parseOpaqueHost(input);\n }\n\n const domain = utf8DecodeWithoutBOM(percentDecodeString(input));\n const asciiDomain = domainToASCII(domain);\n if (asciiDomain === failure) {\n return failure;\n }\n\n if (containsForbiddenDomainCodePoint(asciiDomain)) {\n return failure;\n }\n\n if (endsInANumber(asciiDomain)) {\n return parseIPv4(asciiDomain);\n }\n\n return asciiDomain;\n}\n\nfunction endsInANumber(input: string) {\n const parts = input.split(\".\");\n if (parts[parts.length - 1] === \"\") {\n if (parts.length === 1) {\n return false;\n }\n parts.pop();\n }\n\n const last = parts[parts.length - 1];\n if (parseIPv4Number(last) !== failure) {\n return true;\n }\n\n if (/^[0-9]+$/u.test(last)) {\n return true;\n }\n\n return false;\n}\n\nfunction parseOpaqueHost(input: string) {\n if (containsForbiddenHostCodePoint(input)) {\n return failure;\n }\n\n return utf8PercentEncodeString(input, isC0ControlPercentEncode);\n}\n\nfunction findLongestZeroSequence(arr: number[]) {\n let maxIdx = null;\n let maxLen = 1; // only find elements > 1\n let currStart = null;\n let currLen = 0;\n\n for (let i = 0; i < arr.length; ++i) {\n if (arr[i] !== 0) {\n if (currLen > maxLen) {\n maxIdx = currStart;\n maxLen = currLen;\n }\n\n currStart = null;\n currLen = 0;\n } else {\n if (currStart === null) {\n currStart = i;\n }\n ++currLen;\n }\n }\n\n // if trailing zeros\n if (currLen > maxLen) {\n return currStart;\n }\n\n return maxIdx;\n}\n\nfunction serializeHost(host: number | number[] | string) {\n if (typeof host === \"number\") {\n return serializeIPv4(host);\n }\n\n // IPv6 serializer\n if (host instanceof Array) {\n return `[${serializeIPv6(host)}]`;\n }\n\n return host;\n}\n\nimport { punycode } from \"./punycode.js\";\n\nfunction domainToASCII(domain: string, beStrict = false) {\n // const result = tr46.toASCII(domain, {\n // checkBidi: true,\n // checkHyphens: false,\n // checkJoiners: true,\n // useSTD3ASCIIRules: beStrict,\n // verifyDNSLength: beStrict,\n // });\n let result;\n try {\n result = punycode.toASCII(domain);\n } catch (e) {\n return failure;\n }\n if (result === null || result === \"\") {\n return failure;\n }\n return result;\n}\n\nfunction trimControlChars(url: string) {\n return url.replace(/^[\\u0000-\\u001F\\u0020]+|[\\u0000-\\u001F\\u0020]+$/gu, \"\");\n}\n\nfunction trimTabAndNewline(url: string) {\n return url.replace(/\\u0009|\\u000A|\\u000D/gu, \"\");\n}\n\nfunction shortenPath(url: UrlObj) {\n const { path } = url;\n if (path.length === 0) {\n return;\n }\n if (\n url.scheme === \"file\" &&\n path.length === 1 &&\n isNormalizedWindowsDriveLetter(path[0])\n ) {\n return;\n }\n\n path.pop();\n}\n\nfunction includesCredentials(url: UrlObj) {\n return url.username !== \"\" || url.password !== \"\";\n}\n\nfunction cannotHaveAUsernamePasswordPort(url: UrlObj) {\n return url.host === null || url.host === \"\" || url.scheme === \"file\";\n}\n\nfunction hasAnOpaquePath(url: UrlObj) {\n return typeof url.path === \"string\";\n}\n\nfunction isNormalizedWindowsDriveLetter(string: string) {\n return /^[A-Za-z]:$/u.test(string);\n}\n\nexport interface UrlObj {\n scheme: string;\n username: string;\n password: string;\n host: string | number[] | number | null | undefined;\n port: number | null;\n path: string[];\n query: any;\n fragment: any;\n}\n\nclass URLStateMachine {\n pointer: number;\n input: number[];\n base: any;\n encodingOverride: string;\n url: UrlObj;\n state: string;\n stateOverride: string;\n failure: boolean;\n parseError: boolean;\n buffer: string;\n atFlag: boolean;\n arrFlag: boolean;\n passwordTokenSeenFlag: boolean;\n\n constructor(\n input: string,\n base: any,\n encodingOverride: string,\n url: UrlObj,\n stateOverride: string,\n ) {\n this.pointer = 0;\n this.base = base || null;\n this.encodingOverride = encodingOverride || \"utf-8\";\n this.url = url;\n this.failure = false;\n this.parseError = false;\n\n if (!this.url) {\n this.url = {\n scheme: \"\",\n username: \"\",\n password: \"\",\n host: null,\n port: null,\n path: [],\n query: null,\n fragment: null,\n };\n\n const res = trimControlChars(input);\n if (res !== input) {\n this.parseError = true;\n }\n input = res;\n }\n\n const res = trimTabAndNewline(input);\n if (res !== input) {\n this.parseError = true;\n }\n input = res;\n\n this.state = stateOverride || \"scheme start\";\n\n this.buffer = \"\";\n this.atFlag = false;\n this.arrFlag = false;\n this.passwordTokenSeenFlag = false;\n\n this.input = Array.from(input, (c) => c.codePointAt(0)!);\n\n for (; this.pointer <= this.input.length; ++this.pointer) {\n const c = this.input[this.pointer];\n const cStr = isNaN(c) ? undefined : String.fromCodePoint(c);\n\n // exec state machine\n const ret = this.table[`parse ${this.state}`].call(this, c, cStr!);\n if (!ret) {\n break; // terminate algorithm\n } else if (ret === failure) {\n this.failure = true;\n break;\n }\n }\n }\n\n table = {\n \"parse scheme start\": this.parseSchemeStart,\n \"parse scheme\": this.parseScheme,\n \"parse no scheme\": this.parseNoScheme,\n \"parse special relative or authority\": this.parseSpecialRelativeOrAuthority,\n \"parse path or authority\": this.parsePathOrAuthority,\n \"parse relative\": this.parseRelative,\n \"parse relative slash\": this.parseRelativeSlash,\n \"parse special authority slashes\": this.parseSpecialAuthoritySlashes,\n \"parse special authority ignore slashes\":\n this.parseSpecialAuthorityIgnoreSlashes,\n \"parse authority\": this.parseAuthority,\n \"parse host\": this.parseHostName,\n \"parse hostname\": this.parseHostName /* intentional duplication */,\n \"parse port\": this.parsePort,\n \"parse file\": this.parseFile,\n \"parse file slash\": this.parseFileSlash,\n \"parse file host\": this.parseFileHost,\n \"parse path start\": this.parsePathStart,\n \"parse path\": this.parsePath,\n \"parse opaque path\": this.parseOpaquePath,\n \"parse query\": this.parseQuery,\n \"parse fragment\": this.parseFragment,\n } as { [x: string]: (c: number, cStr: string) => any };\n\n parseSchemeStart(c: number, cStr: string) {\n if (isASCIIAlpha(c)) {\n this.buffer += cStr.toLowerCase();\n this.state = \"scheme\";\n } else if (!this.stateOverride) {\n this.state = \"no scheme\";\n --this.pointer;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseScheme(c: number, cStr: string) {\n if (\n isASCIIAlphanumeric(c) ||\n c === p(\"+\") ||\n c === p(\"-\") ||\n c === p(\".\")\n ) {\n this.buffer += cStr.toLowerCase();\n } else if (c === p(\":\")) {\n if (this.stateOverride) {\n if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {\n return false;\n }\n\n if (\n (includesCredentials(this.url) || this.url.port !== null) &&\n this.buffer === \"file\"\n ) {\n return false;\n }\n\n if (this.url.scheme === \"file\" && this.url.host === \"\") {\n return false;\n }\n }\n this.url.scheme = this.buffer;\n if (this.stateOverride) {\n if (this.url.port === defaultPort(this.url.scheme)) {\n this.url.port = null;\n }\n return false;\n }\n this.buffer = \"\";\n if (this.url.scheme === \"file\") {\n if (\n this.input[this.pointer + 1] !== p(\"/\") ||\n this.input[this.pointer + 2] !== p(\"/\")\n ) {\n this.parseError = true;\n }\n this.state = \"file\";\n } else if (\n isSpecial(this.url) &&\n this.base !== null &&\n this.base.scheme === this.url.scheme\n ) {\n this.state = \"special relative or authority\";\n } else if (isSpecial(this.url)) {\n this.state = \"special authority slashes\";\n } else if (this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"path or authority\";\n ++this.pointer;\n } else {\n this.url.path = [\"\"];\n this.state = \"opaque path\";\n }\n } else if (!this.stateOverride) {\n this.buffer = \"\";\n this.state = \"no scheme\";\n this.pointer = -1;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseNoScheme(c: number) {\n if (this.base === null || (hasAnOpaquePath(this.base) && c !== p(\"#\"))) {\n return failure;\n } else if (hasAnOpaquePath(this.base) && c === p(\"#\")) {\n this.url.scheme = this.base.scheme;\n this.url.path = this.base.path;\n this.url.query = this.base.query;\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (this.base.scheme === \"file\") {\n this.state = \"file\";\n --this.pointer;\n } else {\n this.state = \"relative\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialRelativeOrAuthority(c: number) {\n if (c === p(\"/\") && this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"special authority ignore slashes\";\n ++this.pointer;\n } else {\n this.parseError = true;\n this.state = \"relative\";\n --this.pointer;\n }\n\n return true;\n }\n\n parsePathOrAuthority(c: number) {\n if (c === p(\"/\")) {\n this.state = \"authority\";\n } else {\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseRelative(c: number) {\n this.url.scheme = this.base.scheme;\n if (c === p(\"/\")) {\n this.state = \"relative slash\";\n } else if (isSpecial(this.url) && c === p(\"\\\\\")) {\n this.parseError = true;\n this.state = \"relative slash\";\n } else {\n this.url.username = this.base.username;\n this.url.password = this.base.password;\n this.url.host = this.base.host;\n this.url.port = this.base.port;\n this.url.path = this.base.path.slice();\n this.url.query = this.base.query;\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (!isNaN(c)) {\n this.url.query = null;\n this.url.path.pop();\n this.state = \"path\";\n --this.pointer;\n }\n }\n\n return true;\n }\n\n parseRelativeSlash(c: number) {\n if (isSpecial(this.url) && (c === p(\"/\") || c === p(\"\\\\\"))) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"special authority ignore slashes\";\n } else if (c === p(\"/\")) {\n this.state = \"authority\";\n } else {\n this.url.username = this.base.username;\n this.url.password = this.base.password;\n this.url.host = this.base.host;\n this.url.port = this.base.port;\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialAuthoritySlashes(c: number) {\n if (c === p(\"/\") && this.input[this.pointer + 1] === p(\"/\")) {\n this.state = \"special authority ignore slashes\";\n ++this.pointer;\n } else {\n this.parseError = true;\n this.state = \"special authority ignore slashes\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseSpecialAuthorityIgnoreSlashes(c: number) {\n if (c !== p(\"/\") && c !== p(\"\\\\\")) {\n this.state = \"authority\";\n --this.pointer;\n } else {\n this.parseError = true;\n }\n\n return true;\n }\n\n parseAuthority(c: number, cStr: string) {\n if (c === p(\"@\")) {\n this.parseError = true;\n if (this.atFlag) {\n this.buffer = `%40${this.buffer}`;\n }\n this.atFlag = true;\n\n // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars\n const len = countSymbols(this.buffer);\n for (let pointer = 0; pointer < len; ++pointer) {\n const codePoint = this.buffer.codePointAt(pointer);\n\n if (codePoint === p(\":\") && !this.passwordTokenSeenFlag) {\n this.passwordTokenSeenFlag = true;\n continue;\n }\n const encodedCodePoints = utf8PercentEncodeCodePoint(\n codePoint!,\n isUserinfoPercentEncode,\n );\n if (this.passwordTokenSeenFlag) {\n this.url.password += encodedCodePoints;\n } else {\n this.url.username += encodedCodePoints;\n }\n }\n this.buffer = \"\";\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n if (this.atFlag && this.buffer === \"\") {\n this.parseError = true;\n return failure;\n }\n this.pointer -= countSymbols(this.buffer) + 1;\n this.buffer = \"\";\n this.state = \"host\";\n } else {\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parseHostName(c: number, cStr: string) {\n if (this.stateOverride && this.url.scheme === \"file\") {\n --this.pointer;\n this.state = \"file host\";\n } else if (c === p(\":\") && !this.arrFlag) {\n if (this.buffer === \"\") {\n this.parseError = true;\n return failure;\n }\n\n if (this.stateOverride === \"hostname\") {\n return false;\n }\n\n const host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n\n this.url.host = host;\n this.buffer = \"\";\n this.state = \"port\";\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n --this.pointer;\n if (isSpecial(this.url) && this.buffer === \"\") {\n this.parseError = true;\n return failure;\n } else if (\n this.stateOverride &&\n this.buffer === \"\" &&\n (includesCredentials(this.url) || this.url.port !== null)\n ) {\n this.parseError = true;\n return false;\n }\n\n const host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n\n this.url.host = host;\n this.buffer = \"\";\n this.state = \"path start\";\n if (this.stateOverride) {\n return false;\n }\n } else {\n if (c === p(\"[\")) {\n this.arrFlag = true;\n } else if (c === p(\"]\")) {\n this.arrFlag = false;\n }\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parsePort(c: number, cStr: any) {\n if (isASCIIDigit(c)) {\n this.buffer += cStr;\n } else if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"?\") ||\n c === p(\"#\") ||\n (isSpecial(this.url) && c === p(\"\\\\\")) ||\n this.stateOverride\n ) {\n if (this.buffer !== \"\") {\n const port = parseInt(this.buffer);\n if (port > 2 ** 16 - 1) {\n this.parseError = true;\n return failure;\n }\n this.url.port = port === defaultPort(this.url.scheme) ? null : port;\n this.buffer = \"\";\n }\n if (this.stateOverride) {\n return false;\n }\n this.state = \"path start\";\n --this.pointer;\n } else {\n this.parseError = true;\n return failure;\n }\n\n return true;\n }\n\n parseFile(c: number) {\n this.url.scheme = \"file\";\n this.url.host = \"\";\n\n if (c === p(\"/\") || c === p(\"\\\\\")) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"file slash\";\n } else if (this.base !== null && this.base.scheme === \"file\") {\n this.url.host = this.base.host;\n this.url.path = this.base.path.slice();\n this.url.query = this.base.query;\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (!isNaN(c)) {\n this.url.query = null;\n if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {\n shortenPath(this.url);\n } else {\n this.parseError = true;\n this.url.path = [];\n }\n\n this.state = \"path\";\n --this.pointer;\n }\n } else {\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseFileSlash(c: number) {\n if (c === p(\"/\") || c === p(\"\\\\\")) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"file host\";\n } else {\n if (this.base !== null && this.base.scheme === \"file\") {\n if (\n !startsWithWindowsDriveLetter(this.input, this.pointer) &&\n isNormalizedWindowsDriveLetterString(this.base.path[0])\n ) {\n this.url.path.push(this.base.path[0]);\n }\n this.url.host = this.base.host;\n }\n this.state = \"path\";\n --this.pointer;\n }\n\n return true;\n }\n\n parseFileHost(c: number, cStr: string) {\n if (\n isNaN(c) ||\n c === p(\"/\") ||\n c === p(\"\\\\\") ||\n c === p(\"?\") ||\n c === p(\"#\")\n ) {\n --this.pointer;\n if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) {\n this.parseError = true;\n this.state = \"path\";\n } else if (this.buffer === \"\") {\n this.url.host = \"\";\n if (this.stateOverride) {\n return false;\n }\n this.state = \"path start\";\n } else {\n let host = parseHost(this.buffer, isNotSpecial(this.url));\n if (host === failure) {\n return failure;\n }\n if (host === \"localhost\") {\n host = \"\";\n }\n this.url.host = host as any;\n\n if (this.stateOverride) {\n return false;\n }\n\n this.buffer = \"\";\n this.state = \"path start\";\n }\n } else {\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parsePathStart(c: number) {\n if (isSpecial(this.url)) {\n if (c === p(\"\\\\\")) {\n this.parseError = true;\n }\n this.state = \"path\";\n\n if (c !== p(\"/\") && c !== p(\"\\\\\")) {\n --this.pointer;\n }\n } else if (!this.stateOverride && c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (!this.stateOverride && c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else if (c !== undefined) {\n this.state = \"path\";\n if (c !== p(\"/\")) {\n --this.pointer;\n }\n } else if (this.stateOverride && this.url.host === null) {\n this.url.path.push(\"\");\n }\n\n return true;\n }\n\n parsePath(c: number) {\n if (\n isNaN(c) ||\n c === p(\"/\") ||\n (isSpecial(this.url) && c === p(\"\\\\\")) ||\n (!this.stateOverride && (c === p(\"?\") || c === p(\"#\")))\n ) {\n if (isSpecial(this.url) && c === p(\"\\\\\")) {\n this.parseError = true;\n }\n\n if (isDoubleDot(this.buffer)) {\n shortenPath(this.url);\n if (c !== p(\"/\") && !(isSpecial(this.url) && c === p(\"\\\\\"))) {\n this.url.path.push(\"\");\n }\n } else if (\n isSingleDot(this.buffer) &&\n c !== p(\"/\") &&\n !(isSpecial(this.url) && c === p(\"\\\\\"))\n ) {\n this.url.path.push(\"\");\n } else if (!isSingleDot(this.buffer)) {\n if (\n this.url.scheme === \"file\" &&\n this.url.path.length === 0 &&\n isWindowsDriveLetterString(this.buffer)\n ) {\n this.buffer = `${this.buffer[0]}:`;\n }\n this.url.path.push(this.buffer);\n }\n this.buffer = \"\";\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n }\n if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n }\n } else {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.buffer += utf8PercentEncodeCodePoint(c, isPathPercentEncode);\n }\n\n return true;\n }\n\n parseOpaquePath(c: number) {\n if (c === p(\"?\")) {\n this.url.query = \"\";\n this.state = \"query\";\n } else if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n } else {\n // TODO: Add: not a URL code point\n if (!isNaN(c) && c !== p(\"%\")) {\n this.parseError = true;\n }\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n if (!isNaN(c)) {\n // @ts-ignore\n this.url.path += utf8PercentEncodeCodePoint(\n c,\n isC0ControlPercentEncode,\n );\n }\n }\n\n return true;\n }\n\n parseQuery(c: number, cStr: string) {\n if (\n !isSpecial(this.url) ||\n this.url.scheme === \"ws\" ||\n this.url.scheme === \"wss\"\n ) {\n this.encodingOverride = \"utf-8\";\n }\n\n if ((!this.stateOverride && c === p(\"#\")) || isNaN(c)) {\n const queryPercentEncodePredicate = isSpecial(this.url)\n ? isSpecialQueryPercentEncode\n : isQueryPercentEncode;\n this.url.query += utf8PercentEncodeString(\n this.buffer,\n queryPercentEncodePredicate,\n );\n\n this.buffer = \"\";\n\n if (c === p(\"#\")) {\n this.url.fragment = \"\";\n this.state = \"fragment\";\n }\n } else if (!isNaN(c)) {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.buffer += cStr;\n }\n\n return true;\n }\n\n parseFragment(c: number) {\n if (!isNaN(c)) {\n // TODO: If c is not a URL code point and not \"%\", parse error.\n if (\n c === p(\"%\") &&\n (!isASCIIHex(this.input[this.pointer + 1]) ||\n !isASCIIHex(this.input[this.pointer + 2]))\n ) {\n this.parseError = true;\n }\n\n this.url.fragment += utf8PercentEncodeCodePoint(\n c,\n isFragmentPercentEncode,\n );\n }\n\n return true;\n }\n}\n\nconst fileOtherwiseCodePoints = new Set([p(\"/\"), p(\"\\\\\"), p(\"?\"), p(\"#\")]);\n\nfunction startsWithWindowsDriveLetter(input: number[], pointer: number) {\n const length = input.length - pointer;\n return (\n length >= 2 &&\n isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) &&\n (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2]))\n );\n}\n\nfunction serializeURL(url: any, excludeFragment?: boolean) {\n let output = `${url.scheme}:`;\n if (url.host !== null) {\n output += \"//\";\n\n if (url.username !== \"\" || url.password !== \"\") {\n output += url.username;\n if (url.password !== \"\") {\n output += `:${url.password}`;\n }\n output += \"@\";\n }\n\n output += serializeHost(url.host);\n\n if (url.port !== null) {\n output += `:${url.port}`;\n }\n }\n\n if (\n url.host === null &&\n !hasAnOpaquePath(url) &&\n url.path.length > 1 &&\n url.path[0] === \"\"\n ) {\n output += \"/.\";\n }\n output += serializePath(url);\n\n if (url.query !== null) {\n output += `?${url.query}`;\n }\n\n if (!excludeFragment && url.fragment !== null) {\n output += `#${url.fragment}`;\n }\n\n return output;\n}\n\nfunction serializeOrigin(tuple: {\n scheme: string;\n port: number;\n host: number | number[] | string;\n}) {\n let result = `${tuple.scheme}://`;\n result += serializeHost(tuple.host);\n\n if (tuple.port !== null) {\n result += `:${tuple.port}`;\n }\n\n return result;\n}\n\nfunction serializePath(url: UrlObj): string {\n if (typeof url.path === \"string\") {\n return url.path;\n }\n\n let output = \"\";\n for (const segment of url.path) {\n output += `/${segment}`;\n }\n return output;\n}\n\nfunction serializeURLOrigin(url: any): any {\n // https://url.spec.whatwg.org/#concept-url-origin\n switch (url.scheme) {\n case \"blob\":\n try {\n return serializeURLOrigin(parseURL(serializePath(url)));\n } catch (e) {\n // serializing an opaque origin returns \"null\"\n return \"null\";\n }\n case \"ftp\":\n case \"http\":\n case \"https\":\n case \"ws\":\n case \"wss\":\n return serializeOrigin({\n scheme: url.scheme,\n host: url.host,\n port: url.port,\n });\n case \"file\":\n // The spec says:\n // > Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.\n // Browsers tested so far:\n // - Chrome says \"file://\", but treats file: URLs as cross-origin for most (all?) purposes; see e.g.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=37586\n // - Firefox says \"null\", but treats file: URLs as same-origin sometimes based on directory stuff; see\n // https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs\n return \"null\";\n default:\n // serializing an opaque origin returns \"null\"\n return \"null\";\n }\n}\n\nexport function basicURLParse(input: string, options?: any) {\n if (options === undefined) {\n options = {};\n }\n\n const usm = new URLStateMachine(\n input,\n options.baseURL,\n options.encodingOverride,\n options.url,\n options.stateOverride,\n );\n\n if (usm.failure) {\n return null;\n }\n\n return usm.url;\n}\n\nfunction setTheUsername(url: UrlObj, username: string) {\n url.username = utf8PercentEncodeString(username, isUserinfoPercentEncode);\n}\n\nfunction setThePassword(url: UrlObj, password: string) {\n url.password = utf8PercentEncodeString(password, isUserinfoPercentEncode);\n}\n\nfunction serializeInteger(integer: number) {\n return String(integer);\n}\n\nfunction parseURL(\n input: any,\n options?: { baseURL?: any; encodingOverride?: any },\n) {\n if (options === undefined) {\n options = {};\n }\n\n // We don't handle blobs, so this just delegates:\n return basicURLParse(input, {\n baseURL: options.baseURL,\n encodingOverride: options.encodingOverride,\n });\n}\n\nexport class URLImpl {\n //Include URL type for \"url\" and \"base\" params.\n constructor(url: string | URL, base?: string | URL) {\n let parsedBase = null;\n if (base !== undefined) {\n if (base instanceof URL) {\n base = base.href;\n }\n parsedBase = basicURLParse(base);\n if (parsedBase === null) {\n throw new TypeError(`Invalid base URL: ${base}`);\n }\n }\n\n if (url instanceof URL) {\n url = url.href;\n }\n const parsedURL = basicURLParse(url, { baseURL: parsedBase });\n if (parsedURL === null) {\n throw new TypeError(`Invalid URL: ${url}`);\n }\n\n const query = parsedURL.query !== null ? parsedURL.query : \"\";\n\n this._url = parsedURL;\n\n // We cannot invoke the \"new URLSearchParams object\" algorithm without going through the constructor, which strips\n // question mark by default. Therefore the doNotStripQMark hack is used.\n this._query = new URLSearchParamsImpl(query, {\n doNotStripQMark: true,\n });\n this._query._url = this;\n }\n\n get href() {\n return serializeURL(this._url);\n }\n\n set href(v) {\n const parsedURL = basicURLParse(v);\n if (parsedURL === null) {\n throw new TypeError(`Invalid URL: ${v}`);\n }\n\n this._url = parsedURL;\n\n this._query._list.splice(0);\n const { query } = parsedURL;\n if (query !== null) {\n this._query._list = parseUrlencodedString(query);\n }\n }\n\n get origin() {\n return serializeURLOrigin(this._url);\n }\n\n get protocol() {\n return `${this._url.scheme}:`;\n }\n\n set protocol(v) {\n basicURLParse(`${v}:`, {\n url: this._url,\n stateOverride: \"scheme start\",\n });\n }\n\n get username() {\n return this._url.username;\n }\n\n set username(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n setTheUsername(this._url, v);\n }\n\n get password() {\n return this._url.password;\n }\n\n set password(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n setThePassword(this._url, v);\n }\n\n get host() {\n const url = this._url;\n\n if (url.host === null) {\n return \"\";\n }\n\n if (url.port === null) {\n return serializeHost(url.host);\n }\n\n return `${serializeHost(url.host)}:${serializeInteger(url.port)}`;\n }\n\n set host(v) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n basicURLParse(v, { url: this._url, stateOverride: \"host\" });\n }\n\n get hostname() {\n if (this._url.host === null) {\n return \"\";\n }\n\n return serializeHost(this._url.host);\n }\n\n set hostname(v) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n basicURLParse(v, { url: this._url, stateOverride: \"hostname\" });\n }\n\n get port() {\n if (this._url.port === null) {\n return \"\";\n }\n\n return serializeInteger(this._url.port);\n }\n\n set port(v) {\n if (cannotHaveAUsernamePasswordPort(this._url)) {\n return;\n }\n\n if (v === \"\") {\n this._url.port = null;\n } else {\n basicURLParse(v, { url: this._url, stateOverride: \"port\" });\n }\n }\n\n get pathname() {\n return serializePath(this._url);\n }\n\n set pathname(v: string) {\n if (hasAnOpaquePath(this._url)) {\n return;\n }\n\n this._url.path = [];\n basicURLParse(v, { url: this._url, stateOverride: \"path start\" });\n }\n\n get search() {\n if (this._url.query === null || this._url.query === \"\") {\n return \"\";\n }\n\n return `?${this._url.query}`;\n }\n\n set search(v) {\n const url = this._url;\n\n if (v === \"\") {\n url.query = null;\n this._query._list = [];\n return;\n }\n\n const input = v[0] === \"?\" ? v.substring(1) : v;\n url.query = \"\";\n basicURLParse(input, { url, stateOverride: \"query\" });\n this._query._list = parseUrlencodedString(input);\n }\n\n get searchParams() {\n return this._query;\n }\n\n get hash() {\n if (this._url.fragment === null || this._url.fragment === \"\") {\n return \"\";\n }\n\n return `#${this._url.fragment}`;\n }\n\n set hash(v) {\n if (v === \"\") {\n this._url.fragment = null;\n return;\n }\n\n const input = v[0] === \"#\" ? v.substring(1) : v;\n this._url.fragment = \"\";\n basicURLParse(input, { url: this._url, stateOverride: \"fragment\" });\n }\n\n toJSON() {\n return this.href;\n }\n\n // FIXME: type!\n _url: any;\n _query: any;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2020 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { URLImpl, URLSearchParamsImpl } from \"./whatwg-url.js\";\n\ninterface URL {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n toString(): string;\n readonly origin: string;\n password: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n readonly searchParams: URLSearchParams;\n username: string;\n toJSON(): string;\n}\n\ninterface URLSearchParams {\n append(name: string, value: string): void;\n delete(name: string): void;\n get(name: string): string | null;\n getAll(name: string): string[];\n has(name: string): boolean;\n set(name: string, value: string): void;\n sort(): void;\n toString(): string;\n forEach(\n callbackfn: (value: string, key: string, parent: URLSearchParams) => void,\n thisArg?: any,\n ): void;\n entries(): IterableIterator<[string, string]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n [Symbol.iterator](): IterableIterator<[string, string]>;\n}\n\nexport interface URLSearchParamsCtor {\n new (\n init?:\n | URLSearchParams\n | string\n | Record>\n | Iterable<[string, string]>\n | ReadonlyArray<[string, string]>,\n ): URLSearchParams;\n}\n\nexport interface URLCtor {\n new (url: string, base?: string | URL): URL;\n}\n\n// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis\n(function () {\n if (typeof globalThis === \"object\") return;\n Object.defineProperty(Object.prototype, \"__magic__\", {\n get: function () {\n return this;\n },\n configurable: true, // This makes it possible to `delete` the getter later.\n });\n // @ts-ignore: polyfill magic\n __magic__.globalThis = __magic__; // lolwat\n // @ts-ignore: polyfill magic\n delete Object.prototype.__magic__;\n})();\n\n// Use native or pure JS URL implementation?\nconst useOwnUrlImp = true;\n\n// @ts-ignore\nlet _URL = globalThis.URL;\nif (useOwnUrlImp || !_URL) {\n // @ts-ignore\n globalThis.URL = _URL = URLImpl;\n // @ts-ignore\n _URL = URLImpl;\n}\n\nexport const URL = _URL;\n\n// @ts-ignore\nlet _URLSearchParams = globalThis.URLSearchParams;\n\nif (useOwnUrlImp || !_URLSearchParams) {\n // @ts-ignore\n globalThis.URLSearchParams = URLSearchParamsImpl;\n // @ts-ignore\n _URLSearchParams = URLSearchParamsImpl;\n}\n\nexport const URLSearchParams: URLSearchParamsCtor = _URLSearchParams;\n", "/*\n This file is part of TALER\n (C) 2016 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Small helper functions that don't fit anywhere else.\n */\n\n/**\n * Imports.\n */\nimport { AmountJson } from \"./amounts.js\";\nimport * as Amounts from \"./amounts.js\";\nimport { URL } from \"./url.js\";\n\n/**\n * Show an amount in a form suitable for the user.\n * FIXME: In the future, this should consider currency-specific\n * settings such as significant digits or currency symbols.\n */\nexport function amountToPretty(amount: AmountJson): string {\n const x = amount.value + amount.fraction / Amounts.amountFractionalBase;\n return `${x} ${amount.currency}`;\n}\n\n/**\n * Canonicalize a base url, typically for the exchange.\n *\n * See http://api.taler.net/wallet.html#general\n */\nexport function canonicalizeBaseUrl(url: string): string {\n if (!url.startsWith(\"http\") && !url.startsWith(\"https\")) {\n url = \"https://\" + url;\n }\n const x = new URL(url);\n if (!x.pathname.endsWith(\"/\")) {\n x.pathname = x.pathname + \"/\";\n }\n x.search = \"\";\n x.hash = \"\";\n return x.href;\n}\n\n/**\n * Convert object to JSON with canonical ordering of keys\n * and whitespace omitted.\n *\n * See RFC 4885 (https://tools.ietf.org/html/rfc8785).\n */\nexport function canonicalJson(obj: any): string {\n // Check for cycles, etc.\n obj = JSON.parse(JSON.stringify(obj));\n if (typeof obj === \"string\") {\n return JSON.stringify(obj);\n }\n if (typeof obj === \"number\" || typeof obj === \"boolean\" || obj === null) {\n return JSON.stringify(obj);\n }\n if (Array.isArray(obj)) {\n const objs: string[] = obj.map((e) => canonicalJson(e));\n return `[${objs.join(\",\")}]`;\n }\n const keys: string[] = [];\n for (const key in obj) {\n keys.push(key);\n }\n keys.sort();\n let s = \"{\";\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n s += JSON.stringify(key) + \":\" + canonicalJson(obj[key]);\n if (i !== keys.length - 1) {\n s += \",\";\n }\n }\n return s + \"}\";\n}\n\n/**\n * Lexically compare two strings.\n */\nexport function strcmp(s1: string, s2: string): -1 | 0 | 1 {\n if (s1 < s2) {\n return -1;\n }\n if (s1 > s2) {\n return 1;\n }\n return 0;\n}\n\n/**\n * Shorthand function for formatted JSON stringification.\n */\nexport function j2s(x: any): string {\n return JSON.stringify(x, undefined, 2);\n}\n\n/**\n * Use this to filter null or undefined from an array in a type-safe fashion\n *\n * example:\n * const array: Array = [undefined, null]\n * const filtered: Array = array.filter(notEmpty)\n *\n * @param value\n * @returns\n */\nexport function notEmpty(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Safe function to stringify errors.\n */\nexport function stringifyError(x: any): string {\n if (typeof x === \"undefined\") {\n return \"\";\n }\n if (x === null) {\n return ``;\n }\n if (typeof x === \"object\") {\n return x.toString();\n }\n return ``;\n}\n", "/*\n This file is part of TALER\n (C) 2019 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Check if we are running under nodejs.\n */\n\nconst isNode =\n typeof process !== \"undefined\" &&\n typeof process.release !== \"undefined\" &&\n process.release.name === \"node\";\n\nexport enum LogLevel {\n Trace = \"trace\",\n Message = \"message\",\n Info = \"info\",\n Warn = \"warn\",\n Error = \"error\",\n None = \"none\",\n}\n\nlet globalLogLevel = LogLevel.Info;\nconst byTagLogLevel: Record = {};\n\nlet nativeLogging: boolean = false;\n\n// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/toString\nError.prototype.toString = function () {\n if (\n this === null ||\n (typeof this !== \"object\" && typeof this !== \"function\")\n ) {\n throw new TypeError();\n }\n let name = this.name;\n name = name === undefined ? \"Error\" : `${name}`;\n let msg = this.message;\n msg = msg === undefined ? \"\" : `${msg}`;\n\n let cause = \"\";\n if (\"cause\" in this) {\n cause = `\\n Caused by: ${this.cause}`;\n }\n return `${name}: ${msg}${cause}`;\n};\n\nexport function getGlobalLogLevel(): string {\n return globalLogLevel;\n}\n\nexport function setGlobalLogLevelFromString(logLevelStr: string): void {\n globalLogLevel = getLevelForString(logLevelStr);\n}\n\nexport function setLogLevelFromString(tag: string, logLevelStr: string): void {\n byTagLogLevel[tag] = getLevelForString(logLevelStr);\n}\n\nexport function enableNativeLogging() {\n nativeLogging = true;\n}\n\nfunction getLevelForString(logLevelStr: string): LogLevel {\n switch (logLevelStr.toLowerCase()) {\n case \"trace\":\n return LogLevel.Trace;\n case \"info\":\n return LogLevel.Info;\n case \"warn\":\n case \"warning\":\n return LogLevel.Warn;\n case \"error\":\n return LogLevel.Error;\n case \"none\":\n return LogLevel.None;\n default:\n if (isNode) {\n process.stderr.write(`Invalid log level, defaulting to WARNING\\n`);\n } else {\n console.warn(`Invalid log level, defaulting to WARNING`);\n }\n return LogLevel.Warn;\n }\n}\n\nfunction writeNativeLog(\n message: any,\n tag: string,\n level: number,\n args: any[],\n): void {\n const logFn = (globalThis as any).__nativeLog;\n if (logFn) {\n let m: string;\n if (args.length == 0) {\n m = message;\n } else {\n m = message + \" \" + args.toString();\n }\n logFn(level, tag, message);\n }\n}\n\nfunction writeNodeLog(\n message: any,\n tag: string,\n level: string,\n args: any[],\n): void {\n try {\n let msg = `${new Date().toISOString()} ${tag} ${level} ${message}`;\n if (args.length != 0) {\n msg += ` ${JSON.stringify(args, undefined, 2)}\\n`;\n } else {\n msg += `\\n`;\n }\n process.stderr.write(msg);\n } catch (e) {\n // This can happen when we're trying to log something that doesn't want to be\n // converted to a string.\n let msg = `${new Date().toISOString()} (logger) FATAL `;\n if (e instanceof Error) {\n msg += `failed to write log: ${e.message}\\n`;\n } else {\n msg += \"failed to write log\\n\";\n }\n process.stderr.write(msg);\n }\n}\n\n/**\n * Logger that writes to stderr when running under node,\n * and uses the corresponding console.* method to log in the browser.\n */\nexport class Logger {\n constructor(private tag: string) {}\n\n shouldLogTrace(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n return true;\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogInfo(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n return true;\n case LogLevel.Warn:\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogWarn(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n return true;\n case LogLevel.Error:\n case LogLevel.None:\n return false;\n }\n }\n\n shouldLogError(): boolean {\n const level = byTagLogLevel[this.tag] ?? globalLogLevel;\n switch (level) {\n case LogLevel.Trace:\n case LogLevel.Message:\n case LogLevel.Info:\n case LogLevel.Warn:\n case LogLevel.Error:\n return true;\n case LogLevel.None:\n return false;\n }\n }\n\n info(message: string, ...args: any[]): void {\n if (!this.shouldLogInfo()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 2, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"INFO\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} INFO ` + message,\n ...args,\n );\n }\n }\n\n warn(message: string, ...args: any[]): void {\n if (!this.shouldLogWarn()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 3, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"WARN\", args);\n } else {\n console.warn(\n `${new Date().toISOString()} ${this.tag} INFO ` + message,\n ...args,\n );\n }\n }\n\n error(message: string, ...args: any[]): void {\n if (!this.shouldLogError()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 4, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"ERROR\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} ERROR ` + message,\n ...args,\n );\n }\n }\n\n trace(message: string, ...args: any[]): void {\n if (!this.shouldLogTrace()) {\n return;\n }\n if (nativeLogging) {\n writeNativeLog(message, this.tag, 1, args);\n return;\n }\n if (isNode) {\n writeNodeLog(message, this.tag, \"TRACE\", args);\n } else {\n console.info(\n `${new Date().toISOString()} ${this.tag} TRACE ` + message,\n ...args,\n );\n }\n }\n\n reportBreak(): void {\n if (!this.shouldLogError()) {\n return;\n }\n const location = new Error(\"programming error\");\n this.error(`assertion failed: ${location.stack}`);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2018-2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { j2s } from \"./helpers.js\";\nimport { Logger } from \"./logging.js\";\n\n/**\n * Type-safe codecs for converting from/to JSON.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\n\nconst logger = new Logger(\"codec.ts\");\n\n/**\n * Error thrown when decoding fails.\n */\nexport class DecodingError extends Error {\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, DecodingError.prototype);\n this.name = \"DecodingError\";\n }\n}\n\n/**\n * Context information to show nicer error messages when decoding fails.\n */\nexport interface Context {\n readonly path?: string[];\n}\n\nexport function renderContext(c?: Context): string {\n const p = c?.path;\n if (p) {\n return p.join(\".\");\n } else {\n return \"(unknown)\";\n }\n}\n\nfunction joinContext(c: Context | undefined, part: string): Context {\n const path = c?.path ?? [];\n return {\n path: path.concat([part]),\n };\n}\n\n/**\n * A codec converts untyped JSON to a typed object.\n */\nexport interface Codec {\n /**\n * Decode untyped JSON to an object of type [[V]].\n */\n readonly decode: (x: any, c?: Context) => V;\n}\n\ntype SingletonRecord = { [Y in K]: V };\n\ninterface Prop {\n name: string;\n codec: Codec;\n}\n\ninterface Alternative {\n tagValue: any;\n codec: Codec;\n}\n\nclass ObjectCodecBuilder {\n private propList: Prop[] = [];\n\n /**\n * Define a property for the object.\n */\n property(\n x: K,\n codec: Codec,\n ): ObjectCodecBuilder> {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.propList.push({ name: x, codec: codec });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(objectDisplayName: string): Codec {\n const propList = this.propList;\n return {\n decode(x: any, c?: Context): PartialOutputType {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n if (typeof x !== \"object\") {\n throw new DecodingError(\n `expected object for ${objectDisplayName} at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n const obj: any = {};\n for (const prop of propList) {\n const propRawVal = x[prop.name];\n const propVal = prop.codec.decode(\n propRawVal,\n joinContext(c, prop.name),\n );\n obj[prop.name] = propVal;\n }\n return obj as PartialOutputType;\n },\n };\n }\n}\n\nclass UnionCodecBuilder<\n TargetType,\n TagPropertyLabel extends keyof TargetType,\n CommonBaseType,\n PartialTargetType,\n> {\n private alternatives = new Map();\n\n constructor(\n private discriminator: TagPropertyLabel,\n private baseCodec?: Codec,\n ) { }\n\n /**\n * Define a property for the object.\n */\n alternative(\n tagValue: TargetType[TagPropertyLabel],\n codec: Codec,\n ): UnionCodecBuilder<\n TargetType,\n TagPropertyLabel,\n CommonBaseType,\n PartialTargetType | V\n > {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.alternatives.set(tagValue, { codec, tagValue });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(\n objectDisplayName: string,\n ): Codec {\n const alternatives = this.alternatives;\n const discriminator = this.discriminator;\n const baseCodec = this.baseCodec;\n return {\n decode(x: any, c?: Context): R {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n const d = x[discriminator];\n if (d === undefined) {\n throw new DecodingError(\n `expected tag for ${objectDisplayName} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const alt = alternatives.get(d);\n if (!alt) {\n throw new DecodingError(\n `unknown tag for ${objectDisplayName} ${d} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const altDecoded = alt.codec.decode(x);\n if (baseCodec) {\n const baseDecoded = baseCodec.decode(x, c);\n return { ...baseDecoded, ...altDecoded };\n } else {\n return altDecoded;\n }\n },\n };\n }\n}\n\nexport class UnionCodecPreBuilder {\n discriminateOn(\n discriminator: D,\n baseCodec?: Codec,\n ): UnionCodecBuilder {\n return new UnionCodecBuilder(discriminator, baseCodec);\n }\n}\n\n/**\n * Return a builder for a codec that decodes an object with properties.\n */\nexport function buildCodecForObject(): ObjectCodecBuilder {\n return new ObjectCodecBuilder();\n}\n\nexport function buildCodecForUnion(): UnionCodecPreBuilder {\n return new UnionCodecPreBuilder();\n}\n\n/**\n * Return a codec for a mapping from a string to values described by the inner codec.\n */\nexport function codecForMap(\n innerCodec: Codec,\n): Codec<{ [x: string]: T }> {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): { [x: string]: T } {\n const map: { [x: string]: T } = {};\n if (typeof x !== \"object\") {\n throw new DecodingError(`expected object at ${renderContext(c)}`);\n }\n for (const i in x) {\n map[i] = innerCodec.decode(x[i], joinContext(c, `[${i}]`));\n }\n return map;\n },\n };\n}\n\n/**\n * Return a codec for a list, containing values described by the inner codec.\n */\nexport function codecForList(innerCodec: Codec): Codec {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): T[] {\n const arr: T[] = [];\n if (!Array.isArray(x)) {\n throw new DecodingError(`expected array at ${renderContext(c)}`);\n }\n for (const i in x) {\n arr.push(innerCodec.decode(x[i], joinContext(c, `[${i}]`)));\n }\n return arr;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForNumber(): Codec {\n return {\n decode(x: any, c?: Context): number {\n if (typeof x === \"number\") {\n return x;\n }\n throw new DecodingError(\n `expected number at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForBoolean(): Codec {\n return {\n decode(x: any, c?: Context): boolean {\n if (typeof x === \"boolean\") {\n return x;\n }\n throw new DecodingError(\n `expected boolean at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForString(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n return x;\n }\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForStringURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return x;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): URL {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return url;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Codec that allows any value.\n */\nexport function codecForAny(): Codec {\n return {\n decode(x: any, c?: Context): any {\n return x;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForConstString(s: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === s) {\n return x;\n }\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got string value \"${x}\"`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstTrue(): Codec {\n return {\n decode(x: any, c?: Context): true {\n if (x === true) {\n return x;\n }\n throw new DecodingError(\n `expected boolean true at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstFalse(): Codec {\n return {\n decode(x: any, c?: Context): false {\n if (x === false) {\n return x;\n }\n throw new DecodingError(\n `expected boolean false at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a constant number.\n */\nexport function codecForConstNumber(n: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === n) {\n return x;\n }\n throw new DecodingError(\n `expected number constant \"${n}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n },\n };\n}\n\nexport function codecOptional(innerCodec: Codec): Codec {\n return {\n decode(x: any, c?: Context): V | undefined {\n if (x === undefined || x === null) {\n return undefined;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport function codecOptionalDefault(innerCodec: Codec, def: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === undefined || x === null) {\n return def;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport function codecForLazy(innerCodec: () => Codec): Codec {\n let instance: Codec | undefined = undefined\n return {\n decode(x: any, c?: Context): V {\n if (instance === undefined) {\n instance = innerCodec()\n }\n return instance.decode(x, c);\n },\n };\n}\n\n\nexport type CodecType = T extends Codec ? X : any;\n\nexport function codecForEither>>(\n ...alts: [...T]\n): Codec> {\n return {\n decode(x: any, c?: Context): any {\n for (const alt of alts) {\n try {\n return alt.decode(x, c);\n } catch (e) {\n continue;\n }\n }\n if (logger.shouldLogTrace()) {\n logger.trace(`offending value: ${j2s(x)}`);\n }\n throw new DecodingError(\n `No alternative matched at at ${renderContext(c)}`,\n );\n },\n };\n}\n", "/**\n * Hypertext Transfer Protocol (HTTP) response status codes.\n *\n * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}\n */\nexport enum HttpStatusCode {\n /**\n * The server has received the request headers and the client should proceed to send the request body\n * (in the case of a request for which a body needs to be sent; for example, a POST request).\n * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.\n * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request\n * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.\n */\n Continue = 100,\n\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SwitchingProtocols = 101,\n\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n * This prevents the client from timing out and assuming the request was lost.\n */\n Processing = 102,\n\n /**\n * Standard response for successful HTTP requests.\n * The actual response will depend on the request method used.\n * In a GET request, the response will contain an entity corresponding to the requested resource.\n * In a POST request, the response will contain an entity describing or containing the result of the action.\n */\n Ok = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n Created = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n Accepted = 202,\n\n /**\n * SINCE HTTP/1.1\n * The server is a transforming proxy that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NonAuthoritativeInformation = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NoContent = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n ResetContent = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.\n * The range header is used by HTTP clients to enable resuming of interrupted downloads,\n * or split a download into multiple simultaneous streams.\n */\n PartialContent = 206,\n\n /**\n * The message body that follows is an XML message and can contain a number of separate response codes,\n * depending on how many sub-requests were made.\n */\n MultiStatus = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,\n * and are not being included again.\n */\n AlreadyReported = 208,\n\n /**\n * The server has fulfilled a request for the resource,\n * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\n */\n ImUsed = 226,\n\n /**\n * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).\n * For example, this code could be used to present multiple video format options,\n * to list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MultipleChoices = 300,\n\n /**\n * This and all future requests should be directed to the given URI.\n */\n MovedPermanently = 301,\n\n /**\n * This is an example of industry practice contradicting the standard.\n * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect\n * (the original describing phrase was \"Moved Temporarily\"), but popular browsers implemented 302\n * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307\n * to distinguish between the two behaviours. However, some Web applications and frameworks\n * use the 302 status code as if it were the 303.\n */\n Found = 302,\n\n /**\n * SINCE HTTP/1.1\n * The response to the request can be found under another URI using a GET method.\n * When received in response to a POST (or PUT/DELETE), the client should presume that\n * the server has received the data and should issue a redirect with a separate GET message.\n */\n SeeOther = 303,\n\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\n * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.\n */\n NotModified = 304,\n\n /**\n * SINCE HTTP/1.1\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.\n */\n UseProxy = 305,\n\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\"\n */\n SwitchProxy = 306,\n\n /**\n * SINCE HTTP/1.1\n * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\n * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.\n * For example, a POST request should be repeated using another POST request.\n */\n TemporaryRedirect = 307,\n\n /**\n * The request and all future requests should be repeated using another URI.\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PermanentRedirect = 308,\n\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).\n */\n BadRequest = 400,\n\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet\n * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means\n * \"unauthenticated\",i.e. the user does not have the necessary credentials.\n */\n Unauthorized = 401,\n\n /**\n * Reserved for future use. The original intention was that this code might be used as part of some form of digital\n * cash or micro payment scheme, but that has not happened, and this code is not usually used.\n * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.\n */\n PaymentRequired = 402,\n\n /**\n * The request was valid, but the server is refusing action.\n * The user might not have the necessary permissions for a resource.\n */\n Forbidden = 403,\n\n /**\n * The requested resource could not be found but may be available in the future.\n * Subsequent requests by the client are permissible.\n */\n NotFound = 404,\n\n /**\n * A request method is not supported for the requested resource;\n * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.\n */\n MethodNotAllowed = 405,\n\n /**\n * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.\n */\n NotAcceptable = 406,\n\n /**\n * The client must first authenticate itself with the proxy.\n */\n ProxyAuthenticationRequired = 407,\n\n /**\n * The server timed out waiting for the request.\n * According to HTTP specifications:\n * \"The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.\"\n */\n RequestTimeout = 408,\n\n /**\n * Indicates that the request could not be processed because of conflict in the request,\n * such as an edit conflict between multiple simultaneous updates.\n */\n Conflict = 409,\n\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n * This should be used when a resource has been intentionally removed and the resource should be purged.\n * Upon receiving a 410 status code, the client should not request the resource in the future.\n * Clients such as search engines should remove the resource from their indices.\n * Most use cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may be used instead.\n */\n Gone = 410,\n\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LengthRequired = 411,\n\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PreconditionFailed = 412,\n\n /**\n * The request is larger than the server is willing or able to process. Previously called \"Request Entity Too Large\".\n */\n PayloadTooLarge = 413,\n\n /**\n * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,\n * in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n UriTooLong = 414,\n\n /**\n * The request entity has a media type which the server or resource does not support.\n * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.\n */\n UnsupportedMediaType = 415,\n\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RangeNotSatisfiable = 416,\n\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n ExpectationFailed = 417,\n\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,\n * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by\n * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.\n */\n IAmATeapot = 418,\n\n /**\n * The request was directed at a server that is not able to produce a response (for example because a connection reuse).\n */\n MisdirectedRequest = 421,\n\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UnprocessableEntity = 422,\n\n /**\n * The resource that is being accessed is locked.\n */\n Locked = 423,\n\n /**\n * The request failed due to failure of a previous request (e.g., a PROPPATCH).\n */\n FailedDependency = 424,\n\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UpgradeRequired = 426,\n\n /**\n * The origin server requires the request to be conditional.\n * Intended to prevent \"the 'lost update' problem, where a client\n * GETs a resource's state, modifies it, and PUTs it back to the server,\n * when meanwhile a third party has modified the state on the server, leading to a conflict.\"\n */\n PreconditionRequired = 428,\n\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TooManyRequests = 429,\n\n /**\n * The server is unwilling to process the request because either an individual header field,\n * or all the header fields collectively, are too large.\n */\n RequestHeaderFieldsTooLarge = 431,\n\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources\n * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UnavailableForLegalReasons = 451,\n\n /**\n * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\n */\n InternalServerError = 500,\n\n /**\n * The server either does not recognize the request method, or it lacks the ability to fulfill the request.\n * Usually this implies future availability (e.g., a new feature of a web-service API).\n */\n NotImplemented = 501,\n\n /**\n * The server was acting as a gateway or proxy and received an invalid response from the upstream server.\n */\n BadGateway = 502,\n\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n ServiceUnavailable = 503,\n\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\n */\n GatewayTimeout = 504,\n\n /**\n * The server does not support the HTTP protocol version used in the request\n */\n HttpVersionNotSupported = 505,\n\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VariantAlsoNegotiates = 506,\n\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n InsufficientStorage = 507,\n\n /**\n * The server detected an infinite loop while processing the request.\n */\n LoopDetected = 508,\n\n /**\n * Further extensions to the request are required for the server to fulfill it.\n */\n NotExtended = 510,\n\n /**\n * The client needs to authenticate to gain network access.\n * Intended for use by intercepting proxies used to control access to the network (e.g., \"captive portals\" used\n * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).\n */\n NetworkAuthenticationRequired = 511,\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL3.0-or-later\n*/\n\n/**\n * Imports.\n */\nimport {\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n} from \"./http.js\";\n\n/**\n * Implementation of the HTTP request library interface for node.\n */\nexport class HttpLibImpl implements HttpRequestLibrary {\n fetch(\n url: string,\n opt?: HttpRequestOptions | undefined,\n ): Promise {\n throw new Error(\"Method not implemented.\");\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for relative and absolute time.\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, renderContext } from \"./codec.js\";\n\ndeclare const flavor_AbsoluteTime: unique symbol;\ndeclare const flavor_TalerProtocolTimestamp: unique symbol;\ndeclare const flavor_TalerPreciseTimestamp: unique symbol;\n\nconst opaque_AbsoluteTime: unique symbol = Symbol(\"opaque_AbsoluteTime\");\n\n// FIXME: Make this opaque!\nexport interface AbsoluteTime {\n /**\n * Timestamp in milliseconds.\n */\n readonly t_ms: number | \"never\";\n\n readonly _flavor?: typeof flavor_AbsoluteTime;\n\n // Make the type opaque, we only want our constructors\n // to able to create an AbsoluteTime value.\n [opaque_AbsoluteTime]: true;\n}\n\nexport interface TalerProtocolTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n readonly _flavor?: typeof flavor_TalerProtocolTimestamp;\n}\n\n/**\n * Precise timestamp, typically used in the wallet-core\n * API but not in other Taler APIs so far.\n */\nexport interface TalerPreciseTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n /**\n * Optional microsecond offset (non-negative integer).\n */\n readonly off_us?: number;\n\n readonly _flavor?: typeof flavor_TalerPreciseTimestamp;\n}\n\nexport namespace TalerPreciseTimestamp {\n export function now(): TalerPreciseTimestamp {\n const absNow = AbsoluteTime.now();\n return AbsoluteTime.toPreciseTimestamp(absNow);\n }\n\n export function round(t: TalerPreciseTimestamp): TalerProtocolTimestamp {\n return {\n t_s: t.t_s,\n };\n }\n\n export function fromSeconds(s: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(s),\n off_us: Math.floor((s - Math.floor(s)) / 1000 / 1000),\n };\n }\n\n export function fromMilliseconds(ms: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(ms / 1000),\n off_us: Math.floor((ms - Math.floor(ms / 1000) * 1000) * 1000),\n };\n }\n}\n\nexport namespace TalerProtocolTimestamp {\n export function now(): TalerProtocolTimestamp {\n return AbsoluteTime.toProtocolTimestamp(AbsoluteTime.now());\n }\n\n export function zero(): TalerProtocolTimestamp {\n return {\n t_s: 0,\n };\n }\n\n export function never(): TalerProtocolTimestamp {\n return {\n t_s: \"never\",\n };\n }\n\n export function isNever(t: TalerProtocolTimestamp): boolean {\n return t.t_s === \"never\";\n }\n\n export function fromSeconds(s: number): TalerProtocolTimestamp {\n return {\n t_s: s,\n };\n }\n\n export function min(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\") {\n return { t_s: t2.t_s };\n }\n if (t2.t_s === \"never\") {\n return { t_s: t1.t_s };\n }\n return { t_s: Math.min(t1.t_s, t2.t_s) };\n }\n export function max(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\" || t2.t_s === \"never\") {\n return { t_s: \"never\" };\n }\n return { t_s: Math.max(t1.t_s, t2.t_s) };\n }\n}\n\nexport interface Duration {\n /**\n * Duration in milliseconds.\n */\n readonly d_ms: number | \"forever\";\n}\n\nexport interface TalerProtocolDuration {\n readonly d_us: number | \"forever\";\n}\n\n/**\n * Timeshift in milliseconds.\n */\nlet timeshift = 0;\n\n/**\n * Set timetravel offset in milliseconds.\n *\n * Use carefully and only for testing.\n */\nexport function setDangerousTimetravel(dt: number): void {\n timeshift = dt;\n}\n\nexport namespace Duration {\n export function toMilliseconds(d: Duration): number {\n if (d.d_ms === \"forever\") {\n return Number.MAX_VALUE;\n }\n return d.d_ms;\n }\n export function getRemaining(\n deadline: AbsoluteTime,\n now = AbsoluteTime.now(),\n ): Duration {\n if (deadline.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (now.t_ms === \"never\") {\n throw Error(\"invalid argument for 'now'\");\n }\n if (deadline.t_ms < now.t_ms) {\n return { d_ms: 0 };\n }\n return { d_ms: deadline.t_ms - now.t_ms };\n }\n\n export function fromPrettyString(s: string): Duration {\n let dMs = 0;\n let currentNum = \"\";\n let parsingNum = true;\n for (let i = 0; i < s.length; i++) {\n const cc = s.charCodeAt(i);\n if (cc >= \"0\".charCodeAt(0) && cc <= \"9\".charCodeAt(0)) {\n if (!parsingNum) {\n throw Error(\"invalid duration, unexpected number\");\n }\n currentNum += s[i];\n continue;\n }\n if (s[i] == \" \") {\n if (currentNum != \"\") {\n parsingNum = false;\n }\n continue;\n }\n\n if (currentNum == \"\") {\n throw Error(\"invalid duration, missing number\");\n }\n\n if (s[i] === \"s\") {\n dMs += 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"m\") {\n dMs += 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"h\") {\n dMs += 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"d\") {\n dMs += 24 * 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else {\n throw Error(\"invalid duration, unsupported unit\");\n }\n currentNum = \"\";\n parsingNum = true;\n }\n return {\n d_ms: dMs,\n };\n }\n\n /**\n * Compare two durations. Returns 0 when equal, -1 when a < b\n * and +1 when a > b.\n */\n export function cmp(d1: Duration, d2: Duration): 1 | 0 | -1 {\n if (d1.d_ms === \"forever\") {\n if (d2.d_ms === \"forever\") {\n return 0;\n }\n return 1;\n }\n if (d2.d_ms === \"forever\") {\n return -1;\n }\n if (d1.d_ms == d2.d_ms) {\n return 0;\n }\n if (d1.d_ms > d2.d_ms) {\n return 1;\n }\n return -1;\n }\n\n export function max(d1: Duration, d2: Duration): Duration {\n return durationMax(d1, d2);\n }\n\n export function min(d1: Duration, d2: Duration): Duration {\n return durationMin(d1, d2);\n }\n\n export function multiply(d1: Duration, n: number): Duration {\n return durationMul(d1, n);\n }\n\n export function toIntegerYears(d: Duration): number {\n if (typeof d.d_ms !== \"number\") {\n throw Error(\"infinite duration\");\n }\n return Math.ceil(d.d_ms / 1000 / 60 / 60 / 24 / 365);\n }\n\n export function fromSpec(spec: {\n seconds?: number;\n minutes?: number;\n hours?: number;\n days?: number;\n months?: number;\n years?: number;\n }): Duration {\n let d_ms = 0;\n d_ms += (spec.seconds ?? 0) * SECONDS;\n d_ms += (spec.minutes ?? 0) * MINUTES;\n d_ms += (spec.hours ?? 0) * HOURS;\n d_ms += (spec.days ?? 0) * DAYS;\n d_ms += (spec.months ?? 0) * MONTHS;\n d_ms += (spec.years ?? 0) * YEARS;\n return { d_ms };\n }\n\n export function getForever(): Duration {\n return { d_ms: \"forever\" };\n }\n\n export function getZero(): Duration {\n return { d_ms: 0 };\n }\n\n export function fromTalerProtocolDuration(\n d: TalerProtocolDuration,\n ): Duration {\n if (d.d_us === \"forever\") {\n return {\n d_ms: \"forever\",\n };\n }\n return {\n d_ms: Math.floor(d.d_us / 1000),\n };\n }\n\n export function toTalerProtocolDuration(d: Duration): TalerProtocolDuration {\n if (d.d_ms === \"forever\") {\n return {\n d_us: \"forever\",\n };\n }\n return {\n d_us: d.d_ms * 1000,\n };\n }\n\n export function fromMilliseconds(ms: number): Duration {\n return {\n d_ms: ms,\n };\n }\n\n export function clamp(args: {\n lower: Duration;\n upper: Duration;\n value: Duration;\n }): Duration {\n return durationMax(durationMin(args.value, args.upper), args.lower);\n }\n}\n\nexport namespace AbsoluteTime {\n export function getStampMsNow(): number {\n return new Date().getTime();\n }\n\n export function getStampMsNever(): number {\n return Number.MAX_SAFE_INTEGER;\n }\n\n export function now(): AbsoluteTime {\n return {\n t_ms: new Date().getTime() + timeshift,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function never(): AbsoluteTime {\n return {\n t_ms: \"never\",\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromMilliseconds(ms: number): AbsoluteTime {\n return {\n t_ms: ms,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function cmp(t1: AbsoluteTime, t2: AbsoluteTime): number {\n if (t1.t_ms === \"never\") {\n if (t2.t_ms === \"never\") {\n return 0;\n }\n return 1;\n }\n if (t2.t_ms === \"never\") {\n return -1;\n }\n if (t1.t_ms == t2.t_ms) {\n return 0;\n }\n if (t1.t_ms > t2.t_ms) {\n return 1;\n }\n return -1;\n }\n\n export function min(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.min(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function max(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function difference(t1: AbsoluteTime, t2: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (t2.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.abs(t1.t_ms - t2.t_ms) };\n }\n\n export function isExpired(t: AbsoluteTime) {\n return cmp(t, now()) <= 0;\n }\n\n export function isNever(t: AbsoluteTime): boolean {\n return t.t_ms === \"never\";\n }\n\n export function fromProtocolTimestamp(\n t: TalerProtocolTimestamp,\n ): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return {\n t_ms: t.t_s * 1000,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromStampMs(stampMs: number): AbsoluteTime {\n return {\n t_ms: stampMs,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromPreciseTimestamp(t: TalerPreciseTimestamp): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n const offsetUs = t.off_us ?? 0;\n return {\n t_ms: t.t_s * 1000 + Math.floor(offsetUs / 1000),\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function toStampMs(at: AbsoluteTime): number {\n if (at.t_ms === \"never\") {\n return Number.MAX_SAFE_INTEGER;\n }\n return at.t_ms;\n }\n\n export function toPreciseTimestamp(at: AbsoluteTime): TalerPreciseTimestamp {\n if (at.t_ms == \"never\") {\n return {\n t_s: \"never\",\n };\n }\n const t_s = Math.floor(at.t_ms / 1000);\n const off_us = Math.floor(1000 * (at.t_ms - t_s * 1000));\n return {\n t_s,\n off_us,\n };\n }\n\n export function toProtocolTimestamp(\n at: AbsoluteTime,\n ): TalerProtocolTimestamp {\n if (at.t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n return {\n t_s: Math.floor(at.t_ms / 1000),\n };\n }\n\n export function isBetween(\n t: AbsoluteTime,\n start: AbsoluteTime,\n end: AbsoluteTime,\n ): boolean {\n if (cmp(t, start) < 0) {\n return false;\n }\n if (cmp(t, end) > 0) {\n return false;\n }\n return true;\n }\n\n export function toIsoString(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"\";\n } else {\n return new Date(t.t_ms).toISOString();\n }\n }\n\n export function addDuration(t1: AbsoluteTime, d: Duration): AbsoluteTime {\n if (t1.t_ms === \"never\" || d.d_ms === \"forever\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: t1.t_ms + d.d_ms, [opaque_AbsoluteTime]: true };\n }\n\n /**\n * Get the remaining duration until {@param t1}.\n *\n * If {@param t1} already happened, the remaining duration\n * is zero.\n */\n export function remaining(t1: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return Duration.getForever();\n }\n const stampNow = now();\n if (stampNow.t_ms === \"never\") {\n throw Error(\"invariant violated\");\n }\n return Duration.fromMilliseconds(Math.max(0, t1.t_ms - stampNow.t_ms));\n }\n\n export function subtractDuraction(\n t1: AbsoluteTime,\n d: Duration,\n ): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (d.d_ms === \"forever\") {\n return { t_ms: 0, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(0, t1.t_ms - d.d_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function stringify(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"never\";\n }\n return new Date(t.t_ms).toISOString();\n }\n}\n\nconst SECONDS = 1000;\nconst MINUTES = SECONDS * 60;\nconst HOURS = MINUTES * 60;\nconst DAYS = HOURS * 24;\nconst MONTHS = DAYS * 30;\nconst YEARS = DAYS * 365;\n\nexport function durationMin(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: d2.d_ms };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: d1.d_ms };\n }\n return { d_ms: Math.min(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMax(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.max(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMul(d: Duration, n: number): Duration {\n if (d.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.round(d.d_ms * n) };\n}\n\nexport function durationAdd(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\" || d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: d1.d_ms + d2.d_ms };\n}\n\nexport const codecForAbsoluteTime: Codec = {\n decode(x: any, c?: Context): AbsoluteTime {\n if (x === undefined) {\n throw Error(`got undefined and expected absolute time at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_ms, [opaque_AbsoluteTime]: true };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForTimestamp: Codec = {\n decode(x: any, c?: Context): TalerProtocolTimestamp {\n // Compatibility, should be removed soon.\n if (x === undefined) {\n throw Error(`got undefined and expected timestamp at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n const t_s = x.t_s;\n if (typeof t_s === \"string\") {\n if (t_s === \"never\") {\n return { t_s: \"never\" };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n }\n if (typeof t_s === \"number\") {\n return { t_s };\n }\n throw Error(`expected protocol timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForPreciseTimestamp: Codec = {\n decode(x: any, c?: Context): TalerPreciseTimestamp {\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n throw Error(`expected precise timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForDuration: Codec = {\n decode(x: any, c?: Context): TalerProtocolDuration {\n const d_us = x.d_us;\n if (typeof d_us === \"string\") {\n if (d_us === \"forever\") {\n return { d_us: \"forever\" };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n }\n if (typeof d_us === \"number\") {\n return { d_us };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n },\n};\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL3.0-or-later\n*/\n\nimport type { CancellationToken } from \"./CancellationToken.js\";\nimport { Codec } from \"./codec.js\";\nimport { j2s } from \"./helpers.js\";\nimport {\n TalerError,\n base64FromArrayBuffer,\n makeErrorDetail,\n stringToBytes,\n} from \"./index.js\";\nimport { Logger } from \"./logging.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport { AbsoluteTime, Duration } from \"./time.js\";\nimport { TalerErrorDetail } from \"./types-taler-wallet.js\";\n\nconst textEncoder = new TextEncoder();\n\nconst logger = new Logger(\"http.ts\");\n\n/**\n * An HTTP response that is returned by all request methods of this library.\n */\nexport interface HttpResponse {\n requestUrl: string;\n requestMethod: string;\n status: number;\n headers: Headers;\n json(): Promise;\n text(): Promise;\n bytes(): Promise;\n}\n\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 60000;\n\nexport interface HttpRequestOptions {\n method?: \"POST\" | \"PATCH\" | \"PUT\" | \"GET\" | \"DELETE\";\n headers?: { [name: string]: string | undefined };\n\n /**\n * Timeout after which the request should be aborted.\n */\n timeout?: Duration;\n\n /**\n * Cancellation token that should abort the request when\n * cancelled.\n */\n cancellationToken?: CancellationToken;\n\n body?: string | ArrayBuffer | object;\n\n /**\n * How to handle redirects.\n * Same semantics as WHATWG fetch.\n */\n redirect?: \"follow\" | \"error\" | \"manual\";\n}\n\n/**\n * Headers, roughly modeled after the fetch API's headers object.\n */\nexport class Headers {\n private headerMap = new Map();\n\n get(name: string): string | null {\n const r = this.headerMap.get(name.toLowerCase());\n if (r) {\n return r;\n }\n return null;\n }\n\n set(name: string, value: string): void {\n const normalizedName = name.toLowerCase();\n const existing = this.headerMap.get(normalizedName);\n if (existing !== undefined) {\n this.headerMap.set(normalizedName, existing + \",\" + value);\n } else {\n this.headerMap.set(normalizedName, value);\n }\n }\n\n toJSON(): any {\n const m: Record = {};\n this.headerMap.forEach((v, k) => (m[k] = v));\n return m;\n }\n}\n\n/**\n * Interface for the HTTP request library used by the wallet.\n *\n * The request library is bundled into an interface to make mocking and\n * request tunneling easy.\n */\nexport interface HttpRequestLibrary {\n /**\n * Make an HTTP POST request with a JSON body.\n */\n fetch(url: string, opt?: HttpRequestOptions): Promise;\n}\n\ntype TalerErrorResponse = {\n code: number;\n} & unknown;\n\ntype ResponseOrError =\n | { isError: false; response: T }\n | { isError: true; talerErrorResponse: TalerErrorResponse };\n\n/**\n * Read Taler error details from an HTTP response.\n */\nexport async function readTalerErrorResponse(\n httpResponse: HttpResponse,\n): Promise {\n const contentType = httpResponse.headers.get(\"content-type\");\n if (contentType !== \"application/json\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n contentType: contentType || \"\",\n },\n \"Error response did not even contain JSON. The request URL might be wrong or the service might be unavailable.\",\n );\n }\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n logger.warn(\n `malformed error response (status ${httpResponse.status}): ${j2s(\n errJson,\n )}`,\n );\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n },\n \"Error response did not contain error code\",\n );\n }\n return errJson;\n}\n\nexport async function readUnexpectedResponseDetails(\n httpResponse: HttpResponse,\n): Promise {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n return makeErrorDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n },\n \"Error response did not contain error code\",\n );\n }\n return makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n errorResponse: errJson,\n },\n `Unexpected HTTP status (${httpResponse.status}) in response`,\n );\n}\n\nexport async function readSuccessResponseJsonOrErrorCode(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise> {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n return {\n isError: true,\n talerErrorResponse: await readTalerErrorResponse(httpResponse),\n };\n }\n let respJson;\n try {\n respJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from response\",\n );\n }\n let parsedResponse: T;\n try {\n parsedResponse = codec.decode(respJson);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Response invalid\",\n );\n }\n return {\n isError: false,\n response: parsedResponse,\n };\n}\n\nexport async function readResponseJsonOrErrorCode(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise<{ isError: boolean; response: T }> {\n let respJson;\n try {\n respJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from response\",\n );\n }\n let parsedResponse: T;\n try {\n parsedResponse = codec.decode(respJson);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Response invalid\",\n );\n }\n return {\n isError: !(httpResponse.status >= 200 && httpResponse.status < 300),\n response: parsedResponse,\n };\n}\n\n\ntype HttpErrorDetails = {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n};\n\nexport function getHttpResponseErrorDetails(\n httpResponse: HttpResponse,\n): HttpErrorDetails {\n return {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n };\n}\n\nexport function throwUnexpectedRequestError(\n httpResponse: HttpResponse,\n talerErrorResponse: TalerErrorResponse,\n): never {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n errorResponse: talerErrorResponse,\n },\n `Unexpected HTTP status ${httpResponse.status} in response`,\n );\n}\n\nexport async function readSuccessResponseJsonOrThrow(\n httpResponse: HttpResponse,\n codec: Codec,\n): Promise {\n const r = await readSuccessResponseJsonOrErrorCode(httpResponse, codec);\n if (!r.isError) {\n return r.response;\n }\n throwUnexpectedRequestError(httpResponse, r.talerErrorResponse);\n}\n\nexport async function expectSuccessResponseOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n if (httpResponse.status >= 200 && httpResponse.status <= 299) {\n return;\n }\n const errResp = await readTalerErrorResponse(httpResponse);\n throwUnexpectedRequestError(httpResponse, errResp);\n}\n\nexport async function readSuccessResponseTextOrErrorCode(\n httpResponse: HttpResponse,\n): Promise> {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n httpStatusCode: httpResponse.status,\n requestUrl: httpResponse.requestUrl,\n response: await httpResponse.text(),\n requestMethod: httpResponse.requestMethod,\n },\n \"Error response did not contain error code\",\n );\n }\n return {\n isError: true,\n talerErrorResponse: errJson,\n };\n }\n const respJson = await httpResponse.text();\n return {\n isError: false,\n response: respJson,\n };\n}\n\nexport async function checkSuccessResponseOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {\n let errJson;\n try {\n errJson = await httpResponse.json();\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl: httpResponse.requestUrl,\n requestMethod: httpResponse.requestMethod,\n httpStatusCode: httpResponse.status,\n response: await httpResponse.text(),\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Couldn't parse JSON format from error response\",\n );\n }\n\n const talerErrorCode = errJson.code;\n if (typeof talerErrorCode !== \"number\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n httpStatusCode: httpResponse.status,\n requestUrl: httpResponse.requestUrl,\n response: await httpResponse.text(),\n requestMethod: httpResponse.requestMethod,\n },\n \"Error response did not contain error code\",\n );\n }\n throwUnexpectedRequestError(httpResponse, errJson);\n }\n}\n\nexport async function readSuccessResponseTextOrThrow(\n httpResponse: HttpResponse,\n): Promise {\n const r = await readSuccessResponseTextOrErrorCode(httpResponse);\n if (!r.isError) {\n return r.response;\n }\n throwUnexpectedRequestError(httpResponse, r.talerErrorResponse);\n}\n\n/**\n * Get the timestamp at which the response's content is considered expired.\n */\nexport function getExpiry(\n httpResponse: HttpResponse,\n opt: { minDuration?: Duration },\n): AbsoluteTime {\n const expiryDateMs = new Date(\n httpResponse.headers.get(\"expiry\") ?? \"\",\n ).getTime();\n let t: AbsoluteTime;\n if (Number.isNaN(expiryDateMs)) {\n t = AbsoluteTime.now();\n } else {\n t = AbsoluteTime.fromMilliseconds(expiryDateMs);\n }\n if (opt.minDuration) {\n const t2 = AbsoluteTime.addDuration(AbsoluteTime.now(), opt.minDuration);\n return AbsoluteTime.max(t, t2);\n }\n return t;\n}\n\nexport interface HttpLibArgs {\n enableThrottling?: boolean;\n /**\n * Only allow HTTPS connections, not plain http.\n */\n requireTls?: boolean;\n printAsCurl?: boolean;\n}\n\nexport function encodeBody(body: unknown): ArrayBuffer {\n if (body == null) {\n return new ArrayBuffer(0);\n }\n if (typeof body === \"string\") {\n return textEncoder.encode(body).buffer;\n } else if (ArrayBuffer.isView(body)) {\n return body.buffer;\n } else if (body instanceof ArrayBuffer) {\n return body;\n } else if (typeof body === \"object\") {\n return textEncoder.encode(JSON.stringify(body)).buffer;\n }\n throw new TypeError(\"unsupported request body type\");\n}\n\nexport function getDefaultHeaders(method: string): Record {\n const headers: Record = {};\n\n if (method === \"POST\" || method === \"PUT\" || method === \"PATCH\") {\n // Default to JSON if we have a body\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n headers[\"Accept\"] = \"application/json\";\n\n return headers;\n}\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nexport function makeBasicAuthHeader(\n username: string,\n password: string,\n): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n", "/*\n This file is part of TALER\n (C) 2016 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for doing XMLHttpRequest-s that are based on ES6 promises.\n * Allows for easy mocking for test cases.\n *\n * The API is inspired by the HTML5 fetch API.\n */\n\n/**\n * Imports\n */\n\nimport * as impl from \"#http-impl\";\nimport * as common from \"./http-common.js\";\n\nexport * from \"./http-common.js\";\n\nexport function createPlatformHttpLib(\n args?: common.HttpLibArgs,\n): common.HttpRequestLibrary {\n return new impl.HttpLibImpl(args);\n}\n", "/*\n This file is part of TALER\n (C) 2017 GNUnet e.V.\n\n TALER is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n TALER; see the file COPYING. If not, see \n */\n\n/**\n * Semantic versioning, but libtool-style.\n * See https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html\n */\n\n/**\n * Result of comparing two libtool versions.\n */\nexport interface VersionMatchResult {\n /**\n * Is the first version compatible with the second?\n */\n compatible: boolean;\n\n /**\n * Is the first version older (-1), newer (+1) or\n * identical (0)?\n */\n currentCmp: number;\n}\n\nexport interface Version {\n current: number;\n revision: number;\n age: number;\n}\n\nexport namespace LibtoolVersion {\n /**\n * Compare two libtool-style version strings.\n */\n export function compare(\n me: string,\n other: string,\n ): VersionMatchResult | undefined {\n const meVer = parseVersion(me);\n const otherVer = parseVersion(other);\n\n if (!(meVer && otherVer)) {\n return undefined;\n }\n\n const compatible =\n meVer.current - meVer.age <= otherVer.current &&\n meVer.current >= otherVer.current - otherVer.age;\n\n const currentCmp = Math.sign(meVer.current - otherVer.current);\n\n return { compatible, currentCmp };\n }\n\n export function parseVersion(v: string): Version | undefined {\n const [currentStr, revisionStr, ageStr, ...rest] = v.split(\":\");\n if (rest.length !== 0) {\n return undefined;\n }\n const current = Number.parseInt(currentStr);\n const revision = Number.parseInt(revisionStr);\n const age = Number.parseInt(ageStr);\n\n if (Number.isNaN(current)) {\n return undefined;\n }\n\n if (Number.isNaN(revision)) {\n return undefined;\n }\n\n if (Number.isNaN(age)) {\n return undefined;\n }\n\n return { current, revision, age };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2023-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n HttpResponse,\n readResponseJsonOrErrorCode,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"./http-common.js\";\nimport {\n Codec,\n HttpStatusCode,\n TalerError,\n TalerErrorCode,\n TalerErrorDetail,\n} from \"./index.js\";\n\ntype OperationFailWithBodyOrNever =\n ErrorEnum extends keyof ErrorMap ? OperationFailWithBody : never;\n\nexport type OperationResult =\n | OperationOk\n | OperationAlternative\n | OperationFail\n | OperationFailWithBodyOrNever;\n\nexport function isOperationOk(\n c: OperationResult,\n): c is OperationOk {\n return c.type === \"ok\";\n}\n\nexport function isOperationFail(\n c: OperationResult,\n): c is OperationFail {\n return c.type === \"fail\";\n}\n\n/**\n * successful operation\n */\nexport interface OperationOk {\n type: \"ok\";\n\n /**\n * Parsed response body.\n */\n body: BodyT;\n}\n\n/**\n * unsuccessful operation, see details\n */\nexport interface OperationFail {\n type: \"fail\";\n\n /**\n * Error case (either HTTP status code or TalerErrorCode)\n */\n case: T;\n\n detail: TalerErrorDetail;\n}\n\n/**\n * unsuccessful operation, see body\n */\nexport interface OperationAlternative {\n type: \"fail\";\n\n case: T;\n body: B;\n}\n\nexport interface OperationFailWithBody {\n type: \"fail\";\n\n case: keyof B;\n body: B[OperationFailWithBody[\"case\"]];\n}\n\nexport async function opSuccessFromHttp(\n resp: HttpResponse,\n codec: Codec,\n): Promise> {\n const body = await readSuccessResponseJsonOrThrow(resp, codec);\n return { type: \"ok\" as const, body };\n}\n\n/**\n * Success case, but instead of the body we're returning a fixed response\n * to the client.\n */\nexport function opFixedSuccess(body: T): OperationOk {\n return { type: \"ok\" as const, body };\n}\n\nexport function opEmptySuccess(resp: HttpResponse): OperationOk {\n return { type: \"ok\" as const, body: void 0 };\n}\n\nexport async function opKnownFailureWithBody(\n case_: keyof B,\n body: B[typeof case_],\n): Promise> {\n return { type: \"fail\", case: case_, body };\n}\n\nexport async function opKnownAlternativeFailure(\n resp: HttpResponse,\n s: T,\n codec: Codec,\n): Promise> {\n const body = (await readResponseJsonOrErrorCode(resp, codec)).response;\n return { type: \"fail\", case: s, body };\n}\n\nexport async function opKnownHttpFailure(\n s: T,\n resp: HttpResponse,\n): Promise> {\n const detail = await readTalerErrorResponse(resp);\n return { type: \"fail\", case: s, detail };\n}\n\nexport function opKnownTalerFailure(\n s: T,\n detail: TalerErrorDetail,\n): OperationFail {\n return { type: \"fail\", case: s, detail };\n}\n\nexport function opUnknownFailure(\n resp: HttpResponse,\n error: TalerErrorDetail,\n): never {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,\n {\n requestUrl: resp.requestUrl,\n requestMethod: resp.requestMethod,\n httpStatusCode: resp.status,\n errorResponse: error,\n },\n `Unexpected HTTP status ${resp.status} in response`,\n );\n}\n\n/**\n * Convenience function to throw an error if the operation is not a success.\n */\nexport function narrowOpSuccessOrThrow(\n opName: string,\n opRes: OperationResult,\n): asserts opRes is OperationOk {\n if (opRes.type !== \"ok\") {\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR,\n {\n operation: opName,\n error: String(opRes.case),\n detail: \"detail\" in opRes ? opRes.detail : undefined,\n },\n `Operation ${opName} failed: ${String(opRes.case)}`,\n );\n }\n}\n\nexport async function succeedOrThrow(\n promise: Promise>,\n): Promise {\n const resp = await promise;\n if (isOperationOk(resp)) {\n return resp.body;\n }\n\n if (isOperationFail(resp)) {\n throw TalerError.fromUncheckedDetail({ ...resp, case: resp.case } as any);\n }\n throw TalerError.fromException(resp);\n}\n\nexport async function failOrThrow(\n s: E,\n promise: Promise>,\n): Promise {\n const resp = await promise;\n if (isOperationOk(resp)) {\n throw TalerError.fromException(\n new Error(`request succeed but failure \"${s}\" was expected`),\n );\n }\n if (isOperationFail(resp) && resp.case === s) {\n return resp.detail;\n }\n throw TalerError.fromException(\n new Error(\n `request failed with \"${JSON.stringify(\n resp,\n )}\" but case \"${s}\" was expected`,\n ),\n );\n}\n\nexport type ResultByMethod<\n TT extends object,\n p extends keyof TT,\n> = TT[p] extends (...args: any[]) => infer Ret\n ? Ret extends Promise\n ? Result extends OperationResult\n ? Result\n : never\n : never //api always use Promises\n : never; //error cases just for functions\n\nexport type FailCasesByMethod = Exclude<\n ResultByMethod,\n OperationOk\n>;\n\nexport type RedirectResult = { redirectURL: URL };\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Type and schema definitions and helpers for the core GNU Taler protocol.\n *\n * Even though the rest of the wallet uses camelCase for fields, use snake_case\n * here, since that's the convention for the Taler JSON+HTTP API.\n */\n\n/**\n * Imports.\n */\n\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForList,\n codecForMap,\n codecForNumber,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport { codecForEither } from \"./index.js\";\nimport {\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForTimestamp,\n} from \"./time.js\";\n\n// 64-byte hash code.\nexport type HashCode = string;\n\nexport type PaytoHash = string;\n\nexport type AmlOfficerPublicKeyP = string;\n\n// 32-byte hash code.\nexport type ShortHashCode = string;\n\nexport type SHA256HashCode = ShortHashCode;\n\nexport type SHA512HashCode = HashCode;\n\n// 32-byte nonce value, must only be used once.\nexport type CSNonce = string;\n\n// 32-byte nonce value, must only be used once.\nexport type RefreshMasterSeed = string;\n\n// 32-byte value representing a scalar multiplier\n// for scalar operations on points on Curve25519.\nexport type Cs25519Scalar = string;\n\n///\n/// KEYS\n///\n\n// 16-byte access token used to authorize access.\nexport type ClaimToken = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EddsaPublicKey = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EddsaPrivateKey = string;\n\n// Edx25519 public keys are points on Curve25519 and represented using the\n// standard 256 bits Ed25519 compact format converted to Crockford\n// Base32.\n//export type Edx25519PublicKey = string;\n\n// Edx25519 private keys are always points on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\n//export type Edx25519PrivateKey = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EcdhePublicKey = string;\n\n// Point on Curve25519 represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type CsRPublic = string;\n\n// EdDSA and ECDHE public keys always point on Curve25519\n// and represented using the standard 256 bits Ed25519 compact format,\n// converted to Crockford Base32.\nexport type EcdhePrivateKey = string;\n\nexport type CoinPublicKey = EddsaPublicKey;\n\n// RSA public key converted to Crockford Base32.\nexport type RsaPublicKey = string;\n\nexport type WireTransferIdentifierRawP = string;\n// Subset of numbers: Integers in the\n// inclusive range 0 .. (2^53 - 1).\nexport type SafeUint64 = number;\n\nexport type WadId = string;\n\nexport type Timestamp = TalerProtocolTimestamp;\n\nexport type RelativeTime = TalerProtocolDuration;\n\nexport type RsaSignature = string;\n\nexport type BlindedRsaSignature = string;\n\n/**\n * DD51 https://docs.taler.net/design-documents/051-fractional-digits.html\n */\nexport interface CurrencySpecification {\n // Name of the currency.\n name: string;\n\n // how many digits the user may enter after the decimal_separator\n num_fractional_input_digits: Integer;\n\n // Number of fractional digits to render in normal font and size.\n num_fractional_normal_digits: Integer;\n\n // Number of fractional digits to render always, if needed by\n // padding with zeros.\n num_fractional_trailing_zero_digits: Integer;\n\n // map of powers of 10 to alternative currency names / symbols, must\n // always have an entry under \"0\" that defines the base name,\n // e.g. \"0 => \u20AC\" or \"3 => k\u20AC\". For BTC, would be \"0 => BTC, -3 => mBTC\".\n // Communicates the currency symbol to be used.\n alt_unit_names: { [log10: string]: string };\n}\n\nexport interface InternationalizedString {\n [lang_tag: string]: string;\n}\n\nexport type RsaPublicKeySring = string;\nexport type AgeMask = number;\n\n// The string must be a data URL according to RFC 2397\n// with explicit mediatype and base64 parameters.\n//\n// data:;base64,\n//\n// Supported mediatypes are image/jpeg and image/png.\n// Invalid strings will be rejected by the wallet.\nexport type ImageDataUrl = string;\n\n/**\n * 32-byte value representing a point on Curve25519.\n */\nexport type Cs25519Point = string;\n\n/**\n * Response from the bank.\n */\nexport class WithdrawOperationStatusResponse {\n status: \"selected\" | \"aborted\" | \"confirmed\" | \"pending\";\n\n selection_done: boolean;\n\n transfer_done: boolean;\n\n aborted: boolean;\n\n amount: string | undefined;\n\n sender_wire?: string;\n\n suggested_exchange?: string;\n\n confirm_transfer_url?: string;\n\n wire_types: string[];\n}\n\nexport type LitAmountString = `${string}:${number}`;\n\nexport type LibtoolVersionString = string;\n\nexport type DecimalNumber = string;\n\ndeclare const __amount_str: unique symbol;\nexport type AmountString =\n | (string & { [__amount_str]: true })\n | LitAmountString;\n// export type AmountString = string;\nexport type Base32String = string;\nexport type EddsaSignatureString = string;\nexport type EddsaPublicKeyString = string;\nexport type EddsaPrivateKeyString = string;\nexport type CoinPublicKeyString = string;\n\n// FIXME: implement this codec\nexport const codecForURLString = codecForString;\n// FIXME: implement this codec\nexport const codecForLibtoolVersion = codecForString;\n// FIXME: implement this codec\nexport const codecForCurrencyName = codecForString;\n// FIXME: implement this codec\nexport const codecForDecimalNumber = codecForString;\n\nexport const codecForInternationalizedString =\n (): Codec => codecForMap(codecForString());\n\nexport const codecForWithdrawOperationStatusResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"selected\"),\n codecForConstString(\"confirmed\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"pending\"),\n ),\n )\n .property(\"selection_done\", codecForBoolean())\n .property(\"transfer_done\", codecForBoolean())\n .property(\"aborted\", codecForBoolean())\n .property(\"amount\", codecOptional(codecForString()))\n .property(\"sender_wire\", codecOptional(codecForString()))\n .property(\"suggested_exchange\", codecOptional(codecForString()))\n .property(\"confirm_transfer_url\", codecOptional(codecForString()))\n .property(\"wire_types\", codecForList(codecForString()))\n .build(\"WithdrawOperationStatusResponse\");\n\nexport const codecForCurrencySpecificiation =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"num_fractional_input_digits\", codecForNumber())\n .property(\"num_fractional_normal_digits\", codecForNumber())\n .property(\"num_fractional_trailing_zero_digits\", codecForNumber())\n .property(\"alt_unit_names\", codecForMap(codecForString()))\n .build(\"CurrencySpecification\");\n\nexport interface TalerCommonConfigResponse {\n name: string;\n version: string;\n}\n\nexport const codecForTalerCommonConfigResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"version\", codecForString())\n .build(\"TalerCommonConfigResponse\");\n\nexport enum ExchangeProtocolVersion {\n /**\n * Current version supported by the wallet.\n */\n V12 = 12,\n}\n\nexport enum MerchantProtocolVersion {\n /**\n * Current version supported by the wallet.\n */\n V3 = 3,\n}\n\nexport type HashCodeString = string;\n\nexport type WireSalt = string;\n\nexport interface WalletKycUuid {\n // UUID that the wallet should use when initiating\n // the KYC check.\n requirement_row: number;\n\n // Hash of the payto:// account URI for the wallet.\n h_payto: string;\n}\n\nexport const codecForWalletKycUuid = (): Codec =>\n buildCodecForObject()\n .property(\"requirement_row\", codecForNumber())\n .property(\"h_payto\", codecForString())\n .build(\"WalletKycUuid\");\n\nexport interface MerchantUsingTemplateDetails {\n summary?: string;\n amount?: AmountString;\n}\n\nexport type Integer = number;\n\nexport interface BankConversionInfoConfig {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the API.\n name: \"taler-conversion-info\";\n\n regional_currency: string;\n\n fiat_currency: string;\n\n // Currency used by this bank.\n regional_currency_specification: CurrencySpecification;\n\n // External currency used during conversion.\n fiat_currency_specification: CurrencySpecification;\n}\n\nexport const codecForBankConversionInfoConfig =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-conversion-info\"))\n .property(\"version\", codecForString())\n .property(\"fiat_currency\", codecForString())\n .property(\"regional_currency\", codecForString())\n .property(\"fiat_currency_specification\", codecForCurrencySpecificiation())\n .property(\n \"regional_currency_specification\",\n codecForCurrencySpecificiation(),\n )\n .build(\"BankConversionInfoConfig\");\n\nexport interface DenominationExpiredMessage {\n // Taler error code. Note that beyond\n // expiration this message format is also\n // used if the key is not yet valid, or\n // has been revoked.\n code: number;\n\n // Signature by the exchange over a\n // TALER_DenominationExpiredAffirmationPS.\n // Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED.\n exchange_sig: EddsaSignatureString;\n\n // Public key of the exchange used to create\n // the 'exchange_sig.\n exchange_pub: EddsaPublicKeyString;\n\n // Hash of the denomination public key that is unknown.\n h_denom_pub: HashCodeString;\n\n // When was the signature created.\n timestamp: TalerProtocolTimestamp;\n\n // What kind of operation was requested that now\n // failed?\n oper: string;\n}\n\nexport const codecForDenominationExpiredMessage = () =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"oper\", codecForString())\n .build(\"DenominationExpiredMessage\");\n\nexport interface CoinHistoryResponse {\n // Current balance of the coin.\n balance: AmountString;\n\n // Hash of the coin's denomination.\n h_denom_pub: HashCodeString;\n\n // Transaction history for the coin.\n history: any[];\n}\n\nexport const codecForCoinHistoryResponse = () =>\n buildCodecForObject()\n .property(\"balance\", codecForAmountString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"history\", codecForAny())\n .build(\"CoinHistoryResponse\");\n\nexport interface TokenRequest {\n // Service-defined scope for the token.\n // Typical scopes would be \"readonly\" or \"readwrite\".\n scope: string;\n\n // Server may impose its own upper bound\n // on the token validity duration\n duration?: RelativeTime;\n\n // Is the token refreshable into a new token during its\n // validity?\n // Refreshable tokens effectively provide indefinite\n // access if they are refreshed in time.\n refreshable?: boolean;\n}\n\nexport interface TokenSuccessResponse {\n // Expiration determined by the server.\n // Can be based on the token_duration\n // from the request, but ultimately the\n // server decides the expiration.\n expiration: Timestamp;\n\n // Opque access token.\n access_token: AccessToken;\n}\nexport interface TokenSuccessResponseMerchant {\n // Expiration determined by the server.\n // Can be based on the token_duration\n // from the request, but ultimately the\n // server decides the expiration.\n expiration: Timestamp;\n\n // Opque access token.\n token: AccessToken;\n}\n\n//FIXME: implement this codec\nexport const codecForAccessToken = codecForString as () => Codec;\nexport const codecForTokenSuccessResponse = (): Codec =>\n buildCodecForObject()\n .property(\"access_token\", codecForAccessToken())\n .property(\"expiration\", codecForTimestamp)\n .build(\"TalerAuthentication.TokenSuccessResponse\");\n\nexport const codecForTokenSuccessResponseMerchant =\n (): Codec =>\n buildCodecForObject()\n .property(\"token\", codecForAccessToken())\n .property(\"expiration\", codecForTimestamp)\n .build(\"TalerAuthentication.TokenSuccessResponseMerchant\");\n\n// FIXME: implement this codec\nexport const codecForURN = codecForString;\n\ndeclare const __ac_token: unique symbol;\n\n/**\n * Use `createAccessToken(string)` function to build one.\n */\nexport type AccessToken = string & {\n [__ac_token]: true;\n};\n\n/**\n * Create a rfc8959 access token.\n * Adds secret-token: prefix if there is none.\n * Encode the token with rfc7230 to send in a http header.\n *\n * @param token\n * @returns\n */\nexport function createRFC8959AccessTokenEncoded(token: string): AccessToken {\n return (\n token.startsWith(\"secret-token:\")\n ? token\n : `secret-token:${encodeURIComponent(token)}`\n ) as AccessToken;\n}\n\n/**\n * Create a rfc8959 access token.\n * Adds secret-token: prefix if there is none.\n *\n * @param token\n * @returns\n */\nexport function createRFC8959AccessTokenPlain(token: string): AccessToken {\n return (\n token.startsWith(\"secret-token:\") ? token : `secret-token:${token}`\n ) as AccessToken;\n}\n\n/**\n * Convert string to access token.\n *\n * @param clientSecret\n * @returns\n */\nexport function createClientSecretAccessToken(\n clientSecret: string,\n): AccessToken {\n return clientSecret as AccessToken;\n}\n\nexport type UserAndPassword = {\n username: string;\n password: string;\n};\n\nexport type UserAndToken = {\n username: string;\n token: AccessToken;\n};\n\ndeclare const opaque_OfficerAccount: unique symbol;\nexport type LockedAccount = string & { [opaque_OfficerAccount]: true };\n\ndeclare const opaque_OfficerId: unique symbol;\nexport type OfficerId = string & { [opaque_OfficerId]: true };\n\ndeclare const opaque_OfficerSigningKey: unique symbol;\nexport type SigningKey = Uint8Array & { [opaque_OfficerSigningKey]: true };\n\nexport interface OfficerAccount {\n id: OfficerId;\n signingKey: SigningKey;\n}\n\nexport type PaginationParams = {\n /**\n * row identifier as the starting point of the query\n */\n offset?: string;\n /**\n * max number of element in the result response\n * always greater than 0\n */\n limit?: number;\n /**\n * order\n */\n order?: \"asc\" | \"dec\";\n};\n\nexport type LongPollParams = {\n /**\n * milliseconds the server should wait for at least one result to be shown\n */\n timeoutMs?: number;\n};\n\nexport interface LoginToken {\n token: AccessToken;\n expiration: Timestamp;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForList,\n codecForNumber,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport {\n AccessToken,\n CoinEnvelope,\n ExchangeWireAccount,\n PaytoString,\n buildCodecForUnion,\n codecForConstNumber,\n codecForConstString,\n codecForEither,\n codecForExchangeWireAccount,\n codecForMap,\n codecForPaytoString,\n codecForTalerUriString,\n} from \"./index.js\";\nimport {\n AbsoluteTime,\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForDuration,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AmountString,\n Base32String,\n BlindedRsaSignature,\n ClaimToken,\n CoinPublicKey,\n CurrencySpecification,\n EddsaPublicKey,\n EddsaPublicKeyString,\n EddsaSignatureString,\n HashCode,\n HashCodeString,\n ImageDataUrl,\n Integer,\n InternationalizedString,\n RelativeTime,\n RsaSignature,\n Timestamp,\n WireTransferIdentifierRawP,\n codecForCurrencySpecificiation,\n codecForInternationalizedString,\n codecForURLString,\n} from \"./types-taler-common.js\";\n\n/**\n * Proposal returned from the contract URL.\n */\nexport interface Proposal {\n /**\n * Contract terms for the propoal.\n * Raw, un-decoded JSON object.\n */\n contract_terms: any;\n\n /**\n * Signature over contract, made by the merchant. The public key used for signing\n * must be contract_terms.merchant_pub.\n */\n sig: string;\n}\n\nexport interface MerchantPayResponse {\n sig: string;\n pos_confirmation?: string;\n}\n\ninterface MerchantOrderStatusPaid {\n // Was the payment refunded (even partially, via refund or abort)?\n refunded: boolean;\n\n // Is any amount of the refund still waiting to be picked up (even partially)?\n refund_pending: boolean;\n\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Amount that already taken by the wallet.\n refund_taken: AmountString;\n}\n\ninterface MerchantOrderRefundResponse {\n /**\n * Amount that was refunded in total.\n */\n refund_amount: AmountString;\n\n /**\n * Successful refunds for this payment, empty array for none.\n */\n refunds: MerchantCoinRefundStatus[];\n\n /**\n * Public key of the merchant.\n */\n merchant_pub: EddsaPublicKeyString;\n}\n\n/**\n * Response from the internal merchant API.\n */\nexport class CheckPaymentResponse {\n order_status: string;\n refunded: boolean | undefined;\n refunded_amount: string | undefined;\n contract_terms: any | undefined;\n taler_pay_uri: string | undefined;\n contract_url: string | undefined;\n}\n\nexport const codecForMerchantRefundPermission =\n (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_fee\", codecForAmountString())\n .property(\"coin_pub\", codecForString())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"exchange_code\", codecOptional(codecForNumber()))\n .property(\"exchange_reply\", codecOptional(codecForAny()))\n .property(\"exchange_sig\", codecOptional(codecForString()))\n .property(\"exchange_pub\", codecOptional(codecForString()))\n .build(\"MerchantRefundPermission\");\n\nexport const codecForProposal = (): Codec =>\n buildCodecForObject()\n .property(\"contract_terms\", codecForAny())\n .property(\"sig\", codecForString())\n .build(\"Proposal\");\n\nexport const codecForCheckPaymentResponse = (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForString())\n .property(\"refunded\", codecOptional(codecForBoolean()))\n .property(\"refunded_amount\", codecOptional(codecForString()))\n .property(\"contract_terms\", codecOptional(codecForAny()))\n .property(\"taler_pay_uri\", codecOptional(codecForString()))\n .property(\"contract_url\", codecOptional(codecForString()))\n .build(\"CheckPaymentResponse\");\n\nexport type MerchantCoinRefundStatus =\n | MerchantCoinRefundSuccessStatus\n | MerchantCoinRefundFailureStatus;\n\nexport interface MerchantCoinRefundSuccessStatus {\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // the EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund\n exchange_sig: EddsaSignatureString;\n\n // public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n\n // Refund transaction ID.\n rtransaction_id: number;\n\n // public key of a coin that was refunded\n coin_pub: EddsaPublicKeyString;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n execution_time: TalerProtocolTimestamp;\n}\n\nexport interface MerchantCoinRefundFailureStatus {\n type: \"failure\";\n\n // HTTP status of the exchange request, must NOT be 200.\n exchange_status: number;\n\n // Taler error code from the exchange reply, if available.\n exchange_code?: number;\n\n // If available, HTTP reply from the exchange.\n exchange_reply?: any;\n\n // Refund transaction ID.\n rtransaction_id: number;\n\n // public key of a coin that was refunded\n coin_pub: EddsaPublicKeyString;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n execution_time: TalerProtocolTimestamp;\n}\n\nexport interface MerchantOrderStatusUnpaid {\n /**\n * URI that the wallet must process to complete the payment.\n */\n taler_pay_uri: string;\n\n /**\n * Alternative order ID which was paid for already in the same session.\n *\n * Only given if the same product was purchased before in the same session.\n */\n already_paid_order_id?: string;\n}\n\nexport const codecForMerchantPayResponse = (): Codec =>\n buildCodecForObject()\n .property(\"sig\", codecForString())\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .build(\"MerchantPayResponse\");\n\nexport const codecForMerchantOrderStatusPaid =\n (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_taken\", codecForAmountString())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"refunded\", codecForBoolean())\n .build(\"MerchantOrderStatusPaid\");\n\nexport const codecForMerchantOrderStatusUnpaid =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_pay_uri\", codecForString())\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .build(\"MerchantOrderStatusUnpaid\");\n\nexport interface AbortRequest {\n // hash of the order's contract terms (this is used to authenticate the\n // wallet/customer in case $ORDER_ID is guessable).\n h_contract: string;\n\n // List of coins the wallet would like to see refunds for.\n // (Should be limited to the coins for which the original\n // payment succeeded, as far as the wallet knows.)\n coins: AbortingCoin[];\n}\n\nexport interface AbortingCoin {\n // Public key of a coin for which the wallet is requesting an abort-related refund.\n coin_pub: EddsaPublicKeyString;\n\n // The amount to be refunded (matches the original contribution)\n contribution: AmountString;\n\n // URL of the exchange this coin was withdrawn from.\n exchange_url: string;\n}\n\nexport interface AbortResponse {\n // List of refund responses about the coins that the wallet\n // requested an abort for. In the same order as the 'coins'\n // from the original request.\n // The rtransaction_id is implied to be 0.\n refunds: MerchantAbortPayRefundStatus[];\n}\n\nexport type MerchantAbortPayRefundStatus =\n | MerchantAbortPayRefundSuccessStatus\n | MerchantAbortPayRefundFailureStatus;\n\n// Details about why a refund failed.\nexport interface MerchantAbortPayRefundFailureStatus {\n // Used as tag for the sum type RefundStatus sum type.\n type: \"failure\";\n\n // HTTP status of the exchange request, must NOT be 200.\n exchange_status: number;\n\n // Taler error code from the exchange reply, if available.\n exchange_code?: number;\n\n // If available, HTTP reply from the exchange.\n exchange_reply?: unknown;\n}\n\n// Additional details needed to verify the refund confirmation signature\n// (h_contract_terms and merchant_pub) are already known\n// to the wallet and thus not included.\nexport interface MerchantAbortPayRefundSuccessStatus {\n // Used as tag for the sum type MerchantCoinRefundStatus sum type.\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // the EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund\n exchange_sig: string;\n\n // public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: string;\n}\n\n/**\n * Information about an exchange as stored inside a\n * merchant's contract terms.\n */\nexport interface ExchangeHandle {\n // The exchange's base URL.\n url: string;\n\n // Master public key of the exchange.\n master_pub: EddsaPublicKeyString;\n}\n\nexport interface AuditorHandle {\n /**\n * Official name of the auditor.\n */\n name: string;\n\n /**\n * Master public signing key of the auditor.\n */\n auditor_pub: EddsaPublicKeyString;\n\n /**\n * Base URL of the auditor.\n */\n url: string;\n}\n\n// Delivery location, loosely modeled as a subset of\n// ISO20022's PostalAddress25.\nexport interface Location {\n // Nation with its own government.\n country?: string;\n\n // Identifies a subdivision of a country such as state, region, county.\n country_subdivision?: string;\n\n // Identifies a subdivision within a country sub-division.\n district?: string;\n\n // Name of a built-up area, with defined boundaries, and a local government.\n town?: string;\n\n // Specific location name within the town.\n town_location?: string;\n\n // Identifier consisting of a group of letters and/or numbers that\n // is added to a postal address to assist the sorting of mail.\n post_code?: string;\n\n // Name of a street or thoroughfare.\n street?: string;\n\n // Name of the building or house.\n building_name?: string;\n\n // Number that identifies the position of a building on a street.\n building_number?: string;\n\n // Free-form address lines, should not exceed 7 elements.\n address_lines?: string[];\n}\n\nexport interface MerchantInfo {\n // The merchant's legal name of business.\n name: string;\n\n // Label for a location with the business address of the merchant.\n email?: string;\n\n // Label for a location with the business address of the merchant.\n website?: string;\n\n // An optional base64-encoded product image.\n logo?: ImageDataUrl;\n\n // Label for a location with the business address of the merchant.\n address?: Location;\n\n // Label for a location that denotes the jurisdiction for disputes.\n // Some of the typical fields for a location (such as a street address) may be absent.\n jurisdiction?: Location;\n}\n\nexport interface Tax {\n // the name of the tax\n name: string;\n\n // amount paid in tax\n tax: AmountString;\n}\n\nexport interface Product {\n // merchant-internal identifier for the product.\n product_id?: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions\n description_i18n?: InternationalizedString;\n\n // The number of units of the product to deliver to the customer.\n quantity?: Integer;\n\n // The unit in which the product is measured (liters, kilograms, packages, etc.)\n unit?: string;\n\n // The price of the product; this is the total price for quantity times unit of this product.\n price?: AmountString;\n\n // An optional base64-encoded product image\n image?: ImageDataUrl;\n\n // a list of taxes paid by the merchant for this product. Can be empty.\n taxes?: Tax[];\n\n // time indicating when this product should be delivered\n delivery_date?: TalerProtocolTimestamp;\n}\n\n/**\n * Contract terms from a merchant.\n * FIXME: Add type field!\n */\nexport interface MerchantContractTerms {\n // The hash of the merchant instance's wire details.\n h_wire: string;\n\n // Specifies for how long the wallet should try to get an\n // automatic refund for the purchase. If this field is\n // present, the wallet should wait for a few seconds after\n // the purchase and then automatically attempt to obtain\n // a refund. The wallet should probe until \"delay\"\n // after the payment was successful (i.e. via long polling\n // or via explicit requests with exponential back-off).\n //\n // In particular, if the wallet is offline\n // at that time, it MUST repeat the request until it gets\n // one response from the merchant after the delay has expired.\n // If the refund is granted, the wallet MUST automatically\n // recover the payment. This is used in case a merchant\n // knows that it might be unable to satisfy the contract and\n // desires for the wallet to attempt to get the refund without any\n // customer interaction. Note that it is NOT an error if the\n // merchant does not grant a refund.\n auto_refund?: TalerProtocolDuration;\n\n // Wire transfer method identifier for the wire method associated with h_wire.\n // The wallet may only select exchanges via a matching auditor if the\n // exchange also supports this wire method.\n // The wire transfer fees must be added based on this wire transfer method.\n wire_method: string;\n\n // Human-readable description of the whole purchase.\n summary: string;\n\n // Map from IETF BCP 47 language tags to localized summaries.\n summary_i18n?: InternationalizedString;\n\n // Unique, free-form identifier for the proposal.\n // Must be unique within a merchant instance.\n // For merchants that do not store proposals in their DB\n // before the customer paid for them, the order_id can be used\n // by the frontend to restore a proposal from the information\n // encoded in it (such as a short product identifier and timestamp).\n order_id: string;\n\n // Total price for the transaction.\n // The exchange will subtract deposit fees from that amount\n // before transferring it to the merchant.\n amount: string;\n\n // Nonce generated by the wallet and echoed by the merchant\n // in this field when the proposal is generated.\n nonce: string;\n\n // After this deadline, the merchant won't accept payments for the contract.\n pay_deadline: TalerProtocolTimestamp;\n\n // More info about the merchant, see below.\n merchant: MerchantInfo;\n\n // Merchant's public key used to sign this proposal; this information\n // is typically added by the backend. Note that this can be an ephemeral key.\n merchant_pub: string;\n\n // Time indicating when the order should be delivered.\n // May be overwritten by individual products.\n delivery_date?: TalerProtocolTimestamp;\n\n // Delivery location for (all!) products.\n delivery_location?: Location;\n\n // Exchanges that the merchant accepts even if it does not accept any auditors that audit them.\n exchanges: ExchangeHandle[];\n\n // List of products that are part of the purchase (see Product).\n products?: Product[];\n\n // After this deadline has passed, no refunds will be accepted.\n refund_deadline: TalerProtocolTimestamp;\n\n // Transfer deadline for the exchange. Must be in the\n // deposit permissions of coins used to pay for this order.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // Time when this contract was generated.\n timestamp: TalerProtocolTimestamp;\n\n // Base URL of the (public!) merchant backend API.\n // Must be an absolute URL that ends with a slash.\n merchant_base_url: string;\n\n // URL that will show that the order was successful after\n // it has been paid for. Optional, but either fulfillment_url\n // or fulfillment_message must be specified in every\n // contract terms.\n //\n // If a non-unique fulfillment URL is used, a customer can only\n // buy the order once and will be redirected to a previous purchase\n // when trying to buy an order with the same fulfillment URL a second\n // time. This is useful for digital goods that a customer only needs\n // to buy once but should be able to repeatedly download.\n //\n // For orders where the customer is expected to be able to make\n // repeated purchases (for equivalent goods), the fulfillment URL\n // should be made unique for every order. The easiest way to do\n // this is to include a unique order ID in the fulfillment URL.\n //\n // When POSTing to the merchant, the placeholder text \"${ORDER_ID}\"\n // is be replaced with the actual order ID (useful if the\n // order ID is generated server-side and needs to be\n // in the URL). Note that this placeholder can only be used once.\n // Front-ends may use other means to generate a unique fulfillment URL.\n fulfillment_url?: string;\n\n // URL where the same contract could be ordered again (if\n // available). Returned also at the public order endpoint\n // for people other than the actual buyer (hence public,\n // in case order IDs are guessable).\n public_reorder_url?: string;\n\n // Message shown to the customer after paying for the order.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n\n // Map from IETF BCP 47 language tags to localized fulfillment\n // messages.\n fulfillment_message_i18n?: InternationalizedString;\n\n // Maximum total deposit fee accepted by the merchant for this contract.\n // Overrides defaults of the merchant instance.\n max_fee: string;\n\n // Extra data that is only interpreted by the merchant frontend.\n // Useful when the merchant needs to store extra information on a\n // contract without storing it separately in their database.\n // Must really be an Object (not a string, integer, float or array).\n extra?: any;\n\n // Minimum age the buyer must have (in years). Default is 0.\n // This value is at least as large as the maximum over all\n // minimum age requirements of the products in this contract.\n // It might also be set independent of any product, due to\n // legal requirements.\n minimum_age?: Integer;\n}\n\n/**\n * Refund permission in the format that the merchant gives it to us.\n */\nexport interface MerchantAbortPayRefundDetails {\n /**\n * Amount to be refunded.\n */\n refund_amount: string;\n\n /**\n * Fee for the refund.\n */\n refund_fee: string;\n\n /**\n * Public key of the coin being refunded.\n */\n coin_pub: string;\n\n /**\n * Refund transaction ID between merchant and exchange.\n */\n rtransaction_id: number;\n\n /**\n * Exchange's key used for the signature.\n */\n exchange_pub?: string;\n\n /**\n * Exchange's signature to confirm the refund.\n */\n exchange_sig?: string;\n\n /**\n * Error replay from the exchange (if any).\n */\n exchange_reply?: any;\n\n /**\n * Error code from the exchange (if any).\n */\n exchange_code?: number;\n\n /**\n * HTTP status code of the exchange's response\n * to the merchant's refund request.\n */\n exchange_http_status: number;\n}\n\n/**\n * Reserve signature, defined as separate class to facilitate\n * schema validation.\n */\nexport interface MerchantBlindSigWrapperV1 {\n /**\n * Reserve signature.\n */\n blind_sig: string;\n}\n\nexport const codecForExchangeHandle = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"url\", codecForString())\n .build(\"ExchangeHandle\");\n\nexport const codecForAuditorHandle = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"auditor_pub\", codecForString())\n .property(\"url\", codecForString())\n .build(\"AuditorHandle\");\n\nexport const codecForLocation = (): Codec =>\n buildCodecForObject()\n .property(\"country\", codecOptional(codecForString()))\n .property(\"country_subdivision\", codecOptional(codecForString()))\n .property(\"building_name\", codecOptional(codecForString()))\n .property(\"building_number\", codecOptional(codecForString()))\n .property(\"district\", codecOptional(codecForString()))\n .property(\"street\", codecOptional(codecForString()))\n .property(\"post_code\", codecOptional(codecForString()))\n .property(\"town\", codecOptional(codecForString()))\n .property(\"town_location\", codecOptional(codecForString()))\n .property(\"address_lines\", codecOptional(codecForList(codecForString())))\n .build(\"Location\");\n\nexport const codecForMerchantInfo = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"jurisdiction\", codecOptional(codecForLocation()))\n .build(\"MerchantInfo\");\n\nexport const codecForMerchantContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"fulfillment_message\", codecOptional(codecForString()))\n .property(\n \"fulfillment_message_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"merchant_base_url\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"auto_refund\", codecOptional(codecForDuration))\n .property(\"wire_method\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .property(\"nonce\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"pay_deadline\", codecForTimestamp)\n .property(\"refund_deadline\", codecForTimestamp)\n .property(\"wire_transfer_deadline\", codecForTimestamp)\n .property(\"timestamp\", codecForTimestamp)\n .property(\"delivery_location\", codecOptional(codecForLocation()))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .property(\"max_fee\", codecForAmountString())\n .property(\"merchant\", codecForMerchantInfo())\n .property(\"merchant_pub\", codecForString())\n .property(\"exchanges\", codecForList(codecForExchangeHandle()))\n .property(\"products\", codecOptional(codecForList(codecForProduct())))\n .property(\"extra\", codecForAny())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"MerchantContractTerms\");\n\nexport interface TalerMerchantConfigResponse {\n // libtool-style representation of the Merchant protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the protocol.\n name: \"taler-merchant\";\n\n // URN of the implementation (needed to interpret 'revision' in version).\n // @since **v8**, may become mandatory in the future.\n implementation?: string;\n\n // Default (!) currency supported by this backend.\n // This is the currency that the backend should\n // suggest by default to the user when entering\n // amounts. See currencies for a list of\n // supported currencies and how to render them.\n currency: string;\n\n // How services should render currencies supported\n // by this backend. Maps\n // currency codes (e.g. \"EUR\" or \"KUDOS\") to\n // the respective currency specification.\n // All currencies in this map are supported by\n // the backend. Note that the actual currency\n // specifications are a *hint* for applications\n // that would like *advice* on how to render amounts.\n // Applications *may* ignore the currency specification\n // if they know how to render currencies that they are\n // used with.\n currencies: { [currency: string]: CurrencySpecification };\n\n // Array of exchanges trusted by the merchant.\n // Since protocol **v6**.\n exchanges: ExchangeConfigInfo[];\n}\n\nexport interface ExchangeConfigInfo {\n // Base URL of the exchange REST API.\n base_url: string;\n\n // Currency for which the merchant is configured\n // to trust the exchange.\n // May not be the one the exchange actually uses,\n // but is the only one we would trust this exchange for.\n currency: string;\n\n // Offline master public key of the exchange. The\n // /keys data must be signed with this public\n // key for us to trust it.\n master_pub: EddsaPublicKey;\n}\n\nexport interface ClaimRequest {\n // Nonce to identify the wallet that claimed the order.\n nonce: string;\n\n // Token that authorizes the wallet to claim the order.\n // *Optional* as the merchant may not have required it\n // (create_token set to false in PostOrderRequest).\n token?: ClaimToken;\n}\n\nexport interface ClaimResponse {\n // Contract terms of the claimed order\n contract_terms: ContractTerms;\n\n // Signature by the merchant over the contract terms.\n sig: EddsaSignatureString;\n}\n\nexport interface PaymentResponse {\n // Signature on TALER_PaymentResponsePS with the public\n // key of the merchant instance.\n sig: EddsaSignatureString;\n\n // Text to be shown to the point-of-sale staff as a proof of\n // payment.\n pos_confirmation?: string;\n}\n\nexport interface PaymentStatusRequestParams {\n // Hash of the order\u2019s contract terms (this is used to\n // authenticate the wallet/customer in case\n // $ORDER_ID is guessable).\n // Required once an order was claimed.\n contractTermHash?: string;\n // Authorizes the request via the claim token that\n // was returned in the PostOrderResponse. Used with\n // unclaimed orders only. Whether token authorization is\n // required is determined by the merchant when the\n // frontend creates the order.\n claimToken?: string;\n // Session ID that the payment must be bound to.\n // If not specified, the payment is not session-bound.\n sessionId?: string;\n // If specified, the merchant backend will wait up to\n // timeout_ms milliseconds for completion of the payment\n // before sending the HTTP response. A client must never\n // rely on this behavior, as the merchant backend may return\n // a response immediately.\n timeout?: number;\n // If set to \u201Cyes\u201D, poll for the order\u2019s pending refunds\n // to be picked up. timeout_ms specifies how long we\n // will wait for the refund.\n awaitRefundObtained?: boolean;\n // Indicates that we are polling for a refund above the\n // given AMOUNT. timeout_ms will specify how long we\n // will wait for the refund.\n refund?: AmountString;\n // Since protocol v9 refunded orders are only returned\n // under \u201Calready_paid_order_id\u201D if this flag is set\n // explicitly to \u201CYES\u201D.\n allowRefundedForRepurchase?: boolean;\n}\nexport interface GetKycStatusRequestParams {\n // If specified, the KYC check should return\n // the KYC status only for this wire account.\n // Otherwise, for all wire accounts.\n wireHash?: string;\n // If specified, the KYC check should return\n // the KYC status only for the given exchange.\n // Otherwise, for all exchanges we interacted with.\n exchangeURL?: string;\n // If specified, the merchant will wait up to\n // timeout_ms milliseconds for the exchanges to\n // confirm completion of the KYC process(es).\n timeout?: number;\n}\nexport interface GetOtpDeviceRequestParams {\n // Timestamp in seconds to use when calculating\n // the current OTP code of the device. Since protocol v10.\n faketime?: number;\n // Price to use when calculating the current OTP\n // code of the device. Since protocol v10.\n price?: AmountString;\n}\nexport interface GetOrderRequestParams {\n // Session ID that the payment must be bound to.\n // If not specified, the payment is not session-bound.\n sessionId?: string;\n // Timeout in milliseconds to wait for a payment if\n // the answer would otherwise be negative (long polling).\n timeout?: number;\n // Since protocol v9 refunded orders are only returned\n // under \u201Calready_paid_order_id\u201D if this flag is set\n // explicitly to \u201CYES\u201D.\n allowRefundedForRepurchase?: boolean;\n}\nexport interface ListWireTransferRequestParams {\n // Filter for transfers to the given bank account\n // (subject and amount MUST NOT be given in the payto URI).\n paytoURI?: string;\n // Filter for transfers executed before the given timestamp.\n before?: number;\n // Filter for transfers executed after the given timestamp.\n after?: number;\n // At most return the given number of results. Negative for\n // descending in execution time, positive for ascending in\n // execution time. Default is -20.\n limit?: number;\n // Starting transfer_serial_id for an iteration.\n offset?: string;\n // Filter transfers by verification status.\n verified?: boolean;\n order?: \"asc\" | \"dec\";\n}\nexport interface ListOrdersRequestParams {\n // If set to yes, only return paid orders, if no only\n // unpaid orders. Do not give (or use \u201Call\u201D) to see all\n // orders regardless of payment status.\n paid?: boolean;\n // If set to yes, only return refunded orders, if no only\n // unrefunded orders. Do not give (or use \u201Call\u201D) to see\n // all orders regardless of refund status.\n refunded?: boolean;\n // If set to yes, only return wired orders, if no only\n // orders with missing wire transfers. Do not give (or\n // use \u201Call\u201D) to see all orders regardless of wire transfer\n // status.\n wired?: boolean;\n // At most return the given number of results. Negative\n // for descending by row ID, positive for ascending by\n // row ID. Default is 20. Since protocol v12.\n limit?: number;\n // Non-negative date in seconds after the UNIX Epoc, see delta\n // for its interpretation. If not specified, we default to the\n // oldest or most recent entry, depending on delta.\n date?: AbsoluteTime;\n // Starting product_serial_id for an iteration.\n // Since protocol v12.\n offset?: string;\n // Timeout in milliseconds to wait for additional orders if the\n // answer would otherwise be negative (long polling). Only useful\n // if delta is positive. Note that the merchant MAY still return\n // a response that contains fewer than delta orders.\n timeout?: number;\n // Since protocol v6. Filters by session ID.\n sessionId?: string;\n // Since protocol v6. Filters by fulfillment URL.\n fulfillmentUrl?: string;\n\n order?: \"asc\" | \"dec\";\n}\n\nexport interface PayRequest {\n // The coins used to make the payment.\n coins: CoinPaySig[];\n\n // Custom inputs from the wallet for the contract.\n wallet_data?: Object;\n\n // The session for which the payment is made (or replayed).\n // Only set for session-based payments.\n session_id?: string;\n}\n\nexport interface CoinPaySig {\n // Signature by the coin.\n coin_sig: EddsaSignatureString;\n\n // Public key of the coin being spent.\n coin_pub: EddsaPublicKey;\n\n // Signature made by the denomination public key.\n ub_sig: RsaSignature;\n\n // The hash of the denomination public key associated with this coin.\n h_denom: HashCodeString;\n\n // The amount that is subtracted from this coin with this payment.\n contribution: AmountString;\n\n // URL of the exchange this coin was withdrawn from.\n exchange_url: string;\n}\n\nexport interface StatusPaid {\n type: \"paid\";\n\n // Was the payment refunded (even partially, via refund or abort)?\n refunded: boolean;\n\n // Is any amount of the refund still waiting to be picked up (even partially)?\n refund_pending: boolean;\n\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Amount that already taken by the wallet.\n refund_taken: AmountString;\n}\nexport interface StatusGotoResponse {\n type: \"goto\";\n // The client should go to the reorder URL, there a fresh\n // order might be created as this one is taken by another\n // customer or wallet (or repurchase detection logic may\n // apply).\n public_reorder_url: string;\n}\nexport interface StatusUnpaidResponse {\n type: \"unpaid\";\n // URI that the wallet must process to complete the payment.\n taler_pay_uri: string;\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n fulfillment_url?: string;\n\n // Alternative order ID which was paid for already in the same session.\n // Only given if the same product was purchased before in the same session.\n already_paid_order_id?: string;\n}\n\nexport interface PaidRefundStatusResponse {\n // Text to be shown to the point-of-sale staff as a proof of\n // payment (present only if reusable OTP algorithm is used).\n pos_confirmation?: string;\n\n // True if the order has been subjected to\n // refunds. False if it was simply paid.\n refunded: boolean;\n}\n\nexport interface PaidRequest {\n // Signature on TALER_PaymentResponsePS with the public\n // key of the merchant instance.\n sig: EddsaSignatureString;\n\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer and to enable signature verification without\n // database access).\n h_contract: HashCodeString;\n\n // Hash over custom inputs from the wallet for the contract.\n wallet_data_hash?: HashCodeString;\n\n // Session id for which the payment is proven.\n session_id: string;\n}\n\nexport interface AbortRequest {\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer in case $ORDER_ID is guessable).\n h_contract: HashCodeString;\n\n // List of coins the wallet would like to see refunds for.\n // (Should be limited to the coins for which the original\n // payment succeeded, as far as the wallet knows.)\n coins: AbortingCoin[];\n}\n\nexport interface AbortResponse {\n // List of refund responses about the coins that the wallet\n // requested an abort for. In the same order as the coins\n // from the original request.\n // The rtransaction_id is implied to be 0.\n refunds: MerchantAbortPayRefundStatus[];\n}\n\nexport interface WalletRefundRequest {\n // Hash of the order's contract terms (this is used to authenticate the\n // wallet/customer).\n h_contract: HashCodeString;\n}\n\nexport interface WalletRefundResponse {\n // Amount that was refunded in total.\n refund_amount: AmountString;\n\n // Successful refunds for this payment, empty array for none.\n refunds: MerchantCoinRefundStatus[];\n\n // Public key of the merchant.\n merchant_pub: EddsaPublicKey;\n}\n\n// Additional details needed to verify the refund confirmation signature\n// (h_contract_terms and merchant_pub) are already known\n// to the wallet and thus not included.\nexport interface MerchantCoinRefundSuccessStatus {\n // Used as tag for the sum type MerchantCoinRefundStatus sum type.\n type: \"success\";\n\n // HTTP status of the exchange request, 200 (integer) required for refund confirmations.\n exchange_status: 200;\n\n // The EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the\n // exchange affirming the successful refund.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKey;\n\n // Refund transaction ID.\n rtransaction_id: Integer;\n\n // Public key of a coin that was refunded.\n coin_pub: EddsaPublicKey;\n\n // Amount that was refunded, including refund fee charged by the exchange\n // to the customer.\n refund_amount: AmountString;\n\n // Timestamp when the merchant approved the refund.\n // Useful for grouping refunds.\n execution_time: Timestamp;\n}\n\ninterface RewardInformation {\n // Exchange from which the reward will be withdrawn. Needed by the\n // wallet to determine denominations, fees, etc.\n exchange_url: string;\n\n // URL where to go after obtaining the reward.\n next_url: string;\n\n // (Remaining) amount of the reward (including fees).\n reward_amount: AmountString;\n\n // Timestamp indicating when the reward is set to expire (may be in the past).\n // Note that rewards that have expired MAY also result in a 404 response.\n expiration: Timestamp;\n}\n\ninterface PlanchetDetail {\n // Hash of the denomination's public key (hashed to reduce\n // bandwidth consumption).\n denom_pub_hash: HashCodeString;\n\n // Coin's blinded public key.\n coin_ev: CoinEnvelope;\n}\n\ninterface BlindSignature {\n // The (blind) RSA signature. Still needs to be unblinded.\n blind_sig: BlindedRsaSignature;\n}\n\nexport interface InstanceConfigurationMessage {\n // Name of the merchant instance to create (will become $INSTANCE).\n // Must match the regex ^[A-Za-z0-9][A-Za-z0-9_.@-]+$.\n id: string;\n\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (business or individual).\n // Defaults to 'business'. Should become mandatory field\n // in the future, left as optional for API compatibility for now.\n user_type?: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Authentication settings for this instance\n auth: InstanceAuthConfigurationMessage;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n}\n\nexport interface InstanceAuthConfigurationMessage {\n // Type of authentication.\n // \"external\": The mechant backend does not do\n // any authentication checks. Instead an API\n // gateway must do the authentication.\n // \"token\": The merchant checks an auth token.\n // See \"token\" for details.\n method: \"external\" | \"token\";\n\n // For method \"token\", this field is mandatory.\n // The token MUST begin with the string \"secret-token:\".\n // After the auth token has been set (with method \"token\"),\n // the value must be provided in a \"Authorization: Bearer $token\"\n // header.\n token?: AccessToken;\n}\n\nexport interface InstanceReconfigurationMessage {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (business or individual).\n // Defaults to 'business'. Should become mandatory field\n // in the future, left as optional for API compatibility for now.\n user_type?: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n}\n\nexport interface InstancesResponse {\n // List of instances that are present in the backend (see Instance).\n instances: Instance[];\n}\n\nexport interface Instance {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (\"business\" or \"individual\").\n user_type: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Merchant instance this response is about ($INSTANCE).\n id: string;\n\n // Public key of the merchant/instance, in Crockford Base32 encoding.\n merchant_pub: EddsaPublicKey;\n\n // List of the payment targets supported by this instance. Clients can\n // specify the desired payment target in /order requests. Note that\n // front-ends do not have to support wallets selecting payment targets.\n payment_targets: string[];\n\n // Has this instance been deleted (but not purged)?\n deleted: boolean;\n}\n\nexport interface QueryInstancesResponse {\n // Merchant name corresponding to this instance.\n name: string;\n\n // Type of the user (\"business\" or \"individual\").\n user_type: string;\n\n // Merchant email for customer contact.\n email?: string;\n\n // Merchant public website.\n website?: string;\n\n // Merchant logo.\n logo?: ImageDataUrl;\n\n // Public key of the merchant/instance, in Crockford Base32 encoding.\n merchant_pub: EddsaPublicKey;\n\n // The merchant's physical address (to be put into contracts).\n address: Location;\n\n // The jurisdiction under which the merchant conducts its business\n // (to be put into contracts).\n jurisdiction: Location;\n\n // Use STEFAN curves to determine default fees?\n // If false, no fees are allowed by default.\n // Can always be overridden by the frontend on a per-order basis.\n use_stefan: boolean;\n\n // If the frontend does NOT specify an execution date, how long should\n // we tell the exchange to wait to aggregate transactions before\n // executing the wire transfer? This delay is added to the current\n // time when we generate the advisory execution time for the exchange.\n default_wire_transfer_delay: RelativeTime;\n\n // If the frontend does NOT specify a payment deadline, how long should\n // offers we make be valid by default?\n default_pay_delay: RelativeTime;\n\n // Authentication configuration.\n // Does not contain the token when token auth is configured.\n auth: {\n method: \"external\" | \"token\";\n };\n}\n\nexport interface AccountKycRedirects {\n // Array of pending KYCs.\n pending_kycs: MerchantAccountKycRedirect[];\n\n // Array of exchanges with no reply.\n timeout_kycs: ExchangeKycTimeout[];\n}\n\nexport interface MerchantAccountKycRedirect {\n // URL that the user should open in a browser to\n // proceed with the KYC process (as returned\n // by the exchange's /kyc-check/ endpoint).\n // Optional, missing if the account is blocked\n // due to AML and not due to KYC.\n kyc_url?: string;\n\n // AML status of the account.\n aml_status: Integer;\n\n // Base URL of the exchange this is about.\n exchange_url: string;\n\n // Our bank wire account this is about.\n payto_uri: PaytoString;\n}\n\nexport interface ExchangeKycTimeout {\n // Base URL of the exchange this is about.\n exchange_url: string;\n\n // Numeric error code indicating errors the exchange\n // returned, or TALER_EC_INVALID for none.\n exchange_code: number;\n\n // HTTP status code returned by the exchange when we asked for\n // information about the KYC status.\n // 0 if there was no response at all.\n exchange_http_status: number;\n}\n\nexport interface AccountAddDetails {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // Credentials to use when accessing the credit facade.\n // Never returned on a GET (as this may be somewhat\n // sensitive data). Can be set in POST\n // or PATCH requests to update (or delete) credentials.\n // To really delete credentials, set them to the type: \"none\".\n credit_facade_credentials?: FacadeCredentials;\n}\n\nexport type FacadeCredentials =\n | NoFacadeCredentials\n | BasicAuthFacadeCredentials;\n\nexport interface NoFacadeCredentials {\n type: \"none\";\n}\n\nexport interface BasicAuthFacadeCredentials {\n type: \"basic\";\n\n // Username to use to authenticate\n username: string;\n\n // Password to use to authenticate\n password: string;\n}\n\nexport interface AccountAddResponse {\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // Salt used to compute h_wire.\n salt: HashCode;\n}\n\nexport interface AccountPatchDetails {\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // Credentials to use when accessing the credit facade.\n // Never returned on a GET (as this may be somewhat\n // sensitive data). Can be set in POST\n // or PATCH requests to update (or delete) credentials.\n // To really delete credentials, set them to the type: \"none\".\n // If the argument is omitted, the old credentials\n // are simply preserved.\n credit_facade_credentials?: FacadeCredentials;\n}\n\nexport interface AccountsSummaryResponse {\n // List of accounts that are known for the instance.\n accounts: BankAccountEntry[];\n}\n\n// TODO: missing in docs\nexport interface BankAccountEntry {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // true if this account is active,\n // false if it is historic.\n active?: boolean;\n}\nexport interface BankAccountDetail {\n // payto:// URI of the account.\n payto_uri: PaytoString;\n\n // Hash over the wire details (including over the salt).\n h_wire: HashCode;\n\n // Salt used to compute h_wire.\n salt: HashCode;\n\n // URL from where the merchant can download information\n // about incoming wire transfers to this account.\n credit_facade_url?: string;\n\n // true if this account is active,\n // false if it is historic.\n active?: boolean;\n}\n\nexport interface ProductAddDetail {\n // Product ID to use.\n product_id: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age?: Integer;\n}\n\nexport interface ProductPatchDetail {\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Number of units of the product that were lost (spoiled, stolen, etc.).\n total_lost?: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age?: Integer;\n}\n\nexport interface InventorySummaryResponse {\n // List of products that are present in the inventory.\n products: InventoryEntry[];\n}\n\nexport interface InventoryEntry {\n // Product identifier, as found in the product.\n product_id: string;\n // product_serial_id of the product in the database.\n product_serial: Integer;\n}\n\nexport interface FullInventoryDetailsResponse {\n // List of products that are present in the inventory.\n products: MerchantPosProductDetail[];\n\n // List of categories in the inventory.\n categories: MerchantCategory[];\n}\n\nexport interface MerchantPosProductDetail {\n // A unique numeric ID of the product\n product_serial: number;\n\n // A merchant-internal unique identifier for the product\n product_id?: string;\n\n // A list of category IDs this product belongs to.\n // Typically, a product only belongs to one category, but more than one is supported.\n categories: number[];\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // Optional, if missing treat as \"infinite\".\n total_stock?: Integer;\n\n // Minimum age buyer must have (in years).\n minimum_age?: Integer;\n}\n\nexport interface MerchantCategory {\n // A unique numeric ID of the category\n id: number;\n\n // The name of the category. This will be shown to users and used in the order summary.\n name: string;\n\n // Map from IETF BCP 47 language tags to localized names\n name_i18n?: { [lang_tag: string]: string };\n}\n\nexport interface ProductDetail {\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit: string;\n\n // The price for one unit of the product. Zero is used\n // to imply that this product is not sold separately, or\n // that the price is not fixed, and must be supplied by the\n // front-end. If non-zero, this price MUST include applicable\n // taxes.\n price: AmountString;\n\n // An optional base64-encoded product image.\n image: ImageDataUrl;\n\n // A list of taxes paid by the merchant for one unit of this product.\n taxes?: Tax[];\n\n // Number of units of the product in stock in sum in total,\n // including all existing sales ever. Given in product-specific\n // units.\n // A value of -1 indicates \"infinite\" (i.e. for \"electronic\" books).\n total_stock: Integer;\n\n // Number of units of the product that have already been sold.\n total_sold: Integer;\n\n // Number of units of the product that were lost (spoiled, stolen, etc.).\n total_lost: Integer;\n\n // Identifies where the product is in stock.\n address?: Location;\n\n // Identifies when we expect the next restocking to happen.\n next_restock?: Timestamp;\n\n // Minimum age buyer must have (in years).\n minimum_age?: Integer;\n}\nexport interface LockRequest {\n // UUID that identifies the frontend performing the lock\n // Must be unique for the lifetime of the lock.\n lock_uuid: string;\n\n // How long does the frontend intend to hold the lock?\n duration: RelativeTime;\n\n // How many units should be locked?\n quantity: Integer;\n}\n\nexport interface PostOrderRequest {\n // The order must at least contain the minimal\n // order detail, but can override all.\n order: Order;\n\n // If set, the backend will then set the refund deadline to the current\n // time plus the specified delay. If it's not set, refunds will not be\n // possible.\n refund_delay?: RelativeTime;\n\n // Specifies the payment target preferred by the client. Can be used\n // to select among the various (active) wire methods supported by the instance.\n payment_target?: string;\n\n // Specifies that some products are to be included in the\n // order from the inventory. For these inventory management\n // is performed (so the products must be in stock) and\n // details are completed from the product data of the backend.\n inventory_products?: MinimalInventoryProduct[];\n\n // Specifies a lock identifier that was used to\n // lock a product in the inventory. Only useful if\n // inventory_products is set. Used in case a frontend\n // reserved quantities of the individual products while\n // the shopping cart was being built. Multiple UUIDs can\n // be used in case different UUIDs were used for different\n // products (i.e. in case the user started with multiple\n // shopping sessions that were combined during checkout).\n lock_uuids?: string[];\n\n // Should a token for claiming the order be generated?\n // False can make sense if the ORDER_ID is sufficiently\n // high entropy to prevent adversarial claims (like it is\n // if the backend auto-generates one). Default is 'true'.\n create_token?: boolean;\n\n // OTP device ID to associate with the order.\n // This parameter is optional.\n otp_id?: string;\n}\n\nexport type Order = MinimalOrderDetail & Partial;\n\nexport interface MinimalOrderDetail {\n // Amount to be paid by the customer.\n amount: AmountString;\n\n // Short summary of the order.\n summary: string;\n\n // See documentation of fulfillment_url in ContractTerms.\n // Either fulfillment_url or fulfillment_message must be specified.\n // When creating an order, the fulfillment URL can\n // contain ${ORDER_ID} which will be substituted with the\n // order ID of the newly created order.\n fulfillment_url?: string;\n\n // See documentation of fulfillment_message in ContractTerms.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n}\n\nexport interface MinimalInventoryProduct {\n // Which product is requested (here mandatory!).\n product_id: string;\n\n // How many units of the product are requested.\n quantity: Integer;\n}\n\nexport interface PostOrderResponse {\n // Order ID of the response that was just created.\n order_id: string;\n\n // Token that authorizes the wallet to claim the order.\n // Provided only if \"create_token\" was set to 'true'\n // in the request.\n token?: ClaimToken;\n}\nexport interface OutOfStockResponse {\n // Product ID of an out-of-stock item.\n product_id: string;\n\n // Requested quantity.\n requested_quantity: Integer;\n\n // Available quantity (must be below requested_quantity).\n available_quantity: Integer;\n\n // When do we expect the product to be again in stock?\n // Optional, not given if unknown.\n restock_expected?: Timestamp;\n}\n\nexport interface OrderHistory {\n // Timestamp-sorted array of all orders matching the query.\n // The order of the sorting depends on the sign of delta.\n orders: OrderHistoryEntry[];\n}\n\nexport interface OrderHistoryEntry {\n // Order ID of the transaction related to this entry.\n order_id: string;\n\n // Row ID of the order in the database.\n row_id: number;\n\n // When the order was created.\n timestamp: Timestamp;\n\n // The amount of money the order is for.\n amount: AmountString;\n\n // The summary of the order.\n summary: string;\n\n // Whether some part of the order is refundable,\n // that is the refund deadline has not yet expired\n // and the total amount refunded so far is below\n // the value of the original transaction.\n refundable: boolean;\n\n // Whether the order has been paid or not.\n paid: boolean;\n}\n\nexport type MerchantOrderStatusResponse =\n | CheckPaymentPaidResponse\n | CheckPaymentClaimedResponse\n | CheckPaymentUnpaidResponse;\n\nexport interface CheckPaymentPaidResponse {\n // The customer paid for this contract.\n order_status: \"paid\";\n\n // Was the payment refunded (even partially)?\n refunded: boolean;\n\n // True if there are any approved refunds that the wallet has\n // not yet obtained.\n refund_pending: boolean;\n\n // Did the exchange wire us the funds?\n wired: boolean;\n\n // Total amount the exchange deposited into our bank account\n // for this contract, excluding fees.\n deposit_total: AmountString;\n\n // Numeric error code indicating errors the exchange\n // encountered tracking the wire transfer for this purchase (before\n // we even got to specific coin issues).\n // 0 if there were no issues.\n exchange_code: number;\n\n // HTTP status code returned by the exchange when we asked for\n // information to track the wire transfer for this purchase.\n // 0 if there were no issues.\n exchange_http_status: number;\n\n // Total amount that was refunded, 0 if refunded is false.\n refund_amount: AmountString;\n\n // Contract terms.\n contract_terms: ContractTerms;\n\n // The wire transfer status from the exchange for this order if\n // available, otherwise empty array.\n wire_details: TransactionWireTransfer[];\n\n // Reports about trouble obtaining wire transfer details,\n // empty array if no trouble were encountered.\n wire_reports: TransactionWireReport[];\n\n // The refund details for this order. One entry per\n // refunded coin; empty array if there are no refunds.\n refund_details: RefundDetails[];\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n order_status_url: string;\n}\n\nexport interface CheckPaymentClaimedResponse {\n // A wallet claimed the order, but did not yet pay for the contract.\n order_status: \"claimed\";\n\n // Contract terms.\n contract_terms: ContractTerms;\n}\n\nexport interface CheckPaymentUnpaidResponse {\n // The order was neither claimed nor paid.\n order_status: \"unpaid\";\n\n // URI that the wallet must process to complete the payment.\n taler_pay_uri: string;\n\n // when was the order created\n creation_time: Timestamp;\n\n // Order summary text.\n summary: string;\n\n // Total amount of the order (to be paid by the customer).\n total_amount: AmountString;\n\n // Alternative order ID which was paid for already in the same session.\n // Only given if the same product was purchased before in the same session.\n already_paid_order_id?: string;\n\n // Fulfillment URL of an already paid order. Only given if under this\n // session an already paid order with a fulfillment URL exists.\n already_paid_fulfillment_url?: string;\n\n // Status URL, can be used as a redirect target for the browser\n // to show the order QR code / trigger the wallet.\n order_status_url: string;\n\n // We do we NOT return the contract terms here because they may not\n // exist in case the wallet did not yet claim them.\n}\nexport interface RefundDetails {\n // Reason given for the refund.\n reason: string;\n\n // Set to true if a refund is still available for the wallet for this payment.\n pending: boolean;\n\n // When was the refund approved.\n timestamp: Timestamp;\n\n // Total amount that was refunded (minus a refund fee).\n amount: AmountString;\n}\n\nexport interface TransactionWireTransfer {\n // Responsible exchange.\n exchange_url: string;\n\n // 32-byte wire transfer identifier.\n wtid: Base32String;\n\n // Execution time of the wire transfer.\n execution_time: Timestamp;\n\n // Total amount that has been wire transferred\n // to the merchant.\n amount: AmountString;\n\n // Was this transfer confirmed by the merchant via the\n // POST /transfers API, or is it merely claimed by the exchange?\n confirmed: boolean;\n}\n\nexport interface TransactionWireReport {\n // Numerical error code.\n code: number;\n\n // Human-readable error description.\n hint: string;\n\n // Numerical error code from the exchange.\n exchange_code: number;\n\n // HTTP status code received from the exchange.\n exchange_http_status: number;\n\n // Public key of the coin for which we got the exchange error.\n coin_pub: CoinPublicKey;\n}\n\nexport interface ForgetRequest {\n // Array of valid JSON paths to forgettable fields in the order's\n // contract terms.\n fields: string[];\n}\n\nexport interface RefundRequest {\n // Amount to be refunded.\n refund: AmountString;\n\n // Human-readable refund justification.\n reason: string;\n}\nexport interface MerchantRefundResponse {\n // URL (handled by the backend) that the wallet should access to\n // trigger refund processing.\n // taler://refund/...\n taler_refund_uri: string;\n\n // Contract hash that a client may need to authenticate an\n // HTTP request to obtain the above URI in a wallet-friendly way.\n h_contract: HashCode;\n}\n\nexport interface TransferInformation {\n // How much was wired to the merchant (minus fees).\n credit_amount: AmountString;\n\n // Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).\n wtid: WireTransferIdentifierRawP;\n\n // Target account that received the wire transfer.\n payto_uri: PaytoString;\n\n // Base URL of the exchange that made the wire transfer.\n exchange_url: string;\n}\n\nexport interface TransferList {\n // List of all the transfers that fit the filter that we know.\n transfers: TransferDetails[];\n}\nexport interface TransferDetails {\n // How much was wired to the merchant (minus fees).\n credit_amount: AmountString;\n\n // Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).\n wtid: WireTransferIdentifierRawP;\n\n // Target account that received the wire transfer.\n payto_uri: PaytoString;\n\n // Base URL of the exchange that made the wire transfer.\n exchange_url: string;\n\n // Serial number identifying the transfer in the merchant backend.\n // Used for filtering via offset.\n transfer_serial_id: number;\n\n // Time of the execution of the wire transfer by the exchange, according to the exchange\n // Only provided if we did get an answer from the exchange.\n execution_time?: Timestamp;\n\n // True if we checked the exchange's answer and are happy with it.\n // False if we have an answer and are unhappy, missing if we\n // do not have an answer from the exchange.\n verified?: boolean;\n\n // True if the merchant uses the POST /transfers API to confirm\n // that this wire transfer took place (and it is thus not\n // something merely claimed by the exchange).\n confirmed?: boolean;\n}\n\nexport interface OtpDeviceAddDetails {\n // Device ID to use.\n otp_device_id: string;\n\n // Human-readable description for the device.\n otp_device_description: string;\n\n // A key encoded with RFC 3548 Base32.\n // IMPORTANT: This is not using the typical\n // Taler base32-crockford encoding.\n // Instead it uses the RFC 3548 encoding to\n // be compatible with the TOTP standard.\n otp_key: string;\n\n // Algorithm for computing the POS confirmation.\n // \"NONE\" or 0: No algorithm (no pos confirmation will be generated)\n // \"TOTP_WITHOUT_PRICE\" or 1: Without amounts (typical OTP device)\n // \"TOTP_WITH_PRICE\" or 2: With amounts (special-purpose OTP device)\n // The \"String\" variants are supported @since protocol **v7**.\n otp_algorithm: Integer | string;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n}\n\nexport interface OtpDevicePatchDetails {\n // Human-readable description for the device.\n otp_device_description: string;\n\n // A key encoded with RFC 3548 Base32.\n // IMPORTANT: This is not using the typical\n // Taler base32-crockford encoding.\n // Instead it uses the RFC 3548 encoding to\n // be compatible with the TOTP standard.\n otp_key: string;\n\n // Algorithm for computing the POS confirmation.\n otp_algorithm: Integer;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n}\n\nexport interface OtpDeviceSummaryResponse {\n // Array of devices that are present in our backend.\n otp_devices: OtpDeviceEntry[];\n}\nexport interface OtpDeviceEntry {\n // Device identifier.\n otp_device_id: string;\n\n // Human-readable description for the device.\n device_description: string;\n}\n\nexport interface OtpDeviceDetails {\n // Human-readable description for the device.\n device_description: string;\n\n // Algorithm for computing the POS confirmation.\n //\n // Currently, the following numbers are defined:\n // 0: None\n // 1: TOTP without price\n // 2: TOTP with price\n otp_algorithm: Integer;\n\n // Counter for counter-based OTP devices.\n otp_ctr?: Integer;\n\n // Current time for time-based OTP devices.\n // Will match the faketime argument of the\n // query if one was present, otherwise the current\n // time at the backend.\n //\n // Available since protocol **v10**.\n otp_timestamp: Integer;\n\n // Current OTP confirmation string of the device.\n // Matches exactly the string that would be returned\n // as part of a payment confirmation for the given\n // amount and time (so may contain multiple OTP codes).\n //\n // If the otp_algorithm is time-based, the code is\n // returned for the current time, or for the faketime\n // if a TIMESTAMP query argument was provided by the client.\n //\n // When using OTP with counters, the counter is **NOT**\n // increased merely because this endpoint created\n // an OTP code (this is a GET request, after all!).\n //\n // If the otp_algorithm requires an amount, the\n // amount argument must be specified in the\n // query, otherwise the otp_code is not\n // generated.\n //\n // This field is *optional* in the response, as it is\n // only provided if we could compute it based on the\n // otp_algorithm and matching client query arguments.\n //\n // Available since protocol **v10**.\n otp_code?: string;\n}\nexport interface TemplateAddDetails {\n // Template ID to use.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\nexport interface TemplateContractDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // Required currency for payments to the template.\n // The user may specify any amount, but it must be\n // in this currency.\n // This parameter is optional and should not be present\n // if \"amount\" is given.\n currency?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: AmountString;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age: Integer;\n\n // The time the customer need to pay before his order will be deleted.\n // It is deleted if the customer did not pay and if the duration is over.\n pay_duration: RelativeTime;\n}\n\nexport interface TemplateContractDetailsDefaults {\n summary?: string;\n\n currency?: string;\n\n /**\n * Amount *or* a plain currency string.\n */\n amount?: string;\n}\n\nexport interface TemplatePatchDetails {\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\n\nexport interface TemplateSummaryResponse {\n // List of templates that are present in our backend.\n templates: TemplateEntry[];\n}\n\nexport interface TemplateEntry {\n // Template identifier, as found in the template.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n}\n\nexport interface WalletTemplateDetails {\n // Hard-coded information about the contrac terms\n // for this template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\n\nexport interface TemplateDetails {\n // Human-readable description for the template.\n template_description: string;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n\n // Additional information in a separate template.\n template_contract: TemplateContractDetails;\n\n // Key-value pairs matching a subset of the\n // fields from template_contract that are\n // user-editable defaults for this template.\n // Since protocol **v13**.\n editable_defaults?: TemplateContractDetailsDefaults;\n}\nexport interface UsingTemplateDetails {\n // Summary of the template\n summary?: string;\n\n // The amount entered by the customer.\n amount?: AmountString;\n}\n\nexport interface WebhookAddDetails {\n // Webhook ID to use.\n webhook_id: string;\n\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface WebhookPatchDetails {\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface WebhookSummaryResponse {\n // Return webhooks that are present in our backend.\n webhooks: WebhookEntry[];\n}\n\nexport interface WebhookEntry {\n // Webhook identifier, as found in the webhook.\n webhook_id: string;\n\n // The event of the webhook: why the webhook is used.\n event_type: string;\n}\n\nexport interface WebhookDetails {\n // The event of the webhook: why the webhook is used.\n event_type: string;\n\n // URL of the webhook where the customer will be redirected.\n url: string;\n\n // Method used by the webhook\n http_method: string;\n\n // Header template of the webhook\n header_template?: string;\n\n // Body template by the webhook\n body_template?: string;\n}\n\nexport interface TokenFamilyCreateRequest {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n // If not specified, merchant backend will use the current time.\n valid_after?: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n}\n\nexport enum TokenFamilyKind {\n Discount = \"discount\",\n Subscription = \"subscription\",\n}\n\nexport interface TokenFamilyUpdateRequest {\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n}\n\nexport interface TokenFamiliesList {\n // All configured token families of this instance.\n token_families: TokenFamilySummary[];\n}\n\nexport interface TokenFamilySummary {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n}\n\nexport interface TokenFamilyDetails {\n // Identifier for the token family consisting of unreserved characters\n // according to RFC 3986.\n slug: string;\n\n // Human-readable name for the token family.\n name: string;\n\n // Human-readable description for the token family.\n description: string;\n\n // Optional map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // Start time of the token family's validity period.\n valid_after: Timestamp;\n\n // End time of the token family's validity period.\n valid_before: Timestamp;\n\n // Validity duration of an issued token.\n duration: RelativeTime;\n\n // Kind of the token family.\n kind: TokenFamilyKind;\n\n // How many tokens have been issued for this family.\n issued: Integer;\n\n // How many tokens have been redeemed for this family.\n redeemed: Integer;\n}\nexport interface ContractTerms {\n // Human-readable description of the whole purchase.\n summary: string;\n\n // Map from IETF BCP 47 language tags to localized summaries.\n summary_i18n?: { [lang_tag: string]: string };\n\n // Unique, free-form identifier for the proposal.\n // Must be unique within a merchant instance.\n // For merchants that do not store proposals in their DB\n // before the customer paid for them, the order_id can be used\n // by the frontend to restore a proposal from the information\n // encoded in it (such as a short product identifier and timestamp).\n order_id: string;\n\n // Total price for the transaction.\n // The exchange will subtract deposit fees from that amount\n // before transferring it to the merchant.\n amount: AmountString;\n\n // URL where the same contract could be ordered again (if\n // available). Returned also at the public order endpoint\n // for people other than the actual buyer (hence public,\n // in case order IDs are guessable).\n public_reorder_url?: string;\n\n // URL that will show that the order was successful after\n // it has been paid for. Optional. When POSTing to the\n // merchant, the placeholder \"${ORDER_ID}\" will be\n // replaced with the actual order ID (useful if the\n // order ID is generated server-side and needs to be\n // in the URL).\n // Note that this placeholder can only be used once.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_url?: string;\n\n // Message shown to the customer after paying for the order.\n // Either fulfillment_url or fulfillment_message must be specified.\n fulfillment_message?: string;\n\n // Map from IETF BCP 47 language tags to localized fulfillment\n // messages.\n fulfillment_message_i18n?: { [lang_tag: string]: string };\n\n // Maximum total deposit fee accepted by the merchant for this contract.\n // Overrides defaults of the merchant instance.\n max_fee: AmountString;\n\n // List of products that are part of the purchase (see Product).\n products: Product[];\n\n // Time when this contract was generated.\n timestamp: Timestamp;\n\n // After this deadline has passed, no refunds will be accepted.\n refund_deadline: Timestamp;\n\n // After this deadline, the merchant won't accept payments for the contract.\n pay_deadline: Timestamp;\n\n // Transfer deadline for the exchange. Must be in the\n // deposit permissions of coins used to pay for this order.\n wire_transfer_deadline: Timestamp;\n\n // Merchant's public key used to sign this proposal; this information\n // is typically added by the backend. Note that this can be an ephemeral key.\n merchant_pub: EddsaPublicKey;\n\n // Base URL of the (public!) merchant backend API.\n // Must be an absolute URL that ends with a slash.\n merchant_base_url: string;\n\n // More info about the merchant, see below.\n merchant: Merchant;\n\n // The hash of the merchant instance's wire details.\n h_wire: HashCode;\n\n // Wire transfer method identifier for the wire method associated with h_wire.\n // The wallet may only select exchanges via a matching auditor if the\n // exchange also supports this wire method.\n // The wire transfer fees must be added based on this wire transfer method.\n wire_method: string;\n\n // Exchanges that the merchant accepts even if it does not accept any auditors that audit them.\n exchanges: Exchange[];\n\n // Delivery location for (all!) products.\n delivery_location?: Location;\n\n // Time indicating when the order should be delivered.\n // May be overwritten by individual products.\n delivery_date?: Timestamp;\n\n // Nonce generated by the wallet and echoed by the merchant\n // in this field when the proposal is generated.\n nonce: string;\n\n // Specifies for how long the wallet should try to get an\n // automatic refund for the purchase. If this field is\n // present, the wallet should wait for a few seconds after\n // the purchase and then automatically attempt to obtain\n // a refund. The wallet should probe until \"delay\"\n // after the payment was successful (i.e. via long polling\n // or via explicit requests with exponential back-off).\n //\n // In particular, if the wallet is offline\n // at that time, it MUST repeat the request until it gets\n // one response from the merchant after the delay has expired.\n // If the refund is granted, the wallet MUST automatically\n // recover the payment. This is used in case a merchant\n // knows that it might be unable to satisfy the contract and\n // desires for the wallet to attempt to get the refund without any\n // customer interaction. Note that it is NOT an error if the\n // merchant does not grant a refund.\n auto_refund?: RelativeTime;\n\n // Extra data that is only interpreted by the merchant frontend.\n // Useful when the merchant needs to store extra information on a\n // contract without storing it separately in their database.\n extra?: any;\n\n // Minimum age the buyer must have (in years). Default is 0.\n // This value is at least as large as the maximum over all\n // minimum age requirements of the products in this contract.\n // It might also be set independent of any product, due to\n // legal requirements.\n minimum_age?: Integer;\n}\n\nexport interface Product {\n // Merchant-internal identifier for the product.\n product_id?: string;\n\n // Human-readable product description.\n description: string;\n\n // Map from IETF BCP 47 language tags to localized descriptions.\n description_i18n?: { [lang_tag: string]: string };\n\n // The number of units of the product to deliver to the customer.\n quantity?: Integer;\n\n // Unit in which the product is measured (liters, kilograms, packages, etc.).\n unit?: string;\n\n // The price of the product; this is the total price for quantity times unit of this product.\n price?: AmountString;\n\n // An optional base64-encoded product image.\n image?: ImageDataUrl;\n\n // A list of taxes paid by the merchant for this product. Can be empty.\n taxes?: Tax[];\n\n // Time indicating when this product should be delivered.\n delivery_date?: Timestamp;\n}\n\nexport interface Tax {\n // The name of the tax.\n name: string;\n\n // Amount paid in tax.\n tax: AmountString;\n}\nexport interface Merchant {\n // The merchant's legal name of business.\n name: string;\n\n // Label for a location with the business address of the merchant.\n email?: string;\n\n // Label for a location with the business address of the merchant.\n website?: string;\n\n // An optional base64-encoded product image.\n logo?: ImageDataUrl;\n\n // Label for a location with the business address of the merchant.\n address?: Location;\n\n // Label for a location that denotes the jurisdiction for disputes.\n // Some of the typical fields for a location (such as a street address) may be absent.\n jurisdiction?: Location;\n}\n// Delivery location, loosely modeled as a subset of\n// ISO20022's PostalAddress25.\nexport interface Location {\n // Nation with its own government.\n country?: string;\n\n // Identifies a subdivision of a country such as state, region, county.\n country_subdivision?: string;\n\n // Identifies a subdivision within a country sub-division.\n district?: string;\n\n // Name of a built-up area, with defined boundaries, and a local government.\n town?: string;\n\n // Specific location name within the town.\n town_location?: string;\n\n // Identifier consisting of a group of letters and/or numbers that\n // is added to a postal address to assist the sorting of mail.\n post_code?: string;\n\n // Name of a street or thoroughfare.\n street?: string;\n\n // Name of the building or house.\n building_name?: string;\n\n // Number that identifies the position of a building on a street.\n building_number?: string;\n\n // Free-form address lines, should not exceed 7 elements.\n address_lines?: string[];\n}\ninterface Auditor {\n // Official name.\n name: string;\n\n // Auditor's public key.\n auditor_pub: EddsaPublicKey;\n\n // Base URL of the auditor.\n url: string;\n}\nexport interface Exchange {\n // The exchange's base URL.\n url: string;\n\n // How much would the merchant like to use this exchange.\n // The wallet should use a suitable exchange with high\n // priority. The following priority values are used, but\n // it should be noted that they are NOT in any way normative.\n //\n // 0: likely it will not work (recently seen with account\n // restriction that would be bad for this merchant)\n // 512: merchant does not know, might be down (merchant\n // did not yet get /wire response).\n // 1024: good choice (recently confirmed working)\n priority: Integer;\n\n // Master public key of the exchange.\n master_pub: EddsaPublicKey;\n}\n\nexport interface MerchantReserveCreateConfirmation {\n // Public key identifying the reserve.\n reserve_pub: EddsaPublicKey;\n\n // Wire accounts of the exchange where to transfer the funds.\n accounts: ExchangeWireAccount[];\n}\n\nexport interface TemplateEditableDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // Required currency for payments to the template.\n // The user may specify any amount, but it must be\n // in this currency.\n // This parameter is optional and should not be present\n // if \"amount\" is given.\n currency?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: AmountString;\n}\n\nexport interface MerchantTemplateContractDetails {\n // Human-readable summary for the template.\n summary?: string;\n\n // The price is imposed by the merchant and cannot be changed by the customer.\n // This parameter is optional.\n amount?: string;\n\n // Minimum age buyer must have (in years). Default is 0.\n minimum_age: number;\n\n // The time the customer need to pay before his order will be deleted.\n // It is deleted if the customer did not pay and if the duration is over.\n pay_duration: TalerProtocolDuration;\n}\n\nexport interface MerchantTemplateAddDetails {\n // Template ID to use.\n template_id: string;\n\n // Human-readable description for the template.\n template_description: string;\n\n // A base64-encoded image selected by the merchant.\n // This parameter is optional.\n // We are not sure about it.\n image?: string;\n\n editable_defaults?: TemplateEditableDetails;\n\n // Additional information in a separate template.\n template_contract: MerchantTemplateContractDetails;\n\n // OTP device ID.\n // This parameter is optional.\n otp_id?: string;\n}\n\nconst codecForExchangeConfigInfo = (): Codec =>\n buildCodecForObject()\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .property(\"master_pub\", codecForString())\n .build(\"TalerMerchantApi.ExchangeConfigInfo\");\n\nexport const codecForTalerMerchantConfigResponse = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-merchant\"))\n .property(\"currency\", codecForString())\n .property(\"version\", codecForString())\n .property(\"currencies\", codecForMap(codecForCurrencySpecificiation()))\n .property(\"exchanges\", codecForList(codecForExchangeConfigInfo()))\n .build(\"TalerMerchantApi.VersionResponse\");\n\nexport const codecForClaimResponse = (): Codec =>\n buildCodecForObject()\n .property(\"contract_terms\", codecForContractTerms())\n .property(\"sig\", codecForString())\n .build(\"TalerMerchantApi.ClaimResponse\");\n\nexport const codecForPaymentResponse = (): Codec =>\n buildCodecForObject()\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .property(\"sig\", codecForString())\n .build(\"TalerMerchantApi.PaymentResponse\");\n\nexport const codecForStatusPaid = (): Codec =>\n buildCodecForObject()\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"refund_taken\", codecForAmountString())\n .property(\"refunded\", codecForBoolean())\n .property(\"type\", codecForConstString(\"paid\"))\n .build(\"TalerMerchantApi.StatusPaid\");\n\nexport const codecForStatusGoto = (): Codec =>\n buildCodecForObject()\n .property(\"public_reorder_url\", codecForURLString())\n .property(\"type\", codecForConstString(\"goto\"))\n .build(\"TalerMerchantApi.StatusGotoResponse\");\n\nexport const codecForStatusStatusUnpaid = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"unpaid\"))\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"taler_pay_uri\", codecForTalerUriString())\n .build(\"TalerMerchantApi.PaymentResponse\");\n\nexport const codecForPaidRefundStatusResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"pos_confirmation\", codecOptional(codecForString()))\n .property(\"refunded\", codecForBoolean())\n .build(\"TalerMerchantApi.PaidRefundStatusResponse\");\n\nexport const codecForMerchantAbortPayRefundSuccessStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_status\", codecForConstNumber(200))\n .property(\"type\", codecForConstString(\"success\"))\n .build(\"TalerMerchantApi.MerchantAbortPayRefundSuccessStatus\");\n\nexport const codecForMerchantAbortPayRefundFailureStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_reply\", codecForAny())\n .property(\"exchange_status\", codecForNumber())\n .property(\"type\", codecForConstString(\"failure\"))\n .build(\"TalerMerchantApi.MerchantAbortPayRefundFailureStatus\");\n\nexport const codecForMerchantAbortPayRefundStatus =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"success\", codecForMerchantAbortPayRefundSuccessStatus())\n .alternative(\"failure\", codecForMerchantAbortPayRefundFailureStatus())\n .build(\"TalerMerchantApi.MerchantAbortPayRefundStatus\");\n\nexport const codecForAbortResponse = (): Codec =>\n buildCodecForObject()\n .property(\"refunds\", codecForList(codecForMerchantAbortPayRefundStatus()))\n .build(\"TalerMerchantApi.AbortResponse\");\n\nexport const codecForWalletRefundResponse = (): Codec =>\n buildCodecForObject()\n .property(\"merchant_pub\", codecForString())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"refunds\", codecForList(codecForMerchantCoinRefundStatus()))\n .build(\"TalerMerchantApi.AbortResponse\");\n\nexport const codecForMerchantCoinRefundSuccessStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"success\"))\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_status\", codecForConstNumber(200))\n .property(\"exchange_sig\", codecForString())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"exchange_pub\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TalerMerchantApi.MerchantCoinRefundSuccessStatus\");\n\nexport const codecForMerchantCoinRefundFailureStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"failure\"))\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_status\", codecForNumber())\n .property(\"rtransaction_id\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"exchange_code\", codecOptional(codecForNumber()))\n .property(\"exchange_reply\", codecOptional(codecForAny()))\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TalerMerchantApi.MerchantCoinRefundFailureStatus\");\n\nexport const codecForMerchantCoinRefundStatus =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"success\", codecForMerchantCoinRefundSuccessStatus())\n .alternative(\"failure\", codecForMerchantCoinRefundFailureStatus())\n .build(\"TalerMerchantApi.MerchantCoinRefundStatus\");\n\nexport const codecForQueryInstancesResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"user_type\", codecForString())\n .property(\"email\", codecOptional(codecForString()))\n .property(\"website\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"merchant_pub\", codecForString())\n .property(\"address\", codecForLocation())\n .property(\"jurisdiction\", codecForLocation())\n .property(\"use_stefan\", codecForBoolean())\n .property(\"default_wire_transfer_delay\", codecForDuration)\n .property(\"default_pay_delay\", codecForDuration)\n .property(\n \"auth\",\n buildCodecForObject<{\n method: \"external\" | \"token\";\n }>()\n .property(\n \"method\",\n codecForEither(\n codecForConstString(\"token\"),\n codecForConstString(\"external\"),\n ),\n )\n .build(\"TalerMerchantApi.QueryInstancesResponse.auth\"),\n )\n .build(\"TalerMerchantApi.QueryInstancesResponse\");\n\nexport const codecForAccountKycRedirects = (): Codec =>\n buildCodecForObject()\n .property(\n \"pending_kycs\",\n codecForList(codecForMerchantAccountKycRedirect()),\n )\n .property(\"timeout_kycs\", codecForList(codecForExchangeKycTimeout()))\n\n .build(\"TalerMerchantApi.AccountKycRedirects\");\n\nexport const codecForMerchantAccountKycRedirect =\n (): Codec =>\n buildCodecForObject()\n .property(\"kyc_url\", codecForURLString())\n .property(\"aml_status\", codecForNumber())\n .property(\"exchange_url\", codecForURLString())\n .property(\"payto_uri\", codecForPaytoString())\n .build(\"TalerMerchantApi.MerchantAccountKycRedirect\");\n\nexport const codecForExchangeKycTimeout = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_url\", codecForURLString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .build(\"TalerMerchantApi.ExchangeKycTimeout\");\n\nexport const codecForAccountAddResponse = (): Codec =>\n buildCodecForObject()\n .property(\"h_wire\", codecForString())\n .property(\"salt\", codecForString())\n .build(\"TalerMerchantApi.AccountAddResponse\");\n\nexport const codecForAccountsSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForBankAccountEntry()))\n .build(\"TalerMerchantApi.AccountsSummaryResponse\");\n\nexport const codecForBankAccountEntry = (): Codec =>\n buildCodecForObject()\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"h_wire\", codecForString())\n .property(\"active\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.BankAccountEntry\");\n\nexport const codecForBankAccountDetail = (): Codec =>\n buildCodecForObject()\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"h_wire\", codecForString())\n .property(\"salt\", codecForString())\n .property(\"credit_facade_url\", codecOptional(codecForURLString()))\n .property(\"active\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.BankAccountEntry\");\n\nexport const codecForInventorySummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"products\", codecForList(codecForInventoryEntry()))\n .build(\"TalerMerchantApi.InventorySummaryResponse\");\n\nexport const codecForInventoryEntry = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecForString())\n .property(\"product_serial\", codecForNumber())\n .build(\"TalerMerchantApi.InventoryEntry\");\n\nexport const codecForMerchantPosProductDetail =\n (): Codec =>\n buildCodecForObject()\n .property(\"product_serial\", codecForNumber())\n .property(\"product_id\", codecOptional(codecForString()))\n .property(\"categories\", codecForList(codecForNumber()))\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"unit\", codecForString())\n .property(\"price\", codecForAmountString())\n .property(\"image\", codecForString())\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"total_stock\", codecForNumber())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"TalerMerchantApi.MerchantPosProductDetail\");\n\nexport const codecForMerchantCategory = (): Codec =>\n buildCodecForObject()\n .property(\"id\", codecForNumber())\n .property(\"name\", codecForString())\n .property(\"name_i18n\", codecForInternationalizedString())\n .build(\"TalerMerchantApi.MerchantCategory\");\n\nexport const codecForFullInventoryDetailsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"categories\", codecForList(codecForMerchantCategory()))\n .property(\"products\", codecForList(codecForMerchantPosProductDetail()))\n .build(\"TalerMerchantApi.FullInventoryDetailsResponse\");\n\nexport const codecForProductDetail = (): Codec =>\n buildCodecForObject()\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"unit\", codecForString())\n .property(\"price\", codecForAmountString())\n .property(\"image\", codecForString())\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"next_restock\", codecOptional(codecForTimestamp))\n .property(\"total_stock\", codecForNumber())\n .property(\"total_sold\", codecForNumber())\n .property(\"total_lost\", codecForNumber())\n .property(\"minimum_age\", codecOptional(codecForNumber()))\n .build(\"TalerMerchantApi.ProductDetail\");\n\nexport const codecForTax = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"tax\", codecForAmountString())\n .build(\"TalerMerchantApi.Tax\");\n\nexport const codecForPostOrderResponse = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"token\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.PostOrderResponse\");\n\nexport const codecForOutOfStockResponse = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecForString())\n .property(\"available_quantity\", codecForNumber())\n .property(\"requested_quantity\", codecForNumber())\n .property(\"restock_expected\", codecForTimestamp)\n .build(\"TalerMerchantApi.OutOfStockResponse\");\n\nexport const codecForOrderHistory = (): Codec =>\n buildCodecForObject()\n .property(\"orders\", codecForList(codecForOrderHistoryEntry()))\n .build(\"TalerMerchantApi.OrderHistory\");\n\nexport const codecForOrderHistoryEntry = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"row_id\", codecForNumber())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .property(\"summary\", codecForString())\n .property(\"refundable\", codecForBoolean())\n .property(\"paid\", codecForBoolean())\n .build(\"TalerMerchantApi.OrderHistoryEntry\");\n\nexport const codecForMerchant = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"email\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"website\", codecOptional(codecForString()))\n .property(\"address\", codecOptional(codecForLocation()))\n .property(\"jurisdiction\", codecOptional(codecForLocation()))\n .build(\"TalerMerchantApi.MerchantInfo\");\n\nexport const codecForExchange = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"priority\", codecForNumber())\n .property(\"url\", codecForString())\n .build(\"TalerMerchantApi.Exchange\");\n\nexport const codecForContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"order_id\", codecForString())\n .property(\"fulfillment_url\", codecOptional(codecForString()))\n .property(\"fulfillment_message\", codecOptional(codecForString()))\n .property(\n \"fulfillment_message_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"merchant_base_url\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"auto_refund\", codecOptional(codecForDuration))\n .property(\"wire_method\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .property(\"nonce\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"pay_deadline\", codecForTimestamp)\n .property(\"refund_deadline\", codecForTimestamp)\n .property(\"wire_transfer_deadline\", codecForTimestamp)\n .property(\"timestamp\", codecForTimestamp)\n .property(\"delivery_location\", codecOptional(codecForLocation()))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .property(\"max_fee\", codecForAmountString())\n .property(\"merchant\", codecForMerchant())\n .property(\"merchant_pub\", codecForString())\n .property(\"exchanges\", codecForList(codecForExchange()))\n .property(\"products\", codecForList(codecForProduct()))\n .property(\"extra\", codecForAny())\n .build(\"TalerMerchantApi.ContractTerms\");\n\nexport const codecForProduct = (): Codec =>\n buildCodecForObject()\n .property(\"product_id\", codecOptional(codecForString()))\n .property(\"description\", codecForString())\n .property(\n \"description_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"quantity\", codecOptional(codecForNumber()))\n .property(\"unit\", codecOptional(codecForString()))\n .property(\"price\", codecOptional(codecForAmountString()))\n .property(\"image\", codecOptional(codecForString()))\n .property(\"taxes\", codecOptional(codecForList(codecForTax())))\n .property(\"delivery_date\", codecOptional(codecForTimestamp))\n .build(\"TalerMerchantApi.Product\");\n\nexport const codecForCheckPaymentPaidResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"paid\"))\n .property(\"refunded\", codecForBoolean())\n .property(\"refund_pending\", codecForBoolean())\n .property(\"wired\", codecForBoolean())\n .property(\"deposit_total\", codecForAmountString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"refund_amount\", codecForAmountString())\n .property(\"contract_terms\", codecForContractTerms())\n .property(\"wire_reports\", codecForList(codecForTransactionWireReport()))\n .property(\"wire_details\", codecForList(codecForTransactionWireTransfer()))\n .property(\"refund_details\", codecForList(codecForRefundDetails()))\n .property(\"order_status_url\", codecForURLString())\n .build(\"TalerMerchantApi.CheckPaymentPaidResponse\");\n\nexport const codecForCheckPaymentUnpaidResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"unpaid\"))\n .property(\"taler_pay_uri\", codecForTalerUriString())\n .property(\"creation_time\", codecForTimestamp)\n .property(\"summary\", codecForString())\n .property(\"total_amount\", codecForAmountString())\n .property(\"already_paid_order_id\", codecOptional(codecForString()))\n .property(\"already_paid_fulfillment_url\", codecOptional(codecForString()))\n .property(\"order_status_url\", codecForString())\n .build(\"TalerMerchantApi.CheckPaymentPaidResponse\");\n\nexport const codecForCheckPaymentClaimedResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"order_status\", codecForConstString(\"claimed\"))\n .property(\"contract_terms\", codecForContractTerms())\n .build(\"TalerMerchantApi.CheckPaymentClaimedResponse\");\n\nexport const codecForMerchantOrderPrivateStatusResponse =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"order_status\")\n .alternative(\"paid\", codecForCheckPaymentPaidResponse())\n .alternative(\"unpaid\", codecForCheckPaymentUnpaidResponse())\n .alternative(\"claimed\", codecForCheckPaymentClaimedResponse())\n .build(\"TalerMerchantApi.MerchantOrderStatusResponse\");\n\nexport const codecForRefundDetails = (): Codec =>\n buildCodecForObject()\n .property(\"reason\", codecForString())\n .property(\"pending\", codecForBoolean())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .build(\"TalerMerchantApi.RefundDetails\");\n\nexport const codecForTransactionWireTransfer =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_url\", codecForURLString())\n .property(\"wtid\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .property(\"amount\", codecForAmountString())\n .property(\"confirmed\", codecForBoolean())\n .build(\"TalerMerchantApi.TransactionWireTransfer\");\n\nexport const codecForTransactionWireReport = (): Codec =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"hint\", codecForString())\n .property(\"exchange_code\", codecForNumber())\n .property(\"exchange_http_status\", codecForNumber())\n .property(\"coin_pub\", codecForString())\n .build(\"TalerMerchantApi.TransactionWireReport\");\n\nexport const codecForMerchantRefundResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_refund_uri\", codecForTalerUriString())\n .property(\"h_contract\", codecForString())\n .build(\"TalerMerchantApi.MerchantRefundResponse\");\n\nexport const codecForTansferList = (): Codec =>\n buildCodecForObject()\n .property(\"transfers\", codecForList(codecForTransferDetails()))\n .build(\"TalerMerchantApi.TransferList\");\n\nexport const codecForTransferDetails = (): Codec =>\n buildCodecForObject()\n .property(\"credit_amount\", codecForAmountString())\n .property(\"wtid\", codecForString())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"exchange_url\", codecForURLString())\n .property(\"transfer_serial_id\", codecForNumber())\n .property(\"execution_time\", codecOptional(codecForTimestamp))\n .property(\"verified\", codecOptional(codecForBoolean()))\n .property(\"confirmed\", codecOptional(codecForBoolean()))\n .build(\"TalerMerchantApi.TransferDetails\");\n\nexport const codecForOtpDeviceSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"otp_devices\", codecForList(codecForOtpDeviceEntry()))\n .build(\"TalerMerchantApi.OtpDeviceSummaryResponse\");\n\nexport const codecForOtpDeviceEntry = (): Codec =>\n buildCodecForObject()\n .property(\"otp_device_id\", codecForString())\n .property(\"device_description\", codecForString())\n .build(\"TalerMerchantApi.OtpDeviceEntry\");\n\nexport const codecForOtpDeviceDetails = (): Codec =>\n buildCodecForObject()\n .property(\"device_description\", codecForString())\n .property(\"otp_algorithm\", codecForNumber())\n .property(\"otp_ctr\", codecOptional(codecForNumber()))\n .property(\"otp_timestamp\", codecForNumber())\n .property(\"otp_code\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.OtpDeviceDetails\");\n\nexport const codecForTemplateSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"templates\", codecForList(codecForTemplateEntry()))\n .build(\"TalerMerchantApi.TemplateSummaryResponse\");\n\nexport const codecForTemplateEntry = (): Codec =>\n buildCodecForObject()\n .property(\"template_id\", codecForString())\n .property(\"template_description\", codecForString())\n .build(\"TalerMerchantApi.TemplateEntry\");\n\nexport const codecForTemplateDetails = (): Codec =>\n buildCodecForObject()\n .property(\"template_description\", codecForString())\n .property(\"otp_id\", codecOptional(codecForString()))\n .property(\"template_contract\", codecForTemplateContractDetails())\n .property(\n \"editable_defaults\",\n codecOptional(codecForTemplateContractDetailsDefaults()),\n )\n .build(\"TalerMerchantApi.TemplateDetails\");\n\nexport const codecForTemplateContractDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"minimum_age\", codecForNumber())\n .property(\"pay_duration\", codecForDuration)\n .build(\"TalerMerchantApi.TemplateContractDetails\");\n\nexport const codecForTemplateContractDetailsDefaults =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .build(\"TalerMerchantApi.TemplateContractDetailsDefaults\");\n\nexport const codecForWalletTemplateDetails = (): Codec =>\n buildCodecForObject()\n .property(\"template_contract\", codecForTemplateContractDetails())\n .property(\n \"editable_defaults\",\n codecOptional(codecForTemplateContractDetailsDefaults()),\n )\n .build(\"TalerMerchantApi.WalletTemplateDetails\");\n\nexport const codecForWebhookSummaryResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"webhooks\", codecForList(codecForWebhookEntry()))\n .build(\"TalerMerchantApi.WebhookSummaryResponse\");\n\nexport const codecForWebhookEntry = (): Codec =>\n buildCodecForObject()\n .property(\"webhook_id\", codecForString())\n .property(\"event_type\", codecForString())\n .build(\"TalerMerchantApi.WebhookEntry\");\n\nexport const codecForWebhookDetails = (): Codec =>\n buildCodecForObject()\n .property(\"event_type\", codecForString())\n .property(\"url\", codecForString())\n .property(\"http_method\", codecForString())\n .property(\"header_template\", codecOptional(codecForString()))\n .property(\"body_template\", codecOptional(codecForString()))\n .build(\"TalerMerchantApi.WebhookDetails\");\n\nexport const codecForTokenFamilyKind = (): Codec =>\n codecForEither(\n codecForConstString(\"discount\"),\n codecForConstString(\"subscription\"),\n ) as any; //FIXME: create a codecForEnum\nexport const codecForTokenFamilyDetails = (): Codec =>\n buildCodecForObject()\n .property(\"slug\", codecForString())\n .property(\"name\", codecForString())\n .property(\"description\", codecForString())\n .property(\"description_i18n\", codecForInternationalizedString())\n .property(\"valid_after\", codecForTimestamp)\n .property(\"valid_before\", codecForTimestamp)\n .property(\"duration\", codecForDuration)\n .property(\"kind\", codecForTokenFamilyKind())\n .property(\"issued\", codecForNumber())\n .property(\"redeemed\", codecForNumber())\n .build(\"TalerMerchantApi.TokenFamilyDetails\");\n\nexport const codecForTokenFamiliesList = (): Codec =>\n buildCodecForObject()\n .property(\"token_families\", codecForList(codecForTokenFamilySummary()))\n .build(\"TalerMerchantApi.TokenFamiliesList\");\n\nexport const codecForTokenFamilySummary = (): Codec =>\n buildCodecForObject()\n .property(\"slug\", codecForString())\n .property(\"name\", codecForString())\n .property(\"valid_after\", codecForTimestamp)\n .property(\"valid_before\", codecForTimestamp)\n .property(\"kind\", codecForTokenFamilyKind())\n .build(\"TalerMerchantApi.TokenFamilySummary\");\n\nexport const codecForInstancesResponse = (): Codec =>\n buildCodecForObject()\n .property(\"instances\", codecForList(codecForInstance()))\n .build(\"TalerMerchantApi.InstancesResponse\");\n\nexport const codecForInstance = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"user_type\", codecForString())\n .property(\"website\", codecOptional(codecForString()))\n .property(\"logo\", codecOptional(codecForString()))\n .property(\"id\", codecForString())\n .property(\"merchant_pub\", codecForString())\n .property(\"payment_targets\", codecForList(codecForString()))\n .property(\"deleted\", codecForBoolean())\n .build(\"TalerMerchantApi.Instance\");\n\nexport const codecForTemplateEditableDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecOptional(codecForString()))\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"amount\", codecOptional(codecForAmountString()))\n .build(\"TemplateEditableDetails\");\n\nexport const codecForMerchantReserveCreateConfirmation =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .property(\"reserve_pub\", codecForString())\n .build(\"MerchantReserveCreateConfirmation\");\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { codecForAny } from \"./codec.js\";\nimport { HttpStatusCode } from \"./http-status-codes.js\";\nimport {\n createPlatformHttpLib,\n expectSuccessResponseOrThrow,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"./http.js\";\nimport { LibtoolVersion } from \"./libtool-version.js\";\nimport { Logger } from \"./logging.js\";\nimport {\n FailCasesByMethod,\n OperationFail,\n OperationOk,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"./operation.js\";\nimport { TalerProtocolDuration } from \"./time.js\";\nimport { AmountString } from \"./types-taler-common.js\";\nimport {\n OtpDeviceAddDetails,\n codecForTalerMerchantConfigResponse,\n codecForMerchantOrderPrivateStatusResponse,\n codecForPostOrderResponse,\n} from \"./types-taler-merchant.js\";\n\nimport * as TalerMerchantApi from \"./types-taler-merchant.js\";\n\nconst logger = new Logger(\"MerchantApiClient.ts\");\n\n// FIXME: Explain!\nexport type TalerMerchantResultByMethod =\n ResultByMethod;\n\n// FIXME: Explain!\nexport type TalerMerchantErrorsByMethod =\n FailCasesByMethod;\n\nexport interface MerchantAuthConfiguration {\n method: \"external\" | \"token\";\n token?: string;\n}\n\n// FIXME: Why do we need this? Describe / fix!\nexport interface PartialMerchantInstanceConfig {\n auth?: MerchantAuthConfiguration;\n id: string;\n name: string;\n paytoUris: string[];\n address?: unknown;\n jurisdiction?: unknown;\n defaultWireTransferDelay?: TalerProtocolDuration;\n defaultPayDelay?: TalerProtocolDuration;\n}\n\nexport interface CreateMerchantTippingReserveRequest {\n // Amount that the merchant promises to put into the reserve\n initial_balance: AmountString;\n\n // Exchange the merchant intends to use for tipping\n exchange_url: string;\n\n // Desired wire method, for example \"iban\" or \"x-taler-bank\"\n wire_method: string;\n}\n\nexport interface DeleteTippingReserveArgs {\n reservePub: string;\n purge?: boolean;\n}\n\nexport interface MerchantInstanceConfig {\n auth: MerchantAuthConfiguration;\n id: string;\n name: string;\n address: unknown;\n jurisdiction: unknown;\n use_stefan: boolean;\n default_wire_transfer_delay: TalerProtocolDuration;\n default_pay_delay: TalerProtocolDuration;\n}\n\nexport interface PrivateOrderStatusQuery {\n instance?: string;\n orderId: string;\n sessionId?: string;\n}\n\n/**\n * Client for the GNU Taler merchant backend.\n */\nexport class MerchantApiClient {\n /**\n * Base URL for the particular instance that this merchant API client\n * is for.\n */\n private baseUrl: string;\n\n readonly auth: MerchantAuthConfiguration;\n\n public readonly PROTOCOL_VERSION = \"6:0:2\";\n\n constructor(\n baseUrl: string,\n options: { auth?: MerchantAuthConfiguration } = {},\n ) {\n this.baseUrl = baseUrl;\n\n this.auth = options?.auth ?? {\n method: \"external\",\n };\n }\n\n httpClient = createPlatformHttpLib();\n\n async changeAuth(auth: MerchantAuthConfiguration): Promise {\n const url = new URL(\"private/auth\", this.baseUrl);\n const res = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: auth,\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(res);\n }\n\n async getPrivateInstanceInfo(): Promise {\n const url = new URL(\"private\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n headers: this.makeAuthHeader(),\n });\n return await resp.json();\n }\n\n async deleteInstance(instanceId: string) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"DELETE\",\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(resp);\n }\n\n async createInstance(req: MerchantInstanceConfig): Promise {\n const url = new URL(\"management/instances\", this.baseUrl);\n await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n }\n\n async getInstances(): Promise {\n const url = new URL(\"management/instances\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async getInstanceFullDetails(instanceId: string): Promise {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n try {\n const resp = await this.httpClient.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return resp.json();\n } catch (e) {\n throw e;\n }\n }\n\n async createOrder(\n req: TalerMerchantApi.PostOrderRequest,\n ): Promise {\n let url = new URL(\"private/orders\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForPostOrderResponse());\n }\n\n async deleteOrder(req: { orderId: string; force?: boolean }): Promise {\n let url = new URL(`private/orders/${req.orderId}`, this.baseUrl);\n if (req.force) {\n url.searchParams.set(\"force\", \"yes\");\n }\n const resp = await this.httpClient.fetch(url.href, {\n method: \"DELETE\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n if (resp.status !== 204) {\n throw Error(`failed to delete order (status ${resp.status})`);\n }\n }\n\n async queryPrivateOrderStatus(\n query: PrivateOrderStatusQuery,\n ): Promise {\n const reqUrl = new URL(`private/orders/${query.orderId}`, this.baseUrl);\n if (query.sessionId) {\n reqUrl.searchParams.set(\"session_id\", query.sessionId);\n }\n const resp = await this.httpClient.fetch(reqUrl.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(\n resp,\n codecForMerchantOrderPrivateStatusResponse(),\n );\n }\n\n async giveRefund(r: {\n instance: string;\n orderId: string;\n amount: string;\n justification: string;\n }): Promise<{ talerRefundUri: string }> {\n const reqUrl = new URL(`private/orders/${r.orderId}/refund`, this.baseUrl);\n const resp = await this.httpClient.fetch(reqUrl.href, {\n method: \"POST\",\n body: {\n refund: r.amount,\n reason: r.justification,\n },\n });\n const respBody = await resp.json();\n return {\n talerRefundUri: respBody.taler_refund_uri,\n };\n }\n\n async createTemplate(req: TalerMerchantApi.MerchantTemplateAddDetails) {\n let url = new URL(\"private/templates\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async getTemplate(templateId: string) {\n let url = new URL(`private/templates/${templateId}`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAny());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n *\n */\n async getConfig(): Promise> {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTalerMerchantConfigResponse());\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async createOtpDevice(\n req: OtpDeviceAddDetails,\n ): Promise | OperationFail> {\n let url = new URL(\"private/otp-devices\", this.baseUrl);\n const resp = await this.httpClient.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n private makeAuthHeader(): Record {\n switch (this.auth.method) {\n case \"external\":\n return {};\n case \"token\":\n return {\n Authorization: `Bearer ${this.auth.token}`,\n };\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Logger } from \"./logging.js\";\nimport { AbsoluteTime } from \"./time.js\";\n\n/**\n * Implementation of token bucket throttling.\n */\n\nconst logger = new Logger(\"RequestThrottler.ts\");\n\n/**\n * Maximum request per second, per origin.\n */\nconst MAX_PER_SECOND = 100;\n\n/**\n * Maximum request per minute, per origin.\n */\nconst MAX_PER_MINUTE = 500;\n\n/**\n * Maximum request per hour, per origin.\n */\nconst MAX_PER_HOUR = 2000;\n\n/**\n * Throttling state for one origin.\n */\nclass OriginState {\n tokensSecond: number = MAX_PER_SECOND;\n tokensMinute: number = MAX_PER_MINUTE;\n tokensHour: number = MAX_PER_HOUR;\n private lastUpdate = AbsoluteTime.now();\n\n private refill(): void {\n const now = AbsoluteTime.now();\n if (AbsoluteTime.cmp(now, this.lastUpdate) < 0) {\n // Did the system time change?\n this.lastUpdate = now;\n return;\n }\n const d = AbsoluteTime.difference(now, this.lastUpdate);\n if (d.d_ms === \"forever\") {\n throw Error(\"assertion failed\");\n }\n this.tokensSecond = Math.min(\n MAX_PER_SECOND,\n this.tokensSecond + d.d_ms / 1000,\n );\n this.tokensMinute = Math.min(\n MAX_PER_MINUTE,\n this.tokensMinute + d.d_ms / 1000 / 60,\n );\n this.tokensHour = Math.min(\n MAX_PER_HOUR,\n this.tokensHour + d.d_ms / 1000 / 60 / 60,\n );\n this.lastUpdate = now;\n }\n\n /**\n * Return true if the request for this origin should be throttled.\n * Otherwise, take a token out of the respective buckets.\n */\n applyThrottle(): boolean {\n this.refill();\n if (this.tokensSecond < 1) {\n logger.warn(\"request throttled (per second limit exceeded)\");\n return true;\n }\n if (this.tokensMinute < 1) {\n logger.warn(\"request throttled (per minute limit exceeded)\");\n return true;\n }\n if (this.tokensHour < 1) {\n logger.warn(\"request throttled (per hour limit exceeded)\");\n return true;\n }\n this.tokensSecond--;\n this.tokensMinute--;\n this.tokensHour--;\n return false;\n }\n}\n\n/**\n * Request throttler, used as a \"last layer of defense\" when some\n * other part of the re-try logic is broken and we're sending too\n * many requests to the same exchange/bank/merchant.\n */\nexport class RequestThrottler {\n private perOriginInfo: { [origin: string]: OriginState } = {};\n\n /**\n * Get the throttling state for an origin, or\n * initialize if no state is associated with the\n * origin yet.\n */\n private getState(origin: string): OriginState {\n const s = this.perOriginInfo[origin];\n if (s) {\n return s;\n }\n const ns = (this.perOriginInfo[origin] = new OriginState());\n return ns;\n }\n\n /**\n * Apply throttling to a request.\n *\n * @returns whether the request should be throttled.\n */\n applyThrottle(requestUrl: string): boolean {\n const origin = new URL(requestUrl).origin;\n return this.getState(origin).applyThrottle();\n }\n\n /**\n * Get the throttle statistics for a particular URL.\n */\n getThrottleStats(requestUrl: string): Record {\n const origin = new URL(requestUrl).origin;\n const state = this.getState(origin);\n return {\n tokensHour: state.tokensHour,\n tokensMinute: state.tokensMinute,\n tokensSecond: state.tokensSecond,\n maxTokensHour: MAX_PER_HOUR,\n maxTokensMinute: MAX_PER_MINUTE,\n maxTokensSecond: MAX_PER_SECOND,\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type declarations for the exchange's reserve transaction information.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport { codecForAmountString } from \"./amounts.js\";\nimport {\n codecForString,\n buildCodecForObject,\n codecForConstString,\n buildCodecForUnion,\n Codec,\n codecForNumber,\n} from \"./codec.js\";\nimport {\n AmountString,\n Base32String,\n EddsaSignatureString,\n EddsaPublicKeyString,\n CoinPublicKeyString,\n} from \"./types-taler-common.js\";\nimport {\n AbsoluteTime,\n codecForTimestamp,\n TalerProtocolTimestamp,\n} from \"./time.js\";\n\nexport enum ReserveTransactionType {\n Withdraw = \"WITHDRAW\",\n Credit = \"CREDIT\",\n Recoup = \"RECOUP\",\n Closing = \"CLOSING\",\n}\n\nexport interface ReserveWithdrawTransaction {\n type: ReserveTransactionType.Withdraw;\n\n /**\n * Amount withdrawn.\n */\n amount: AmountString;\n\n /**\n * Hash of the denomination public key of the coin.\n */\n h_denom_pub: Base32String;\n\n /**\n * Hash of the blinded coin to be signed\n */\n h_coin_envelope: Base32String;\n\n /**\n * Signature of 'TALER_WithdrawRequestPS' created with the reserves's\n * private key.\n */\n reserve_sig: EddsaSignatureString;\n\n /**\n * Fee that is charged for withdraw.\n */\n withdraw_fee: AmountString;\n}\n\nexport interface ReserveCreditTransaction {\n type: ReserveTransactionType.Credit;\n\n /**\n * Amount withdrawn.\n */\n amount: AmountString;\n\n /**\n * Sender account payto://-URL\n */\n sender_account_url: string;\n\n /**\n * Transfer details uniquely identifying the transfer.\n */\n wire_reference: number;\n\n /**\n * Timestamp of the incoming wire transfer.\n */\n timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ReserveClosingTransaction {\n type: ReserveTransactionType.Closing;\n\n /**\n * Closing balance.\n */\n amount: AmountString;\n\n /**\n * Closing fee charged by the exchange.\n */\n closing_fee: AmountString;\n\n /**\n * Wire transfer subject.\n */\n wtid: string;\n\n /**\n * Hash of the wire account into which the funds were returned to.\n */\n h_wire: string;\n\n /**\n * This is a signature over a\n * struct TALER_ReserveCloseConfirmationPS with purpose\n * TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED.\n */\n exchange_sig: EddsaSignatureString;\n\n /**\n * Public key used to create exchange_sig.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /**\n * Time when the reserve was closed.\n */\n timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ReserveRecoupTransaction {\n type: ReserveTransactionType.Recoup;\n\n /**\n * Amount paid back.\n */\n amount: AmountString;\n\n /**\n * This is a signature over\n * a struct TALER_PaybackConfirmationPS with purpose\n * TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK.\n */\n exchange_sig: EddsaSignatureString;\n\n /**\n * Public key used to create exchange_sig.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /**\n * Time when the funds were paid back into the reserve.\n */\n timestamp: TalerProtocolTimestamp;\n\n /**\n * Public key of the coin that was paid back.\n */\n coin_pub: CoinPublicKeyString;\n}\n\n/**\n * Format of the exchange's transaction history for a reserve.\n */\nexport type ReserveTransaction =\n | ReserveWithdrawTransaction\n | ReserveCreditTransaction\n | ReserveClosingTransaction\n | ReserveRecoupTransaction;\n\nexport const codecForReserveWithdrawTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"h_coin_envelope\", codecForString())\n .property(\"h_denom_pub\", codecForString())\n .property(\"reserve_sig\", codecForString())\n .property(\"type\", codecForConstString(ReserveTransactionType.Withdraw))\n .property(\"withdraw_fee\", codecForAmountString())\n .build(\"ReserveWithdrawTransaction\");\n\nexport const codecForReserveCreditTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"sender_account_url\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"wire_reference\", codecForNumber())\n .property(\"type\", codecForConstString(ReserveTransactionType.Credit))\n .build(\"ReserveCreditTransaction\");\n\nexport const codecForReserveClosingTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"closing_fee\", codecForAmountString())\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"h_wire\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"type\", codecForConstString(ReserveTransactionType.Closing))\n .property(\"wtid\", codecForString())\n .build(\"ReserveClosingTransaction\");\n\nexport const codecForReserveRecoupTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"coin_pub\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"timestamp\", codecForTimestamp)\n .property(\"type\", codecForConstString(ReserveTransactionType.Recoup))\n .build(\"ReserveRecoupTransaction\");\n\nexport const codecForReserveTransaction = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n ReserveTransactionType.Withdraw,\n codecForReserveWithdrawTransaction(),\n )\n .alternative(\n ReserveTransactionType.Closing,\n codecForReserveClosingTransaction(),\n )\n .alternative(\n ReserveTransactionType.Recoup,\n codecForReserveRecoupTransaction(),\n )\n .alternative(\n ReserveTransactionType.Credit,\n codecForReserveCreditTransaction(),\n )\n .build(\"ReserveTransaction\");\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n TALER is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Logger } from \"./logging.js\";\nimport { AbsoluteTime, Duration } from \"./time.js\";\n\n/**\n * Implementation of token bucket throttling.\n */\n\n/**\n * Logger.\n */\nconst logger = new Logger(\"OperationThrottler.ts\");\n\n/**\n * Maximum request per second, per origin.\n */\nconst MAX_PER_SECOND = 100;\n\n/**\n * Maximum request per minute, per origin.\n */\nconst MAX_PER_MINUTE = 500;\n\n/**\n * Maximum request per hour, per origin.\n */\nconst MAX_PER_HOUR = 2000;\n\n/**\n * Throttling state for one task.\n */\nclass TaskState {\n tokensSecond: number = MAX_PER_SECOND;\n tokensMinute: number = MAX_PER_MINUTE;\n tokensHour: number = MAX_PER_HOUR;\n lastUpdate = AbsoluteTime.now();\n\n private refill(): void {\n const now = AbsoluteTime.now();\n if (AbsoluteTime.cmp(now, this.lastUpdate) < 0) {\n // Did the system time change?\n this.lastUpdate = now;\n return;\n }\n const d = AbsoluteTime.difference(now, this.lastUpdate);\n if (d.d_ms === \"forever\") {\n throw Error(\"assertion failed\");\n }\n this.tokensSecond = Math.min(\n MAX_PER_SECOND,\n this.tokensSecond + d.d_ms / 1000,\n );\n this.tokensMinute = Math.min(\n MAX_PER_MINUTE,\n this.tokensMinute + d.d_ms / 1000 / 60,\n );\n this.tokensHour = Math.min(\n MAX_PER_HOUR,\n this.tokensHour + d.d_ms / 1000 / 60 / 60,\n );\n this.lastUpdate = now;\n }\n\n /**\n * Return true if the request for this origin should be throttled.\n * Otherwise, take a token out of the respective buckets.\n */\n applyThrottle(): boolean {\n this.refill();\n if (this.tokensSecond < 1) {\n logger.warn(\"request throttled (per second limit exceeded)\");\n return true;\n }\n if (this.tokensMinute < 1) {\n logger.warn(\"request throttled (per minute limit exceeded)\");\n return true;\n }\n if (this.tokensHour < 1) {\n logger.warn(\"request throttled (per hour limit exceeded)\");\n return true;\n }\n this.tokensSecond--;\n this.tokensMinute--;\n this.tokensHour--;\n return false;\n }\n}\n\n/**\n * Request throttler, used as a \"last layer of defense\" when some\n * other part of the re-try logic is broken and we're sending too\n * many requests to the same exchange/bank/merchant.\n */\nexport class TaskThrottler {\n private perTaskInfo: { [taskId: string]: TaskState } = {};\n\n /**\n * Get the throttling state for an origin, or\n * initialize if no state is associated with the\n * origin yet.\n */\n private getState(origin: string): TaskState {\n const s = this.perTaskInfo[origin];\n if (s) {\n return s;\n }\n const ns = (this.perTaskInfo[origin] = new TaskState());\n return ns;\n }\n\n /**\n * Apply throttling to a request.\n *\n * @returns whether the request should be throttled.\n */\n applyThrottle(taskId: string): boolean {\n for (let [k, v] of Object.entries(this.perTaskInfo)) {\n // Remove throttled tasks that haven't seen an update in more than one hour.\n if (\n Duration.cmp(\n AbsoluteTime.difference(v.lastUpdate, AbsoluteTime.now()),\n Duration.fromSpec({ hours: 1 }),\n ) > 1\n ) {\n delete this.perTaskInfo[k];\n }\n }\n return this.getState(taskId).applyThrottle();\n }\n\n /**\n * Get the throttle statistics for a particular URL.\n */\n getThrottleStats(taskId: string): Record {\n const state = this.getState(taskId);\n return {\n tokensHour: state.tokensHour,\n tokensMinute: state.tokensMinute,\n tokensSecond: state.tokensSecond,\n maxTokensHour: MAX_PER_HOUR,\n maxTokensMinute: MAX_PER_MINUTE,\n maxTokensSecond: MAX_PER_SECOND,\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Client for the Taler (demo-)bank.\n */\n\n/**\n * Imports.\n */\nimport {\n AccountData,\n AmountString,\n base64FromArrayBuffer,\n buildCodecForObject,\n Codec,\n codecForAny,\n codecForString,\n encodeCrock,\n getRandomBytes,\n HttpStatusCode,\n j2s,\n Logger,\n opEmptySuccess,\n opKnownHttpFailure,\n opUnknownFailure,\n RegisterAccountRequest,\n stringToBytes,\n TalerError,\n TalerErrorCode,\n} from \"@gnu-taler/taler-util\";\nimport {\n checkSuccessResponseOrThrow,\n createPlatformHttpLib,\n expectSuccessResponseOrThrow,\n HttpRequestLibrary,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\n\nconst logger = new Logger(\"bank-api-client.ts\");\n\nexport enum CreditDebitIndicator {\n Credit = \"credit\",\n Debit = \"debit\",\n}\n\nexport interface BankAccountBalanceResponse {\n balance: {\n amount: AmountString;\n credit_debit_indicator: CreditDebitIndicator;\n };\n}\n\nexport interface BankUser {\n username: string;\n password: string;\n accountPaytoUri: string;\n}\n\nexport interface WithdrawalOperationInfo {\n withdrawal_id: string;\n taler_withdraw_uri: string;\n}\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nfunction makeBasicAuthHeader(username: string, password: string): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n\nconst codecForWithdrawalOperationInfo = (): Codec =>\n buildCodecForObject()\n .property(\"withdrawal_id\", codecForString())\n .property(\"taler_withdraw_uri\", codecForString())\n .build(\"WithdrawalOperationInfo\");\n\nexport interface BankAccessApiClientArgs {\n auth?: { username: string; password: string };\n httpClient?: HttpRequestLibrary;\n}\n\nexport interface BankAccessApiCreateTransactionRequest {\n amount: AmountString;\n paytoUri: string;\n}\n\nexport class WireGatewayApiClientArgs {\n auth?: {\n username: string;\n password: string;\n };\n httpClient?: HttpRequestLibrary;\n}\n\n/**\n * This API look like it belongs to harness\n * but it will be nice to have in utils to be used by others\n */\nexport class WireGatewayApiClient {\n httpLib;\n\n constructor(\n private baseUrl: string,\n private args: WireGatewayApiClientArgs = {},\n ) {\n this.httpLib = args.httpClient ?? createPlatformHttpLib();\n }\n\n private makeAuthHeader(): Record {\n const auth = this.args.auth;\n if (auth) {\n return {\n Authorization: makeBasicAuthHeader(auth.username, auth.password),\n };\n }\n return {};\n }\n\n async adminAddIncoming(params: {\n amount: string;\n reservePub: string;\n debitAccountPayto: string;\n }): Promise {\n let url = new URL(`admin/add-incoming`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n amount: params.amount,\n reserve_pub: params.reservePub,\n debit_account: params.debitAccountPayto,\n },\n headers: this.makeAuthHeader(),\n });\n logger.info(`add-incoming response status: ${resp.status}`);\n await checkSuccessResponseOrThrow(resp);\n }\n}\n\nexport interface AccountBalance {\n amount: AmountString;\n credit_debit_indicator: \"credit\" | \"debit\";\n}\n\nexport interface ConfirmWithdrawalArgs {\n withdrawalOperationId: string;\n}\n\n/**\n * Client for the Taler corebank API.\n */\nexport class TalerCorebankApiClient {\n httpLib: HttpRequestLibrary;\n\n constructor(\n public baseUrl: string,\n private args: BankAccessApiClientArgs = {},\n ) {\n this.httpLib = args.httpClient ?? createPlatformHttpLib();\n }\n\n setAuth(auth: { username: string; password: string }) {\n this.args.auth = auth;\n }\n\n private makeAuthHeader(): Record {\n if (!this.args.auth) {\n return {};\n }\n const authHeaderValue = makeBasicAuthHeader(\n this.args.auth.username,\n this.args.auth.password,\n );\n return {\n Authorization: authHeaderValue,\n };\n }\n\n async getAccountBalance(\n username: string,\n ): Promise {\n const url = new URL(`accounts/${username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async getTransactions(username: string): Promise {\n const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl);\n const resp = await this.httpLib.fetch(reqUrl.href, {\n method: \"GET\",\n headers: {\n ...this.makeAuthHeader(),\n },\n });\n\n const res = await readSuccessResponseJsonOrThrow(resp, codecForAny());\n logger.info(`result: ${j2s(res)}`);\n }\n\n async createTransaction(\n username: string,\n req: BankAccessApiCreateTransactionRequest,\n ): Promise {\n const reqUrl = new URL(`accounts/${username}/transactions`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(reqUrl.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n\n return await readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async registerAccountExtended(req: RegisterAccountRequest): Promise {\n const url = new URL(\"accounts\", this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: req,\n headers: this.makeAuthHeader(),\n });\n\n if (\n resp.status !== 200 &&\n resp.status !== 201 &&\n resp.status !== 202 &&\n resp.status !== 204\n ) {\n logger.error(`unexpected status ${resp.status} from POST ${url.href}`);\n logger.error(`${j2s(await resp.json())}`);\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n {\n httpStatusCode: resp.status,\n },\n );\n }\n }\n\n /**\n * Register a new account and return information about it.\n *\n * This is a helper, as it does both the registration and the\n * account info query.\n */\n async registerAccount(username: string, password: string): Promise {\n const url = new URL(\"accounts\", this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n username,\n password,\n name: username,\n },\n headers: this.makeAuthHeader(),\n });\n if (\n resp.status !== 200 &&\n resp.status !== 201 &&\n resp.status !== 202 &&\n resp.status !== 204\n ) {\n logger.error(`unexpected status ${resp.status} from POST ${url.href}`);\n logger.error(`${j2s(await resp.json())}`);\n throw TalerError.fromDetail(\n TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n {\n httpStatusCode: resp.status,\n },\n );\n }\n // FIXME: Corebank should directly return this info!\n const infoUrl = new URL(`accounts/${username}`, this.baseUrl);\n const infoResp = await this.httpLib.fetch(infoUrl.href, {\n headers: {\n Authorization: makeBasicAuthHeader(username, password),\n },\n });\n // FIXME: Validate!\n const acctInfo: AccountData = await readSuccessResponseJsonOrThrow(\n infoResp,\n codecForAny(),\n );\n return {\n password,\n username,\n accountPaytoUri: acctInfo.payto_uri,\n };\n }\n\n async createRandomBankUser(): Promise {\n const username = \"user-\" + encodeCrock(getRandomBytes(10)).toLowerCase();\n const password = \"pw-\" + encodeCrock(getRandomBytes(10)).toLowerCase();\n return await this.registerAccount(username, password);\n }\n\n async createWithdrawalOperation(\n user: string,\n amount: string | undefined,\n ): Promise {\n const url = new URL(`accounts/${user}/withdrawals`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {\n amount,\n },\n headers: this.makeAuthHeader(),\n });\n return readSuccessResponseJsonOrThrow(\n resp,\n codecForWithdrawalOperationInfo(),\n );\n }\n\n async confirmWithdrawalOperation(\n username: string,\n wopi: ConfirmWithdrawalArgs,\n ) {\n const url = new URL(\n `accounts/${username}/withdrawals/${wopi.withdrawalOperationId}/confirm`,\n this.baseUrl,\n );\n logger.info(`confirming withdrawal operation via ${url.href}`);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n async abortWithdrawalOperation(wopi: WithdrawalOperationInfo): Promise {\n const url = new URL(\n `withdrawals/${wopi.withdrawal_id}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n await readSuccessResponseJsonOrThrow(resp, codecForAny());\n }\n\n async abortWithdrawalOperationV2(\n username: string,\n wopi: WithdrawalOperationInfo,\n ): Promise {\n const url = new URL(\n `accounts/${username}/withdrawals/${wopi.withdrawal_id}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: {},\n headers: this.makeAuthHeader(),\n });\n await expectSuccessResponseOrThrow(resp);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Native implementation of GNU Taler crypto primitives.\n */\n\n/**\n * Imports.\n */\nimport bigint from \"big-integer\";\nimport * as fflate from \"fflate\";\nimport { AmountLike, Amounts } from \"./amounts.js\";\nimport * as argon2 from \"./argon2.js\";\nimport { canonicalJson } from \"./helpers.js\";\nimport { hmacSha256, hmacSha512 } from \"./kdf.js\";\nimport { Logger } from \"./logging.js\";\nimport * as nacl from \"./nacl-fast.js\";\nimport { secretbox } from \"./nacl-fast.js\";\nimport { TalerProtocolDuration, TalerProtocolTimestamp } from \"./time.js\";\nimport {\n CoinPublicKeyString,\n HashCodeString,\n} from \"./types-taler-common.js\";\nimport { CoinEnvelope, DenomKeyType, DenominationPubKey } from \"./types-taler-exchange.js\";\n\nexport type Flavor = T & {\n _flavor?: `taler.${FlavorT}`;\n};\n\nexport type FlavorP = T & {\n _flavor?: `taler.${FlavorT}`;\n _size?: S;\n};\n\nexport function getRandomBytes(n: number): Uint8Array {\n return nacl.randomBytes(n);\n}\n\nexport function getRandomBytesF(\n n: T,\n): FlavorP {\n return nacl.randomBytes(n);\n}\n\nexport const useNative = true;\n\n/**\n * Interface of the native Taler runtime library.\n */\ninterface NativeTartLib {\n decodeUtf8(buf: Uint8Array): string;\n decodeUtf8(str: string): Uint8Array;\n randomBytes(n: number): Uint8Array;\n encodeCrock(buf: Uint8Array | ArrayBuffer): string;\n decodeCrock(str: string): Uint8Array;\n hash(buf: Uint8Array): Uint8Array;\n hashArgon2id(\n password: Uint8Array,\n salt: Uint8Array,\n iterations: number,\n memorySize: number,\n hashLength: number,\n ): Uint8Array;\n eddsaGetPublic(buf: Uint8Array): Uint8Array;\n ecdheGetPublic(buf: Uint8Array): Uint8Array;\n eddsaSign(msg: Uint8Array, priv: Uint8Array): Uint8Array;\n eddsaVerify(msg: Uint8Array, sig: Uint8Array, pub: Uint8Array): boolean;\n kdf(\n outLen: number,\n ikm: Uint8Array,\n salt?: Uint8Array,\n info?: Uint8Array,\n ): Uint8Array;\n keyExchangeEcdhEddsa(ecdhPriv: Uint8Array, eddsaPub: Uint8Array): Uint8Array;\n keyExchangeEddsaEcdh(eddsaPriv: Uint8Array, ecdhPub: Uint8Array): Uint8Array;\n rsaBlind(hmsg: Uint8Array, bks: Uint8Array, rsaPub: Uint8Array): Uint8Array;\n rsaUnblind(\n blindSig: Uint8Array,\n rsaPub: Uint8Array,\n bks: Uint8Array,\n ): Uint8Array;\n rsaVerify(hmsg: Uint8Array, rsaSig: Uint8Array, rsaPub: Uint8Array): boolean;\n hashStateInit(): any;\n hashStateUpdate(st: any, data: Uint8Array): any;\n hashStateFinish(st: any): Uint8Array;\n}\n\n// @ts-ignore\nlet tart: NativeTartLib | undefined;\n\nif (useNative) {\n // @ts-ignore\n tart = globalThis._tart;\n}\n\nconst encTable = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nclass EncodingError extends Error {\n constructor() {\n super(\"Encoding error\");\n Object.setPrototypeOf(this, EncodingError.prototype);\n }\n}\n\nfunction getValue(chr: string): number {\n let a = chr;\n switch (chr) {\n case \"O\":\n case \"o\":\n a = \"0\";\n break;\n case \"i\":\n case \"I\":\n case \"l\":\n case \"L\":\n a = \"1\";\n break;\n case \"u\":\n case \"U\":\n a = \"V\";\n }\n\n if (a >= \"0\" && a <= \"9\") {\n return a.charCodeAt(0) - \"0\".charCodeAt(0);\n }\n\n if (a >= \"a\" && a <= \"z\") a = a.toUpperCase();\n let dec = 0;\n if (a >= \"A\" && a <= \"Z\") {\n if (\"I\" < a) dec++;\n if (\"L\" < a) dec++;\n if (\"O\" < a) dec++;\n if (\"U\" < a) dec++;\n return a.charCodeAt(0) - \"A\".charCodeAt(0) + 10 - dec;\n }\n throw new EncodingError();\n}\n\nexport function encodeCrock(data: ArrayBuffer): string {\n if (tart) {\n return tart.encodeCrock(data);\n }\n const dataBytes = new Uint8Array(data);\n let sb = \"\";\n const size = data.byteLength;\n let bitBuf = 0;\n let numBits = 0;\n let pos = 0;\n while (pos < size || numBits > 0) {\n if (pos < size && numBits < 5) {\n const d = dataBytes[pos++];\n bitBuf = (bitBuf << 8) | d;\n numBits += 8;\n }\n if (numBits < 5) {\n // zero-padding\n bitBuf = bitBuf << (5 - numBits);\n numBits = 5;\n }\n const v = (bitBuf >>> (numBits - 5)) & 31;\n sb += encTable[v];\n numBits -= 5;\n }\n return sb;\n}\n\nexport function kdf(\n outputLength: number,\n ikm: Uint8Array,\n salt?: Uint8Array,\n info?: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.kdf(outputLength, ikm, salt, info);\n }\n salt = salt ?? new Uint8Array(64);\n // extract\n const prk = hmacSha512(salt, ikm);\n\n info = info ?? new Uint8Array(0);\n\n // expand\n const N = Math.ceil(outputLength / 32);\n const output = new Uint8Array(N * 32);\n for (let i = 0; i < N; i++) {\n let buf;\n if (i == 0) {\n buf = new Uint8Array(info.byteLength + 1);\n buf.set(info, 0);\n } else {\n buf = new Uint8Array(info.byteLength + 1 + 32);\n for (let j = 0; j < 32; j++) {\n buf[j] = output[(i - 1) * 32 + j];\n }\n buf.set(info, 32);\n }\n buf[buf.length - 1] = i + 1;\n const chunk = hmacSha256(prk, buf);\n output.set(chunk, i * 32);\n }\n\n return output.slice(0, outputLength);\n}\n\n/**\n * HMAC-SHA512-SHA256 (see RFC 5869).\n */\nexport function kdfKw(args: {\n outputLength: number;\n ikm: Uint8Array;\n salt?: Uint8Array;\n info?: Uint8Array;\n}) {\n return kdf(args.outputLength, args.ikm, args.salt, args.info);\n}\n\nexport function decodeCrock(encoded: string): Uint8Array {\n if (tart) {\n return tart.decodeCrock(encoded);\n }\n const size = encoded.length;\n let bitpos = 0;\n let bitbuf = 0;\n let readPosition = 0;\n const outLen = Math.floor((size * 5) / 8);\n const out = new Uint8Array(outLen);\n let outPos = 0;\n\n while (readPosition < size || bitpos > 0) {\n if (readPosition < size) {\n const v = getValue(encoded[readPosition++]);\n bitbuf = (bitbuf << 5) | v;\n bitpos += 5;\n }\n while (bitpos >= 8) {\n const d = (bitbuf >>> (bitpos - 8)) & 0xff;\n out[outPos++] = d;\n bitpos -= 8;\n }\n if (readPosition == size && bitpos > 0) {\n bitbuf = (bitbuf << (8 - bitpos)) & 0xff;\n bitpos = bitbuf == 0 ? 0 : 8;\n }\n }\n return out;\n}\n\nexport async function hashArgon2id(\n password: Uint8Array,\n salt: Uint8Array,\n iterations: number,\n memorySize: number,\n hashLength: number,\n): Promise {\n if (tart) {\n return tart.hashArgon2id(\n password,\n salt,\n iterations,\n memorySize,\n hashLength,\n );\n }\n return await argon2.hashArgon2id(\n password,\n salt,\n iterations,\n memorySize,\n hashLength,\n );\n}\n\nexport function eddsaGetPublic(eddsaPriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.eddsaGetPublic(eddsaPriv);\n }\n const pair = nacl.crypto_sign_keyPair_fromSeed(eddsaPriv);\n return pair.publicKey;\n}\n\nexport function ecdhGetPublic(ecdhePriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.ecdheGetPublic(ecdhePriv);\n }\n return nacl.scalarMult_base(ecdhePriv);\n}\n\nexport function keyExchangeEddsaEcdh(\n eddsaPriv: Uint8Array,\n ecdhPub: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.keyExchangeEddsaEcdh(eddsaPriv, ecdhPub);\n }\n const ph = hash(eddsaPriv);\n const a = new Uint8Array(32);\n for (let i = 0; i < 32; i++) {\n a[i] = ph[i];\n }\n const x = nacl.scalarMult(a, ecdhPub);\n return hash(x);\n}\n\nexport function keyExchangeEcdhEddsa(\n ecdhPriv: Uint8Array & MaterialEcdhePriv,\n eddsaPub: Uint8Array & MaterialEddsaPub,\n): Uint8Array {\n if (tart) {\n return tart.keyExchangeEcdhEddsa(ecdhPriv, eddsaPub);\n }\n const curve25519Pub = nacl.sign_ed25519_pk_to_curve25519(eddsaPub);\n const x = nacl.scalarMult(ecdhPriv, curve25519Pub);\n return hash(x);\n}\n\ninterface RsaPub {\n N: bigint.BigInteger;\n e: bigint.BigInteger;\n}\n\n/**\n * KDF modulo a big integer.\n */\nfunction kdfMod(\n n: bigint.BigInteger,\n ikm: Uint8Array,\n salt: Uint8Array,\n info: Uint8Array,\n): bigint.BigInteger {\n const nbits = n.bitLength().toJSNumber();\n const buflen = Math.floor((nbits - 1) / 8 + 1);\n const mask = (1 << (8 - (buflen * 8 - nbits))) - 1;\n let counter = 0;\n while (true) {\n const ctx = new Uint8Array(info.byteLength + 2);\n ctx.set(info, 0);\n ctx[ctx.length - 2] = (counter >>> 8) & 0xff;\n ctx[ctx.length - 1] = counter & 0xff;\n const buf = kdf(buflen, ikm, salt, ctx);\n const arr = Array.from(buf);\n arr[0] = arr[0] & mask;\n const r = bigint.fromArray(arr, 256, false);\n if (r.lt(n)) {\n return r;\n }\n counter++;\n }\n}\n\nfunction csKdfMod(\n n: bigint.BigInteger,\n ikm: Uint8Array,\n salt: Uint8Array,\n info: Uint8Array,\n): Uint8Array {\n const nbits = n.bitLength().toJSNumber();\n const buflen = Math.floor((nbits - 1) / 8 + 1);\n const mask = (1 << (8 - (buflen * 8 - nbits))) - 1;\n let counter = 0;\n while (true) {\n const ctx = new Uint8Array(info.byteLength + 2);\n ctx.set(info, 0);\n ctx[ctx.length - 2] = (counter >>> 8) & 0xff;\n ctx[ctx.length - 1] = counter & 0xff;\n const buf = kdf(buflen, ikm, salt, ctx);\n const arr = Array.from(buf);\n arr[0] = arr[0] & mask;\n const r = bigint.fromArray(arr, 256, false);\n if (r.lt(n)) {\n return new Uint8Array(arr);\n }\n counter++;\n }\n}\n\n// Newer versions of node have TextEncoder and TextDecoder as a global,\n// just like modern browsers.\n// In older versions of node or environments that do not have these\n// globals, they must be polyfilled (by adding them to global/globalThis)\n// before stringToBytes or bytesToString is called the first time.\n\nlet encoder: any;\nlet decoder: any;\n\nexport function stringToBytes(s: string): Uint8Array {\n if (!encoder) {\n encoder = new TextEncoder();\n }\n return encoder.encode(s);\n}\n\nexport function bytesToString(b: Uint8Array): string {\n if (!decoder) {\n decoder = new TextDecoder();\n }\n return decoder.decode(b);\n}\n\nfunction loadBigInt(arr: Uint8Array): bigint.BigInteger {\n return bigint.fromArray(Array.from(arr), 256, false);\n}\n\nfunction rsaBlindingKeyDerive(\n rsaPub: RsaPub,\n bks: Uint8Array,\n): bigint.BigInteger {\n const salt = stringToBytes(\"Blinding KDF extractor HMAC key\");\n const info = stringToBytes(\"Blinding KDF\");\n return kdfMod(rsaPub.N, bks, salt, info);\n}\n\n/*\n * Test for malicious RSA key.\n *\n * Assuming n is an RSA modulous and r is generated using a call to\n * GNUNET_CRYPTO_kdf_mod_mpi, if gcd(r,n) != 1 then n must be a\n * malicious RSA key designed to deanomize the user.\n *\n * @param r KDF result\n * @param n RSA modulus of the public key\n */\nfunction rsaGcdValidate(r: bigint.BigInteger, n: bigint.BigInteger): void {\n const t = bigint.gcd(r, n);\n if (!t.equals(bigint.one)) {\n throw Error(\"malicious RSA public key\");\n }\n}\n\nfunction rsaFullDomainHash(hm: Uint8Array, rsaPub: RsaPub): bigint.BigInteger {\n const info = stringToBytes(\"RSA-FDA FTpsW!\");\n const salt = rsaPubEncode(rsaPub);\n const r = kdfMod(rsaPub.N, hm, salt, info);\n rsaGcdValidate(r, rsaPub.N);\n return r;\n}\n\nfunction rsaPubDecode(rsaPub: Uint8Array): RsaPub {\n const modulusLength = (rsaPub[0] << 8) | rsaPub[1];\n const exponentLength = (rsaPub[2] << 8) | rsaPub[3];\n if (4 + exponentLength + modulusLength != rsaPub.length) {\n throw Error(\"invalid RSA public key (format wrong)\");\n }\n const modulus = rsaPub.slice(4, 4 + modulusLength);\n const exponent = rsaPub.slice(\n 4 + modulusLength,\n 4 + modulusLength + exponentLength,\n );\n const res = {\n N: loadBigInt(modulus),\n e: loadBigInt(exponent),\n };\n return res;\n}\n\nfunction rsaPubEncode(rsaPub: RsaPub): Uint8Array {\n const mb = rsaPub.N.toArray(256).value;\n const eb = rsaPub.e.toArray(256).value;\n const out = new Uint8Array(4 + mb.length + eb.length);\n out[0] = (mb.length >>> 8) & 0xff;\n out[1] = mb.length & 0xff;\n out[2] = (eb.length >>> 8) & 0xff;\n out[3] = eb.length & 0xff;\n out.set(mb, 4);\n out.set(eb, 4 + mb.length);\n return out;\n}\n\nexport function rsaBlind(\n hm: Uint8Array,\n bks: Uint8Array,\n rsaPubEnc: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.rsaBlind(hm, bks, rsaPubEnc);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const data = rsaFullDomainHash(hm, rsaPub);\n const r = rsaBlindingKeyDerive(rsaPub, bks);\n const r_e = r.modPow(rsaPub.e, rsaPub.N);\n const bm = r_e.multiply(data).mod(rsaPub.N);\n return new Uint8Array(bm.toArray(256).value);\n}\n\nexport function rsaUnblind(\n sig: Uint8Array,\n rsaPubEnc: Uint8Array,\n bks: Uint8Array,\n): Uint8Array {\n if (tart) {\n return tart.rsaUnblind(sig, rsaPubEnc, bks);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const blinded_s = loadBigInt(sig);\n const r = rsaBlindingKeyDerive(rsaPub, bks);\n const r_inv = r.modInv(rsaPub.N);\n const s = blinded_s.multiply(r_inv).mod(rsaPub.N);\n return new Uint8Array(s.toArray(256).value);\n}\n\nexport function rsaVerify(\n hm: Uint8Array,\n rsaSig: Uint8Array,\n rsaPubEnc: Uint8Array,\n): boolean {\n if (tart) {\n return tart.rsaVerify(hm, rsaSig, rsaPubEnc);\n }\n const rsaPub = rsaPubDecode(rsaPubEnc);\n const d = rsaFullDomainHash(hm, rsaPub);\n const sig = loadBigInt(rsaSig);\n const sig_e = sig.modPow(rsaPub.e, rsaPub.N);\n return sig_e.equals(d);\n}\n\nexport type CsSignature = {\n s: Uint8Array;\n rPub: Uint8Array;\n};\n\nexport type CsBlindSignature = {\n sBlind: Uint8Array;\n rPubBlind: Uint8Array;\n};\n\nexport type CsBlindingSecrets = {\n alpha: [Uint8Array, Uint8Array];\n beta: [Uint8Array, Uint8Array];\n};\n\nexport function typedArrayConcat(chunks: Uint8Array[]): Uint8Array {\n let payloadLen = 0;\n for (const c of chunks) {\n payloadLen += c.byteLength;\n }\n const buf = new ArrayBuffer(payloadLen);\n const u8buf = new Uint8Array(buf);\n let p = 0;\n for (const c of chunks) {\n u8buf.set(c, p);\n p += c.byteLength;\n }\n return u8buf;\n}\n\n/**\n * Map to scalar subgroup function\n * perform clamping as described in RFC7748\n * @param scalar\n */\nfunction mtoSS(scalar: Uint8Array): Uint8Array {\n scalar[0] &= 248;\n scalar[31] &= 127;\n scalar[31] |= 64;\n return scalar;\n}\n\n/**\n * The function returns the CS blinding secrets from a seed\n * @param bseed seed to derive blinding secrets\n * @returns blinding secrets\n */\nexport function deriveSecrets(bseed: Uint8Array): CsBlindingSecrets {\n const outLen = 130;\n const salt = stringToBytes(\"alphabeta\");\n const rndout = kdf(outLen, bseed, salt);\n const secrets: CsBlindingSecrets = {\n alpha: [mtoSS(rndout.slice(0, 32)), mtoSS(rndout.slice(64, 96))],\n beta: [mtoSS(rndout.slice(32, 64)), mtoSS(rndout.slice(96, 128))],\n };\n return secrets;\n}\n\n/**\n * calculation of the blinded public point R in CS\n * @param csPub denomination publik key\n * @param secrets client blinding secrets\n * @param rPub public R received from /csr API\n */\nexport async function calcRBlind(\n csPub: Uint8Array,\n secrets: CsBlindingSecrets,\n rPub: [Uint8Array, Uint8Array],\n): Promise<[Uint8Array, Uint8Array]> {\n const aG0 = nacl.crypto_scalarmult_ed25519_base_noclamp(secrets.alpha[0]);\n const aG1 = nacl.crypto_scalarmult_ed25519_base_noclamp(secrets.alpha[1]);\n\n const bDp0 = nacl.crypto_scalarmult_ed25519_noclamp(secrets.beta[0], csPub);\n const bDp1 = nacl.crypto_scalarmult_ed25519_noclamp(secrets.beta[1], csPub);\n\n const res0 = nacl.crypto_core_ed25519_add(aG0, bDp0);\n const res1 = nacl.crypto_core_ed25519_add(aG1, bDp1);\n return [\n nacl.crypto_core_ed25519_add(rPub[0], res0),\n nacl.crypto_core_ed25519_add(rPub[1], res1),\n ];\n}\n\n/**\n * FDH function used in CS\n * @param hm message hash\n * @param rPub public R included in FDH\n * @param csPub denomination public key as context\n * @returns mapped Curve25519 scalar\n */\nfunction csFDH(\n hm: Uint8Array,\n rPub: Uint8Array,\n csPub: Uint8Array,\n): Uint8Array {\n const lMod = Array.from(\n new Uint8Array([\n 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x14, 0xde, 0xf9, 0xde, 0xa2, 0xf7, 0x9c, 0xd6,\n 0x58, 0x12, 0x63, 0x1a, 0x5c, 0xf5, 0xd3, 0xed,\n ]),\n );\n const L = bigint.fromArray(lMod, 256, false);\n\n const info = stringToBytes(\"Curve25519FDH\");\n const preshash = hash(typedArrayConcat([rPub, hm]));\n return csKdfMod(L, preshash, csPub, info).reverse();\n}\n\n/**\n * blinding seed derived from coin private key\n * @param coinPriv private key of the corresponding coin\n * @param rPub public R received from /csr API\n * @returns blinding seed\n */\nexport function deriveBSeed(\n coinPriv: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n): Uint8Array {\n const outLen = 32;\n const salt = stringToBytes(\"b-seed\");\n const ikm = typedArrayConcat([coinPriv, rPub[0], rPub[1]]);\n return kdf(outLen, ikm, salt);\n}\n\n/**\n * Derive withdraw nonce, used in /csr request\n * Note: In withdraw protocol, the nonce is chosen randomly\n * @param coinPriv coin private key\n * @returns nonce\n */\nexport function deriveWithdrawNonce(coinPriv: Uint8Array): Uint8Array {\n const outLen = 32;\n const salt = stringToBytes(\"n\");\n return kdf(outLen, coinPriv, salt);\n}\n\n/**\n * Blind operation for CS signatures, used after /csr call\n * @param bseed blinding seed to derive blinding secrets\n * @param rPub public R received from /csr\n * @param csPub denomination public key\n * @param hm message to blind\n * @returns two blinded c\n */\nexport async function csBlind(\n bseed: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n csPub: Uint8Array,\n hm: Uint8Array,\n): Promise<[Uint8Array, Uint8Array]> {\n const secrets = deriveSecrets(bseed);\n const rPubBlind = await calcRBlind(csPub, secrets, rPub);\n const c_0 = csFDH(hm, rPubBlind[0], csPub);\n const c_1 = csFDH(hm, rPubBlind[1], csPub);\n return [\n nacl.crypto_core_ed25519_scalar_add(c_0, secrets.beta[0]),\n nacl.crypto_core_ed25519_scalar_add(c_1, secrets.beta[1]),\n ];\n}\n\n/**\n * Unblind operation to unblind the signature\n * @param bseed seed to derive secrets\n * @param rPub public R received from /csr\n * @param csPub denomination public key\n * @param b returned from exchange to select c\n * @param csSig blinded signature\n * @returns unblinded signature\n */\nexport async function csUnblind(\n bseed: Uint8Array,\n rPub: [Uint8Array, Uint8Array],\n csPub: Uint8Array,\n b: number,\n csSig: CsBlindSignature,\n): Promise {\n if (b != 0 && b != 1) {\n throw new Error();\n }\n const secrets = deriveSecrets(bseed);\n const rPubDash = (await calcRBlind(csPub, secrets, rPub))[b];\n const sig: CsSignature = {\n s: nacl.crypto_core_ed25519_scalar_add(csSig.sBlind, secrets.alpha[b]),\n rPub: rPubDash,\n };\n return sig;\n}\n\n/**\n * Verification algorithm for CS signatures\n * @param hm message signed\n * @param csSig unblinded signature\n * @param csPub denomination public key\n * @returns true if valid, false if invalid\n */\nexport async function csVerify(\n hm: Uint8Array,\n csSig: CsSignature,\n csPub: Uint8Array,\n): Promise {\n const cDash = csFDH(hm, csSig.rPub, csPub);\n const sG = nacl.crypto_scalarmult_ed25519_base_noclamp(csSig.s);\n const cbDp = nacl.crypto_scalarmult_ed25519_noclamp(cDash, csPub);\n const sGeq = nacl.crypto_core_ed25519_add(csSig.rPub, cbDp);\n return nacl.verify(sG, sGeq);\n}\n\nexport interface EddsaKeyPair {\n eddsaPub: Uint8Array;\n eddsaPriv: Uint8Array;\n}\n\nexport interface EcdheKeyPair {\n ecdhePub: Uint8Array;\n ecdhePriv: Uint8Array;\n}\n\nexport interface Edx25519Keypair {\n edxPub: string;\n edxPriv: string;\n}\n\nexport function createEddsaKeyPair(): EddsaKeyPair {\n const eddsaPriv = nacl.randomBytes(32);\n const eddsaPub = eddsaGetPublic(eddsaPriv);\n return { eddsaPriv, eddsaPub };\n}\n\nexport function createEcdheKeyPair(): EcdheKeyPair {\n const ecdhePriv = nacl.randomBytes(32);\n const ecdhePub = ecdhGetPublic(ecdhePriv);\n return { ecdhePriv, ecdhePub };\n}\n\nexport function hash(d: Uint8Array): Uint8Array {\n if (tart) {\n return tart.hash(d);\n }\n return nacl.hash(d);\n}\n\n/**\n * Hash the input with SHA-512 and truncate the result\n * to 32 bytes.\n */\nexport function hashTruncate32(d: Uint8Array): Uint8Array {\n const sha512HashCode = hash(d);\n return sha512HashCode.subarray(0, 32);\n}\n\nexport function hashCoinEv(\n coinEv: CoinEnvelope,\n denomPubHash: HashCodeString,\n): Uint8Array {\n const hashContext = createHashContext();\n hashContext.update(decodeCrock(denomPubHash));\n hashCoinEvInner(coinEv, hashContext);\n return hashContext.finish();\n}\n\nconst logger = new Logger(\"talerCrypto.ts\");\n\nexport function hashCoinEvInner(\n coinEv: CoinEnvelope,\n hashState: TalerHashState,\n): void {\n const hashInputBuf = new ArrayBuffer(4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, DenomKeyType.toIntTag(coinEv.cipher));\n hashState.update(uint8ArrayBuf);\n switch (coinEv.cipher) {\n case DenomKeyType.Rsa:\n hashState.update(decodeCrock(coinEv.rsa_blinded_planchet));\n return;\n default:\n throw new Error();\n }\n}\n\nexport function hashCoinPub(\n coinPub: CoinPublicKeyString,\n ach?: HashCodeString,\n): Uint8Array {\n if (!ach) {\n return hash(decodeCrock(coinPub));\n }\n\n return hash(typedArrayConcat([decodeCrock(coinPub), decodeCrock(ach)]));\n}\n\n/**\n * Hash a denomination public key.\n */\nexport function hashDenomPub(pub: DenominationPubKey): Uint8Array {\n if (pub.cipher === DenomKeyType.Rsa) {\n const pubBuf = decodeCrock(pub.rsa_public_key);\n const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, pub.age_mask ?? 0);\n dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));\n uint8ArrayBuf.set(pubBuf, 8);\n return hash(uint8ArrayBuf);\n } else if (pub.cipher === DenomKeyType.ClauseSchnorr) {\n const pubBuf = decodeCrock(pub.cs_public_key);\n const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4);\n const uint8ArrayBuf = new Uint8Array(hashInputBuf);\n const dv = new DataView(hashInputBuf);\n dv.setUint32(0, pub.age_mask ?? 0);\n dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));\n uint8ArrayBuf.set(pubBuf, 8);\n return hash(uint8ArrayBuf);\n } else {\n throw Error(\n `unsupported cipher (${\n (pub as DenominationPubKey).cipher\n }), unable to hash`,\n );\n }\n}\n\nexport function eddsaSign(msg: Uint8Array, eddsaPriv: Uint8Array): Uint8Array {\n if (tart) {\n return tart.eddsaSign(msg, eddsaPriv);\n }\n const pair = nacl.crypto_sign_keyPair_fromSeed(eddsaPriv);\n return nacl.sign_detached(msg, pair.secretKey);\n}\n\nexport function eddsaVerify(\n msg: Uint8Array,\n sig: Uint8Array,\n eddsaPub: Uint8Array,\n): boolean {\n if (tart) {\n return tart.eddsaVerify(msg, sig, eddsaPub);\n }\n return nacl.sign_detached_verify(msg, sig, eddsaPub);\n}\n\nexport interface TalerHashState {\n update(data: Uint8Array): void;\n finish(): Uint8Array;\n}\n\nexport function createHashContext(): TalerHashState {\n if (tart) {\n const t = tart;\n const st = tart.hashStateInit();\n return {\n finish: () => t.hashStateFinish(st),\n update: (d) => t.hashStateUpdate(st, d),\n };\n }\n return new nacl.HashState();\n}\n\nexport interface FreshCoin {\n coinPub: Uint8Array;\n coinPriv: Uint8Array;\n bks: Uint8Array;\n maxAge: number;\n ageCommitmentProof: AgeCommitmentProof | undefined;\n}\n\nexport function bufferForUint32(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(4);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n dv.setUint32(0, n);\n return buf;\n}\n\n/**\n * This makes the assumption that the uint64 fits a float,\n * which should be true for all Taler protocol messages.\n */\nexport function bufferForUint64(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(8);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n if (n < 0 || !Number.isInteger(n)) {\n throw Error(\"non-negative integer expected\");\n }\n dv.setBigUint64(0, BigInt(n));\n return buf;\n}\n\nexport function bufferForUint8(n: number): Uint8Array {\n const arrBuf = new ArrayBuffer(1);\n const buf = new Uint8Array(arrBuf);\n const dv = new DataView(arrBuf);\n dv.setUint8(0, n);\n return buf;\n}\n\nexport async function setupTipPlanchet(\n secretSeed: Uint8Array,\n denomPub: DenominationPubKey,\n coinNumber: number,\n): Promise {\n const info = stringToBytes(\"taler-tip-coin-derivation\");\n const saltArrBuf = new ArrayBuffer(4);\n const salt = new Uint8Array(saltArrBuf);\n const saltDataView = new DataView(saltArrBuf);\n saltDataView.setUint32(0, coinNumber);\n const out = kdf(64, secretSeed, salt, info);\n const coinPriv = out.slice(0, 32);\n const bks = out.slice(32, 64);\n let maybeAcp: AgeCommitmentProof | undefined;\n if (denomPub.age_mask != 0) {\n maybeAcp = await AgeRestriction.restrictionCommitSeeded(\n denomPub.age_mask,\n AgeRestriction.AGE_UNRESTRICTED,\n secretSeed,\n );\n }\n return {\n bks,\n coinPriv,\n coinPub: eddsaGetPublic(coinPriv),\n maxAge: AgeRestriction.AGE_UNRESTRICTED,\n ageCommitmentProof: maybeAcp,\n };\n}\n/**\n *\n * @param paytoUri\n * @param salt 16-byte salt\n * @returns\n */\nexport function hashWire(paytoUri: string, salt: string): string {\n const r = kdf(\n 64,\n stringToBytes(paytoUri + \"\\0\"),\n decodeCrock(salt),\n stringToBytes(\"merchant-wire-signature\"),\n );\n return encodeCrock(r);\n}\n\nexport enum TalerSignaturePurpose {\n MERCHANT_TRACK_TRANSACTION = 1103,\n WALLET_RESERVE_WITHDRAW = 1200,\n WALLET_RESERVE_HISTORY = 1208,\n WALLET_COIN_DEPOSIT = 1201,\n GLOBAL_FEES = 1022,\n MASTER_DENOMINATION_KEY_VALIDITY = 1025,\n MASTER_WIRE_FEES = 1028,\n MASTER_WIRE_DETAILS = 1030,\n WALLET_COIN_MELT = 1202,\n TEST = 4242,\n MERCHANT_PAYMENT_OK = 1104,\n MERCHANT_CONTRACT = 1101,\n MERCHANT_REFUND = 1102,\n WALLET_COIN_RECOUP = 1203,\n WALLET_COIN_LINK = 1204,\n WALLET_COIN_RECOUP_REFRESH = 1206,\n WALLET_AGE_ATTESTATION = 1207,\n WALLET_PURSE_CREATE = 1210,\n WALLET_PURSE_DEPOSIT = 1211,\n WALLET_PURSE_MERGE = 1213,\n WALLET_ACCOUNT_MERGE = 1214,\n WALLET_PURSE_ECONTRACT = 1216,\n WALLET_PURSE_DELETE = 1220,\n WALLET_COIN_HISTORY = 1209,\n EXCHANGE_CONFIRM_RECOUP = 1039,\n EXCHANGE_CONFIRM_RECOUP_REFRESH = 1041,\n TALER_SIGNATURE_AML_DECISION = 1350,\n TALER_SIGNATURE_AML_QUERY = 1351,\n TALER_SIGNATURE_MASTER_AML_KEY = 1017,\n ANASTASIS_POLICY_UPLOAD = 1400,\n ANASTASIS_POLICY_DOWNLOAD = 1401,\n SYNC_BACKUP_UPLOAD = 1450,\n}\n\nexport enum WalletAccountMergeFlags {\n /**\n * Not a legal mode!\n */\n None = 0,\n\n /**\n * We are merging a fully paid-up purse into a reserve.\n */\n MergeFullyPaidPurse = 1,\n\n CreateFromPurseQuota = 2,\n\n CreateWithPurseFee = 3,\n}\n\nexport class SignaturePurposeBuilder {\n private chunks: Uint8Array[] = [];\n\n constructor(private purposeNum: number) {}\n\n put(bytes: Uint8Array): SignaturePurposeBuilder {\n this.chunks.push(Uint8Array.from(bytes));\n return this;\n }\n\n build(): Uint8Array {\n let payloadLen = 0;\n for (const c of this.chunks) {\n payloadLen += c.byteLength;\n }\n const buf = new ArrayBuffer(4 + 4 + payloadLen);\n const u8buf = new Uint8Array(buf);\n let p = 8;\n for (const c of this.chunks) {\n u8buf.set(c, p);\n p += c.byteLength;\n }\n const dvbuf = new DataView(buf);\n dvbuf.setUint32(0, payloadLen + 4 + 4);\n dvbuf.setUint32(4, this.purposeNum);\n return u8buf;\n }\n}\n\nexport function buildSigPS(purposeNum: number): SignaturePurposeBuilder {\n return new SignaturePurposeBuilder(purposeNum);\n}\n\nexport type OpaqueData = Flavor;\nexport type Edx25519PublicKey = FlavorP;\nexport type Edx25519PrivateKey = FlavorP;\nexport type Edx25519Signature = FlavorP;\n\nexport type Edx25519PublicKeyEnc = FlavorP;\nexport type Edx25519PrivateKeyEnc = FlavorP<\n string,\n \"Edx25519PrivateKeyEnc\",\n 64\n>;\n\n/**\n * Convert a big integer to a fixed-size, little-endian array.\n */\nexport function bigintToNaclArr(\n x: bigint.BigInteger,\n size: number,\n): Uint8Array {\n const byteArr = new Uint8Array(size);\n const arr = x.toArray(256).value.reverse();\n byteArr.set(arr, 0);\n return byteArr;\n}\n\nexport function bigintFromNaclArr(arr: Uint8Array): bigint.BigInteger {\n let rev = new Uint8Array(arr);\n rev = rev.reverse();\n return bigint.fromArray(Array.from(rev), 256, false);\n}\n\nexport namespace Edx25519 {\n const revL = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2,\n 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10,\n ];\n\n const L = bigint.fromArray(revL.reverse(), 256, false);\n\n export async function keyCreateFromSeed(\n seed: OpaqueData,\n ): Promise {\n return nacl.crypto_edx25519_private_key_create_from_seed(seed);\n }\n\n export async function keyCreate(): Promise {\n return nacl.crypto_edx25519_private_key_create();\n }\n\n export async function getPublic(\n priv: Edx25519PrivateKey,\n ): Promise {\n return nacl.crypto_edx25519_get_public(priv);\n }\n\n export function sign(\n msg: OpaqueData,\n key: Edx25519PrivateKey,\n ): Promise {\n throw Error(\"not implemented\");\n }\n\n async function deriveFactor(\n pub: Edx25519PublicKey,\n seed: OpaqueData,\n ): Promise {\n const res = kdfKw({\n outputLength: 64,\n salt: seed,\n ikm: pub,\n info: stringToBytes(\"edx25519-derivation\"),\n });\n\n return res;\n }\n\n export async function privateKeyDerive(\n priv: Edx25519PrivateKey,\n seed: OpaqueData,\n ): Promise {\n const pub = await getPublic(priv);\n const privDec = priv;\n const a = bigintFromNaclArr(privDec.subarray(0, 32));\n const factorEnc = await deriveFactor(pub, seed);\n const factorModL = bigintFromNaclArr(factorEnc).mod(L);\n\n const aPrime = a.divide(8).multiply(factorModL).mod(L).multiply(8).mod(L);\n const bPrime = nacl\n .hash(typedArrayConcat([privDec.subarray(32, 64), factorEnc]))\n .subarray(0, 32);\n\n const newPriv = typedArrayConcat([bigintToNaclArr(aPrime, 32), bPrime]);\n\n return newPriv;\n }\n\n export async function publicKeyDerive(\n pub: Edx25519PublicKey,\n seed: OpaqueData,\n ): Promise {\n const factorEnc = await deriveFactor(pub, seed);\n const factorReduced = nacl.crypto_core_ed25519_scalar_reduce(factorEnc);\n const res = nacl.crypto_scalarmult_ed25519_noclamp(factorReduced, pub);\n return res;\n }\n}\n\nexport interface AgeCommitment {\n mask: number;\n\n /**\n * Public keys, one for each age group specified in the age mask.\n */\n publicKeys: Edx25519PublicKeyEnc[];\n}\n\nexport interface AgeProof {\n /**\n * Private keys. Typically smaller than the number of public keys,\n * because we drop private keys from age groups that are restricted.\n */\n privateKeys: Edx25519PrivateKeyEnc[];\n}\n\nexport interface AgeCommitmentProof {\n commitment: AgeCommitment;\n proof: AgeProof;\n}\n\nfunction invariant(cond: boolean): asserts cond {\n if (!cond) {\n throw Error(\"invariant failed\");\n }\n}\n\nexport namespace AgeRestriction {\n /**\n * Smallest age value that the protocol considers \"unrestricted\".\n */\n export const AGE_UNRESTRICTED = 32;\n\n export function hashCommitment(ac: AgeCommitment): HashCodeString {\n const hc = new nacl.HashState();\n for (const pub of ac.publicKeys) {\n hc.update(decodeCrock(pub));\n }\n return encodeCrock(hc.finish().subarray(0, 32));\n }\n\n export function countAgeGroups(mask: number): number {\n let count = 0;\n let m = mask;\n while (m > 0) {\n count += m & 1;\n m = m >> 1;\n }\n return count;\n }\n\n /**\n * Get the starting points for age groups in the mask.\n */\n export function getAgeGroupsFromMask(mask: number): number[] {\n const groups: number[] = [];\n let age = 1;\n let m = mask >> 1;\n while (m > 0) {\n if (m & 1) {\n groups.push(age);\n }\n m = m >> 1;\n age++;\n }\n return groups;\n }\n\n export function getAgeGroupIndex(mask: number, age: number): number {\n invariant((mask & 1) === 1);\n let i = 0;\n let m = mask;\n let a = age;\n while (m > 0) {\n if (a <= 0) {\n break;\n }\n m = m >> 1;\n i += m & 1;\n a--;\n }\n return i;\n }\n\n export function ageGroupSpecToMask(ageGroupSpec: string): number {\n throw Error(\"not implemented\");\n }\n\n export async function restrictionCommit(\n ageMask: number,\n age: number,\n ): Promise {\n invariant((ageMask & 1) === 1);\n const numPubs = countAgeGroups(ageMask) - 1;\n const numPrivs = getAgeGroupIndex(ageMask, age);\n\n const pubs: Edx25519PublicKey[] = [];\n const privs: Edx25519PrivateKey[] = [];\n\n for (let i = 0; i < numPubs; i++) {\n const priv = await Edx25519.keyCreate();\n const pub = await Edx25519.getPublic(priv);\n pubs.push(pub);\n if (i < numPrivs) {\n privs.push(priv);\n }\n }\n\n return {\n commitment: {\n mask: ageMask,\n publicKeys: pubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: privs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n const PublishedAgeRestrictionBaseKey: Edx25519PublicKey = decodeCrock(\n \"CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG\",\n );\n\n export async function restrictionCommitSeeded(\n ageMask: number,\n age: number,\n seed: Uint8Array,\n ): Promise {\n invariant((ageMask & 1) === 1);\n const numPubs = countAgeGroups(ageMask) - 1;\n const numPrivs = getAgeGroupIndex(ageMask, age);\n\n const pubs: Edx25519PublicKey[] = [];\n const privs: Edx25519PrivateKey[] = [];\n\n for (let i = 0; i < numPrivs; i++) {\n const privSeed = await kdfKw({\n outputLength: 32,\n ikm: seed,\n info: stringToBytes(\"age-commitment\"),\n salt: bufferForUint32(i),\n });\n\n const priv = await Edx25519.keyCreateFromSeed(privSeed);\n const pub = await Edx25519.getPublic(priv);\n pubs.push(pub);\n privs.push(priv);\n }\n\n for (let i = numPrivs; i < numPubs; i++) {\n const deriveSeed = await kdfKw({\n outputLength: 32,\n ikm: seed,\n info: stringToBytes(\"age-factor\"),\n salt: bufferForUint32(i),\n });\n const pub = await Edx25519.publicKeyDerive(\n PublishedAgeRestrictionBaseKey,\n deriveSeed,\n );\n pubs.push(pub);\n }\n\n return {\n commitment: {\n mask: ageMask,\n publicKeys: pubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: privs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n /**\n * Check that c1 = c2*salt\n */\n export async function commitCompare(\n c1: AgeCommitment,\n c2: AgeCommitment,\n salt: OpaqueData,\n ): Promise {\n if (c1.publicKeys.length != c2.publicKeys.length) {\n return false;\n }\n for (let i = 0; i < c1.publicKeys.length; i++) {\n const k1 = decodeCrock(c1.publicKeys[i]);\n const k2 = await Edx25519.publicKeyDerive(\n decodeCrock(c2.publicKeys[i]),\n salt,\n );\n if (k1 != k2) {\n return false;\n }\n }\n return true;\n }\n\n export async function commitmentDerive(\n commitmentProof: AgeCommitmentProof,\n salt: OpaqueData,\n ): Promise {\n const newPrivs: Edx25519PrivateKey[] = [];\n const newPubs: Edx25519PublicKey[] = [];\n\n for (const oldPub of commitmentProof.commitment.publicKeys) {\n newPubs.push(await Edx25519.publicKeyDerive(decodeCrock(oldPub), salt));\n }\n\n for (const oldPriv of commitmentProof.proof.privateKeys) {\n newPrivs.push(\n await Edx25519.privateKeyDerive(decodeCrock(oldPriv), salt),\n );\n }\n\n return {\n commitment: {\n mask: commitmentProof.commitment.mask,\n publicKeys: newPubs.map((x) => encodeCrock(x)),\n },\n proof: {\n privateKeys: newPrivs.map((x) => encodeCrock(x)),\n },\n };\n }\n\n export function commitmentAttest(\n commitmentProof: AgeCommitmentProof,\n age: number,\n ): Edx25519Signature {\n const d = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION)\n .put(bufferForUint32(commitmentProof.commitment.mask))\n .put(bufferForUint32(age))\n .build();\n const group = getAgeGroupIndex(commitmentProof.commitment.mask, age);\n if (group === 0) {\n // No attestation required.\n return new Uint8Array(64);\n }\n const priv = commitmentProof.proof.privateKeys[group - 1];\n const pub = commitmentProof.commitment.publicKeys[group - 1];\n const sig = nacl.crypto_edx25519_sign_detached(\n d,\n decodeCrock(priv),\n decodeCrock(pub),\n );\n return sig;\n }\n\n export function commitmentVerify(\n commitment: AgeCommitment,\n sig: string,\n age: number,\n ): boolean {\n const d = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION)\n .put(bufferForUint32(commitment.mask))\n .put(bufferForUint32(age))\n .build();\n const group = getAgeGroupIndex(commitment.mask, age);\n if (group === 0) {\n // No attestation required.\n return true;\n }\n const pub = commitment.publicKeys[group - 1];\n return nacl.crypto_edx25519_sign_detached_verify(\n d,\n decodeCrock(sig),\n decodeCrock(pub),\n );\n }\n}\n\n// FIXME: make it a branded type!\nexport type EncryptionNonce = FlavorP;\n\nasync function deriveKey(\n keySeed: OpaqueData,\n nonce: EncryptionNonce,\n salt: string,\n): Promise {\n return kdfKw({\n outputLength: 32,\n salt: nonce,\n ikm: keySeed,\n info: stringToBytes(salt),\n });\n}\n\nexport async function encryptWithDerivedKey(\n nonce: EncryptionNonce,\n keySeed: OpaqueData,\n plaintext: OpaqueData,\n salt: string,\n): Promise {\n const key = await deriveKey(keySeed, nonce, salt);\n const cipherText = secretbox(plaintext, nonce, key);\n return typedArrayConcat([nonce, cipherText]);\n}\n\nconst nonceSize = 24;\n\nexport async function decryptWithDerivedKey(\n ciphertext: OpaqueData,\n keySeed: OpaqueData,\n salt: string,\n): Promise {\n const ctBuf = ciphertext;\n const nonceBuf = ctBuf.slice(0, nonceSize);\n const enc = ctBuf.slice(nonceSize);\n const key = await deriveKey(keySeed, nonceBuf, salt);\n const clearText = nacl.secretbox_open(enc, nonceBuf, key);\n if (!clearText) {\n throw Error(\"could not decrypt\");\n }\n return clearText;\n}\n\nenum ContractFormatTag {\n PaymentOffer = 0,\n PaymentRequest = 1,\n}\n\ntype MaterialEddsaPub = {\n _materialType?: \"eddsa-pub\";\n _size?: 32;\n};\n\ntype MaterialEddsaPriv = {\n _materialType?: \"ecdhe-priv\";\n _size?: 32;\n};\n\ntype MaterialEcdhePub = {\n _materialType?: \"ecdhe-pub\";\n _size?: 32;\n};\n\ntype MaterialEcdhePriv = {\n _materialType?: \"ecdhe-priv\";\n _size?: 32;\n};\n\ntype PursePublicKey = FlavorP &\n MaterialEddsaPub;\n\ntype ContractPrivateKey = FlavorP &\n MaterialEcdhePriv;\n\ntype MergePrivateKey = FlavorP &\n MaterialEddsaPriv;\n\nconst mergeSalt = \"p2p-merge-contract\";\nconst depositSalt = \"p2p-deposit-contract\";\n\nexport function encryptContractForMerge(\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n mergePriv: MergePrivateKey,\n contractTerms: any,\n nonce: EncryptionNonce,\n): Promise {\n const contractTermsCanon = canonicalJson(contractTerms) + \"\\0\";\n const contractTermsBytes = stringToBytes(contractTermsCanon);\n const contractTermsCompressed = fflate.zlibSync(contractTermsBytes);\n const data = typedArrayConcat([\n bufferForUint32(ContractFormatTag.PaymentOffer),\n bufferForUint32(contractTermsBytes.length),\n mergePriv,\n contractTermsCompressed,\n ]);\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n return encryptWithDerivedKey(nonce, key, data, mergeSalt);\n}\n\nexport function encryptContractForDeposit(\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n contractTerms: any,\n nonce: EncryptionNonce,\n): Promise {\n const contractTermsCanon = canonicalJson(contractTerms) + \"\\0\";\n const contractTermsBytes = stringToBytes(contractTermsCanon);\n const contractTermsCompressed = fflate.zlibSync(contractTermsBytes);\n const data = typedArrayConcat([\n bufferForUint32(ContractFormatTag.PaymentRequest),\n bufferForUint32(contractTermsBytes.length),\n contractTermsCompressed,\n ]);\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n return encryptWithDerivedKey(nonce, key, data, depositSalt);\n}\n\nexport interface DecryptForMergeResult {\n contractTerms: any;\n mergePriv: Uint8Array;\n}\n\nexport interface DecryptForDepositResult {\n contractTerms: any;\n}\n\nexport async function decryptContractForMerge(\n enc: OpaqueData,\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n): Promise {\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n const dec = await decryptWithDerivedKey(enc, key, mergeSalt);\n const mergePriv = dec.slice(8, 8 + 32);\n const contractTermsCompressed = dec.slice(8 + 32);\n const contractTermsBuf = fflate.unzlibSync(contractTermsCompressed);\n // Slice of the '\\0' at the end and decode to a string\n const contractTermsString = bytesToString(\n contractTermsBuf.slice(0, contractTermsBuf.length - 1),\n );\n return {\n mergePriv: mergePriv,\n contractTerms: JSON.parse(contractTermsString),\n };\n}\n\nexport async function decryptContractForDeposit(\n enc: OpaqueData,\n pursePub: PursePublicKey,\n contractPriv: ContractPrivateKey,\n): Promise {\n const key = keyExchangeEcdhEddsa(contractPriv, pursePub);\n const dec = await decryptWithDerivedKey(enc, key, depositSalt);\n const contractTermsCompressed = dec.slice(8);\n const contractTermsBuf = fflate.unzlibSync(contractTermsCompressed);\n // Slice of the '\\0' at the end and decode to a string\n const contractTermsString = bytesToString(\n contractTermsBuf.slice(0, contractTermsBuf.length - 1),\n );\n return {\n contractTerms: JSON.parse(contractTermsString),\n };\n}\n\nexport function amountToBuffer(amount: AmountLike): Uint8Array {\n const amountJ = Amounts.jsonifyAmount(amount);\n const buffer = new ArrayBuffer(8 + 4 + 12);\n const dvbuf = new DataView(buffer);\n const u8buf = new Uint8Array(buffer);\n const curr = stringToBytes(amountJ.currency);\n if (typeof dvbuf.setBigUint64 !== \"undefined\") {\n dvbuf.setBigUint64(0, BigInt(amountJ.value));\n } else {\n const arr = bigint(amountJ.value).toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n dvbuf.setUint8(offset++, arr[i]);\n }\n }\n dvbuf.setUint32(8, amountJ.fraction);\n u8buf.set(curr, 8 + 4);\n\n return u8buf;\n}\n\nexport function timestampRoundedToBuffer(\n ts: TalerProtocolTimestamp,\n): Uint8Array {\n const b = new ArrayBuffer(8);\n const v = new DataView(b);\n // The buffer we sign over represents the timestamp in microseconds.\n if (typeof v.setBigUint64 !== \"undefined\") {\n const s = BigInt(ts.t_s) * BigInt(1000 * 1000);\n v.setBigUint64(0, s);\n } else {\n const s =\n ts.t_s === \"never\" ? bigint.zero : bigint(ts.t_s).multiply(1000 * 1000);\n const arr = s.toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n v.setUint8(offset++, arr[i]);\n }\n }\n return new Uint8Array(b);\n}\n\nexport function durationRoundedToBuffer(ts: TalerProtocolDuration): Uint8Array {\n const b = new ArrayBuffer(8);\n const v = new DataView(b);\n // The buffer we sign over represents the timestamp in microseconds.\n if (typeof v.setBigUint64 !== \"undefined\") {\n const s = BigInt(ts.d_us);\n v.setBigUint64(0, s);\n } else {\n const s = ts.d_us === \"forever\" ? bigint.zero : bigint(ts.d_us);\n const arr = s.toArray(2 ** 8).value;\n let offset = 8 - arr.length;\n for (let i = 0; i < arr.length; i++) {\n v.setUint8(offset++, arr[i]);\n }\n }\n return new Uint8Array(b);\n}\n", "// SHA-256 for JavaScript.\n//\n// Written in 2014-2016 by Dmitry Chestnykh.\n// Public domain, no warranty.\n//\n// Functions (accept and return Uint8Arrays):\n//\n// sha256(message) -> hash\n// sha256.hmac(key, message) -> mac\n//\n// Classes:\n//\n// new sha256.Hash()\nexport const digestLength = 32;\nexport const blockSize = 64;\n\n// SHA-256 constants\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nfunction hashBlocks(\n w: Int32Array,\n v: Int32Array,\n p: Uint8Array,\n pos: number,\n len: number,\n): number {\n let a: number,\n b: number,\n c: number,\n d: number,\n e: number,\n f: number,\n g: number,\n h: number,\n u: number,\n i: number,\n j: number,\n t1: number,\n t2: number;\n while (len >= 64) {\n a = v[0];\n b = v[1];\n c = v[2];\n d = v[3];\n e = v[4];\n f = v[5];\n g = v[6];\n h = v[7];\n\n for (i = 0; i < 16; i++) {\n j = pos + i * 4;\n w[i] =\n ((p[j] & 0xff) << 24) |\n ((p[j + 1] & 0xff) << 16) |\n ((p[j + 2] & 0xff) << 8) |\n (p[j + 3] & 0xff);\n }\n\n for (i = 16; i < 64; i++) {\n u = w[i - 2];\n t1 =\n ((u >>> 17) | (u << (32 - 17))) ^\n ((u >>> 19) | (u << (32 - 19))) ^\n (u >>> 10);\n\n u = w[i - 15];\n t2 =\n ((u >>> 7) | (u << (32 - 7))) ^\n ((u >>> 18) | (u << (32 - 18))) ^\n (u >>> 3);\n\n w[i] = ((t1 + w[i - 7]) | 0) + ((t2 + w[i - 16]) | 0);\n }\n\n for (i = 0; i < 64; i++) {\n t1 =\n ((((((e >>> 6) | (e << (32 - 6))) ^\n ((e >>> 11) | (e << (32 - 11))) ^\n ((e >>> 25) | (e << (32 - 25)))) +\n ((e & f) ^ (~e & g))) |\n 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) |\n 0;\n\n t2 =\n ((((a >>> 2) | (a << (32 - 2))) ^\n ((a >>> 13) | (a << (32 - 13))) ^\n ((a >>> 22) | (a << (32 - 22)))) +\n ((a & b) ^ (a & c) ^ (b & c))) |\n 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n\n v[0] += a;\n v[1] += b;\n v[2] += c;\n v[3] += d;\n v[4] += e;\n v[5] += f;\n v[6] += g;\n v[7] += h;\n\n pos += 64;\n len -= 64;\n }\n return pos;\n}\n\n// Hash implements SHA256 hash algorithm.\nexport class HashSha256 {\n digestLength: number = digestLength;\n blockSize: number = blockSize;\n\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n private state: Int32Array = new Int32Array(8); // hash state\n private temp: Int32Array = new Int32Array(64); // temporary state\n private buffer: Uint8Array = new Uint8Array(128); // buffer for data to hash\n private bufferLength = 0; // number of bytes in buffer\n private bytesHashed = 0; // number of total bytes hashed\n\n finished = false; // indicates whether the hash was finalized\n\n constructor() {\n this.reset();\n }\n\n // Resets hash state making it possible\n // to reuse this instance to hash other data.\n reset(): this {\n this.state[0] = 0x6a09e667;\n this.state[1] = 0xbb67ae85;\n this.state[2] = 0x3c6ef372;\n this.state[3] = 0xa54ff53a;\n this.state[4] = 0x510e527f;\n this.state[5] = 0x9b05688c;\n this.state[6] = 0x1f83d9ab;\n this.state[7] = 0x5be0cd19;\n this.bufferLength = 0;\n this.bytesHashed = 0;\n this.finished = false;\n return this;\n }\n\n // Cleans internal buffers and re-initializes hash state.\n clean(): void {\n for (let i = 0; i < this.buffer.length; i++) {\n this.buffer[i] = 0;\n }\n for (let i = 0; i < this.temp.length; i++) {\n this.temp[i] = 0;\n }\n this.reset();\n }\n\n // Updates hash state with the given data.\n //\n // Optionally, length of the data can be specified to hash\n // fewer bytes than data.length.\n //\n // Throws error when trying to update already finalized hash:\n // instance must be reset to use it again.\n update(data: Uint8Array, dataLength: number = data.length): this {\n if (this.finished) {\n throw new Error(\"SHA256: can't update because hash was finished.\");\n }\n let dataPos = 0;\n this.bytesHashed += dataLength;\n if (this.bufferLength > 0) {\n while (this.bufferLength < 64 && dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this.bufferLength === 64) {\n hashBlocks(this.temp, this.state, this.buffer, 0, 64);\n this.bufferLength = 0;\n }\n }\n if (dataLength >= 64) {\n dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);\n dataLength %= 64;\n }\n while (dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n }\n\n // Finalizes hash state and puts hash into out.\n //\n // If hash was already finalized, puts the same value.\n finish(out: Uint8Array): this {\n if (!this.finished) {\n const bytesHashed = this.bytesHashed;\n const left = this.bufferLength;\n const bitLenHi = (bytesHashed / 0x20000000) | 0;\n const bitLenLo = bytesHashed << 3;\n const padLength = bytesHashed % 64 < 56 ? 64 : 128;\n\n this.buffer[left] = 0x80;\n for (let i = left + 1; i < padLength - 8; i++) {\n this.buffer[i] = 0;\n }\n this.buffer[padLength - 8] = (bitLenHi >>> 24) & 0xff;\n this.buffer[padLength - 7] = (bitLenHi >>> 16) & 0xff;\n this.buffer[padLength - 6] = (bitLenHi >>> 8) & 0xff;\n this.buffer[padLength - 5] = (bitLenHi >>> 0) & 0xff;\n this.buffer[padLength - 4] = (bitLenLo >>> 24) & 0xff;\n this.buffer[padLength - 3] = (bitLenLo >>> 16) & 0xff;\n this.buffer[padLength - 2] = (bitLenLo >>> 8) & 0xff;\n this.buffer[padLength - 1] = (bitLenLo >>> 0) & 0xff;\n\n hashBlocks(this.temp, this.state, this.buffer, 0, padLength);\n\n this.finished = true;\n }\n\n for (let i = 0; i < 8; i++) {\n out[i * 4 + 0] = (this.state[i] >>> 24) & 0xff;\n out[i * 4 + 1] = (this.state[i] >>> 16) & 0xff;\n out[i * 4 + 2] = (this.state[i] >>> 8) & 0xff;\n out[i * 4 + 3] = (this.state[i] >>> 0) & 0xff;\n }\n\n return this;\n }\n\n // Returns the final hash digest.\n digest(): Uint8Array {\n const out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n }\n\n // Internal function for use in HMAC for optimization.\n _saveState(out: Uint32Array): void {\n for (let i = 0; i < this.state.length; i++) {\n out[i] = this.state[i];\n }\n }\n\n // Internal function for use in HMAC for optimization.\n _restoreState(from: Uint32Array, bytesHashed: number): void {\n for (let i = 0; i < this.state.length; i++) {\n this.state[i] = from[i];\n }\n this.bytesHashed = bytesHashed;\n this.finished = false;\n this.bufferLength = 0;\n }\n}\n\n// HMAC implements HMAC-SHA256 message authentication algorithm.\nexport class HMAC {\n private inner: HashSha256 = new HashSha256();\n private outer: HashSha256 = new HashSha256();\n\n blockSize: number = this.inner.blockSize;\n digestLength: number = this.inner.digestLength;\n\n // Copies of hash states after keying.\n // Need for quick reset without hashing they key again.\n private istate: Uint32Array;\n private ostate: Uint32Array;\n\n constructor(key: Uint8Array) {\n const pad = new Uint8Array(this.blockSize);\n if (key.length > this.blockSize) {\n new HashSha256().update(key).finish(pad).clean();\n } else {\n for (let i = 0; i < key.length; i++) {\n pad[i] = key[i];\n }\n }\n for (let i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36;\n }\n this.inner.update(pad);\n\n for (let i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36 ^ 0x5c;\n }\n this.outer.update(pad);\n\n this.istate = new Uint32Array(8);\n this.ostate = new Uint32Array(8);\n\n this.inner._saveState(this.istate);\n this.outer._saveState(this.ostate);\n\n for (let i = 0; i < pad.length; i++) {\n pad[i] = 0;\n }\n }\n\n // Returns HMAC state to the state initialized with key\n // to make it possible to run HMAC over the other data with the same\n // key without creating a new instance.\n reset(): this {\n this.inner._restoreState(this.istate, this.inner.blockSize);\n this.outer._restoreState(this.ostate, this.outer.blockSize);\n return this;\n }\n\n // Cleans HMAC state.\n clean(): void {\n for (let i = 0; i < this.istate.length; i++) {\n this.ostate[i] = this.istate[i] = 0;\n }\n this.inner.clean();\n this.outer.clean();\n }\n\n // Updates state with provided data.\n update(data: Uint8Array): this {\n this.inner.update(data);\n return this;\n }\n\n // Finalizes HMAC and puts the result in out.\n finish(out: Uint8Array): this {\n if (this.outer.finished) {\n this.outer.finish(out);\n } else {\n this.inner.finish(out);\n this.outer.update(out, this.digestLength).finish(out);\n }\n return this;\n }\n\n // Returns message authentication code.\n digest(): Uint8Array {\n const out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n }\n}\n\n// Returns SHA256 hash of data.\nexport function sha256(data: Uint8Array): Uint8Array {\n const h = new HashSha256().update(data);\n const digest = h.digest();\n h.clean();\n return digest;\n}\n\n// Returns HMAC-SHA256 of data under the key.\nexport function hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array {\n const h = new HMAC(key).update(data);\n const digest = h.digest();\n h.clean();\n return digest;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport * as nacl from \"./nacl-fast.js\";\nimport { sha256 } from \"./sha256.js\";\n\nexport function sha512(data: Uint8Array): Uint8Array {\n return nacl.hash(data);\n}\n\nexport function hmac(\n digest: (d: Uint8Array) => Uint8Array,\n blockSize: number,\n key: Uint8Array,\n message: Uint8Array,\n): Uint8Array {\n if (key.byteLength > blockSize) {\n key = digest(key);\n }\n if (key.byteLength < blockSize) {\n const k = key;\n key = new Uint8Array(blockSize);\n key.set(k, 0);\n }\n const okp = new Uint8Array(blockSize);\n const ikp = new Uint8Array(blockSize);\n for (let i = 0; i < blockSize; i++) {\n ikp[i] = key[i] ^ 0x36;\n okp[i] = key[i] ^ 0x5c;\n }\n const b1 = new Uint8Array(blockSize + message.byteLength);\n b1.set(ikp, 0);\n b1.set(message, blockSize);\n const h0 = digest(b1);\n const b2 = new Uint8Array(blockSize + h0.length);\n b2.set(okp, 0);\n b2.set(h0, blockSize);\n return digest(b2);\n}\n\nexport function hmacSha512(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha512, 128, key, message);\n}\n\nexport function hmacSha256(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha256, 64, key, message);\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForList,\n codecForNumber,\n codecForString,\n codecForStringURL,\n codecOptional,\n} from \"./codec.js\";\nimport {\n PaytoString,\n buildCodecForUnion,\n codecForAmountString,\n codecForBoolean,\n codecForConstString,\n codecForCurrencySpecificiation,\n codecForMap,\n codecForURN,\n strcmp,\n} from \"./index.js\";\nimport { Edx25519PublicKeyEnc } from \"./taler-crypto.js\";\nimport {\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForDuration,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AmlOfficerPublicKeyP,\n AmountString,\n Base32String,\n CoinPublicKeyString,\n Cs25519Point,\n CurrencySpecification,\n EddsaPublicKeyString,\n EddsaSignatureString,\n HashCodeString,\n Integer,\n InternationalizedString,\n LibtoolVersionString,\n PaytoHash,\n RelativeTime,\n RsaPublicKey,\n RsaPublicKeySring,\n Timestamp,\n WireSalt,\n} from \"./types-taler-common.js\";\n\nexport type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey;\n\nexport interface RsaDenominationPubKey {\n readonly cipher: DenomKeyType.Rsa;\n readonly rsa_public_key: string;\n readonly age_mask: number;\n}\n\nexport interface CsDenominationPubKey {\n readonly cipher: DenomKeyType.ClauseSchnorr;\n readonly age_mask: number;\n readonly cs_public_key: string;\n}\n\nexport namespace DenominationPubKey {\n export function cmp(\n p1: DenominationPubKey,\n p2: DenominationPubKey,\n ): -1 | 0 | 1 {\n if (p1.cipher < p2.cipher) {\n return -1;\n } else if (p1.cipher > p2.cipher) {\n return +1;\n } else if (\n p1.cipher === DenomKeyType.Rsa &&\n p2.cipher === DenomKeyType.Rsa\n ) {\n if ((p1.age_mask ?? 0) < (p2.age_mask ?? 0)) {\n return -1;\n } else if ((p1.age_mask ?? 0) > (p2.age_mask ?? 0)) {\n return 1;\n }\n return strcmp(p1.rsa_public_key, p2.rsa_public_key);\n } else if (\n p1.cipher === DenomKeyType.ClauseSchnorr &&\n p2.cipher === DenomKeyType.ClauseSchnorr\n ) {\n if ((p1.age_mask ?? 0) < (p2.age_mask ?? 0)) {\n return -1;\n } else if ((p1.age_mask ?? 0) > (p2.age_mask ?? 0)) {\n return 1;\n }\n return strcmp(p1.cs_public_key, p2.cs_public_key);\n } else {\n throw Error(\"unsupported cipher\");\n }\n }\n}\n\nexport const codecForRsaDenominationPubKey = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.Rsa))\n .property(\"rsa_public_key\", codecForString())\n .property(\"age_mask\", codecForNumber())\n .build(\"DenominationPubKey\");\n\nexport const codecForCsDenominationPubKey = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.ClauseSchnorr))\n .property(\"cs_public_key\", codecForString())\n .property(\"age_mask\", codecForNumber())\n .build(\"CsDenominationPubKey\");\n\nexport const codecForDenominationPubKey = () =>\n buildCodecForUnion()\n .discriminateOn(\"cipher\")\n .alternative(DenomKeyType.Rsa, codecForRsaDenominationPubKey())\n .alternative(DenomKeyType.ClauseSchnorr, codecForCsDenominationPubKey())\n .build(\"DenominationPubKey\");\n\n/**\n * Denomination as found in the /keys response from the exchange.\n */\nexport interface ExchangeDenomination {\n /**\n * Value of one coin of the denomination.\n */\n value: string;\n\n /**\n * Public signing key of the denomination.\n */\n denom_pub: DenominationPubKey;\n\n /**\n * Fee for withdrawing.\n */\n fee_withdraw: string;\n\n /**\n * Fee for depositing.\n */\n fee_deposit: string;\n\n /**\n * Fee for refreshing.\n */\n fee_refresh: string;\n\n /**\n * Fee for refunding.\n */\n fee_refund: string;\n\n /**\n * Start date from which withdraw is allowed.\n */\n stamp_start: TalerProtocolTimestamp;\n\n /**\n * End date for withdrawing.\n */\n stamp_expire_withdraw: TalerProtocolTimestamp;\n\n /**\n * Expiration date after which the exchange can forget about\n * the currency.\n */\n stamp_expire_legal: TalerProtocolTimestamp;\n\n /**\n * Date after which the coins of this denomination can't be\n * deposited anymore.\n */\n stamp_expire_deposit: TalerProtocolTimestamp;\n\n /**\n * Signature over the denomination information by the exchange's master\n * signing key.\n */\n master_sig: string;\n}\n\n/**\n * Signature by the auditor that a particular denomination key is audited.\n */\nexport interface AuditorDenomSig {\n /**\n * Denomination public key's hash.\n */\n denom_pub_h: string;\n\n /**\n * The signature.\n */\n auditor_sig: string;\n}\n\n/**\n * Auditor information as given by the exchange in /keys.\n */\nexport interface ExchangeAuditor {\n /**\n * Auditor's public key.\n */\n auditor_pub: string;\n\n /**\n * Base URL of the auditor.\n */\n auditor_url: string;\n\n /**\n * List of signatures for denominations by the auditor.\n */\n denomination_keys: AuditorDenomSig[];\n}\n\nexport type ExchangeWithdrawValue =\n | ExchangeRsaWithdrawValue\n | ExchangeCsWithdrawValue;\n\nexport interface ExchangeRsaWithdrawValue {\n cipher: \"RSA\";\n}\n\nexport interface ExchangeCsWithdrawValue {\n cipher: \"CS\";\n\n /**\n * CSR R0 value\n */\n r_pub_0: string;\n\n /**\n * CSR R1 value\n */\n r_pub_1: string;\n}\n\nexport interface RecoupRequest {\n /**\n * Hashed denomination public key of the coin we want to get\n * paid back.\n */\n denom_pub_hash: string;\n\n /**\n * Signature over the coin public key by the denomination.\n *\n * The string variant is for the legacy exchange protocol.\n */\n denom_sig: UnblindedSignature;\n\n /**\n * Blinding key that was used during withdraw,\n * used to prove that we were actually withdrawing the coin.\n */\n coin_blind_key_secret: string;\n\n /**\n * Signature of TALER_RecoupRequestPS created with the coin's private key.\n */\n coin_sig: string;\n\n ewv: ExchangeWithdrawValue;\n}\n\nexport interface RecoupRefreshRequest {\n /**\n * Hashed enomination public key of the coin we want to get\n * paid back.\n */\n denom_pub_hash: string;\n\n /**\n * Signature over the coin public key by the denomination.\n *\n * The string variant is for the legacy exchange protocol.\n */\n denom_sig: UnblindedSignature;\n\n /**\n * Coin's blinding factor.\n */\n coin_blind_key_secret: string;\n\n /**\n * Signature of TALER_RecoupRefreshRequestPS created with\n * the coin's private key.\n */\n coin_sig: string;\n\n ewv: ExchangeWithdrawValue;\n}\n\n/**\n * Response that we get from the exchange for a payback request.\n */\nexport interface RecoupConfirmation {\n /**\n * Public key of the reserve that will receive the payback.\n */\n reserve_pub?: string;\n\n /**\n * Public key of the old coin that will receive the recoup,\n * provided if refreshed was true.\n */\n old_coin_pub?: string;\n}\n\nexport type UnblindedSignature = RsaUnblindedSignature;\n\nexport interface RsaUnblindedSignature {\n cipher: DenomKeyType.Rsa;\n rsa_signature: string;\n}\n\n/**\n * Deposit permission for a single coin.\n */\nexport interface CoinDepositPermission {\n /**\n * Signature by the coin.\n */\n coin_sig: string;\n\n /**\n * Public key of the coin being spend.\n */\n coin_pub: string;\n\n /**\n * Signature made by the denomination public key.\n *\n * The string variant is for legacy protocol support.\n */\n\n ub_sig: UnblindedSignature;\n\n /**\n * The denomination public key associated with this coin.\n */\n h_denom: string;\n\n /**\n * The amount that is subtracted from this coin with this payment.\n */\n contribution: string;\n\n /**\n * URL of the exchange this coin was withdrawn from.\n */\n exchange_url: string;\n\n minimum_age_sig?: EddsaSignatureString;\n\n age_commitment?: Edx25519PublicKeyEnc[];\n\n h_age_commitment?: string;\n}\n\n/**\n * Element of the payback list that the\n * exchange gives us in /keys.\n */\nexport interface Recoup {\n /**\n * The hash of the denomination public key for which the payback is offered.\n */\n h_denom_pub: string;\n}\n\n/**\n * Structure that the exchange gives us in /keys.\n */\nexport interface ExchangeKeysJson {\n /**\n * Canonical, public base URL of the exchange.\n */\n base_url: string;\n\n currency: string;\n\n currency_specification?: CurrencySpecification;\n\n /**\n * The exchange's master public key.\n */\n master_public_key: string;\n\n /**\n * The list of auditors (partially) auditing the exchange.\n */\n auditors: ExchangeAuditor[];\n\n /**\n * Timestamp when this response was issued.\n */\n list_issue_date: TalerProtocolTimestamp;\n\n /**\n * List of revoked denominations.\n */\n recoup?: Recoup[];\n\n /**\n * Short-lived signing keys used to sign online\n * responses.\n */\n signkeys: ExchangeSignKeyJson[];\n\n /**\n * Protocol version.\n */\n version: string;\n\n reserve_closing_delay: TalerProtocolDuration;\n\n global_fees: GlobalFees[];\n\n accounts: ExchangeWireAccount[];\n\n wire_fees: { [methodName: string]: WireFeesJson[] };\n\n denominations: DenomGroup[];\n}\n\nexport interface ExchangeMeltRequest {\n coin_pub: CoinPublicKeyString;\n confirm_sig: EddsaSignatureString;\n denom_pub_hash: HashCodeString;\n denom_sig: UnblindedSignature;\n rc: string;\n value_with_fee: AmountString;\n age_commitment_hash?: HashCodeString;\n}\n\nexport interface ExchangeMeltResponse {\n /**\n * Which of the kappa indices does the client not have to reveal.\n */\n noreveal_index: number;\n\n /**\n * Signature of TALER_RefreshMeltConfirmationPS whereby the exchange\n * affirms the successful melt and confirming the noreveal_index\n */\n exchange_sig: EddsaSignatureString;\n\n /*\n * public EdDSA key of the exchange that was used to generate the signature.\n * Should match one of the exchange's signing keys from /keys. Again given\n * explicitly as the client might otherwise be confused by clock skew as to\n * which signing key was used.\n */\n exchange_pub: EddsaPublicKeyString;\n\n /*\n * Base URL to use for operations on the refresh context\n * (so the reveal operation). If not given,\n * the base URL is the same as the one used for this request.\n * Can be used if the base URL for /refreshes/ differs from that\n * for /coins/, i.e. for load balancing. Clients SHOULD\n * respect the refresh_base_url if provided. Any HTTP server\n * belonging to an exchange MUST generate a 307 or 308 redirection\n * to the correct base URL should a client uses the wrong base\n * URL, or if the base URL has changed since the melt.\n *\n * When melting the same coin twice (technically allowed\n * as the response might have been lost on the network),\n * the exchange may return different values for the refresh_base_url.\n */\n refresh_base_url?: string;\n}\n\nexport interface ExchangeRevealItem {\n ev_sig: BlindedDenominationSignature;\n}\n\nexport interface ExchangeRevealResponse {\n // List of the exchange's blinded RSA signatures on the new coins.\n ev_sigs: ExchangeRevealItem[];\n}\n\nexport const codecForDenomination = (): Codec =>\n buildCodecForObject()\n .property(\"value\", codecForString())\n .property(\"denom_pub\", codecForDenominationPubKey())\n .property(\"fee_withdraw\", codecForString())\n .property(\"fee_deposit\", codecForString())\n .property(\"fee_refresh\", codecForString())\n .property(\"fee_refund\", codecForString())\n .property(\"stamp_start\", codecForTimestamp)\n .property(\"stamp_expire_withdraw\", codecForTimestamp)\n .property(\"stamp_expire_legal\", codecForTimestamp)\n .property(\"stamp_expire_deposit\", codecForTimestamp)\n .property(\"master_sig\", codecForString())\n .build(\"Denomination\");\n\nexport const codecForAuditorDenomSig = (): Codec =>\n buildCodecForObject()\n .property(\"denom_pub_h\", codecForString())\n .property(\"auditor_sig\", codecForString())\n .build(\"AuditorDenomSig\");\n\nexport const codecForAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"auditor_pub\", codecForString())\n .property(\"auditor_url\", codecForString())\n .property(\"denomination_keys\", codecForList(codecForAuditorDenomSig()))\n .build(\"Auditor\");\n\n/**\n * Structure of one exchange signing key in the /keys response.\n */\nexport class ExchangeSignKeyJson {\n stamp_start: TalerProtocolTimestamp;\n stamp_expire: TalerProtocolTimestamp;\n stamp_end: TalerProtocolTimestamp;\n key: EddsaPublicKeyString;\n master_sig: EddsaSignatureString;\n}\n\nexport type DenomGroup =\n | DenomGroupRsa\n | DenomGroupCs\n | DenomGroupRsaAgeRestricted\n | DenomGroupCsAgeRestricted;\n\nexport interface DenomGroupCommon {\n // How much are coins of this denomination worth?\n value: AmountString;\n\n // Fee charged by the exchange for withdrawing a coin of this denomination.\n fee_withdraw: AmountString;\n\n // Fee charged by the exchange for depositing a coin of this denomination.\n fee_deposit: AmountString;\n\n // Fee charged by the exchange for refreshing a coin of this denomination.\n fee_refresh: AmountString;\n\n // Fee charged by the exchange for refunding a coin of this denomination.\n fee_refund: AmountString;\n\n // XOR of all the SHA-512 hash values of the denominations' public keys\n // in this group. Note that for hashing, the binary format of the\n // public keys is used, and not their base32 encoding.\n hash: HashCodeString;\n}\n\nexport interface DenomCommon {\n // Signature of TALER_DenominationKeyValidityPS.\n master_sig: EddsaSignatureString;\n\n // When does the denomination key become valid?\n stamp_start: TalerProtocolTimestamp;\n\n // When is it no longer possible to deposit coins\n // of this denomination?\n stamp_expire_withdraw: TalerProtocolTimestamp;\n\n // Timestamp indicating by when legal disputes relating to these coins must\n // be settled, as the exchange will afterwards destroy its evidence relating to\n // transactions involving this coin.\n stamp_expire_legal: TalerProtocolTimestamp;\n\n stamp_expire_deposit: TalerProtocolTimestamp;\n\n // Set to 'true' if the exchange somehow \"lost\"\n // the private key. The denomination was not\n // necessarily revoked, but still cannot be used\n // to withdraw coins at this time (theoretically,\n // the private key could be recovered in the\n // future; coins signed with the private key\n // remain valid).\n lost?: boolean;\n}\n\nexport interface DenomGroupRsa extends DenomGroupCommon {\n cipher: \"RSA\";\n\n denoms: ({\n rsa_pub: RsaPublicKeySring;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupRsaAgeRestricted extends DenomGroupCommon {\n cipher: \"RSA+age_restricted\";\n age_mask: AgeMask;\n\n denoms: ({\n rsa_pub: RsaPublicKeySring;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupCs extends DenomGroupCommon {\n cipher: \"CS\";\n age_mask: AgeMask;\n\n denoms: ({\n cs_pub: Cs25519Point;\n } & DenomCommon)[];\n}\n\nexport interface DenomGroupCsAgeRestricted extends DenomGroupCommon {\n cipher: \"CS+age_restricted\";\n age_mask: AgeMask;\n\n denoms: ({\n cs_pub: Cs25519Point;\n } & DenomCommon)[];\n}\n\n/**\n * Wire fees as announced by the exchange.\n */\nexport class WireFeesJson {\n /**\n * Cost of a wire transfer.\n */\n wire_fee: string;\n\n /**\n * Cost of clising a reserve.\n */\n closing_fee: string;\n\n /**\n * Signature made with the exchange's master key.\n */\n sig: string;\n\n /**\n * Date from which the fee applies.\n */\n start_date: TalerProtocolTimestamp;\n\n /**\n * Data after which the fee doesn't apply anymore.\n */\n end_date: TalerProtocolTimestamp;\n}\n\nexport interface ExchangeWireAccount {\n // payto:// URI identifying the account and wire method\n payto_uri: string;\n\n // URI to convert amounts from or to the currency used by\n // this wire account of the exchange. Missing if no\n // conversion is applicable.\n conversion_url?: string;\n\n // Restrictions that apply to bank accounts that would send\n // funds to the exchange (crediting this exchange bank account).\n // Optional, empty array for unrestricted.\n credit_restrictions: AccountRestriction[];\n\n // Restrictions that apply to bank accounts that would receive\n // funds from the exchange (debiting this exchange bank account).\n // Optional, empty array for unrestricted.\n debit_restrictions: AccountRestriction[];\n\n // Signature using the exchange's offline key over\n // a TALER_MasterWireDetailsPS\n // with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.\n master_sig: EddsaSignatureString;\n\n // Display label wallets should use to show this\n // bank account.\n // Since protocol **v19**.\n bank_label?: string;\n priority?: number;\n}\n\nexport const codecForExchangeWireAccount = (): Codec =>\n buildCodecForObject()\n .property(\"conversion_url\", codecOptional(codecForStringURL()))\n .property(\"credit_restrictions\", codecForList(codecForAny()))\n .property(\"debit_restrictions\", codecForList(codecForAny()))\n .property(\"master_sig\", codecForString())\n .property(\"payto_uri\", codecForString())\n .property(\"bank_label\", codecOptional(codecForString()))\n .property(\"priority\", codecOptional(codecForNumber()))\n .build(\"WireAccount\");\n\nexport interface ExchangeRefundRequest {\n // Amount to be refunded, can be a fraction of the\n // coin's total deposit value (including deposit fee);\n // must be larger than the refund fee.\n refund_amount: AmountString;\n\n // SHA-512 hash of the contact of the merchant with the customer.\n h_contract_terms: HashCodeString;\n\n // 64-bit transaction id of the refund transaction between merchant and customer.\n rtransaction_id: number;\n\n // EdDSA public key of the merchant.\n merchant_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the merchant over a\n // TALER_RefundRequestPS with purpose\n // TALER_SIGNATURE_MERCHANT_REFUND\n // affirming the refund.\n merchant_sig: EddsaPublicKeyString;\n}\n\nexport interface ExchangeRefundSuccessResponse {\n // The EdDSA :ref:signature (binary-only) with purpose\n // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND over\n // a TALER_RecoupRefreshConfirmationPS\n // using a current signing key of the\n // exchange affirming the successful refund.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n}\n\nexport const codecForExchangeRefundSuccessResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .build(\"ExchangeRefundSuccessResponse\");\n\nexport type AccountRestriction =\n | RegexAccountRestriction\n | DenyAllAccountRestriction;\n\nexport interface DenyAllAccountRestriction {\n type: \"deny\";\n}\n\n// Accounts interacting with this type of account\n// restriction must have a payto://-URI matching\n// the given regex.\nexport interface RegexAccountRestriction {\n type: \"regex\";\n\n // Regular expression that the payto://-URI of the\n // partner account must follow. The regular expression\n // should follow posix-egrep, but without support for character\n // classes, GNU extensions, back-references or intervals. See\n // https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html\n // for a description of the posix-egrep syntax. Applications\n // may support regexes with additional features, but exchanges\n // must not use such regexes.\n payto_regex: string;\n\n // Hint for a human to understand the restriction\n // (that is hopefully easier to comprehend than the regex itself).\n human_hint: string;\n\n // Map from IETF BCP 47 language tags to localized\n // human hints.\n human_hint_i18n?: InternationalizedString;\n}\n\nexport type CoinEnvelope = CoinEnvelopeRsa | CoinEnvelopeCs;\n\nexport interface CoinEnvelopeRsa {\n cipher: DenomKeyType.Rsa;\n rsa_blinded_planchet: string;\n}\n\nexport interface CoinEnvelopeCs {\n cipher: DenomKeyType.ClauseSchnorr;\n // FIXME: add remaining fields\n}\n\nexport interface ExchangeWithdrawRequest {\n denom_pub_hash: HashCodeString;\n reserve_sig: EddsaSignatureString;\n coin_ev: CoinEnvelope;\n}\n\nexport interface ExchangeBatchWithdrawRequest {\n planchets: ExchangeWithdrawRequest[];\n}\n\nexport interface ExchangeRefreshRevealRequest {\n new_denoms_h: HashCodeString[];\n coin_evs: CoinEnvelope[];\n /**\n * kappa - 1 transfer private keys (ephemeral ECDHE keys).\n */\n transfer_privs: string[];\n\n transfer_pub: EddsaPublicKeyString;\n\n link_sigs: EddsaSignatureString[];\n\n /**\n * Iff the corresponding denomination has support for age restriction,\n * the client MUST provide the original age commitment, i.e. the vector\n * of public keys.\n */\n old_age_commitment?: Edx25519PublicKeyEnc[];\n}\n\nexport const codecForRecoup = (): Codec =>\n buildCodecForObject()\n .property(\"h_denom_pub\", codecForString())\n .build(\"Recoup\");\n\nexport const codecForExchangeSigningKey = (): Codec =>\n buildCodecForObject()\n .property(\"key\", codecForString())\n .property(\"master_sig\", codecForString())\n .property(\"stamp_end\", codecForTimestamp)\n .property(\"stamp_start\", codecForTimestamp)\n .property(\"stamp_expire\", codecForTimestamp)\n .build(\"ExchangeSignKeyJson\");\n\nexport const codecForGlobalFees = (): Codec =>\n buildCodecForObject()\n .property(\"start_date\", codecForTimestamp)\n .property(\"end_date\", codecForTimestamp)\n .property(\"history_fee\", codecForAmountString())\n .property(\"account_fee\", codecForAmountString())\n .property(\"purse_fee\", codecForAmountString())\n .property(\"history_expiration\", codecForDuration)\n .property(\"purse_account_limit\", codecForNumber())\n .property(\"purse_timeout\", codecForDuration)\n .property(\"master_sig\", codecForString())\n .build(\"GlobalFees\");\n\n// FIXME: Validate properly!\nexport const codecForNgDenominations: Codec = codecForAny();\n\nexport const codecForExchangeKeysJson = (): Codec =>\n buildCodecForObject()\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .property(\n \"currency_specification\",\n codecOptional(codecForCurrencySpecificiation()),\n )\n .property(\"master_public_key\", codecForString())\n .property(\"auditors\", codecForList(codecForAuditor()))\n .property(\"list_issue_date\", codecForTimestamp)\n .property(\"recoup\", codecOptional(codecForList(codecForRecoup())))\n .property(\"signkeys\", codecForList(codecForExchangeSigningKey()))\n .property(\"version\", codecForString())\n .property(\"reserve_closing_delay\", codecForDuration)\n .property(\"global_fees\", codecForList(codecForGlobalFees()))\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .property(\"wire_fees\", codecForMap(codecForList(codecForWireFeesJson())))\n .property(\"denominations\", codecForList(codecForNgDenominations))\n .build(\"ExchangeKeysJson\");\n\nexport const codecForWireFeesJson = (): Codec =>\n buildCodecForObject()\n .property(\"wire_fee\", codecForString())\n .property(\"closing_fee\", codecForString())\n .property(\"sig\", codecForString())\n .property(\"start_date\", codecForTimestamp)\n .property(\"end_date\", codecForTimestamp)\n .build(\"WireFeesJson\");\n\nexport const codecForRecoupConfirmation = (): Codec =>\n buildCodecForObject()\n .property(\"reserve_pub\", codecOptional(codecForString()))\n .property(\"old_coin_pub\", codecOptional(codecForString()))\n .build(\"RecoupConfirmation\");\n\nexport const codecForWithdrawResponse = (): Codec =>\n buildCodecForObject()\n .property(\"ev_sig\", codecForBlindedDenominationSignature())\n .build(\"WithdrawResponse\");\n\nexport class ExchangeWithdrawResponse {\n ev_sig: BlindedDenominationSignature;\n}\n\nexport class ExchangeWithdrawBatchResponse {\n ev_sigs: ExchangeWithdrawResponse[];\n}\n\nexport enum DenomKeyType {\n Rsa = \"RSA\",\n ClauseSchnorr = \"CS\",\n}\n\nexport namespace DenomKeyType {\n export function toIntTag(t: DenomKeyType): number {\n switch (t) {\n case DenomKeyType.Rsa:\n return 1;\n case DenomKeyType.ClauseSchnorr:\n return 2;\n }\n }\n}\n\nexport interface RsaBlindedDenominationSignature {\n cipher: DenomKeyType.Rsa;\n blinded_rsa_signature: string;\n}\n\nexport interface CSBlindedDenominationSignature {\n cipher: DenomKeyType.ClauseSchnorr;\n}\n\nexport type BlindedDenominationSignature =\n | RsaBlindedDenominationSignature\n | CSBlindedDenominationSignature;\n\nexport const codecForRsaBlindedDenominationSignature = () =>\n buildCodecForObject()\n .property(\"cipher\", codecForConstString(DenomKeyType.Rsa))\n .property(\"blinded_rsa_signature\", codecForString())\n .build(\"RsaBlindedDenominationSignature\");\n\nexport const codecForBlindedDenominationSignature = () =>\n buildCodecForUnion()\n .discriminateOn(\"cipher\")\n .alternative(DenomKeyType.Rsa, codecForRsaBlindedDenominationSignature())\n .build(\"BlindedDenominationSignature\");\n\nexport const codecForExchangeWithdrawBatchResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"ev_sigs\", codecForList(codecForWithdrawResponse()))\n .build(\"WithdrawBatchResponse\");\n\nexport const codecForExchangeMeltResponse = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"noreveal_index\", codecForNumber())\n .property(\"refresh_base_url\", codecOptional(codecForString()))\n .build(\"ExchangeMeltResponse\");\n\nexport const codecForExchangeRevealItem = (): Codec =>\n buildCodecForObject()\n .property(\"ev_sig\", codecForBlindedDenominationSignature())\n .build(\"ExchangeRevealItem\");\n\nexport const codecForExchangeRevealResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"ev_sigs\", codecForList(codecForExchangeRevealItem()))\n .build(\"ExchangeRevealResponse\");\n\nexport interface FutureKeysResponse {\n future_denoms: any[];\n\n future_signkeys: any[];\n\n master_pub: string;\n\n denom_secmod_public_key: string;\n\n // Public key of the signkey security module.\n signkey_secmod_public_key: string;\n}\n\nexport const codecForKeysManagementResponse = (): Codec =>\n buildCodecForObject()\n .property(\"master_pub\", codecForString())\n .property(\"future_signkeys\", codecForList(codecForAny()))\n .property(\"future_denoms\", codecForList(codecForAny()))\n .property(\"denom_secmod_public_key\", codecForAny())\n .property(\"signkey_secmod_public_key\", codecForAny())\n .build(\"FutureKeysResponse\");\n\nexport interface PurseDeposit {\n /**\n * Amount to be deposited, can be a fraction of the\n * coin's total value.\n */\n amount: AmountString;\n\n /**\n * Hash of denomination RSA key with which the coin is signed.\n */\n denom_pub_hash: HashCodeString;\n\n /**\n * Exchange's unblinded RSA signature of the coin.\n */\n ub_sig: UnblindedSignature;\n\n /**\n * Age commitment for the coin, if the denomination is age-restricted.\n */\n age_commitment?: string[];\n\n /**\n * Attestation for the minimum age, if the denomination is age-restricted.\n */\n attest?: string;\n\n /**\n * Signature over TALER_PurseDepositSignaturePS\n * of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT\n * made by the customer with the\n * coin's private key.\n */\n coin_sig: EddsaSignatureString;\n\n /**\n * Public key of the coin being deposited into the purse.\n */\n coin_pub: EddsaPublicKeyString;\n}\n\nexport interface ExchangePurseMergeRequest {\n // payto://-URI of the account the purse is to be merged into.\n // Must be of the form: 'payto://taler/$EXCHANGE_URL/$RESERVE_PUB'.\n payto_uri: string;\n\n // EdDSA signature of the account/reserve affirming the merge\n // over a TALER_AccountMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE\n reserve_sig: EddsaSignatureString;\n\n // EdDSA signature of the purse private key affirming the merge\n // over a TALER_PurseMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_PURSE_MERGE.\n merge_sig: EddsaSignatureString;\n\n // Client-side timestamp of when the merge request was made.\n merge_timestamp: TalerProtocolTimestamp;\n}\n\nexport interface ExchangeGetContractResponse {\n purse_pub: string;\n econtract_sig: string;\n econtract: string;\n}\n\nexport const codecForExchangeGetContractResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"purse_pub\", codecForString())\n .property(\"econtract_sig\", codecForString())\n .property(\"econtract\", codecForString())\n .build(\"ExchangeGetContractResponse\");\n\n/**\n * Contract terms between two wallets (as opposed to a merchant and wallet).\n */\nexport interface PeerContractTerms {\n amount: AmountString;\n summary: string;\n purse_expiration: TalerProtocolTimestamp;\n}\n\nexport interface EncryptedContract {\n // Encrypted contract.\n econtract: string;\n\n // Signature over the (encrypted) contract.\n econtract_sig: string;\n\n // Ephemeral public key for the DH operation to decrypt the encrypted contract.\n contract_pub: string;\n}\n\n/**\n * Payload for /reserves/{reserve_pub}/purse\n * endpoint of the exchange.\n */\nexport interface ExchangeReservePurseRequest {\n /**\n * Minimum amount that must be credited to the reserve, that is\n * the total value of the purse minus the deposit fees.\n * If the deposit fees are lower, the contribution to the\n * reserve can be higher!\n */\n purse_value: AmountString;\n\n // Minimum age required for all coins deposited into the purse.\n min_age: number;\n\n // Purse fee the reserve owner is willing to pay\n // for the purse creation. Optional, if not present\n // the purse is to be created from the purse quota\n // of the reserve.\n purse_fee: AmountString;\n\n // Optional encrypted contract, in case the buyer is\n // proposing the contract and thus establishing the\n // purse with the payment.\n econtract?: EncryptedContract;\n\n // EdDSA public key used to approve merges of this purse.\n merge_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the purse private key affirming the merge\n // over a TALER_PurseMergeSignaturePS.\n // Must be of purpose TALER_SIGNATURE_PURSE_MERGE.\n merge_sig: EddsaSignatureString;\n\n // EdDSA signature of the account/reserve affirming the merge.\n // Must be of purpose TALER_SIGNATURE_WALLET_ACCOUNT_MERGE\n reserve_sig: EddsaSignatureString;\n\n // Purse public key.\n purse_pub: EddsaPublicKeyString;\n\n // EdDSA signature of the purse over\n // TALER_PurseRequestSignaturePS of\n // purpose TALER_SIGNATURE_PURSE_REQUEST\n // confirming that the\n // above details hold for this purse.\n purse_sig: EddsaSignatureString;\n\n // SHA-512 hash of the contact of the purse.\n h_contract_terms: HashCodeString;\n\n // Client-side timestamp of when the merge request was made.\n merge_timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the purse should expire\n // if it has not been paid.\n purse_expiration: TalerProtocolTimestamp;\n}\n\nexport interface ExchangePurseDeposits {\n // Array of coins to deposit into the purse.\n deposits: PurseDeposit[];\n}\n\n/**\n * @deprecated batch deposit should be used.\n */\nexport interface ExchangeDepositRequest {\n // Amount to be deposited, can be a fraction of the\n // coin's total value.\n contribution: AmountString;\n\n // The merchant's account details.\n // In case of an auction policy, it refers to the seller.\n merchant_payto_uri: string;\n\n // The salt is used to hide the payto_uri from customers\n // when computing the h_wire of the merchant.\n wire_salt: string;\n\n // SHA-512 hash of the contract of the merchant with the customer. Further\n // details are never disclosed to the exchange.\n h_contract_terms: HashCodeString;\n\n // Hash of denomination RSA key with which the coin is signed.\n denom_pub_hash: HashCodeString;\n\n // Exchange's unblinded RSA signature of the coin.\n ub_sig: UnblindedSignature;\n\n // Timestamp when the contract was finalized.\n timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the exchange undertakes to transfer the funds to\n // the merchant, in case of successful payment. A wire transfer deadline of 'never'\n // is not allowed.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // EdDSA public key of the merchant, so that the client can identify the\n // merchant for refund requests.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n merchant_pub: EddsaPublicKeyString;\n\n // Date until which the merchant can issue a refund to the customer via the\n // exchange, to be omitted if refunds are not allowed.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n refund_deadline?: TalerProtocolTimestamp;\n\n // CAVEAT: THIS IS WORK IN PROGRESS\n // (Optional) policy for the deposit.\n // This might be a refund, auction or escrow policy.\n //\n // Note that support for policies is an optional feature of the exchange.\n // Optional features are so called \"extensions\" in Taler. The exchange\n // provides the list of supported extensions, including policies, in the\n // ExtensionsManifestsResponse response to the /keys endpoint.\n policy?: any;\n\n // Signature over TALER_DepositRequestPS, made by the customer with the\n // coin's private key.\n coin_sig: EddsaSignatureString;\n\n h_age_commitment?: string;\n}\n\nexport type TrackTransaction =\n | ({ type: \"accepted\" } & TrackTransactionAccepted)\n | ({ type: \"wired\" } & TrackTransactionWired);\n\nexport interface BatchDepositSuccess {\n // Optional base URL of the exchange for looking up wire transfers\n // associated with this transaction. If not given,\n // the base URL is the same as the one used for this request.\n // Can be used if the base URL for ``/transactions/`` differs from that\n // for ``/coins/``, i.e. for load balancing. Clients SHOULD\n // respect the ``transaction_base_url`` if provided. Any HTTP server\n // belonging to an exchange MUST generate a 307 or 308 redirection\n // to the correct base URL should a client uses the wrong base\n // URL, or if the base URL has changed since the deposit.\n transaction_base_url?: string;\n\n // Timestamp when the deposit was received by the exchange.\n exchange_timestamp: TalerProtocolTimestamp;\n\n // `Public EdDSA key of the exchange ` that was used to\n // generate the signature.\n // Should match one of the exchange's signing keys from ``/keys``. It is given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n\n // Array of deposit confirmation signatures from the exchange\n // Entries must be in the same order the coins were given\n // in the batch deposit request.\n exchange_sig: EddsaSignatureString;\n}\n\nexport const codecForBatchDepositSuccess = (): Codec =>\n buildCodecForObject()\n .property(\"exchange_pub\", codecForString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_timestamp\", codecForTimestamp)\n .property(\"transaction_base_url\", codecOptional(codecForString()))\n .build(\"BatchDepositSuccess\");\n\nexport interface TrackTransactionWired {\n // Raw wire transfer identifier of the deposit.\n wtid: Base32String;\n\n // When was the wire transfer given to the bank.\n execution_time: TalerProtocolTimestamp;\n\n // The contribution of this coin to the total (without fees)\n coin_contribution: AmountString;\n\n // Binary-only Signature_ with purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE\n // over a TALER_ConfirmWirePS\n // whereby the exchange affirms the successful wire transfer.\n exchange_sig: EddsaSignatureString;\n\n // Public EdDSA key of the exchange that was used to generate the signature.\n // Should match one of the exchange's signing keys from /keys. Again given\n // explicitly as the client might otherwise be confused by clock skew as to\n // which signing key was used.\n exchange_pub: EddsaPublicKeyString;\n}\n\nexport const codecForTackTransactionWired = (): Codec =>\n buildCodecForObject()\n .property(\"wtid\", codecForString())\n .property(\"execution_time\", codecForTimestamp)\n .property(\"coin_contribution\", codecForAmountString())\n .property(\"exchange_sig\", codecForString())\n .property(\"exchange_pub\", codecForString())\n .build(\"TackTransactionWired\");\n\nexport interface TrackTransactionAccepted {\n // Legitimization target that the merchant should\n // use to check for its KYC status using\n // the /kyc-check/$REQUIREMENT_ROW/... endpoint.\n // Optional, not present if the deposit has not\n // yet been aggregated to the point that a KYC\n // need has been evaluated.\n requirement_row?: number;\n\n // True if the KYC check for the merchant has been\n // satisfied. False does not mean that KYC\n // is strictly needed, unless also a\n // legitimization_uuid is provided.\n kyc_ok: boolean;\n\n // Time by which the exchange currently thinks the deposit will be executed.\n // Actual execution may be later if the KYC check is not satisfied by then.\n execution_time: TalerProtocolTimestamp;\n}\n\nexport const codecForTackTransactionAccepted =\n (): Codec =>\n buildCodecForObject()\n .property(\"requirement_row\", codecOptional(codecForNumber()))\n .property(\"kyc_ok\", codecForBoolean())\n .property(\"execution_time\", codecForTimestamp)\n .build(\"TackTransactionAccepted\");\n\nexport const codecForPeerContractTerms = (): Codec =>\n buildCodecForObject()\n .property(\"summary\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"purse_expiration\", codecForTimestamp)\n .build(\"PeerContractTerms\");\n\nexport interface ExchangeBatchDepositRequest {\n // The merchant's account details.\n merchant_payto_uri: string;\n\n // The salt is used to hide the ``payto_uri`` from customers\n // when computing the ``h_wire`` of the merchant.\n wire_salt: WireSalt;\n\n // SHA-512 hash of the contract of the merchant with the customer. Further\n // details are never disclosed to the exchange.\n h_contract_terms: HashCodeString;\n\n // The list of coins that are going to be deposited with this Request.\n coins: BatchDepositRequestCoin[];\n\n // Timestamp when the contract was finalized.\n timestamp: TalerProtocolTimestamp;\n\n // Indicative time by which the exchange undertakes to transfer the funds to\n // the merchant, in case of successful payment. A wire transfer deadline of 'never'\n // is not allowed.\n wire_transfer_deadline: TalerProtocolTimestamp;\n\n // EdDSA `public key of the merchant `, so that the client can identify the\n // merchant for refund requests.\n merchant_pub: EddsaPublicKeyString;\n\n // Date until which the merchant can issue a refund to the customer via the\n // exchange, to be omitted if refunds are not allowed.\n //\n // THIS FIELD WILL BE DEPRECATED, once the refund mechanism becomes a\n // policy via extension.\n refund_deadline?: TalerProtocolTimestamp;\n\n // CAVEAT: THIS IS WORK IN PROGRESS\n // (Optional) policy for the batch-deposit.\n // This might be a refund, auction or escrow policy.\n policy?: any;\n}\n\nexport interface BatchDepositRequestCoin {\n // EdDSA public key of the coin being deposited.\n coin_pub: EddsaPublicKeyString;\n\n // Hash of denomination RSA key with which the coin is signed.\n denom_pub_hash: HashCodeString;\n\n // Exchange's unblinded RSA signature of the coin.\n ub_sig: UnblindedSignature;\n\n // Amount to be deposited, can be a fraction of the\n // coin's total value.\n contribution: AmountString;\n\n // Signature over `TALER_DepositRequestPS`, made by the customer with the\n // `coin's private key `.\n coin_sig: EddsaSignatureString;\n\n h_age_commitment?: string;\n}\n\nexport enum AmlState {\n normal = 0,\n pending = 1,\n frozen = 2,\n}\n\nexport interface AmlRecords {\n // Array of AML records matching the query.\n records: AmlRecord[];\n}\nexport interface AmlRecord {\n // Which payto-address is this record about.\n // Identifies a GNU Taler wallet or an affected bank account.\n h_payto: PaytoHash;\n\n // What is the current AML state.\n current_state: AmlState;\n\n // Monthly transaction threshold before a review will be triggered\n threshold: AmountString;\n\n // RowID of the record.\n rowid: Integer;\n}\n\nexport interface AmlDecisionDetails {\n // Array of AML decisions made for this account. Possibly\n // contains only the most recent decision if \"history\" was\n // not set to 'true'.\n aml_history: AmlDecisionDetail[];\n\n // Array of KYC attributes obtained for this account.\n kyc_attributes: KycDetail[];\n}\nexport interface AmlDecisionDetail {\n // What was the justification given?\n justification: string;\n\n // What is the new AML state.\n new_state: Integer;\n\n // When was this decision made?\n decision_time: Timestamp;\n\n // What is the new AML decision threshold (in monthly transaction volume)?\n new_threshold: AmountString;\n\n // Who made the decision?\n decider_pub: AmlOfficerPublicKeyP;\n}\nexport interface KycDetail {\n // Name of the configuration section that specifies the provider\n // which was used to collect the KYC details\n provider_section: string;\n\n // The collected KYC data. NULL if the attribute data could not\n // be decrypted (internal error of the exchange, likely the\n // attribute key was changed).\n attributes?: Object;\n\n // Time when the KYC data was collected\n collection_time: Timestamp;\n\n // Time when the validity of the KYC data will expire\n expiration_time: Timestamp;\n}\n\nexport interface AmlDecision {\n // Human-readable justification for the decision.\n justification: string;\n\n // At what monthly transaction volume should the\n // decision be automatically reviewed?\n new_threshold: AmountString;\n\n // Which payto-address is the decision about?\n // Identifies a GNU Taler wallet or an affected bank account.\n h_payto: PaytoHash;\n\n // What is the new AML state (e.g. frozen, unfrozen, etc.)\n // Numerical values are defined in AmlDecisionState.\n new_state: Integer;\n\n // Signature by the AML officer over a\n // TALER_MasterAmlOfficerStatusPS.\n // Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.\n officer_sig: EddsaSignatureString;\n\n // When was the decision made?\n decision_time: Timestamp;\n\n // Optional argument to impose new KYC requirements\n // that the customer has to satisfy to unblock transactions.\n kyc_requirements?: string[];\n}\n\nexport interface ExchangeVersionResponse {\n // libtool-style representation of the Exchange protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Name of the protocol.\n name: \"taler-exchange\";\n\n // URN of the implementation (needed to interpret 'revision' in version).\n // @since v18, may become mandatory in the future.\n implementation?: string;\n\n // Currency supported by this exchange, given\n // as a currency code (\"USD\" or \"EUR\").\n currency: string;\n\n // How wallets should render this currency.\n currency_specification: CurrencySpecification;\n\n // Names of supported KYC requirements.\n supported_kyc_requirements: string[];\n}\n\nexport interface WireAccount {\n // payto:// URI identifying the account and wire method\n payto_uri: PaytoString;\n\n // URI to convert amounts from or to the currency used by\n // this wire account of the exchange. Missing if no\n // conversion is applicable.\n conversion_url?: string;\n\n // Restrictions that apply to bank accounts that would send\n // funds to the exchange (crediting this exchange bank account).\n // Optional, empty array for unrestricted.\n credit_restrictions: AccountRestriction[];\n\n // Restrictions that apply to bank accounts that would receive\n // funds from the exchange (debiting this exchange bank account).\n // Optional, empty array for unrestricted.\n debit_restrictions: AccountRestriction[];\n\n // Signature using the exchange's offline key over\n // a TALER_MasterWireDetailsPS\n // with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.\n master_sig: EddsaSignatureString;\n}\n\nexport interface ExchangeKeysResponse {\n // libtool-style representation of the Exchange protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // The exchange's base URL.\n base_url: string;\n\n // The exchange's currency or asset unit.\n currency: string;\n\n /**\n * FIXME: PARTIALLY IMPLEMENTED!!\n */\n\n // How wallets should render this currency.\n // currency_specification: CurrencySpecification;\n\n // // Absolute cost offset for the STEFAN curve used\n // // to (over) approximate fees payable by amount.\n // stefan_abs: AmountString;\n\n // // Factor to multiply the logarithm of the amount\n // // with to (over) approximate fees payable by amount.\n // // Note that the total to be paid is first to be\n // // divided by the smallest denomination to obtain\n // // the value that the logarithm is to be taken of.\n // stefan_log: AmountString;\n\n // // Linear cost factor for the STEFAN curve used\n // // to (over) approximate fees payable by amount.\n // //\n // // Note that this is a scalar, as it is multiplied\n // // with the actual amount.\n // stefan_lin: Float;\n\n // // Type of the asset. \"fiat\", \"crypto\", \"regional\"\n // // or \"stock\". Wallets should adjust their UI/UX\n // // based on this value.\n // asset_type: string;\n\n // // Array of wire accounts operated by the exchange for\n // // incoming wire transfers.\n // accounts: WireAccount[];\n\n // // Object mapping names of wire methods (i.e. \"iban\" or \"x-taler-bank\")\n // // to wire fees.\n // wire_fees: { method: AggregateTransferFee[] };\n\n // // List of exchanges that this exchange is partnering\n // // with to enable wallet-to-wallet transfers.\n // wads: ExchangePartner[];\n\n // // Set to true if this exchange allows the use\n // // of reserves for rewards.\n // // @deprecated in protocol v18.\n // rewards_allowed: false;\n\n // // EdDSA master public key of the exchange, used to sign entries\n // // in denoms and signkeys.\n // master_public_key: EddsaPublicKey;\n\n // // Relative duration until inactive reserves are closed;\n // // not signed (!), can change without notice.\n // reserve_closing_delay: RelativeTime;\n\n // // Threshold amounts beyond which wallet should\n // // trigger the KYC process of the issuing\n // // exchange. Optional option, if not given there is no limit.\n // // Currency must match currency.\n // wallet_balance_limit_without_kyc?: AmountString[];\n\n // // Denominations offered by this exchange\n // denominations: DenomGroup[];\n\n // // Compact EdDSA signature (binary-only) over the\n // // contatentation of all of the master_sigs (in reverse\n // // chronological order by group) in the arrays under\n // // \"denominations\". Signature of TALER_ExchangeKeySetPS\n // exchange_sig: EddsaSignature;\n\n // // Public EdDSA key of the exchange that was used to generate the signature.\n // // Should match one of the exchange's signing keys from signkeys. It is given\n // // explicitly as the client might otherwise be confused by clock skew as to\n // // which signing key was used for the exchange_sig.\n // exchange_pub: EddsaPublicKey;\n\n // // Denominations for which the exchange currently offers/requests recoup.\n // recoup: Recoup[];\n\n // // Array of globally applicable fees by time range.\n // global_fees: GlobalFees[];\n\n // // The date when the denomination keys were last updated.\n // list_issue_date: Timestamp;\n\n // // Auditors of the exchange.\n // auditors: AuditorKeys[];\n\n // // The exchange's signing keys.\n // signkeys: SignKey[];\n\n // // Optional field with a dictionary of (name, object) pairs defining the\n // // supported and enabled extensions, such as age_restriction.\n // extensions?: { name: ExtensionManifest };\n\n // // Signature by the exchange master key of the SHA-256 hash of the\n // // normalized JSON-object of field extensions, if it was set.\n // // The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS.\n // extensions_sig?: EddsaSignature;\n}\n\ninterface ExtensionManifest {\n // The criticality of the extension MUST be provided. It has the same\n // semantics as \"critical\" has for extensions in X.509:\n // - if \"true\", the client must \"understand\" the extension before\n // proceeding,\n // - if \"false\", clients can safely skip extensions they do not\n // understand.\n // (see https://datatracker.ietf.org/doc/html/rfc5280#section-4.2)\n critical: boolean;\n\n // The version information MUST be provided in Taler's protocol version\n // ranges notation, see\n // https://docs.taler.net/core/api-common.html#protocol-version-ranges\n version: LibtoolVersionString;\n\n // Optional configuration object, defined by the feature itself\n config?: object;\n}\n\ninterface SignKey {\n // The actual exchange's EdDSA signing public key.\n key: EddsaPublicKeyString;\n\n // Initial validity date for the signing key.\n stamp_start: Timestamp;\n\n // Date when the exchange will stop using the signing key, allowed to overlap\n // slightly with the next signing key's validity to allow for clock skew.\n stamp_expire: Timestamp;\n\n // Date when all signatures made by the signing key expire and should\n // henceforth no longer be considered valid in legal disputes.\n stamp_end: Timestamp;\n\n // Signature over key and stamp_expire by the exchange master key.\n // Signature of TALER_ExchangeSigningKeyValidityPS.\n // Must have purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.\n master_sig: EddsaSignatureString;\n}\n\ninterface AuditorKeys {\n // The auditor's EdDSA signing public key.\n auditor_pub: EddsaPublicKeyString;\n\n // The auditor's URL.\n auditor_url: string;\n\n // The auditor's name (for humans).\n auditor_name: string;\n\n // An array of denomination keys the auditor affirms with its signature.\n // Note that the message only includes the hash of the public key, while the\n // signature is actually over the expanded information including expiration\n // times and fees. The exact format is described below.\n denomination_keys: AuditorDenominationKey[];\n}\n\ninterface AuditorDenominationKey {\n // Hash of the public RSA key used to sign coins of the respective\n // denomination. Note that the auditor's signature covers more than just\n // the hash, but this other information is already provided in denoms and\n // thus not repeated here.\n denom_pub_h: HashCodeString;\n\n // Signature of TALER_ExchangeKeyValidityPS.\n auditor_sig: EddsaSignatureString;\n}\n\nexport interface GlobalFees {\n // What date (inclusive) does these fees go into effect?\n start_date: Timestamp;\n\n // What date (exclusive) does this fees stop going into effect?\n end_date: Timestamp;\n\n // Account history fee, charged when a user wants to\n // obtain a reserve/account history.\n history_fee: AmountString;\n\n // Annual fee charged for having an open account at the\n // exchange. Charged to the account. If the account\n // balance is insufficient to cover this fee, the account\n // is automatically deleted/closed. (Note that the exchange\n // will keep the account history around for longer for\n // regulatory reasons.)\n account_fee: AmountString;\n\n // Purse fee, charged only if a purse is abandoned\n // and was not covered by the account limit.\n purse_fee: AmountString;\n\n // How long will the exchange preserve the account history?\n // After an account was deleted/closed, the exchange will\n // retain the account history for legal reasons until this time.\n history_expiration: RelativeTime;\n\n // Non-negative number of concurrent purses that any\n // account holder is allowed to create without having\n // to pay the purse_fee.\n purse_account_limit: Integer;\n\n // How long does an exchange keep a purse around after a purse\n // has expired (or been successfully merged)? A 'GET' request\n // for a purse will succeed until the purse expiration time\n // plus this value.\n purse_timeout: RelativeTime;\n\n // Signature of TALER_GlobalFeesPS.\n master_sig: EddsaSignatureString;\n}\n\nexport interface AggregateTransferFee {\n // Per transfer wire transfer fee.\n wire_fee: AmountString;\n\n // Per transfer closing fee.\n closing_fee: AmountString;\n\n // What date (inclusive) does this fee go into effect?\n // The different fees must cover the full time period in which\n // any of the denomination keys are valid without overlap.\n start_date: Timestamp;\n\n // What date (exclusive) does this fee stop going into effect?\n // The different fees must cover the full time period in which\n // any of the denomination keys are valid without overlap.\n end_date: Timestamp;\n\n // Signature of TALER_MasterWireFeePS with\n // purpose TALER_SIGNATURE_MASTER_WIRE_FEES.\n sig: EddsaSignatureString;\n}\n\ninterface ExchangePartner {\n // Base URL of the partner exchange.\n partner_base_url: string;\n\n // Public master key of the partner exchange.\n partner_master_pub: EddsaPublicKeyString;\n\n // Per exchange-to-exchange transfer (wad) fee.\n wad_fee: AmountString;\n\n // Exchange-to-exchange wad (wire) transfer frequency.\n wad_frequency: RelativeTime;\n\n // When did this partnership begin (under these conditions)?\n start_date: Timestamp;\n\n // How long is this partnership expected to last?\n end_date: Timestamp;\n\n // Signature using the exchange's offline key over\n // TALER_WadPartnerSignaturePS\n // with purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS.\n master_sig: EddsaSignatureString;\n}\n\n// Binary representation of the age groups.\n// The bits set in the mask mark the edges at the beginning of a next age\n// group. F.e. for the age groups\n// 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-21, 21-*\n// the following bits are set:\n//\n// 31 24 16 8 0\n// | | | | |\n// oooooooo oo1oo1o1 o1o1o1o1 ooooooo1\n//\n// A value of 0 means that the exchange does not support the extension for\n// age-restriction.\ntype AgeMask = Integer;\n\ntype DenominationKey = RsaDenominationKey | CSDenominationKey;\n\ninterface RsaDenominationKey {\n cipher: \"RSA\";\n\n // 32-bit age mask.\n age_mask: Integer;\n\n // RSA public key\n rsa_public_key: RsaPublicKey;\n}\n\ninterface CSDenominationKey {\n cipher: \"CS\";\n\n // 32-bit age mask.\n age_mask: Integer;\n\n // Public key of the denomination.\n cs_public_key: Cs25519Point;\n}\n\nexport const codecForExchangeConfig = (): Codec =>\n buildCodecForObject()\n .property(\"version\", codecForString())\n .property(\"name\", codecForConstString(\"taler-exchange\"))\n .property(\"implementation\", codecOptional(codecForURN()))\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\"supported_kyc_requirements\", codecForList(codecForString()))\n .build(\"TalerExchangeApi.ExchangeVersionResponse\");\n\nexport const codecForExchangeKeys = (): Codec =>\n buildCodecForObject()\n .property(\"version\", codecForString())\n .property(\"base_url\", codecForString())\n .property(\"currency\", codecForString())\n .build(\"TalerExchangeApi.ExchangeKeysResponse\");\nexport const codecForAmlRecords = (): Codec =>\n buildCodecForObject()\n .property(\"records\", codecForList(codecForAmlRecord()))\n .build(\"TalerExchangeApi.AmlRecords\");\n\nexport const codecForAmlRecord = (): Codec =>\n buildCodecForObject()\n .property(\"current_state\", codecForNumber())\n .property(\"h_payto\", codecForString())\n .property(\"rowid\", codecForNumber())\n .property(\"threshold\", codecForAmountString())\n .build(\"TalerExchangeApi.AmlRecord\");\n\nexport const codecForAmlDecisionDetails = (): Codec =>\n buildCodecForObject()\n .property(\"aml_history\", codecForList(codecForAmlDecisionDetail()))\n .property(\"kyc_attributes\", codecForList(codecForKycDetail()))\n .build(\"TalerExchangeApi.AmlDecisionDetails\");\n\nexport const codecForAmlDecisionDetail = (): Codec =>\n buildCodecForObject()\n .property(\"justification\", codecForString())\n .property(\"new_state\", codecForNumber())\n .property(\"decision_time\", codecForTimestamp)\n .property(\"new_threshold\", codecForAmountString())\n .property(\"decider_pub\", codecForString())\n .build(\"TalerExchangeApi.AmlDecisionDetail\");\n\nexport const codecForKycDetail = (): Codec =>\n buildCodecForObject()\n .property(\"provider_section\", codecForString())\n .property(\"attributes\", codecOptional(codecForAny()))\n .property(\"collection_time\", codecForTimestamp)\n .property(\"expiration_time\", codecForTimestamp)\n .build(\"TalerExchangeApi.KycDetail\");\n\nexport const codecForAmlDecision = (): Codec =>\n buildCodecForObject()\n .property(\"justification\", codecForString())\n .property(\"new_threshold\", codecForAmountString())\n .property(\"h_payto\", codecForString())\n .property(\"new_state\", codecForNumber())\n .property(\"officer_sig\", codecForString())\n .property(\"decision_time\", codecForTimestamp)\n .property(\"kyc_requirements\", codecOptional(codecForList(codecForString())))\n .build(\"TalerExchangeApi.AmlDecision\");\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { canonicalJson } from \"./helpers.js\";\nimport { Logger } from \"./logging.js\";\nimport {\n decodeCrock,\n encodeCrock,\n getRandomBytes,\n hash,\n kdf,\n stringToBytes,\n} from \"./taler-crypto.js\";\n\nconst logger = new Logger(\"contractTerms.ts\");\n\nexport namespace ContractTermsUtil {\n export function forgetAllImpl(\n anyJson: any,\n path: string[],\n pred: PathPredicate,\n ): any {\n const dup = JSON.parse(JSON.stringify(anyJson));\n if (Array.isArray(dup)) {\n for (let i = 0; i < dup.length; i++) {\n dup[i] = forgetAllImpl(dup[i], [...path, `${i}`], pred);\n }\n } else if (typeof dup === \"object\" && dup != null) {\n if (typeof dup.$forgettable === \"object\") {\n for (const x of Object.keys(dup.$forgettable)) {\n if (!pred([...path, x])) {\n continue;\n }\n if (!dup.$forgotten) {\n dup.$forgotten = {};\n }\n if (!dup.$forgotten[x]) {\n const membValCanon = stringToBytes(\n canonicalJson(scrub(dup[x])) + \"\\0\",\n );\n const membSalt = stringToBytes(dup.$forgettable[x] + \"\\0\");\n const h = kdf(64, membValCanon, membSalt, new Uint8Array([]));\n dup.$forgotten[x] = encodeCrock(h);\n }\n delete dup[x];\n delete dup.$forgettable[x];\n }\n if (Object.keys(dup.$forgettable).length === 0) {\n delete dup.$forgettable;\n }\n }\n for (const x of Object.keys(dup)) {\n if (x.startsWith(\"$\")) {\n continue;\n }\n dup[x] = forgetAllImpl(dup[x], [...path, x], pred);\n }\n }\n return dup;\n }\n\n export type PathPredicate = (path: string[]) => boolean;\n\n /**\n * Scrub all forgettable members from an object.\n */\n export function scrub(anyJson: any): any {\n return forgetAllImpl(anyJson, [], () => true);\n }\n\n /**\n * Recursively forget all forgettable members of an object,\n * where the path matches a predicate.\n */\n export function forgetAll(anyJson: any, pred: PathPredicate): any {\n return forgetAllImpl(anyJson, [], pred);\n }\n\n /**\n * Generate a salt for all members marked as forgettable,\n * but which don't have an actual salt yet.\n */\n export function saltForgettable(anyJson: any): any {\n const dup = JSON.parse(JSON.stringify(anyJson));\n if (Array.isArray(dup)) {\n for (let i = 0; i < dup.length; i++) {\n dup[i] = saltForgettable(dup[i]);\n }\n } else if (typeof dup === \"object\" && dup !== null) {\n if (typeof dup.$forgettable === \"object\") {\n for (const k of Object.keys(dup.$forgettable)) {\n if (dup.$forgettable[k] === true) {\n dup.$forgettable[k] = encodeCrock(getRandomBytes(32));\n }\n }\n }\n for (const x of Object.keys(dup)) {\n if (x.startsWith(\"$\")) {\n continue;\n }\n dup[x] = saltForgettable(dup[x]);\n }\n }\n return dup;\n }\n\n const nameRegex = /^[0-9A-Za-z_]+$/;\n\n /**\n * Check that the given JSON object is well-formed with regards\n * to forgettable fields and other restrictions for forgettable JSON.\n */\n export function validateForgettable(anyJson: any): boolean {\n if (typeof anyJson === \"string\") {\n return true;\n }\n if (typeof anyJson === \"number\") {\n return (\n Number.isInteger(anyJson) &&\n anyJson >= Number.MIN_SAFE_INTEGER &&\n anyJson <= Number.MAX_SAFE_INTEGER\n );\n }\n if (typeof anyJson === \"boolean\") {\n return true;\n }\n if (anyJson === null) {\n return true;\n }\n if (Array.isArray(anyJson)) {\n return anyJson.every((x) => validateForgettable(x));\n }\n if (typeof anyJson === \"object\") {\n for (const k of Object.keys(anyJson)) {\n if (k.match(nameRegex)) {\n if (validateForgettable(anyJson[k])) {\n continue;\n } else {\n return false;\n }\n }\n if (k === \"$forgettable\") {\n const fga = anyJson.$forgettable;\n if (!fga || typeof fga !== \"object\") {\n return false;\n }\n for (const fk of Object.keys(fga)) {\n if (!fk.match(nameRegex)) {\n return false;\n }\n if (!(fk in anyJson)) {\n return false;\n }\n const fv = anyJson.$forgettable[fk];\n if (typeof fv !== \"string\") {\n return false;\n }\n }\n } else if (k === \"$forgotten\") {\n const fgo = anyJson.$forgotten;\n if (!fgo || typeof fgo !== \"object\") {\n return false;\n }\n for (const fk of Object.keys(fgo)) {\n if (!fk.match(nameRegex)) {\n return false;\n }\n // Check that the value has actually been forgotten.\n if (fk in anyJson) {\n return false;\n }\n const fv = anyJson.$forgotten[fk];\n if (typeof fv !== \"string\") {\n return false;\n }\n try {\n const decFv = decodeCrock(fv);\n if (decFv.length != 64) {\n return false;\n }\n } catch (e) {\n return false;\n }\n // Check that salt has been deleted after forgetting.\n if (anyJson.$forgettable?.[k] !== undefined) {\n return false;\n }\n }\n } else {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Check that no forgettable information has been forgotten.\n *\n * Must only be called on an object already validated with validateForgettable.\n */\n export function validateNothingForgotten(contractTerms: any): boolean {\n throw Error(\"not implemented yet\");\n }\n\n /**\n * Hash a contract terms object. Forgettable fields\n * are scrubbed and JSON canonicalization is applied\n * before hashing.\n */\n export function hashContractTerms(contractTerms: unknown): string {\n const cleaned = scrub(contractTerms);\n const canon = canonicalJson(cleaned) + \"\\0\";\n const bytes = stringToBytes(canon);\n return encodeCrock(hash(bytes));\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2020 Taler Systems SA\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Classes and helpers for error handling specific to wallet operations.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport {\n AbsoluteTime,\n CancellationToken,\n PaymentInsufficientBalanceDetails,\n TalerErrorCode,\n TalerErrorDetail,\n TransactionType,\n} from \"@gnu-taler/taler-util\";\n\ntype empty = Record;\n\nexport interface DetailsMap {\n [TalerErrorCode.WALLET_PENDING_OPERATION_FAILED]: {\n innerError: TalerErrorDetail;\n transactionId?: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT]: {\n exchangeBaseUrl: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE]: {\n exchangeProtocolVersion: string;\n walletProtocolVersion: string;\n };\n [TalerErrorCode.WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK]: empty;\n [TalerErrorCode.WALLET_REWARD_COIN_SIGNATURE_INVALID]: empty;\n [TalerErrorCode.WALLET_ORDER_ALREADY_CLAIMED]: {\n orderId: string;\n claimUrl: string;\n };\n [TalerErrorCode.WALLET_ORDER_ALREADY_PAID]: {\n orderId: string;\n fulfillmentUrl: string;\n };\n [TalerErrorCode.WALLET_CONTRACT_TERMS_MALFORMED]: empty;\n [TalerErrorCode.WALLET_CONTRACT_TERMS_SIGNATURE_INVALID]: {\n merchantPub: string;\n orderId: string;\n };\n [TalerErrorCode.WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH]: {\n baseUrlForDownload: string;\n baseUrlFromContractTerms: string;\n };\n [TalerErrorCode.WALLET_INVALID_TALER_PAY_URI]: {\n talerPayUri: string;\n };\n [TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR]: {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n errorResponse?: any;\n };\n [TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION]: {\n stack?: string;\n };\n [TalerErrorCode.WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE]: {\n bankProtocolVersion: string;\n walletProtocolVersion: string;\n };\n [TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN]: {\n operation: string;\n };\n [TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED]: {\n requestUrl: string;\n requestMethod: string;\n throttleStats: Record;\n };\n [TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT]: {\n requestUrl: string;\n requestMethod: string;\n timeoutMs: number;\n };\n [TalerErrorCode.GENERIC_TIMEOUT]: {\n requestUrl: string;\n requestMethod: string;\n timeoutMs: number;\n };\n [TalerErrorCode.WALLET_NETWORK_ERROR]: {\n requestUrl: string;\n requestMethod: string;\n };\n [TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE]: {\n requestUrl: string;\n requestMethod: string;\n httpStatusCode: number;\n /**\n * Original response which is malformed\n */\n response?: string;\n validationError?: string;\n /**\n * Content type of the response, usually only specified if not the\n * expected content type.\n */\n contentType?: string;\n };\n [TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR]: {\n operation: string;\n error: string;\n detail: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_COIN_SIGNATURE_INVALID]: empty;\n [TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE]: {\n numErrors: number;\n errorsPerCoin: Record;\n };\n [TalerErrorCode.WALLET_CORE_NOT_AVAILABLE]: {\n lastError?: TalerErrorDetail;\n };\n [TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR]: {\n httpStatusCode: number;\n };\n [TalerErrorCode.WALLET_PAY_MERCHANT_SERVER_ERROR]: {\n requestError: TalerErrorDetail;\n };\n [TalerErrorCode.WALLET_CRYPTO_WORKER_ERROR]: {\n innerError: TalerErrorDetail;\n };\n [TalerErrorCode.WALLET_CRYPTO_WORKER_BAD_REQUEST]: {\n detail: string;\n };\n [TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED]: {\n kycUrl: string;\n };\n [TalerErrorCode.WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE]: {\n insufficientBalanceDetails: PaymentInsufficientBalanceDetails;\n };\n [TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE]: {\n insufficientBalanceDetails: PaymentInsufficientBalanceDetails;\n };\n [TalerErrorCode.WALLET_REFRESH_GROUP_INCOMPLETE]: {\n numErrors: number;\n /**\n * Errors, can be truncated.\n */\n errors: TalerErrorDetail[];\n };\n [TalerErrorCode.WALLET_EXCHANGE_BASE_URL_MISMATCH]: {\n urlWallet: string;\n urlExchange: string;\n };\n [TalerErrorCode.WALLET_EXCHANGE_UNAVAILABLE]: {\n exchangeBaseUrl: string;\n innerError: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_DB_UNAVAILABLE]: {\n innerError: TalerErrorDetail | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_TOS_NOT_ACCEPTED]: {\n exchangeBaseUrl: string;\n tosStatus: string;\n currentEtag: string | undefined;\n };\n [TalerErrorCode.WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT]: {\n detail?: string;\n };\n}\n\ntype ErrBody = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;\n\nexport function makeErrorDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n): TalerErrorDetail {\n if (!hint && !(detail as any).hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n const when = AbsoluteTime.now();\n return { code, when, hint, ...detail };\n}\n\nexport function makePendingOperationFailedError(\n innerError: TalerErrorDetail,\n tag: TransactionType,\n uid: string,\n): TalerError {\n return TalerError.fromDetail(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED, {\n innerError,\n transactionId: `${tag}:${uid}`,\n });\n}\n\nexport function summarizeTalerErrorDetail(ed: TalerErrorDetail): string {\n const errName = TalerErrorCode[ed.code] ?? \"\";\n return `Error (${ed.code}/${errName})`;\n}\n\nexport function getDefaultTalerErrorHint(code: number): string {\n const errName = TalerErrorCode[code];\n if (errName) {\n return `Error (${errName})`;\n } else {\n return `Error ()`;\n }\n}\n\nexport class TalerProtocolViolationError extends Error {\n constructor(hint?: string) {\n let msg: string;\n if (hint) {\n msg = `Taler protocol violation error (${hint})`;\n } else {\n msg = `Taler protocol violation error`;\n }\n super(msg);\n Object.setPrototypeOf(this, TalerProtocolViolationError.prototype);\n }\n}\n\n// compute a subset of TalerError, just for http request\ntype HttpErrors =\n | TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT\n | TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED\n | TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE\n | TalerErrorCode.WALLET_NETWORK_ERROR\n | TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR;\n\ntype TalerHttpErrorsDetails = {\n [code in HttpErrors]: TalerError;\n};\n\nexport type TalerHttpError =\n TalerHttpErrorsDetails[keyof TalerHttpErrorsDetails];\n\n/**\n * Construct typed error details.\n * Fills in the hint with a default based on the error code name.\n */\nexport function makeTalerErrorDetail(\n code: C,\n errBody: ErrBody,\n hint?: string,\n): TalerErrorDetail {\n if (!hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n return { code, hint, ...errBody };\n}\n\nexport class TalerError extends Error {\n errorDetail: TalerErrorDetail & T;\n cause: Error | undefined;\n private constructor(d: TalerErrorDetail & T, cause?: Error) {\n super(d.hint ?? `Error (code ${d.code})`);\n this.errorDetail = d;\n this.cause = cause;\n Object.setPrototypeOf(this, TalerError.prototype);\n }\n\n static fromDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n cause?: Error,\n ): TalerError {\n if (!hint) {\n hint = getDefaultTalerErrorHint(code);\n }\n const when = AbsoluteTime.now();\n return new TalerError({ code, when, hint, ...detail }, cause);\n }\n\n static fromUncheckedDetail(d: TalerErrorDetail, c?: Error): TalerError {\n return new TalerError({ ...d }, c);\n }\n\n static fromException(e: any): TalerError {\n const errDetail = getErrorDetailFromException(e);\n return new TalerError(errDetail, e);\n }\n\n hasErrorCode(\n code: C,\n ): this is TalerError {\n return this.errorDetail.code === code;\n }\n\n toString(): string {\n return `TalerError: ${JSON.stringify(this.errorDetail)}`;\n }\n}\n\nexport function safeStringifyException(e: any): string {\n return JSON.stringify(getErrorDetailFromException(e), undefined, 2);\n}\n\n/**\n * Convert an exception (or anything that was thrown) into\n * a TalerErrorDetail object.\n */\nexport function getErrorDetailFromException(e: any): TalerErrorDetail {\n if (e instanceof TalerError) {\n return e.errorDetail;\n }\n if (e instanceof CancellationToken.CancellationError) {\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_CORE_REQUEST_CANCELLED,\n {},\n );\n return err;\n }\n if (e instanceof Error) {\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,\n {\n stack: e.stack,\n },\n `unexpected exception (message: ${e.message})`,\n );\n return err;\n }\n // Something was thrown that is not even an exception!\n // Try to stringify it.\n let excString: string;\n try {\n excString = e.toString();\n } catch (e) {\n // Something went horribly wrong.\n excString = \"can't stringify exception\";\n }\n const err = makeErrorDetail(\n TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,\n {},\n `unexpected exception (not an exception, ${excString})`,\n );\n return err;\n}\n\nexport function assertUnreachable(x: never): never {\n throw new Error(\"Didn't expect to get here\");\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Functional programming utilities.\n */\nexport namespace fnutil {\n export function all(arr: T[], f: (x: T) => boolean): boolean {\n for (const x of arr) {\n if (!f(x)) {\n return false;\n }\n }\n return true;\n }\n\n export function any(arr: T[], f: (x: T) => boolean): boolean {\n for (const x of arr) {\n if (f(x)) {\n return true;\n }\n }\n return false;\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport { base64FromArrayBuffer } from \"../base64.js\";\nimport { encodeCrock, getRandomBytes, stringToBytes } from \"../taler-crypto.js\";\nimport {\n AccessToken,\n LongPollParams,\n PaginationParams,\n} from \"../types-taler-common.js\";\n\n/**\n * Helper function to generate the \"Authorization\" HTTP header.\n */\nexport function makeBasicAuthHeader(\n username: string,\n password: string,\n): string {\n const auth = `${username}:${password}`;\n const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));\n return `Basic ${authEncoded}`;\n}\n\n/**\n * rfc8959\n * @param token\n * @returns\n */\nexport function makeBearerTokenAuthHeader(token: AccessToken): string {\n return `Bearer ${token}`;\n}\n\n/**\n * https://bugs.gnunet.org/view.php?id=7949\n */\nexport function addPaginationParams(url: URL, pagination?: PaginationParams) {\n if (!pagination) return;\n if (pagination.offset) {\n url.searchParams.set(\"start\", pagination.offset);\n }\n const order = !pagination || pagination.order === \"asc\" ? 1 : -1;\n const limit =\n !pagination || !pagination.limit || pagination.limit === 0\n ? 5\n : Math.abs(pagination.limit);\n //always send delta\n url.searchParams.set(\"delta\", String(order * limit));\n}\n\nexport function addMerchantPaginationParams(\n url: URL,\n pagination?: PaginationParams,\n) {\n if (!pagination) return;\n if (pagination.offset) {\n url.searchParams.set(\"offset\", pagination.offset);\n }\n const order = !pagination || pagination.order === \"asc\" ? 1 : -1;\n const limit =\n !pagination || !pagination.limit || pagination.limit === 0\n ? 5\n : Math.abs(pagination.limit);\n //always send delta\n url.searchParams.set(\"limit\", String(order * limit));\n}\n\nexport function addLongPollingParam(url: URL, param?: LongPollParams) {\n if (!param) return;\n if (param.timeoutMs) {\n url.searchParams.set(\"long_poll_ms\", String(param.timeoutMs));\n }\n}\n\nexport interface CacheEvictor {\n notifySuccess: (op: T) => Promise;\n}\n\nexport const nullEvictor: CacheEvictor = {\n notifySuccess: () => Promise.resolve(),\n};\n\nexport class IdempotencyRetry {\n public readonly uid: string;\n public readonly timesLeft: number;\n public readonly maxTries: number;\n\n private constructor(timesLeft: number, maxTimesLeft: number) {\n this.timesLeft = timesLeft;\n this.maxTries = maxTimesLeft;\n this.uid = encodeCrock(getRandomBytes(32));\n }\n\n static tryFiveTimes() {\n return new IdempotencyRetry(5, 5);\n }\n\n next(): IdempotencyRetry | undefined {\n const left = this.timesLeft - 1;\n if (left <= 0) {\n return undefined;\n }\n return new IdempotencyRetry(left, this.maxTries);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { generateFakeSegwitAddress } from \"./bitcoin.js\";\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n codecForStringURL,\n renderContext,\n} from \"./codec.js\";\nimport {\n AccessToken,\n bytesToString,\n codecForAccessToken,\n codecOptional,\n hashTruncate32,\n stringToBytes,\n} from \"./index.js\";\nimport { URLSearchParams } from \"./url.js\";\n\nexport type PaytoUri =\n | PaytoUriUnknown\n | PaytoUriIBAN\n | PaytoUriTalerBank\n | PaytoUriBitcoin;\n\n// declare const __payto_str: unique symbol;\n// export type PaytoString = string & { [__payto_str]: true };\nexport type PaytoString = string;\n\nexport function codecForPaytoString(): Codec {\n return {\n decode(x: any, c?: Context): PaytoString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (!x.startsWith(paytoPfx)) {\n throw new DecodingError(\n `expected start with payto at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n return x as PaytoString;\n },\n };\n}\n\nexport interface PaytoUriGeneric {\n targetType: PaytoType | string;\n targetPath: string;\n params: { [name: string]: string };\n}\n\nexport interface PaytoUriUnknown extends PaytoUriGeneric {\n isKnown: false;\n}\n\nexport interface PaytoUriIBAN extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"iban\";\n iban: string;\n bic?: string;\n}\n\nexport interface PaytoUriTalerBank extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"x-taler-bank\";\n host: string;\n account: string;\n}\n\nexport interface PaytoUriBitcoin extends PaytoUriGeneric {\n isKnown: true;\n targetType: \"bitcoin\";\n address: string;\n segwitAddrs: Array;\n}\n\nconst paytoPfx = \"payto://\";\n\nexport type PaytoType = \"iban\" | \"bitcoin\" | \"x-taler-bank\";\n\nexport function buildPayto(\n type: \"iban\",\n iban: string,\n bic: string | undefined,\n): PaytoUriIBAN;\nexport function buildPayto(\n type: \"bitcoin\",\n address: string,\n reserve: string | undefined,\n): PaytoUriBitcoin;\nexport function buildPayto(\n type: \"x-taler-bank\",\n host: string,\n account: string,\n): PaytoUriTalerBank;\nexport function buildPayto(\n type: PaytoType,\n first: string,\n second?: string,\n): PaytoUriGeneric {\n switch (type) {\n case \"bitcoin\": {\n const uppercased = first.toUpperCase();\n const result: PaytoUriBitcoin = {\n isKnown: true,\n targetType: \"bitcoin\",\n targetPath: first,\n address: uppercased,\n params: {},\n segwitAddrs: !second ? [] : generateFakeSegwitAddress(second, first),\n };\n return result;\n }\n case \"iban\": {\n const uppercased = first.toUpperCase();\n const result: PaytoUriIBAN = {\n isKnown: true,\n targetType: \"iban\",\n iban: uppercased,\n params: {},\n targetPath: !second ? uppercased : `${second}/${uppercased}`,\n };\n return result;\n }\n case \"x-taler-bank\": {\n if (!second) throw Error(\"missing account for payto://x-taler-bank\");\n const result: PaytoUriTalerBank = {\n isKnown: true,\n targetType: \"x-taler-bank\",\n host: first,\n account: second,\n params: {},\n targetPath: `${first}/${second}`,\n };\n return result;\n }\n default: {\n const unknownType: never = type;\n throw Error(`unknown payto:// type ${unknownType}`);\n }\n }\n}\n\n/**\n * Add query parameters to a payto URI.\n *\n * Existing parameters are preserved.\n */\nexport function addPaytoQueryParams(\n s: string,\n params: { [name: string]: string },\n): string {\n const [acct, search] = s.slice(paytoPfx.length).split(\"?\");\n const searchParams = new URLSearchParams(search || \"\");\n for (const [paramKey, paramValue] of Object.entries(params)) {\n searchParams.set(paramKey, paramValue);\n }\n const paramList = [...searchParams.entries()];\n if (paramList.length === 0) {\n return paytoPfx + acct;\n }\n return paytoPfx + acct + \"?\" + createSearchParams(paramList);\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986\n */\nfunction encodeRFC3986URIComponent(str: string): string {\n return encodeURIComponent(str).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n );\n}\nconst rfc3986 = encodeRFC3986URIComponent;\n\n/**\n *\n * https://www.rfc-editor.org/rfc/rfc3986\n */\nfunction createSearchParams(paramList: [string, string][]): string {\n return paramList\n .map(([key, value]) => `${rfc3986(key)}=${rfc3986(value)}`)\n .join(\"&\");\n}\n\n/**\n * Serialize a PaytoURI into a valid payto:// string\n *\n * @param p\n * @returns\n */\nexport function stringifyPaytoUri(p: PaytoUri): PaytoString {\n const url = new URL(`${paytoPfx}${p.targetType}/${p.targetPath}`);\n const paramList = !p.params ? [] : Object.entries(p.params);\n url.search = createSearchParams(paramList);\n return url.href as PaytoString;\n}\n\nexport function hashPaytoUri(p: PaytoUri): string {\n const paytoUri = stringifyPaytoUri(p);\n return bytesToString(hashTruncate32(stringToBytes(paytoUri + \"\\0\")));\n}\n\n/**\n * Parse a valid payto:// uri into a PaytoUri object\n * RFC 8905\n *\n * @param s\n * @returns\n */\nexport function parsePaytoUri(s: string): PaytoUri | undefined {\n if (!s.startsWith(paytoPfx)) {\n return undefined;\n }\n\n const [acct, search] = s.slice(paytoPfx.length).split(\"?\");\n\n const firstSlashPos = acct.indexOf(\"/\");\n\n if (firstSlashPos === -1) {\n return undefined;\n }\n\n const targetType = acct.slice(0, firstSlashPos);\n const targetPath = acct.slice(firstSlashPos + 1);\n\n const params: { [k: string]: string } = {};\n\n const searchParams = new URLSearchParams(search || \"\");\n\n searchParams.forEach((v, k) => {\n // URLSearchParams already decodes uri components\n params[k] = v; //decodeURIComponent(v);\n });\n\n if (targetType === \"x-taler-bank\") {\n const parts = targetPath.split(\"/\");\n const host = parts[0];\n const account = parts[1];\n return {\n targetPath,\n targetType,\n params,\n isKnown: true,\n host,\n account,\n };\n }\n if (targetType === \"iban\") {\n const parts = targetPath.split(\"/\");\n let iban: string | undefined = undefined;\n let bic: string | undefined = undefined;\n if (parts.length === 1) {\n iban = parts[0].toUpperCase();\n }\n if (parts.length === 2) {\n bic = parts[0];\n iban = parts[1].toUpperCase();\n } else {\n iban = targetPath.toUpperCase();\n }\n return {\n isKnown: true,\n targetPath,\n targetType,\n params,\n iban,\n bic,\n };\n }\n if (targetType === \"bitcoin\") {\n const msg = /\\b([A-Z0-9]{52})\\b/.exec(params[\"message\"]);\n const reserve = !msg ? params[\"subject\"] : msg[0];\n const segwitAddrs = !reserve\n ? []\n : generateFakeSegwitAddress(reserve, targetPath);\n\n const uppercased = targetType.toUpperCase();\n const result: PaytoUriBitcoin = {\n isKnown: true,\n targetPath,\n targetType,\n address: uppercased,\n params,\n segwitAddrs,\n };\n\n return result;\n }\n return {\n targetPath,\n targetType,\n params,\n isKnown: false,\n };\n}\n\nexport function talerPaytoFromExchangeReserve(\n exchangeBaseUrl: string,\n reservePub: string,\n): string {\n const url = new URL(exchangeBaseUrl);\n let proto: string;\n if (url.protocol === \"http:\") {\n proto = \"taler-reserve-http\";\n } else if (url.protocol === \"https:\") {\n proto = \"taler-reserve\";\n } else {\n throw Error(`unsupported exchange base URL protocol (${url.protocol})`);\n }\n\n let path = url.pathname;\n if (!path.endsWith(\"/\")) {\n path = path + \"/\";\n }\n\n return `payto://${proto}/${url.host}${url.pathname}${reservePub}`;\n}\n\n/**\n * The account letter is all the information\n * the merchant backend requires from the\n * bank account to check transfer.\n *\n */\nexport type AccountLetter = {\n accountURI: PaytoString;\n infoURL: string;\n accountToken?: AccessToken;\n};\n\nexport const codecForAccountLetter = (): Codec =>\n buildCodecForObject()\n .property(\"infoURL\", codecForStringURL(true))\n .property(\"accountURI\", codecForPaytoString())\n .property(\"accountToken\", codecOptional(codecForAccessToken()))\n .build(\"AccountLetter\");\n", "/*\n This file is part of GNU Taler\n (C) 2019-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Type and schema definitions for the wallet's transaction list.\n *\n * @author Florian Dold\n * @author Torsten Grote\n */\n\n/**\n * Imports.\n */\nimport {\n Codec,\n buildCodecForObject,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForEither,\n codecForList,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport { TalerPreciseTimestamp, TalerProtocolTimestamp } from \"./time.js\";\nimport {\n AmountString,\n InternationalizedString,\n codecForInternationalizedString,\n} from \"./types-taler-common.js\";\nimport { MerchantInfo, codecForMerchantInfo } from \"./types-taler-merchant.js\";\nimport {\n RefreshReason,\n ScopeInfo,\n TalerErrorDetail,\n TransactionIdStr,\n TransactionStateFilter,\n WithdrawalExchangeAccountDetails,\n codecForScopeInfo,\n} from \"./types-taler-wallet.js\";\n\nexport interface TransactionsRequest {\n /**\n * return only transactions in the given currency\n *\n * it will be removed in next release\n *\n * @deprecated use scopeInfo\n */\n currency?: string;\n\n /**\n * return only transactions in the given scopeInfo\n */\n scopeInfo?: ScopeInfo;\n\n /**\n * if present, results will be limited to transactions related to the given search string\n */\n search?: string;\n\n /**\n * Sort order of the transaction items.\n * By default, items are sorted ascending by their\n * main timestamp.\n *\n * ascending: ascending by timestamp, but pending transactions first\n * descending: ascending by timestamp, but pending transactions first\n * stable-ascending: ascending by timestamp, with pending transactions amidst other transactions\n * (stable in the sense of: pending transactions don't jump around)\n */\n sort?: \"ascending\" | \"descending\" | \"stable-ascending\";\n\n /**\n * If true, include all refreshes in the transactions list.\n */\n includeRefreshes?: boolean;\n\n filterByState?: TransactionStateFilter;\n}\n\nexport interface TransactionState {\n major: TransactionMajorState;\n minor?: TransactionMinorState;\n}\n\nexport enum TransactionMajorState {\n // No state, only used when reporting transitions into the initial state\n None = \"none\",\n Pending = \"pending\",\n Done = \"done\",\n Aborting = \"aborting\",\n Aborted = \"aborted\",\n Dialog = \"dialog\",\n Finalizing = \"finalizing\",\n // Plain suspended is always a suspended pending state.\n Suspended = \"suspended\",\n SuspendedFinalizing = \"suspended-finalizing\",\n SuspendedAborting = \"suspended-aborting\",\n Failed = \"failed\",\n Expired = \"expired\",\n // Only used for the notification, never in the transaction history\n Deleted = \"deleted\",\n}\n\nexport enum TransactionMinorState {\n // Placeholder until D37 is fully implemented\n Unknown = \"unknown\",\n Deposit = \"deposit\",\n KycRequired = \"kyc\",\n AmlRequired = \"aml\",\n MergeKycRequired = \"merge-kyc\",\n Track = \"track\",\n SubmitPayment = \"submit-payment\",\n RebindSession = \"rebind-session\",\n Refresh = \"refresh\",\n Pickup = \"pickup\",\n AutoRefund = \"auto-refund\",\n User = \"user\",\n Bank = \"bank\",\n Exchange = \"exchange\",\n ClaimProposal = \"claim-proposal\",\n CheckRefund = \"check-refund\",\n CreatePurse = \"create-purse\",\n DeletePurse = \"delete-purse\",\n RefreshExpired = \"refresh-expired\",\n Ready = \"ready\",\n Merge = \"merge\",\n Repurchase = \"repurchase\",\n BankRegisterReserve = \"bank-register-reserve\",\n BankConfirmTransfer = \"bank-confirm-transfer\",\n WithdrawCoins = \"withdraw-coins\",\n ExchangeWaitReserve = \"exchange-wait-reserve\",\n AbortingBank = \"aborting-bank\",\n Aborting = \"aborting\",\n Refused = \"refused\",\n Withdraw = \"withdraw\",\n MerchantOrderProposed = \"merchant-order-proposed\",\n Proposed = \"proposed\",\n RefundAvailable = \"refund-available\",\n AcceptRefund = \"accept-refund\",\n PaidByOther = \"paid-by-other\",\n CompletedByOtherWallet = \"completed-by-other-wallet\",\n}\n\nexport enum TransactionAction {\n Delete = \"delete\",\n Suspend = \"suspend\",\n Resume = \"resume\",\n Abort = \"abort\",\n Fail = \"fail\",\n Retry = \"retry\",\n}\n\nexport interface TransactionsResponse {\n // a list of past and pending transactions sorted by pending, timestamp and transactionId.\n // In case two events are both pending and have the same timestamp,\n // they are sorted by the transactionId\n // (lexically ascending and locale-independent comparison).\n transactions: Transaction[];\n}\n\nexport interface TransactionCommon {\n // opaque unique ID for the transaction, used as a starting point for paginating queries\n // and for invoking actions on the transaction (e.g. deleting/hiding it from the history)\n transactionId: TransactionIdStr;\n\n // the type of the transaction; different types might provide additional information\n type: TransactionType;\n\n // main timestamp of the transaction\n timestamp: TalerPreciseTimestamp;\n\n /**\n * Transaction state, as per DD37.\n */\n txState: TransactionState;\n\n /**\n * Possible transitions based on the current state.\n */\n txActions: TransactionAction[];\n\n /**\n * Raw amount of the transaction (exclusive of fees or other extra costs).\n */\n amountRaw: AmountString;\n\n /**\n * Amount added or removed from the wallet's balance (including all fees and other costs).\n */\n amountEffective: AmountString;\n\n error?: TalerErrorDetail;\n\n /**\n * If the transaction minor state is in KycRequired this field is going to\n * have the location where the user need to go to complete KYC information.\n */\n kycUrl?: string;\n}\n\nexport type Transaction =\n | TransactionWithdrawal\n | TransactionPayment\n | TransactionRefund\n | TransactionRefresh\n | TransactionDeposit\n | TransactionPeerPullCredit\n | TransactionPeerPullDebit\n | TransactionPeerPushCredit\n | TransactionPeerPushDebit\n | TransactionInternalWithdrawal\n | TransactionRecoup\n | TransactionDenomLoss;\n\nexport enum TransactionType {\n Withdrawal = \"withdrawal\",\n InternalWithdrawal = \"internal-withdrawal\",\n Payment = \"payment\",\n Refund = \"refund\",\n Refresh = \"refresh\",\n Deposit = \"deposit\",\n PeerPushDebit = \"peer-push-debit\",\n PeerPushCredit = \"peer-push-credit\",\n PeerPullDebit = \"peer-pull-debit\",\n PeerPullCredit = \"peer-pull-credit\",\n Recoup = \"recoup\",\n DenomLoss = \"denom-loss\",\n}\n\nexport enum WithdrawalType {\n TalerBankIntegrationApi = \"taler-bank-integration-api\",\n ManualTransfer = \"manual-transfer\",\n}\n\nexport type WithdrawalDetails =\n | WithdrawalDetailsForManualTransfer\n | WithdrawalDetailsForTalerBankIntegrationApi;\n\ninterface WithdrawalDetailsForManualTransfer {\n type: WithdrawalType.ManualTransfer;\n\n /**\n * Payto URIs that the exchange supports.\n *\n * Already contains the amount and message.\n *\n * @deprecated in favor of exchangeCreditAccounts\n */\n exchangePaytoUris: string[];\n\n exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[];\n\n // Public key of the reserve\n reservePub: string;\n\n /**\n * Is the reserve ready for withdrawal?\n */\n reserveIsReady: boolean;\n}\n\ninterface WithdrawalDetailsForTalerBankIntegrationApi {\n type: WithdrawalType.TalerBankIntegrationApi;\n\n /**\n * Set to true if the bank has confirmed the withdrawal, false if not.\n * An unconfirmed withdrawal usually requires user-input and should be highlighted in the UI.\n * See also bankConfirmationUrl below.\n */\n confirmed: boolean;\n\n /**\n * If the withdrawal is unconfirmed, this can include a URL for user\n * initiated confirmation.\n */\n bankConfirmationUrl?: string;\n\n // Public key of the reserve\n reservePub: string;\n\n /**\n * Is the reserve ready for withdrawal?\n */\n reserveIsReady: boolean;\n\n /**\n * Is the bank transfer for the withdrawal externally confirmed?\n */\n externalConfirmation?: boolean;\n\n exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[];\n}\n\nexport enum DenomLossEventType {\n DenomExpired = \"denom-expired\",\n DenomVanished = \"denom-vanished\",\n DenomUnoffered = \"denom-unoffered\",\n}\n\n/**\n * A transaction to indicate financial loss due to denominations\n * that became unusable for deposits.\n */\nexport interface TransactionDenomLoss extends TransactionCommon {\n type: TransactionType.DenomLoss;\n lossEventType: DenomLossEventType;\n exchangeBaseUrl: string;\n}\n\n/**\n * A withdrawal transaction (either bank-integrated or manual).\n */\nexport interface TransactionWithdrawal extends TransactionCommon {\n type: TransactionType.Withdrawal;\n\n /**\n * Exchange of the withdrawal.\n */\n exchangeBaseUrl: string | undefined;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n withdrawalDetails: WithdrawalDetails;\n}\n\n/**\n * Internal withdrawal operation, only reported on request.\n *\n * Some transactions (peer-*-credit) internally do a withdrawal,\n * but only the peer-*-credit transaction is reported.\n *\n * The internal withdrawal transaction allows to access the details of\n * the underlying withdrawal for testing/debugging.\n *\n * It is usually not reported, so that amounts of transactions properly\n * add up, since the amountEffecive of the withdrawal is already reported\n * in the peer-*-credit transaction.\n */\nexport interface TransactionInternalWithdrawal extends TransactionCommon {\n type: TransactionType.InternalWithdrawal;\n\n /**\n * Exchange of the withdrawal.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n withdrawalDetails: WithdrawalDetails;\n}\n\nexport interface PeerInfoShort {\n expiration: TalerProtocolTimestamp | undefined;\n summary: string | undefined;\n}\n\n/**\n * Credit because we were paid for a P2P invoice we created.\n */\nexport interface TransactionPeerPullCredit extends TransactionCommon {\n type: TransactionType.PeerPullCredit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n /**\n * URI to send to the other party.\n *\n * Only available in the right state.\n */\n talerUri: string | undefined;\n}\n\n/**\n * Debit because we paid someone's invoice.\n */\nexport interface TransactionPeerPullDebit extends TransactionCommon {\n type: TransactionType.PeerPullDebit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n amountRaw: AmountString;\n\n amountEffective: AmountString;\n}\n\n/**\n * We sent money via a P2P payment.\n */\nexport interface TransactionPeerPushDebit extends TransactionCommon {\n type: TransactionType.PeerPushDebit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n\n /**\n * URI to accept the payment.\n *\n * Only present if the transaction is in a state where the other party can\n * accept the payment.\n */\n talerUri?: string;\n}\n\n/**\n * We received money via a P2P payment.\n */\nexport interface TransactionPeerPushCredit extends TransactionCommon {\n type: TransactionType.PeerPushCredit;\n\n info: PeerInfoShort;\n /**\n * Exchange used.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount that got subtracted from the reserve balance.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that actually was (or will be) added to the wallet's balance.\n */\n amountEffective: AmountString;\n}\n\n/**\n * The exchange revoked a key and the wallet recoups funds.\n */\nexport interface TransactionRecoup extends TransactionCommon {\n type: TransactionType.Recoup;\n}\n\nexport enum PaymentStatus {\n /**\n * Explicitly aborted after timeout / failure\n */\n Aborted = \"aborted\",\n\n /**\n * Payment failed, wallet will auto-retry.\n * User should be given the option to retry now / abort.\n */\n Failed = \"failed\",\n\n /**\n * Paid successfully\n */\n Paid = \"paid\",\n\n /**\n * User accepted, payment is processing.\n */\n Accepted = \"accepted\",\n}\n\nexport interface TransactionPayment extends TransactionCommon {\n type: TransactionType.Payment;\n\n /**\n * Additional information about the payment.\n */\n info: OrderShortInfo;\n\n /**\n * Wallet-internal end-to-end identifier for the payment.\n */\n proposalId: string;\n\n /**\n * Amount that must be paid for the contract\n */\n amountRaw: AmountString;\n\n /**\n * Amount that was paid, including deposit, wire and refresh fees.\n */\n amountEffective: AmountString;\n\n /**\n * Amount that has been refunded by the merchant\n */\n totalRefundRaw: AmountString;\n\n /**\n * Amount will be added to the wallet's balance after fees and refreshing\n */\n totalRefundEffective: AmountString;\n\n /**\n * Amount pending to be picked up\n */\n refundPending: AmountString | undefined;\n\n /**\n * Reference to applied refunds\n */\n refunds: RefundInfoShort[];\n\n /**\n * Is the wallet currently checking for a refund?\n */\n refundQueryActive: boolean;\n\n /**\n * Does this purchase has an pos validation\n */\n posConfirmation: string | undefined;\n}\n\nexport interface OrderShortInfo {\n /**\n * Order ID, uniquely identifies the order within a merchant instance\n */\n orderId: string;\n\n /**\n * Hash of the contract terms.\n */\n contractTermsHash: string;\n\n /**\n * More information about the merchant\n */\n merchant: MerchantInfo;\n\n /**\n * Summary of the order, given by the merchant\n */\n summary: string;\n\n /**\n * Map from IETF BCP 47 language tags to localized summaries\n */\n summary_i18n?: InternationalizedString;\n\n /**\n * URL of the fulfillment, given by the merchant\n */\n fulfillmentUrl?: string;\n\n /**\n * Plain text message that should be shown to the user\n * when the payment is complete.\n */\n fulfillmentMessage?: string;\n\n /**\n * Translations of fulfillmentMessage.\n */\n fulfillmentMessage_i18n?: InternationalizedString;\n}\n\nexport interface RefundInfoShort {\n transactionId: string;\n timestamp: TalerProtocolTimestamp;\n amountEffective: AmountString;\n amountRaw: AmountString;\n}\n\n/**\n * Summary information about the payment that we got a refund for.\n */\nexport interface RefundPaymentInfo {\n summary: string;\n summary_i18n?: InternationalizedString;\n /**\n * More information about the merchant\n */\n merchant: MerchantInfo;\n}\n\nexport interface TransactionRefund extends TransactionCommon {\n type: TransactionType.Refund;\n\n // Amount that has been refunded by the merchant\n amountRaw: AmountString;\n\n // Amount will be added to the wallet's balance after fees and refreshing\n amountEffective: AmountString;\n\n // ID for the transaction that is refunded\n refundedTransactionId: string;\n\n paymentInfo: RefundPaymentInfo | undefined;\n}\n\n/**\n * A transaction shown for refreshes.\n * Only shown for (1) refreshes not associated with other transactions\n * and (2) refreshes in an error state.\n */\nexport interface TransactionRefresh extends TransactionCommon {\n type: TransactionType.Refresh;\n\n refreshReason: RefreshReason;\n\n /**\n * Transaction ID that caused this refresh.\n */\n originatingTransactionId?: string;\n\n /**\n * Always zero for refreshes\n */\n amountRaw: AmountString;\n\n /**\n * Fees, i.e. the effective, negative effect of the refresh\n * on the balance.\n *\n * Only applicable for stand-alone refreshes, and zero for\n * other refreshes where the transaction itself accounts for the\n * refresh fee.\n */\n amountEffective: AmountString;\n\n refreshInputAmount: AmountString;\n refreshOutputAmount: AmountString;\n}\n\nexport interface DepositTransactionTrackingState {\n // Raw wire transfer identifier of the deposit.\n wireTransferId: string;\n // When was the wire transfer given to the bank.\n timestampExecuted: TalerProtocolTimestamp;\n // Total amount transfer for this wtid (including fees)\n amountRaw: AmountString;\n // Wire fee amount for this exchange\n wireFee: AmountString;\n}\n\n/**\n * Deposit transaction, which effectively sends\n * money from this wallet somewhere else.\n */\nexport interface TransactionDeposit extends TransactionCommon {\n type: TransactionType.Deposit;\n\n depositGroupId: string;\n\n /**\n * Target for the deposit.\n */\n targetPaytoUri: string;\n\n /**\n * Raw amount that is being deposited\n */\n amountRaw: AmountString;\n\n /**\n * Effective amount that is being deposited\n */\n amountEffective: AmountString;\n\n wireTransferDeadline: TalerProtocolTimestamp;\n\n wireTransferProgress: number;\n\n /**\n * Did all the deposit requests succeed?\n */\n deposited: boolean;\n\n trackingState: Array;\n}\n\nexport interface TransactionByIdRequest {\n transactionId: string;\n}\n\nexport const codecForTransactionByIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"TransactionByIdRequest\");\n\nexport interface WithdrawalTransactionByURIRequest {\n talerWithdrawUri: string;\n}\n\nexport const codecForWithdrawalTransactionByURIRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .build(\"WithdrawalTransactionByURIRequest\");\n\nexport const codecForTransactionsRequest = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecOptional(codecForString()))\n .property(\"scopeInfo\", codecOptional(codecForScopeInfo()))\n .property(\"search\", codecOptional(codecForString()))\n .property(\n \"sort\",\n codecOptional(\n codecForEither(\n codecForConstString(\"ascending\"),\n codecForConstString(\"descending\"),\n codecForConstString(\"stable-ascending\"),\n ),\n ),\n )\n .property(\"includeRefreshes\", codecOptional(codecForBoolean()))\n .build(\"TransactionsRequest\");\n\n// FIXME: do full validation here!\nexport const codecForTransactionsResponse = (): Codec =>\n buildCodecForObject()\n .property(\"transactions\", codecForList(codecForAny()))\n .build(\"TransactionsResponse\");\n\nexport const codecForOrderShortInfo = (): Codec =>\n buildCodecForObject()\n .property(\"contractTermsHash\", codecForString())\n .property(\"fulfillmentMessage\", codecOptional(codecForString()))\n .property(\n \"fulfillmentMessage_i18n\",\n codecOptional(codecForInternationalizedString()),\n )\n .property(\"fulfillmentUrl\", codecOptional(codecForString()))\n .property(\"merchant\", codecForMerchantInfo())\n .property(\"orderId\", codecForString())\n .property(\"summary\", codecForString())\n .property(\"summary_i18n\", codecOptional(codecForInternationalizedString()))\n .build(\"OrderShortInfo\");\n\nexport interface ListAssociatedRefreshesRequest {\n transactionId: string;\n}\n\nexport const codecForListAssociatedRefreshesRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"ListAssociatedRefreshesRequest\");\n\nexport interface ListAssociatedRefreshesResponse {\n transactionIds: string[];\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Types used by clients of the wallet.\n *\n * These types are defined in a separate file make tree shaking easier, since\n * some components use these types (via RPC) but do not depend on the wallet\n * code directly.\n *\n * @author Florian Dold \n */\n\n/**\n * Imports.\n */\nimport { AmountJson, codecForAmountString } from \"./amounts.js\";\nimport {\n Codec,\n Context,\n DecodingError,\n buildCodecForObject,\n buildCodecForUnion,\n codecForAny,\n codecForBoolean,\n codecForConstString,\n codecForEither,\n codecForList,\n codecForMap,\n codecForNumber,\n codecForString,\n codecOptional,\n renderContext,\n} from \"./codec.js\";\nimport {\n AmountString,\n CurrencySpecification,\n EddsaPrivateKeyString,\n InternationalizedString,\n TalerMerchantApi,\n TemplateParams,\n WithdrawalOperationStatus,\n canonicalizeBaseUrl,\n} from \"./index.js\";\nimport { VersionMatchResult } from \"./libtool-version.js\";\nimport { PaytoString, PaytoUri, codecForPaytoString } from \"./payto.js\";\nimport { QrCodeSpec } from \"./qr.js\";\nimport { AgeCommitmentProof } from \"./taler-crypto.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport {\n AbsoluteTime,\n TalerPreciseTimestamp,\n TalerProtocolDuration,\n TalerProtocolTimestamp,\n codecForAbsoluteTime,\n codecForPreciseTimestamp,\n codecForTimestamp,\n} from \"./time.js\";\nimport {\n AccountRestriction,\n AuditorDenomSig,\n CoinEnvelope,\n DenomKeyType,\n DenominationPubKey,\n ExchangeAuditor,\n ExchangeWireAccount,\n PeerContractTerms,\n UnblindedSignature,\n codecForExchangeWireAccount,\n codecForPeerContractTerms,\n} from \"./types-taler-exchange.js\";\nimport {\n MerchantContractTerms,\n MerchantInfo,\n codecForMerchantContractTerms,\n} from \"./types-taler-merchant.js\";\nimport { BackupRecovery } from \"./types-taler-sync.js\";\nimport {\n OrderShortInfo,\n TransactionState,\n TransactionType,\n} from \"./types-taler-wallet-transactions.js\";\n\n/**\n * Identifier for a transaction in the wallet.\n */\ndeclare const __txId: unique symbol;\nexport type TransactionIdStr = `txn:${string}:${string}` & { [__txId]: true };\n\n/**\n * Identifier for a pending task in the wallet.\n */\ndeclare const __pndId: unique symbol;\nexport type PendingIdStr = `pnd:${string}:${string}` & { [__pndId]: true };\n\ndeclare const __tmbId: unique symbol;\nexport type TombstoneIdStr = `tmb:${string}:${string}` & { [__tmbId]: true };\n\nfunction codecForTransactionIdStr(): Codec {\n return {\n decode(x: any, c?: Context): TransactionIdStr {\n if (typeof x === \"string\" && x.startsWith(\"txn:\")) {\n return x as TransactionIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"txn:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nfunction codecForPendingIdStr(): Codec {\n return {\n decode(x: any, c?: Context): PendingIdStr {\n if (typeof x === \"string\" && x.startsWith(\"txn:\")) {\n return x as PendingIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"txn:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nfunction codecForTombstoneIdStr(): Codec {\n return {\n decode(x: any, c?: Context): TombstoneIdStr {\n if (typeof x === \"string\" && x.startsWith(\"tmb:\")) {\n return x as TombstoneIdStr;\n }\n throw new DecodingError(\n `expected string starting with \"tmb:\" at ${renderContext(\n c,\n )} but got ${x}`,\n );\n },\n };\n}\n\nexport function codecForCanonBaseUrl(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n const canon = canonicalizeBaseUrl(x);\n if (x !== canon) {\n throw new DecodingError(\n `expected canonicalized base URL at ${renderContext(\n c,\n )} but got value '${x}'`,\n );\n }\n return x;\n }\n throw new DecodingError(\n `expected base URL at ${renderContext(c)} but got type ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Response for the create reserve request to the wallet.\n */\nexport class CreateReserveResponse {\n /**\n * Exchange URL where the bank should create the reserve.\n * The URL is canonicalized in the response.\n */\n exchange: string;\n\n /**\n * Reserve public key of the newly created reserve.\n */\n reservePub: string;\n}\n\nexport interface GetBalanceDetailRequest {\n currency: string;\n}\n\nexport const codecForGetBalanceDetailRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .build(\"GetBalanceDetailRequest\");\n\n/**\n * How the amount should be interpreted in a transaction\n * Effective = how the balance is change\n * Raw = effective amount without fee\n *\n * Depending on the transaction, raw can be higher than effective\n */\nexport enum TransactionAmountMode {\n Effective = \"effective\",\n Raw = \"raw\",\n}\n\nexport type GetPlanForOperationRequest =\n | GetPlanForWithdrawRequest\n | GetPlanForDepositRequest;\n// | GetPlanForPushDebitRequest\n// | GetPlanForPullCreditRequest\n// | GetPlanForPaymentRequest\n// | GetPlanForTipRequest\n// | GetPlanForRefundRequest\n// | GetPlanForPullDebitRequest\n// | GetPlanForPushCreditRequest;\n\ninterface GetPlanForWalletInitiatedOperation {\n instructedAmount: AmountString;\n mode: TransactionAmountMode;\n}\n\nexport interface ConvertAmountRequest {\n amount: AmountString;\n type: TransactionAmountMode;\n depositPaytoUri: PaytoString;\n}\n\nexport const codecForConvertAmountRequest =\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForPaytoString())\n .property(\n \"type\",\n codecForEither(\n codecForConstString(TransactionAmountMode.Raw),\n codecForConstString(TransactionAmountMode.Effective),\n ),\n )\n .build(\"ConvertAmountRequest\");\n\nexport interface GetAmountRequest {\n currency: string;\n}\n\nexport const codecForGetAmountRequest = buildCodecForObject()\n .property(\"currency\", codecForString())\n .build(\"GetAmountRequest\");\n\ninterface GetPlanToCompleteOperation {\n instructedAmount: AmountString;\n}\n\nconst codecForGetPlanForWalletInitiatedOperation = <\n T extends GetPlanForWalletInitiatedOperation,\n>() =>\n buildCodecForObject()\n .property(\n \"mode\",\n codecForEither(\n codecForConstString(TransactionAmountMode.Raw),\n codecForConstString(TransactionAmountMode.Effective),\n ),\n )\n .property(\"instructedAmount\", codecForAmountString());\n\ninterface GetPlanForWithdrawRequest extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.Withdrawal;\n exchangeUrl?: string;\n}\ninterface GetPlanForDepositRequest extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.Deposit;\n account: string; //payto string\n}\ninterface GetPlanForPushDebitRequest\n extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.PeerPushDebit;\n}\n\ninterface GetPlanForPullCreditRequest\n extends GetPlanForWalletInitiatedOperation {\n type: TransactionType.PeerPullCredit;\n exchangeUrl: string;\n}\n\nconst codecForGetPlanForWithdrawRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.Withdrawal))\n .property(\"exchangeUrl\", codecOptional(codecForString()))\n .build(\"GetPlanForWithdrawRequest\");\n\nconst codecForGetPlanForDepositRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.Deposit))\n .property(\"account\", codecForString())\n .build(\"GetPlanForDepositRequest\");\n\nconst codecForGetPlanForPushDebitRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.PeerPushDebit))\n .build(\"GetPlanForPushDebitRequest\");\n\nconst codecForGetPlanForPullCreditRequest =\n codecForGetPlanForWalletInitiatedOperation()\n .property(\"type\", codecForConstString(TransactionType.PeerPullCredit))\n .property(\"exchangeUrl\", codecForString())\n .build(\"GetPlanForPullCreditRequest\");\n\ninterface GetPlanForPaymentRequest extends GetPlanToCompleteOperation {\n type: TransactionType.Payment;\n wireMethod: string;\n ageRestriction: number;\n maxDepositFee: AmountString;\n}\n\ninterface GetPlanForPullDebitRequest extends GetPlanToCompleteOperation {\n type: TransactionType.PeerPullDebit;\n}\n\ninterface GetPlanForPushCreditRequest extends GetPlanToCompleteOperation {\n type: TransactionType.PeerPushCredit;\n}\n\nconst codecForGetPlanForPaymentRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.Payment))\n .property(\"maxDepositFee\", codecForAmountString())\n .build(\"GetPlanForPaymentRequest\");\n\nconst codecForGetPlanForPullDebitRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.PeerPullDebit))\n .build(\"GetPlanForPullDebitRequest\");\n\nconst codecForGetPlanForPushCreditRequest =\n buildCodecForObject()\n .property(\"type\", codecForConstString(TransactionType.PeerPushCredit))\n .build(\"GetPlanForPushCreditRequest\");\n\nexport const codecForGetPlanForOperationRequest =\n (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n TransactionType.Withdrawal,\n codecForGetPlanForWithdrawRequest,\n )\n .alternative(TransactionType.Deposit, codecForGetPlanForDepositRequest)\n // .alternative(\n // TransactionType.PeerPushDebit,\n // codecForGetPlanForPushDebitRequest,\n // )\n // .alternative(\n // TransactionType.PeerPullCredit,\n // codecForGetPlanForPullCreditRequest,\n // )\n // .alternative(TransactionType.Payment, codecForGetPlanForPaymentRequest)\n // .alternative(\n // TransactionType.PeerPullDebit,\n // codecForGetPlanForPullDebitRequest,\n // )\n // .alternative(\n // TransactionType.PeerPushCredit,\n // codecForGetPlanForPushCreditRequest,\n // )\n .build(\"GetPlanForOperationRequest\");\n\nexport interface GetPlanForOperationResponse {\n effectiveAmount: AmountString;\n rawAmount: AmountString;\n counterPartyAmount?: AmountString;\n details: any;\n}\n\nexport const codecForGetPlanForOperationResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"effectiveAmount\", codecForAmountString())\n .property(\"rawAmount\", codecForAmountString())\n .property(\"details\", codecForAny())\n .property(\"counterPartyAmount\", codecOptional(codecForAmountString()))\n .build(\"GetPlanForOperationResponse\");\n\nexport interface AmountResponse {\n effectiveAmount: AmountString;\n rawAmount: AmountString;\n}\n\nexport const codecForAmountResponse = (): Codec =>\n buildCodecForObject()\n .property(\"effectiveAmount\", codecForAmountString())\n .property(\"rawAmount\", codecForAmountString())\n .build(\"AmountResponse\");\n\nexport enum BalanceFlag {\n IncomingKyc = \"incoming-kyc\",\n IncomingAml = \"incoming-aml\",\n IncomingConfirmation = \"incoming-confirmation\",\n OutgoingKyc = \"outgoing-kyc\",\n}\n\nexport interface WalletBalance {\n scopeInfo: ScopeInfo;\n available: AmountString;\n pendingIncoming: AmountString;\n pendingOutgoing: AmountString;\n\n /**\n * Does the balance for this currency have a pending\n * transaction?\n *\n * @deprecated use flags and pendingIncoming/pendingOutgoing instead\n */\n hasPendingTransactions: boolean;\n\n /**\n * Is there a transaction that requires user input?\n *\n * @deprecated use flags instead\n */\n requiresUserInput: boolean;\n\n flags: BalanceFlag[];\n}\n\nexport const codecForScopeInfoGlobal = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Global))\n .build(\"ScopeInfoGlobal\");\n\nexport const codecForScopeInfoExchange = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Exchange))\n .property(\"url\", codecForString())\n .build(\"ScopeInfoExchange\");\n\nexport const codecForScopeInfoAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"type\", codecForConstString(ScopeType.Auditor))\n .property(\"url\", codecForString())\n .build(\"ScopeInfoAuditor\");\n\nexport const codecForScopeInfo = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(ScopeType.Global, codecForScopeInfoGlobal())\n .alternative(ScopeType.Exchange, codecForScopeInfoExchange())\n .alternative(ScopeType.Auditor, codecForScopeInfoAuditor())\n .build(\"ScopeInfo\");\n\nexport interface GetCurrencySpecificationRequest {\n scope: ScopeInfo;\n}\n\nexport const codecForGetCurrencyInfoRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"scope\", codecForScopeInfo())\n .build(\"GetCurrencySpecificationRequest\");\n\nexport interface ListExchangesForScopedCurrencyRequest {\n scope: ScopeInfo;\n}\n\nexport const codecForListExchangesForScopedCurrencyRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"scope\", codecForScopeInfo())\n .build(\"ListExchangesForScopedCurrencyRequest\");\n\nexport interface GetCurrencySpecificationResponse {\n currencySpecification: CurrencySpecification;\n}\n\nexport interface BuiltinExchange {\n exchangeBaseUrl: string;\n currencyHint: string;\n}\n\nexport interface PartialWalletRunConfig {\n builtin?: Partial;\n testing?: Partial;\n features?: Partial;\n lazyTaskLoop?: Partial;\n}\n\nexport interface WalletRunConfig {\n /**\n * Initialization values useful for a complete startup.\n *\n * These are values may be overridden by different wallets\n */\n builtin: {\n exchanges: BuiltinExchange[];\n };\n\n /**\n * Unsafe options which it should only be used to create\n * testing environment.\n */\n testing: {\n /**\n * Allow withdrawal of denominations even though they are about to expire.\n */\n denomselAllowLate: boolean;\n devModeActive: boolean;\n insecureTrustExchange: boolean;\n preventThrottling: boolean;\n skipDefaults: boolean;\n emitObservabilityEvents?: boolean;\n };\n\n /**\n * Configurations values that may be safe to show to the user\n */\n features: {\n allowHttp: boolean;\n };\n\n /**\n * Start processing tasks only when explicitly required, even after\n * init has been called.\n *\n * Useful when the wallet is started to make single read-only request,\n * as otherwise wallet-core starts making network request and process\n * unrelated pending tasks.\n */\n lazyTaskLoop: boolean;\n}\n\nexport interface InitRequest {\n config?: PartialWalletRunConfig;\n}\n\nexport const codecForInitRequest = (): Codec =>\n buildCodecForObject()\n .property(\"config\", codecForAny())\n .build(\"InitRequest\");\n\nexport interface InitResponse {\n versionInfo: WalletCoreVersion;\n}\n\nexport enum ScopeType {\n Global = \"global\",\n Exchange = \"exchange\",\n Auditor = \"auditor\",\n}\n\nexport type ScopeInfoGlobal = { type: ScopeType.Global; currency: string };\n\nexport type ScopeInfoExchange = {\n type: ScopeType.Exchange;\n currency: string;\n url: string;\n};\n\nexport type ScopeInfoAuditor = {\n type: ScopeType.Auditor;\n currency: string;\n url: string;\n};\n\nexport type ScopeInfo = ScopeInfoGlobal | ScopeInfoExchange | ScopeInfoAuditor;\n\n/**\n * Encode scope info as a string.\n *\n * Format must be stable as it's used in the database.\n */\nexport function stringifyScopeInfo(si: ScopeInfo): string {\n switch (si.type) {\n case ScopeType.Global:\n return `taler-si:global/${si.currency}}`;\n case ScopeType.Auditor:\n return `taler-si:auditor/${si.currency}/${encodeURIComponent(si.url)}`;\n case ScopeType.Exchange:\n return `taler-si:exchange/${si.currency}/${encodeURIComponent(si.url)}`;\n }\n}\n\nexport interface BalancesResponse {\n balances: WalletBalance[];\n}\n\nexport const codecForBalance = (): Codec =>\n buildCodecForObject()\n .property(\"scopeInfo\", codecForAny()) // FIXME\n .property(\"available\", codecForAmountString())\n .property(\"hasPendingTransactions\", codecForBoolean())\n .property(\"pendingIncoming\", codecForAmountString())\n .property(\"pendingOutgoing\", codecForAmountString())\n .property(\"requiresUserInput\", codecForBoolean())\n .property(\"flags\", codecForAny()) // FIXME\n .build(\"Balance\");\n\nexport const codecForBalancesResponse = (): Codec =>\n buildCodecForObject()\n .property(\"balances\", codecForList(codecForBalance()))\n .build(\"BalancesResponse\");\n\n/**\n * For terseness.\n */\nexport function mkAmount(\n value: number,\n fraction: number,\n currency: string,\n): AmountJson {\n return { value, fraction, currency };\n}\n\n/**\n * Status of a coin.\n */\nexport enum CoinStatus {\n /**\n * Withdrawn and never shown to anybody.\n */\n Fresh = \"fresh\",\n\n /**\n * Coin was lost as the denomination is not usable anymore.\n */\n DenomLoss = \"denom-loss\",\n\n /**\n * Fresh, but currently marked as \"suspended\", thus won't be used\n * for spending. Used for testing.\n */\n FreshSuspended = \"fresh-suspended\",\n\n /**\n * A coin that has been spent and refreshed.\n */\n Dormant = \"dormant\",\n}\n\nexport type WalletCoinHistoryItem =\n | {\n type: \"withdraw\";\n transactionId: TransactionIdStr;\n }\n | {\n type: \"spend\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"refresh\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"recoup\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n }\n | {\n type: \"refund\";\n transactionId: TransactionIdStr;\n amount: AmountString;\n };\n\n/**\n * Easy to process format for the public data of coins\n * managed by the wallet.\n */\nexport interface CoinDumpJson {\n coins: Array<{\n /**\n * The coin's denomination's public key.\n */\n denomPub: DenominationPubKey;\n /**\n * Hash of denom_pub.\n */\n denomPubHash: string;\n /**\n * Value of the denomination (without any fees).\n */\n denomValue: string;\n /**\n * Public key of the coin.\n */\n coinPub: string;\n /**\n * Base URL of the exchange for the coin.\n */\n exchangeBaseUrl: string;\n /**\n * Public key of the parent coin.\n * Only present if this coin was obtained via refreshing.\n */\n refreshParentCoinPub: string | undefined;\n /**\n * Public key of the reserve for this coin.\n * Only present if this coin was obtained via refreshing.\n */\n withdrawalReservePub: string | undefined;\n /**\n * Status of the coin.\n */\n coinStatus: CoinStatus;\n /**\n * Information about the age restriction\n */\n ageCommitmentProof: AgeCommitmentProof | undefined;\n history: WalletCoinHistoryItem[];\n }>;\n}\n\nexport enum ConfirmPayResultType {\n Done = \"done\",\n Pending = \"pending\",\n}\n\n/**\n * Result for confirmPay\n */\nexport interface ConfirmPayResultDone {\n type: ConfirmPayResultType.Done;\n contractTerms: MerchantContractTerms;\n transactionId: TransactionIdStr;\n}\n\nexport interface ConfirmPayResultPending {\n type: ConfirmPayResultType.Pending;\n transactionId: TransactionIdStr;\n lastError: TalerErrorDetail | undefined;\n}\n\nexport const codecForTalerErrorDetail = (): Codec =>\n buildCodecForObject()\n .property(\"code\", codecForNumber())\n .property(\"when\", codecOptional(codecForAbsoluteTime))\n .property(\"hint\", codecOptional(codecForString()))\n .build(\"TalerErrorDetail\");\n\nexport type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending;\n\nexport const codecForConfirmPayResultPending =\n (): Codec =>\n buildCodecForObject()\n .property(\"lastError\", codecOptional(codecForTalerErrorDetail()))\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"type\", codecForConstString(ConfirmPayResultType.Pending))\n .build(\"ConfirmPayResultPending\");\n\nexport const codecForConfirmPayResultDone = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(ConfirmPayResultType.Done))\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"contractTerms\", codecForMerchantContractTerms())\n .build(\"ConfirmPayResultDone\");\n\nexport const codecForConfirmPayResult = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\n ConfirmPayResultType.Pending,\n codecForConfirmPayResultPending(),\n )\n .alternative(ConfirmPayResultType.Done, codecForConfirmPayResultDone())\n .build(\"ConfirmPayResult\");\n\n/**\n * Information about all sender wire details known to the wallet,\n * as well as exchanges that accept these wire types.\n */\nexport interface SenderWireInfos {\n /**\n * Mapping from exchange base url to list of accepted\n * wire types.\n */\n exchangeWireTypes: { [exchangeBaseUrl: string]: string[] };\n\n /**\n * Sender wire information stored in the wallet.\n */\n senderWires: string[];\n}\n\n/**\n * Request to mark a reserve as confirmed.\n */\nexport interface ConfirmReserveRequest {\n /**\n * Public key of then reserve that should be marked\n * as confirmed.\n */\n reservePub: string;\n}\n\nexport const codecForConfirmReserveRequest = (): Codec =>\n buildCodecForObject()\n .property(\"reservePub\", codecForString())\n .build(\"ConfirmReserveRequest\");\n\nexport interface PrepareRefundResult {\n proposalId: string;\n\n effectivePaid: AmountString;\n gone: AmountString;\n granted: AmountString;\n pending: boolean;\n awaiting: AmountString;\n\n info: OrderShortInfo;\n}\n\nexport interface BenchmarkResult {\n time: { [s: string]: number };\n repetitions: number;\n}\n\nexport enum PreparePayResultType {\n PaymentPossible = \"payment-possible\",\n InsufficientBalance = \"insufficient-balance\",\n AlreadyConfirmed = \"already-confirmed\",\n}\n\nexport const codecForPreparePayResultPaymentPossible =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountEffective\", codecForAmountString())\n .property(\"amountRaw\", codecForAmountString())\n .property(\"contractTerms\", codecForMerchantContractTerms())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"proposalId\", codecForString())\n .property(\"contractTermsHash\", codecForString())\n .property(\"talerUri\", codecForString())\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.PaymentPossible),\n )\n .build(\"PreparePayResultPaymentPossible\");\n\nexport interface BalanceDetails {}\n\n/**\n * Detailed reason for why the wallet's balance is insufficient.\n */\nexport interface PaymentInsufficientBalanceDetails {\n /**\n * Amount requested by the merchant.\n */\n amountRequested: AmountString;\n\n /**\n * Balance of type \"available\" (see balance.ts for definition).\n */\n balanceAvailable: AmountString;\n\n /**\n * Balance of type \"material\" (see balance.ts for definition).\n */\n balanceMaterial: AmountString;\n\n /**\n * Balance of type \"age-acceptable\" (see balance.ts for definition).\n */\n balanceAgeAcceptable: AmountString;\n\n /**\n * Balance of type \"merchant-acceptable\" (see balance.ts for definition).\n */\n balanceReceiverAcceptable: AmountString;\n\n /**\n * Balance of type \"merchant-depositable\" (see balance.ts for definition).\n */\n balanceReceiverDepositable: AmountString;\n\n balanceExchangeDepositable: AmountString;\n\n /**\n * Maximum effective amount that the wallet can spend,\n * when all fees are paid by the wallet.\n */\n maxEffectiveSpendAmount: AmountString;\n\n perExchange: {\n [url: string]: {\n balanceAvailable: AmountString;\n balanceMaterial: AmountString;\n balanceExchangeDepositable: AmountString;\n balanceAgeAcceptable: AmountString;\n balanceReceiverAcceptable: AmountString;\n balanceReceiverDepositable: AmountString;\n maxEffectiveSpendAmount: AmountString;\n /**\n * Exchange doesn't have global fees configured for the relevant year,\n * p2p payments aren't possible.\n */\n missingGlobalFees: boolean;\n };\n };\n}\n\nexport const codecForPayMerchantInsufficientBalanceDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountRequested\", codecForAmountString())\n .property(\"balanceAgeAcceptable\", codecForAmountString())\n .property(\"balanceAvailable\", codecForAmountString())\n .property(\"balanceMaterial\", codecForAmountString())\n .property(\"balanceReceiverAcceptable\", codecForAmountString())\n .property(\"balanceReceiverDepositable\", codecForAmountString())\n .property(\"balanceExchangeDepositable\", codecForAmountString())\n .property(\"perExchange\", codecForAny())\n .property(\"maxEffectiveSpendAmount\", codecForAmountString())\n .build(\"PayMerchantInsufficientBalanceDetails\");\n\nexport const codecForPreparePayResultInsufficientBalance =\n (): Codec =>\n buildCodecForObject()\n .property(\"amountRaw\", codecForAmountString())\n .property(\"contractTerms\", codecForAny())\n .property(\"talerUri\", codecForString())\n .property(\"proposalId\", codecForString())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.InsufficientBalance),\n )\n .property(\n \"balanceDetails\",\n codecForPayMerchantInsufficientBalanceDetails(),\n )\n .build(\"PreparePayResultInsufficientBalance\");\n\nexport const codecForPreparePayResultAlreadyConfirmed =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForConstString(PreparePayResultType.AlreadyConfirmed),\n )\n .property(\"amountEffective\", codecOptional(codecForAmountString()))\n .property(\"amountRaw\", codecForAmountString())\n .property(\"paid\", codecForBoolean())\n .property(\"talerUri\", codecForString())\n .property(\"contractTerms\", codecForAny())\n .property(\"contractTermsHash\", codecForString())\n .property(\"transactionId\", codecForTransactionIdStr())\n .property(\"proposalId\", codecForString())\n .build(\"PreparePayResultAlreadyConfirmed\");\n\nexport const codecForPreparePayResult = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"status\")\n .alternative(\n PreparePayResultType.AlreadyConfirmed,\n codecForPreparePayResultAlreadyConfirmed(),\n )\n .alternative(\n PreparePayResultType.InsufficientBalance,\n codecForPreparePayResultInsufficientBalance(),\n )\n .alternative(\n PreparePayResultType.PaymentPossible,\n codecForPreparePayResultPaymentPossible(),\n )\n .build(\"PreparePayResult\");\n\n/**\n * Result of a prepare pay operation.\n */\nexport type PreparePayResult =\n | PreparePayResultInsufficientBalance\n | PreparePayResultAlreadyConfirmed\n | PreparePayResultPaymentPossible;\n\n/**\n * Payment is possible.\n */\nexport interface PreparePayResultPaymentPossible {\n status: PreparePayResultType.PaymentPossible;\n transactionId: TransactionIdStr;\n /**\n * @deprecated use transactionId instead\n */\n proposalId: string;\n contractTerms: MerchantContractTerms;\n contractTermsHash: string;\n amountRaw: AmountString;\n amountEffective: AmountString;\n talerUri: string;\n}\n\nexport interface PreparePayResultInsufficientBalance {\n status: PreparePayResultType.InsufficientBalance;\n transactionId: TransactionIdStr;\n /**\n * @deprecated use transactionId\n */\n proposalId: string;\n contractTerms: MerchantContractTerms;\n amountRaw: AmountString;\n talerUri: string;\n balanceDetails: PaymentInsufficientBalanceDetails;\n}\n\nexport interface PreparePayResultAlreadyConfirmed {\n status: PreparePayResultType.AlreadyConfirmed;\n transactionId: TransactionIdStr;\n contractTerms: MerchantContractTerms;\n paid: boolean;\n amountRaw: AmountString;\n amountEffective: AmountString | undefined;\n contractTermsHash: string;\n /**\n * @deprecated use transactionId\n */\n proposalId: string;\n talerUri: string;\n}\n\nexport interface BankWithdrawDetails {\n status: WithdrawalOperationStatus;\n currency: string;\n amount: AmountJson | undefined;\n editableAmount: boolean;\n maxAmount: AmountJson | undefined;\n wireFee: AmountJson | undefined;\n senderWire?: string;\n exchange?: string;\n editableExchange: boolean;\n confirmTransferUrl?: string;\n wireTypes: string[];\n operationId: string;\n apiBaseUrl: string;\n}\n\nexport interface AcceptWithdrawalResponse {\n reservePub: string;\n confirmTransferUrl?: string;\n transactionId: TransactionIdStr;\n}\n\n/**\n * Details about a purchase, including refund status.\n */\nexport interface PurchaseDetails {\n contractTerms: Record;\n hasRefund: boolean;\n totalRefundAmount: AmountJson;\n totalRefundAndRefreshFees: AmountJson;\n}\n\nexport interface WalletDiagnostics {\n walletManifestVersion: string;\n walletManifestDisplayVersion: string;\n errors: string[];\n firefoxIdbProblem: boolean;\n dbOutdated: boolean;\n}\n\nexport interface TalerErrorDetail {\n code: TalerErrorCode;\n when?: AbsoluteTime;\n hint?: string;\n [x: string]: unknown;\n}\n\n/**\n * Minimal information needed about a planchet for unblinding a signature.\n *\n * Can be a withdrawal/refresh planchet.\n */\nexport interface PlanchetUnblindInfo {\n denomPub: DenominationPubKey;\n blindingKey: string;\n}\n\nexport interface WithdrawalPlanchet {\n coinPub: string;\n coinPriv: string;\n reservePub: string;\n denomPubHash: string;\n denomPub: DenominationPubKey;\n blindingKey: string;\n withdrawSig: string;\n coinEv: CoinEnvelope;\n coinValue: AmountJson;\n coinEvHash: string;\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\nexport interface PlanchetCreationRequest {\n secretSeed: string;\n coinIndex: number;\n value: AmountJson;\n feeWithdraw: AmountJson;\n denomPub: DenominationPubKey;\n reservePub: string;\n reservePriv: string;\n restrictAge?: number;\n}\n\n/**\n * Reasons for why a coin is being refreshed.\n */\nexport enum RefreshReason {\n Manual = \"manual\",\n PayMerchant = \"pay-merchant\",\n PayDeposit = \"pay-deposit\",\n PayPeerPush = \"pay-peer-push\",\n PayPeerPull = \"pay-peer-pull\",\n Refund = \"refund\",\n AbortPay = \"abort-pay\",\n AbortDeposit = \"abort-deposit\",\n AbortPeerPushDebit = \"abort-peer-push-debit\",\n AbortPeerPullDebit = \"abort-peer-pull-debit\",\n Recoup = \"recoup\",\n BackupRestored = \"backup-restored\",\n Scheduled = \"scheduled\",\n}\n\n/**\n * Request to refresh a single coin.\n */\nexport interface CoinRefreshRequest {\n readonly coinPub: string;\n readonly amount: AmountString;\n}\n\n/**\n * Private data required to make a deposit permission.\n */\nexport interface DepositInfo {\n exchangeBaseUrl: string;\n contractTermsHash: string;\n coinPub: string;\n coinPriv: string;\n spendAmount: AmountJson;\n timestamp: TalerProtocolTimestamp;\n refundDeadline: TalerProtocolTimestamp;\n merchantPub: string;\n feeDeposit: AmountJson;\n wireInfoHash: string;\n denomKeyType: DenomKeyType;\n denomPubHash: string;\n denomSig: UnblindedSignature;\n\n requiredMinimumAge?: number;\n\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\nexport interface ExchangesShortListResponse {\n exchanges: ShortExchangeListItem[];\n}\n\nexport interface ExchangesListResponse {\n exchanges: ExchangeListItem[];\n}\n\nexport interface ExchangeDetailedResponse {\n exchange: ExchangeFullDetails;\n}\n\nexport interface WalletCoreVersion {\n implementationSemver: string;\n implementationGitHash: string;\n\n /**\n * Wallet-core protocol version supported by this implementation\n * of the API (\"server\" version).\n */\n version: string;\n exchange: string;\n merchant: string;\n\n bankIntegrationApiRange: string;\n bankConversionApiRange: string;\n corebankApiRange: string;\n\n /**\n * @deprecated as bank was split into multiple APIs with separate versioning\n */\n bank: string;\n\n /**\n * @deprecated\n */\n hash: string | undefined;\n\n /**\n * @deprecated will be removed\n */\n devMode: boolean;\n}\n\nexport interface KnownBankAccountsInfo {\n uri: PaytoUri;\n kyc_completed: boolean;\n currency: string;\n alias: string;\n}\n\nexport interface KnownBankAccounts {\n accounts: KnownBankAccountsInfo[];\n}\n\n/**\n * Wire fee for one wire method\n */\nexport interface WireFee {\n /**\n * Fee for wire transfers.\n */\n wireFee: AmountString;\n\n /**\n * Fees to close and refund a reserve.\n */\n closingFee: AmountString;\n\n /**\n * Start date of the fee.\n */\n startStamp: TalerProtocolTimestamp;\n\n /**\n * End date of the fee.\n */\n endStamp: TalerProtocolTimestamp;\n\n /**\n * Signature made by the exchange master key.\n */\n sig: string;\n}\n\nexport type WireFeeMap = { [wireMethod: string]: WireFee[] };\n\nexport interface WireInfo {\n feesForType: WireFeeMap;\n accounts: ExchangeWireAccount[];\n}\n\nexport interface ExchangeGlobalFees {\n startDate: TalerProtocolTimestamp;\n endDate: TalerProtocolTimestamp;\n\n historyFee: AmountString;\n accountFee: AmountString;\n purseFee: AmountString;\n\n historyTimeout: TalerProtocolDuration;\n purseTimeout: TalerProtocolDuration;\n\n purseLimit: number;\n\n signature: string;\n}\n\nconst codecForWireFee = (): Codec =>\n buildCodecForObject()\n .property(\"sig\", codecForString())\n .property(\"wireFee\", codecForAmountString())\n .property(\"closingFee\", codecForAmountString())\n .property(\"startStamp\", codecForTimestamp)\n .property(\"endStamp\", codecForTimestamp)\n .build(\"codecForWireFee\");\n\nconst codecForWireInfo = (): Codec =>\n buildCodecForObject()\n .property(\"feesForType\", codecForMap(codecForList(codecForWireFee())))\n .property(\"accounts\", codecForList(codecForExchangeWireAccount()))\n .build(\"codecForWireInfo\");\n\nexport interface DenominationInfo {\n /**\n * Value of one coin of the denomination.\n */\n value: AmountString;\n\n /**\n * Hash of the denomination public key.\n * Stored in the database for faster lookups.\n */\n denomPubHash: string;\n\n denomPub: DenominationPubKey;\n\n /**\n * Fee for withdrawing.\n */\n feeWithdraw: AmountString;\n\n /**\n * Fee for depositing.\n */\n feeDeposit: AmountString;\n\n /**\n * Fee for refreshing.\n */\n feeRefresh: AmountString;\n\n /**\n * Fee for refunding.\n */\n feeRefund: AmountString;\n\n /**\n * Validity start date of the denomination.\n */\n stampStart: TalerProtocolTimestamp;\n\n /**\n * Date after which the currency can't be withdrawn anymore.\n */\n stampExpireWithdraw: TalerProtocolTimestamp;\n\n /**\n * Date after the denomination officially doesn't exist anymore.\n */\n stampExpireLegal: TalerProtocolTimestamp;\n\n /**\n * Data after which coins of this denomination can't be deposited anymore.\n */\n stampExpireDeposit: TalerProtocolTimestamp;\n\n exchangeBaseUrl: string;\n}\n\nexport type DenomOperation = \"deposit\" | \"withdraw\" | \"refresh\" | \"refund\";\nexport type DenomOperationMap = { [op in DenomOperation]: T };\n\nexport interface FeeDescription {\n group: string;\n from: AbsoluteTime;\n until: AbsoluteTime;\n fee?: AmountString;\n}\n\nexport interface FeeDescriptionPair {\n group: string;\n from: AbsoluteTime;\n until: AbsoluteTime;\n left?: AmountString;\n right?: AmountString;\n}\n\nexport interface TimePoint {\n id: string;\n group: string;\n fee: AmountString;\n type: \"start\" | \"end\";\n moment: AbsoluteTime;\n denom: T;\n}\n\nexport interface ExchangeFullDetails {\n exchangeBaseUrl: string;\n currency: string;\n paytoUris: string[];\n auditors: ExchangeAuditor[];\n wireInfo: WireInfo;\n denomFees: DenomOperationMap;\n transferFees: Record;\n globalFees: FeeDescription[];\n}\n\nexport enum ExchangeTosStatus {\n Pending = \"pending\",\n Proposed = \"proposed\",\n Accepted = \"accepted\",\n MissingTos = \"missing-tos\",\n}\n\nexport enum ExchangeEntryStatus {\n Preset = \"preset\",\n Ephemeral = \"ephemeral\",\n Used = \"used\",\n}\n\nexport enum ExchangeUpdateStatus {\n Initial = \"initial\",\n InitialUpdate = \"initial-update\",\n Suspended = \"suspended\",\n UnavailableUpdate = \"unavailable-update\",\n Ready = \"ready\",\n ReadyUpdate = \"ready-update\",\n OutdatedUpdate = \"outdated-update\",\n}\n\nexport interface OperationErrorInfo {\n error: TalerErrorDetail;\n}\n\nexport interface ShortExchangeListItem {\n exchangeBaseUrl: string;\n}\n\n/**\n * Info about an exchange entry in the wallet.\n */\nexport interface ExchangeListItem {\n exchangeBaseUrl: string;\n masterPub: string | undefined;\n currency: string;\n paytoUris: string[];\n tosStatus: ExchangeTosStatus;\n exchangeEntryStatus: ExchangeEntryStatus;\n exchangeUpdateStatus: ExchangeUpdateStatus;\n ageRestrictionOptions: number[];\n\n /**\n * P2P payments are disabled with this exchange\n * (e.g. because no global fees are configured).\n */\n peerPaymentsDisabled: boolean;\n\n /**\n * Set to true if this exchange doesn't charge any fees.\n */\n noFees: boolean;\n\n scopeInfo: ScopeInfo;\n\n lastUpdateTimestamp: TalerPreciseTimestamp | undefined;\n\n /**\n * Information about the last error that occurred when trying\n * to update the exchange info.\n */\n lastUpdateErrorInfo?: OperationErrorInfo;\n\n unavailableReason?: TalerErrorDetail;\n}\n\nconst codecForAuditorDenomSig = (): Codec =>\n buildCodecForObject()\n .property(\"denom_pub_h\", codecForString())\n .property(\"auditor_sig\", codecForString())\n .build(\"AuditorDenomSig\");\n\nconst codecForExchangeAuditor = (): Codec =>\n buildCodecForObject()\n .property(\"auditor_pub\", codecForString())\n .property(\"auditor_url\", codecForString())\n .property(\"denomination_keys\", codecForList(codecForAuditorDenomSig()))\n .build(\"codecForExchangeAuditor\");\n\nexport const codecForFeeDescriptionPair = (): Codec =>\n buildCodecForObject()\n .property(\"group\", codecForString())\n .property(\"from\", codecForAbsoluteTime)\n .property(\"until\", codecForAbsoluteTime)\n .property(\"left\", codecOptional(codecForAmountString()))\n .property(\"right\", codecOptional(codecForAmountString()))\n .build(\"FeeDescriptionPair\");\n\nexport const codecForFeeDescription = (): Codec =>\n buildCodecForObject()\n .property(\"group\", codecForString())\n .property(\"from\", codecForAbsoluteTime)\n .property(\"until\", codecForAbsoluteTime)\n .property(\"fee\", codecOptional(codecForAmountString()))\n .build(\"FeeDescription\");\n\nexport const codecForFeesByOperations = (): Codec<\n DenomOperationMap\n> =>\n buildCodecForObject>()\n .property(\"deposit\", codecForList(codecForFeeDescription()))\n .property(\"withdraw\", codecForList(codecForFeeDescription()))\n .property(\"refresh\", codecForList(codecForFeeDescription()))\n .property(\"refund\", codecForList(codecForFeeDescription()))\n .build(\"DenomOperationMap\");\n\nexport const codecForExchangeFullDetails = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"paytoUris\", codecForList(codecForString()))\n .property(\"auditors\", codecForList(codecForExchangeAuditor()))\n .property(\"wireInfo\", codecForWireInfo())\n .property(\"denomFees\", codecForFeesByOperations())\n .property(\n \"transferFees\",\n codecForMap(codecForList(codecForFeeDescription())),\n )\n .property(\"globalFees\", codecForList(codecForFeeDescription()))\n .build(\"ExchangeFullDetails\");\n\nexport const codecForExchangeListItem = (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"masterPub\", codecOptional(codecForString()))\n .property(\"paytoUris\", codecForList(codecForString()))\n .property(\"tosStatus\", codecForAny())\n .property(\"exchangeEntryStatus\", codecForAny())\n .property(\"exchangeUpdateStatus\", codecForAny())\n .property(\"ageRestrictionOptions\", codecForList(codecForNumber()))\n .property(\"scopeInfo\", codecForScopeInfo())\n .property(\"lastUpdateErrorInfo\", codecForAny())\n .property(\"lastUpdateTimestamp\", codecOptional(codecForPreciseTimestamp))\n .property(\"noFees\", codecForBoolean())\n .property(\"peerPaymentsDisabled\", codecForBoolean())\n .build(\"ExchangeListItem\");\n\nexport const codecForExchangesListResponse = (): Codec =>\n buildCodecForObject()\n .property(\"exchanges\", codecForList(codecForExchangeListItem()))\n .build(\"ExchangesListResponse\");\n\nexport interface AcceptManualWithdrawalResult {\n /**\n * Payto URIs that can be used to fund the withdrawal.\n *\n * @deprecated in favor of withdrawalAccountsList\n */\n exchangePaytoUris: string[];\n\n /**\n * Public key of the newly created reserve.\n */\n reservePub: string;\n\n withdrawalAccountsList: WithdrawalExchangeAccountDetails[];\n\n transactionId: TransactionIdStr;\n}\n\nexport interface WithdrawalDetailsForAmount {\n /**\n * Did the user accept the current version of the exchange's\n * terms of service?\n *\n * @deprecated the client should query the exchange entry instead\n */\n tosAccepted: boolean;\n\n /**\n * Amount that the user will transfer to the exchange.\n */\n amountRaw: AmountString;\n\n /**\n * Amount that will be added to the user's wallet balance.\n */\n amountEffective: AmountString;\n\n /**\n * Number of coins that would be used for withdrawal.\n *\n * The UIs should warn if this number is too high (roughly at >100).\n */\n numCoins: number;\n\n /**\n * Ways to pay the exchange.\n *\n * @deprecated in favor of withdrawalAccountsList\n */\n paytoUris: string[];\n\n /**\n * Ways to pay the exchange, including accounts that require currency conversion.\n */\n withdrawalAccountsList: WithdrawalExchangeAccountDetails[];\n\n /**\n * If the exchange supports age-restricted coins it will return\n * the array of ages.\n */\n ageRestrictionOptions?: number[];\n\n /**\n * Scope info of the currency withdrawn.\n */\n scopeInfo: ScopeInfo;\n}\n\nexport interface DenomSelItem {\n denomPubHash: string;\n count: number;\n /**\n * Number of denoms/planchets to skip, because\n * a re-denomination effectively deleted them.\n */\n skip?: number;\n}\n\n/**\n * Selected denominations withn some extra info.\n */\nexport interface DenomSelectionState {\n totalCoinValue: AmountString;\n totalWithdrawCost: AmountString;\n selectedDenoms: DenomSelItem[];\n earliestDepositExpiration: TalerProtocolTimestamp;\n hasDenomWithAgeRestriction: boolean;\n}\n\n/**\n * Information about what will happen doing a withdrawal.\n *\n * Sent to the wallet frontend to be rendered and shown to the user.\n */\nexport interface ExchangeWithdrawalDetails {\n exchangePaytoUris: string[];\n\n /**\n * Filtered wire info to send to the bank.\n */\n exchangeWireAccounts: string[];\n\n exchangeCreditAccountDetails: WithdrawalExchangeAccountDetails[];\n\n /**\n * Selected denominations for withdraw.\n */\n selectedDenoms: DenomSelectionState;\n\n /**\n * Did the user already accept the current terms of service for the exchange?\n */\n termsOfServiceAccepted: boolean;\n\n /**\n * The earliest deposit expiration of the selected coins.\n */\n earliestDepositExpiration: TalerProtocolTimestamp;\n\n /**\n * Result of checking the wallet's version\n * against the exchange's version.\n *\n * Older exchanges don't return version information.\n */\n versionMatch: VersionMatchResult | undefined;\n\n /**\n * Libtool-style version string for the exchange or \"unknown\"\n * for older exchanges.\n */\n exchangeVersion: string;\n\n /**\n * Libtool-style version string for the wallet.\n */\n walletVersion: string;\n\n /**\n * Amount that will be subtracted from the reserve's balance.\n */\n withdrawalAmountRaw: AmountString;\n\n /**\n * Amount that will actually be added to the wallet's balance.\n */\n withdrawalAmountEffective: AmountString;\n\n /**\n * If the exchange supports age-restricted coins it will return\n * the array of ages.\n *\n */\n ageRestrictionOptions?: number[];\n\n scopeInfo: ScopeInfo;\n}\n\nexport interface GetExchangeTosResult {\n /**\n * Markdown version of the current ToS.\n */\n content: string;\n\n /**\n * Version tag of the current ToS.\n */\n currentEtag: string;\n\n /**\n * Version tag of the last ToS that the user has accepted,\n * if any.\n */\n acceptedEtag: string | undefined;\n\n /**\n * Accepted content type\n */\n contentType: string;\n\n /**\n * Language of the returned content.\n *\n * If missing, language is unknown.\n */\n contentLanguage: string | undefined;\n\n /**\n * Available languages as advertised by the exchange.\n */\n tosAvailableLanguages: string[];\n\n tosStatus: ExchangeTosStatus;\n}\n\nexport interface TestPayArgs {\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n amount: AmountString;\n summary: string;\n forcedCoinSel?: ForcedCoinSel;\n}\n\nexport const codecForTestPayArgs = (): Codec =>\n buildCodecForObject()\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"amount\", codecForAmountString())\n .property(\"summary\", codecForString())\n .property(\"forcedCoinSel\", codecForAny())\n .build(\"TestPayArgs\");\n\nexport interface IntegrationTestArgs {\n exchangeBaseUrl: string;\n corebankApiBaseUrl: string;\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n amountToWithdraw: AmountString;\n amountToSpend: AmountString;\n}\n\nexport const codecForIntegrationTestArgs = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"amountToSpend\", codecForAmountString())\n .property(\"amountToWithdraw\", codecForAmountString())\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"IntegrationTestArgs\");\n\nexport interface IntegrationTestV2Args {\n exchangeBaseUrl: string;\n corebankApiBaseUrl: string;\n merchantBaseUrl: string;\n merchantAuthToken?: string;\n}\n\nexport const codecForIntegrationTestV2Args = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"merchantAuthToken\", codecOptional(codecForString()))\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"IntegrationTestV2Args\");\n\nexport interface GetExchangeEntryByUrlRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForGetExchangeEntryByUrlRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"GetExchangeEntryByUrlRequest\");\n\nexport type GetExchangeEntryByUrlResponse = ExchangeListItem;\n\nexport interface AddExchangeRequest {\n exchangeBaseUrl: string;\n\n /**\n * @deprecated use a separate API call to start a forced exchange update instead\n */\n forceUpdate?: boolean;\n}\n\nexport const codecForAddExchangeRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forceUpdate\", codecOptional(codecForBoolean()))\n .build(\"AddExchangeRequest\");\n\nexport interface UpdateExchangeEntryRequest {\n exchangeBaseUrl: string;\n force?: boolean;\n}\n\nexport const codecForUpdateExchangeEntryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"force\", codecOptional(codecForBoolean()))\n .build(\"UpdateExchangeEntryRequest\");\n\nexport interface GetExchangeResourcesRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForGetExchangeResourcesRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"GetExchangeResourcesRequest\");\n\nexport interface GetExchangeResourcesResponse {\n hasResources: boolean;\n}\n\nexport interface DeleteExchangeRequest {\n exchangeBaseUrl: string;\n purge?: boolean;\n}\n\nexport const codecForDeleteExchangeRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"purge\", codecOptional(codecForBoolean()))\n .build(\"DeleteExchangeRequest\");\n\nexport interface ForceExchangeUpdateRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForForceExchangeUpdateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"AddExchangeRequest\");\n\nexport interface GetExchangeTosRequest {\n exchangeBaseUrl: string;\n acceptedFormat?: string[];\n acceptLanguage?: string;\n}\n\nexport const codecForGetExchangeTosRequest = (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"acceptedFormat\", codecOptional(codecForList(codecForString())))\n .property(\"acceptLanguage\", codecOptional(codecForString()))\n .build(\"GetExchangeTosRequest\");\n\nexport interface AcceptManualWithdrawalRequest {\n exchangeBaseUrl: string;\n amount: AmountString;\n restrictAge?: number;\n\n /**\n * Instead of generating a fresh, random reserve key pair,\n * use the provided reserve private key.\n *\n * Use with caution. Usage of this field may be restricted\n * to developer mode.\n */\n forceReservePriv?: EddsaPrivateKeyString;\n}\n\nexport const codecForAcceptManualWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"amount\", codecForAmountString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .property(\"forceReservePriv\", codecOptional(codecForString()))\n .build(\"AcceptManualWithdrawalRequest\");\n\nexport interface GetWithdrawalDetailsForAmountRequest {\n exchangeBaseUrl: string;\n amount: AmountString;\n restrictAge?: number;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport interface PrepareBankIntegratedWithdrawalRequest {\n talerWithdrawUri: string;\n}\n\nexport const codecForPrepareBankIntegratedWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .build(\"PrepareBankIntegratedWithdrawalRequest\");\n\nexport interface PrepareBankIntegratedWithdrawalResponse {\n transactionId: TransactionIdStr;\n info: WithdrawUriInfoResponse;\n}\n\nexport interface ConfirmWithdrawalRequest {\n transactionId: string;\n exchangeBaseUrl: string;\n amount: AmountString;\n forcedDenomSel?: ForcedDenomSel;\n restrictAge?: number;\n}\n\nexport const codecForConfirmWithdrawalRequestRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"ConfirmWithdrawalRequest\");\n\nexport interface AcceptBankIntegratedWithdrawalRequest {\n talerWithdrawUri: string;\n exchangeBaseUrl: string;\n forcedDenomSel?: ForcedDenomSel;\n /**\n * Amount to withdraw.\n * If the bank's withdrawal operation uses a fixed amount,\n * this field must either be left undefined or its value must match\n * the amount from the withdrawal operation.\n */\n amount?: AmountString;\n restrictAge?: number;\n}\n\nexport const codecForAcceptBankIntegratedWithdrawalRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"talerWithdrawUri\", codecForString())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"AcceptBankIntegratedWithdrawalRequest\");\n\nexport const codecForGetWithdrawalDetailsForAmountRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"amount\", codecForAmountString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"GetWithdrawalDetailsForAmountRequest\");\n\nexport interface AcceptExchangeTosRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForAcceptExchangeTosRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"AcceptExchangeTosRequest\");\n\nexport interface ForgetExchangeTosRequest {\n exchangeBaseUrl: string;\n}\n\nexport const codecForForgetExchangeTosRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"ForgetExchangeTosRequest\");\n\nexport interface AcceptRefundRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForApplyRefundRequest = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"AcceptRefundRequest\");\n\nexport interface ApplyRefundFromPurchaseIdRequest {\n purchaseId: string;\n}\n\nexport const codecForApplyRefundFromPurchaseIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"purchaseId\", codecForString())\n .build(\"ApplyRefundFromPurchaseIdRequest\");\n\nexport interface GetWithdrawalDetailsForUriRequest {\n talerWithdrawUri: string;\n /**\n * @deprecated not used\n */\n restrictAge?: number;\n}\n\nexport const codecForGetWithdrawalDetailsForUri =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerWithdrawUri\", codecForString())\n .property(\"restrictAge\", codecOptional(codecForNumber()))\n .build(\"GetWithdrawalDetailsForUriRequest\");\n\nexport interface ListKnownBankAccountsRequest {\n currency?: string;\n}\n\nexport const codecForListKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecOptional(codecForString()))\n .build(\"ListKnownBankAccountsRequest\");\n\nexport interface AddKnownBankAccountsRequest {\n payto: string;\n alias: string;\n currency: string;\n}\nexport const codecForAddKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"payto\", codecForString())\n .property(\"alias\", codecForString())\n .property(\"currency\", codecForString())\n .build(\"AddKnownBankAccountsRequest\");\n\nexport interface ForgetKnownBankAccountsRequest {\n payto: string;\n}\n\nexport const codecForForgetKnownBankAccounts =\n (): Codec =>\n buildCodecForObject()\n .property(\"payto\", codecForString())\n .build(\"ForgetKnownBankAccountsRequest\");\n\nexport interface AbortProposalRequest {\n proposalId: string;\n}\n\nexport const codecForAbortProposalRequest = (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecForString())\n .build(\"AbortProposalRequest\");\n\nexport interface GetContractTermsDetailsRequest {\n // @deprecated use transaction id\n proposalId?: string;\n transactionId?: string;\n}\n\nexport const codecForGetContractTermsDetails =\n (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecOptional(codecForString()))\n .property(\"transactionId\", codecOptional(codecForString()))\n .build(\"GetContractTermsDetails\");\n\nexport interface PreparePayRequest {\n talerPayUri: string;\n}\n\nexport const codecForPreparePayRequest = (): Codec =>\n buildCodecForObject()\n .property(\"talerPayUri\", codecForString())\n .build(\"PreparePay\");\n\nexport interface SharePaymentRequest {\n merchantBaseUrl: string;\n orderId: string;\n}\nexport const codecForSharePaymentRequest = (): Codec =>\n buildCodecForObject()\n .property(\"merchantBaseUrl\", codecForCanonBaseUrl())\n .property(\"orderId\", codecForString())\n .build(\"SharePaymentRequest\");\n\nexport interface SharePaymentResult {\n privatePayUri: string;\n}\nexport const codecForSharePaymentResult = (): Codec =>\n buildCodecForObject()\n .property(\"privatePayUri\", codecForString())\n .build(\"SharePaymentResult\");\n\nexport interface CheckPayTemplateRequest {\n talerPayTemplateUri: string;\n}\n\nexport type CheckPayTemplateReponse = {\n templateDetails: TalerMerchantApi.WalletTemplateDetails;\n supportedCurrencies: string[];\n};\n\nexport const codecForCheckPayTemplateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerPayTemplateUri\", codecForString())\n .build(\"CheckPayTemplateRequest\");\n\nexport interface PreparePayTemplateRequest {\n talerPayTemplateUri: string;\n templateParams?: TemplateParams;\n}\n\nexport const codecForPreparePayTemplateRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerPayTemplateUri\", codecForString())\n .property(\"templateParams\", codecForAny())\n .build(\"PreparePayTemplate\");\n\nexport interface ConfirmPayRequest {\n /**\n * @deprecated use transactionId instead\n */\n proposalId?: string;\n transactionId?: TransactionIdStr;\n sessionId?: string;\n forcedCoinSel?: ForcedCoinSel;\n}\n\nexport const codecForConfirmPayRequest = (): Codec =>\n buildCodecForObject()\n .property(\"proposalId\", codecOptional(codecForString()))\n .property(\"transactionId\", codecOptional(codecForTransactionIdStr()))\n .property(\"sessionId\", codecOptional(codecForString()))\n .property(\"forcedCoinSel\", codecForAny())\n .build(\"ConfirmPay\");\n\nexport interface CoreApiRequestEnvelope {\n id: string;\n operation: string;\n args: unknown;\n}\n\nexport type CoreApiResponse = CoreApiResponseSuccess | CoreApiResponseError;\n\nexport type CoreApiMessageEnvelope = CoreApiResponse | CoreApiNotification;\n\nexport interface CoreApiNotification {\n type: \"notification\";\n payload: unknown;\n}\n\nexport interface CoreApiResponseSuccess {\n // To distinguish the message from notifications\n type: \"response\";\n operation: string;\n id: string;\n result: unknown;\n}\n\nexport interface CoreApiResponseError {\n // To distinguish the message from notifications\n type: \"error\";\n operation: string;\n id: string;\n error: TalerErrorDetail;\n}\n\nexport interface WithdrawTestBalanceRequest {\n amount: AmountString;\n /**\n * Corebank API base URL.\n */\n corebankApiBaseUrl: string;\n exchangeBaseUrl: string;\n forcedDenomSel?: ForcedDenomSel;\n}\n\n/**\n * Request to the crypto worker to make a sync signature.\n */\nexport interface MakeSyncSignatureRequest {\n accountPriv: string;\n oldHash: string | undefined;\n newHash: string;\n}\n\n/**\n * Planchet for a coin during refresh.\n */\nexport interface RefreshPlanchetInfo {\n /**\n * Public key for the coin.\n */\n coinPub: string;\n\n /**\n * Private key for the coin.\n */\n coinPriv: string;\n\n /**\n * Blinded public key.\n */\n coinEv: CoinEnvelope;\n\n coinEvHash: string;\n\n /**\n * Blinding key used.\n */\n blindingKey: string;\n\n maxAge: number;\n ageCommitmentProof?: AgeCommitmentProof;\n}\n\n/**\n * Strategy for loading recovery information.\n */\nexport enum RecoveryMergeStrategy {\n /**\n * Keep the local wallet root key, import and take over providers.\n */\n Ours = \"ours\",\n\n /**\n * Migrate to the wallet root key from the recovery information.\n */\n Theirs = \"theirs\",\n}\n\n/**\n * Load recovery information into the wallet.\n */\nexport interface RecoveryLoadRequest {\n recovery: BackupRecovery;\n strategy?: RecoveryMergeStrategy;\n}\n\nexport const codecForWithdrawTestBalance =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"forcedDenomSel\", codecForAny())\n .property(\"corebankApiBaseUrl\", codecForCanonBaseUrl())\n .build(\"WithdrawTestBalanceRequest\");\n\nexport interface SetCoinSuspendedRequest {\n coinPub: string;\n suspended: boolean;\n}\n\nexport const codecForSetCoinSuspendedRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"coinPub\", codecForString())\n .property(\"suspended\", codecForBoolean())\n .build(\"SetCoinSuspendedRequest\");\n\nexport interface RefreshCoinSpec {\n coinPub: string;\n amount?: AmountString;\n}\n\nexport const codecForRefreshCoinSpec = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"coinPub\", codecForString())\n .build(\"ForceRefreshRequest\");\n\nexport interface ForceRefreshRequest {\n refreshCoinSpecs: RefreshCoinSpec[];\n}\n\nexport const codecForForceRefreshRequest = (): Codec =>\n buildCodecForObject()\n .property(\"refreshCoinSpecs\", codecForList(codecForRefreshCoinSpec()))\n .build(\"ForceRefreshRequest\");\n\nexport interface PrepareRefundRequest {\n talerRefundUri: string;\n}\n\nexport interface StartRefundQueryForUriResponse {\n /**\n * Transaction id of the *payment* where the refund query was started.\n */\n transactionId: TransactionIdStr;\n}\n\nexport const codecForPrepareRefundRequest = (): Codec =>\n buildCodecForObject()\n .property(\"talerRefundUri\", codecForString())\n .build(\"PrepareRefundRequest\");\n\nexport interface StartRefundQueryRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForStartRefundQueryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"StartRefundQueryRequest\");\n\nexport interface FailTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForFailTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"FailTransactionRequest\");\n\nexport interface SuspendTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForSuspendTransaction =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"SuspendTransactionRequest\");\n\nexport interface ResumeTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForResumeTransaction = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"ResumeTransactionRequest\");\n\nexport interface AbortTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface FailTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForAbortTransaction = (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"AbortTransactionRequest\");\n\nexport interface DepositGroupFees {\n coin: AmountString;\n wire: AmountString;\n refresh: AmountString;\n}\n\nexport interface CreateDepositGroupRequest {\n /**\n * Pre-allocated transaction ID.\n * Allows clients to easily handle notifications\n * that occur while the operation has been created but\n * before the creation request has returned.\n */\n transactionId?: TransactionIdStr;\n depositPaytoUri: string;\n amount: AmountString;\n}\n\nexport interface PrepareDepositRequest {\n /**\n * Payto URI to identify the (bank) account that the exchange will wire\n * the money to.\n */\n depositPaytoUri: string;\n\n /**\n * Amount that should be deposited.\n *\n * Raw amount, fees will be added on top.\n */\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForPrepareDepositRequest = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForString())\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"PrepareDepositRequest\");\n\nexport interface PrepareDepositResponse {\n totalDepositCost: AmountString;\n effectiveDepositAmount: AmountString;\n fees: DepositGroupFees;\n}\n\nexport const codecForCreateDepositGroupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"depositPaytoUri\", codecForString())\n .property(\"transactionId\", codecOptional(codecForTransactionIdStr()))\n .build(\"CreateDepositGroupRequest\");\n\nexport interface CreateDepositGroupResponse {\n depositGroupId: string;\n transactionId: TransactionIdStr;\n}\n\nexport interface TxIdResponse {\n transactionId: TransactionIdStr;\n}\n\nexport interface WithdrawUriInfoResponse {\n operationId: string;\n status: WithdrawalOperationStatus;\n confirmTransferUrl?: string;\n currency: string;\n amount: AmountString | undefined;\n editableAmount: boolean;\n maxAmount: AmountString | undefined;\n wireFee: AmountString | undefined;\n defaultExchangeBaseUrl?: string;\n editableExchange: boolean;\n possibleExchanges: ExchangeListItem[];\n}\n\nexport const codecForWithdrawUriInfoResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"operationId\", codecForString())\n .property(\"confirmTransferUrl\", codecOptional(codecForString()))\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"maxAmount\", codecOptional(codecForAmountString()))\n .property(\"wireFee\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecForString())\n .property(\"editableAmount\", codecForBoolean())\n .property(\"editableExchange\", codecForBoolean())\n .property(\"defaultExchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"possibleExchanges\", codecForList(codecForExchangeListItem()))\n .build(\"WithdrawUriInfoResponse\");\n\nexport interface WalletCurrencyInfo {\n trustedAuditors: {\n currency: string;\n auditorPub: string;\n auditorBaseUrl: string;\n }[];\n trustedExchanges: {\n currency: string;\n exchangeMasterPub: string;\n exchangeBaseUrl: string;\n }[];\n}\n\nexport interface TestingListTasksForTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface TestingListTasksForTransactionsResponse {\n taskIdList: string[];\n}\n\nexport const codecForTestingListTasksForTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"TestingListTasksForTransactionRequest\");\n\nexport interface DeleteTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface RetryTransactionRequest {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForDeleteTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"DeleteTransactionRequest\");\n\nexport const codecForRetryTransactionRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"RetryTransactionRequest\");\n\nexport interface SetWalletDeviceIdRequest {\n /**\n * New wallet device ID to set.\n */\n walletDeviceId: string;\n}\n\nexport const codecForSetWalletDeviceIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"walletDeviceId\", codecForString())\n .build(\"SetWalletDeviceIdRequest\");\n\nexport interface WithdrawFakebankRequest {\n amount: AmountString;\n exchange: string;\n bank: string;\n}\n\nexport enum AttentionPriority {\n High = \"high\",\n Medium = \"medium\",\n Low = \"low\",\n}\n\nexport interface UserAttentionByIdRequest {\n entityId: string;\n type: AttentionType;\n}\n\nexport const codecForUserAttentionByIdRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForAny())\n .property(\"entityId\", codecForString())\n .build(\"UserAttentionByIdRequest\");\n\nexport const codecForUserAttentionsRequest = (): Codec =>\n buildCodecForObject()\n .property(\n \"priority\",\n codecOptional(\n codecForEither(\n codecForConstString(AttentionPriority.Low),\n codecForConstString(AttentionPriority.Medium),\n codecForConstString(AttentionPriority.High),\n ),\n ),\n )\n .build(\"UserAttentionsRequest\");\n\nexport interface UserAttentionsRequest {\n priority?: AttentionPriority;\n}\n\nexport type AttentionInfo =\n | AttentionKycWithdrawal\n | AttentionBackupUnpaid\n | AttentionBackupExpiresSoon\n | AttentionMerchantRefund\n | AttentionExchangeTosChanged\n | AttentionExchangeKeyExpired\n | AttentionExchangeDenominationExpired\n | AttentionAuditorTosChanged\n | AttentionAuditorKeyExpires\n | AttentionAuditorDenominationExpires\n | AttentionPullPaymentPaid\n | AttentionPushPaymentReceived;\n\nexport enum AttentionType {\n KycWithdrawal = \"kyc-withdrawal\",\n\n BackupUnpaid = \"backup-unpaid\",\n BackupExpiresSoon = \"backup-expires-soon\",\n MerchantRefund = \"merchant-refund\",\n\n ExchangeTosChanged = \"exchange-tos-changed\",\n ExchangeKeyExpired = \"exchange-key-expired\",\n ExchangeKeyExpiresSoon = \"exchange-key-expires-soon\",\n ExchangeDenominationsExpired = \"exchange-denominations-expired\",\n ExchangeDenominationsExpiresSoon = \"exchange-denominations-expires-soon\",\n\n AuditorTosChanged = \"auditor-tos-changed\",\n AuditorKeyExpires = \"auditor-key-expires\",\n AuditorDenominationsExpires = \"auditor-denominations-expires\",\n\n PullPaymentPaid = \"pull-payment-paid\",\n PushPaymentReceived = \"push-payment-withdrawn\",\n}\n\nexport const UserAttentionPriority: {\n [type in AttentionType]: AttentionPriority;\n} = {\n \"kyc-withdrawal\": AttentionPriority.Medium,\n\n \"backup-unpaid\": AttentionPriority.High,\n \"backup-expires-soon\": AttentionPriority.Medium,\n \"merchant-refund\": AttentionPriority.Medium,\n\n \"exchange-tos-changed\": AttentionPriority.Medium,\n\n \"exchange-key-expired\": AttentionPriority.High,\n \"exchange-key-expires-soon\": AttentionPriority.Medium,\n \"exchange-denominations-expired\": AttentionPriority.High,\n \"exchange-denominations-expires-soon\": AttentionPriority.Medium,\n\n \"auditor-tos-changed\": AttentionPriority.Medium,\n \"auditor-key-expires\": AttentionPriority.Medium,\n \"auditor-denominations-expires\": AttentionPriority.Medium,\n\n \"pull-payment-paid\": AttentionPriority.High,\n \"push-payment-withdrawn\": AttentionPriority.High,\n};\n\ninterface AttentionBackupExpiresSoon {\n type: AttentionType.BackupExpiresSoon;\n provider_base_url: string;\n}\ninterface AttentionBackupUnpaid {\n type: AttentionType.BackupUnpaid;\n provider_base_url: string;\n talerUri: string;\n}\n\ninterface AttentionMerchantRefund {\n type: AttentionType.MerchantRefund;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionKycWithdrawal {\n type: AttentionType.KycWithdrawal;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionExchangeTosChanged {\n type: AttentionType.ExchangeTosChanged;\n exchange_base_url: string;\n}\ninterface AttentionExchangeKeyExpired {\n type: AttentionType.ExchangeKeyExpired;\n exchange_base_url: string;\n}\ninterface AttentionExchangeDenominationExpired {\n type: AttentionType.ExchangeDenominationsExpired;\n exchange_base_url: string;\n}\ninterface AttentionAuditorTosChanged {\n type: AttentionType.AuditorTosChanged;\n auditor_base_url: string;\n}\n\ninterface AttentionAuditorKeyExpires {\n type: AttentionType.AuditorKeyExpires;\n auditor_base_url: string;\n}\ninterface AttentionAuditorDenominationExpires {\n type: AttentionType.AuditorDenominationsExpires;\n auditor_base_url: string;\n}\ninterface AttentionPullPaymentPaid {\n type: AttentionType.PullPaymentPaid;\n transactionId: TransactionIdStr;\n}\n\ninterface AttentionPushPaymentReceived {\n type: AttentionType.PushPaymentReceived;\n transactionId: TransactionIdStr;\n}\n\nexport type UserAttentionUnreadList = Array<{\n info: AttentionInfo;\n when: TalerPreciseTimestamp;\n read: boolean;\n}>;\n\nexport interface UserAttentionsResponse {\n pending: UserAttentionUnreadList;\n}\n\nexport interface UserAttentionsCountResponse {\n total: number;\n}\n\nexport const codecForWithdrawFakebankRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"bank\", codecForString())\n .property(\"exchange\", codecForString())\n .build(\"WithdrawFakebankRequest\");\n\nexport interface ActiveTask {\n taskId: string;\n transaction: TransactionIdStr | undefined;\n firstTry: AbsoluteTime | undefined;\n nextTry: AbsoluteTime | undefined;\n retryCounter: number | undefined;\n lastError: TalerErrorDetail | undefined;\n}\n\nexport interface GetActiveTasksResponse {\n tasks: ActiveTask[];\n}\n\nexport const codecForActiveTask = (): Codec =>\n buildCodecForObject()\n .property(\"taskId\", codecForString())\n .property(\"transaction\", codecOptional(codecForTransactionIdStr()))\n .property(\"retryCounter\", codecOptional(codecForNumber()))\n .property(\"firstTry\", codecOptional(codecForAbsoluteTime))\n .property(\"nextTry\", codecOptional(codecForAbsoluteTime))\n .property(\"lastError\", codecOptional(codecForTalerErrorDetail()))\n .build(\"ActiveTask\");\n\nexport const codecForGetActiveTasks = (): Codec =>\n buildCodecForObject()\n .property(\"tasks\", codecForList(codecForActiveTask()))\n .build(\"GetActiveTasks\");\n\nexport interface ImportDbRequest {\n dump: any;\n}\n\nexport const codecForImportDbRequest = (): Codec =>\n buildCodecForObject()\n .property(\"dump\", codecForAny())\n .build(\"ImportDbRequest\");\n\nexport interface ForcedDenomSel {\n denoms: {\n value: AmountString;\n count: number;\n }[];\n}\n\n/**\n * Forced coin selection for deposits/payments.\n */\nexport interface ForcedCoinSel {\n coins: {\n value: AmountString;\n contribution: AmountString;\n }[];\n}\n\nexport interface TestPayResult {\n /**\n * Number of coins used for the payment.\n */\n numCoins: number;\n}\n\nexport interface SelectedCoin {\n denomPubHash: string;\n coinPub: string;\n contribution: AmountString;\n exchangeBaseUrl: string;\n}\n\nexport interface SelectedProspectiveCoin {\n denomPubHash: string;\n contribution: AmountString;\n exchangeBaseUrl: string;\n}\n\n/**\n * Result of selecting coins, contains the exchange, and selected\n * coins with their denomination.\n */\nexport interface PayCoinSelection {\n coins: SelectedCoin[];\n\n /**\n * How much of the wire fees is the customer paying?\n */\n customerWireFees: AmountString;\n\n /**\n * How much of the deposit fees is the customer paying?\n */\n customerDepositFees: AmountString;\n}\n\nexport interface ProspectivePayCoinSelection {\n prospectiveCoins: SelectedProspectiveCoin[];\n\n /**\n * How much of the wire fees is the customer paying?\n */\n customerWireFees: AmountString;\n\n /**\n * How much of the deposit fees is the customer paying?\n */\n customerDepositFees: AmountString;\n}\n\nexport interface CheckPeerPushDebitRequest {\n /**\n * Preferred exchange to use for the p2p payment.\n */\n exchangeBaseUrl?: string;\n\n /**\n * Instructed amount.\n *\n * FIXME: Allow specifying the instructed amount type.\n */\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForCheckPeerPushDebitRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"amount\", codecForAmountString())\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"CheckPeerPushDebitRequest\");\n\nexport interface CheckPeerPushDebitResponse {\n amountRaw: AmountString;\n amountEffective: AmountString;\n exchangeBaseUrl: string;\n /**\n * Maximum expiration date, based on how close the coins\n * used for the payment are to expiry.\n *\n * The value is based on when the wallet would typically\n * automatically refresh the coins on its own, leaving enough\n * time to get a refund for the push payment and refresh the\n * coin.\n */\n maxExpirationDate: TalerProtocolTimestamp;\n}\n\nexport interface InitiatePeerPushDebitRequest {\n exchangeBaseUrl?: string;\n partialContractTerms: PeerContractTerms;\n}\n\nexport interface InitiatePeerPushDebitResponse {\n exchangeBaseUrl: string;\n pursePub: string;\n mergePriv: string;\n contractPriv: string;\n transactionId: TransactionIdStr;\n}\n\nexport const codecForInitiatePeerPushDebitRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"partialContractTerms\", codecForPeerContractTerms())\n .build(\"InitiatePeerPushDebitRequest\");\n\nexport interface PreparePeerPushCreditRequest {\n talerUri: string;\n}\n\nexport interface PreparePeerPullDebitRequest {\n talerUri: string;\n}\n\nexport interface PreparePeerPushCreditResponse {\n contractTerms: PeerContractTerms;\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n transactionId: TransactionIdStr;\n\n exchangeBaseUrl: string;\n\n /**\n * @deprecated use transaction ID instead.\n */\n peerPushCreditId: string;\n\n /**\n * @deprecated\n */\n amount: AmountString;\n}\n\nexport interface PreparePeerPullDebitResponse {\n contractTerms: PeerContractTerms;\n /**\n * @deprecated Redundant field with bad name, will be removed soon.\n */\n amount: AmountString;\n\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n peerPullDebitId: string;\n\n transactionId: TransactionIdStr;\n}\n\nexport const codecForPreparePeerPushCreditRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"CheckPeerPushPaymentRequest\");\n\nexport const codecForCheckPeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"PreparePeerPullDebitRequest\");\n\nexport interface ConfirmPeerPushCreditRequest {\n transactionId: string;\n}\nexport interface AcceptPeerPushPaymentResponse {\n transactionId: TransactionIdStr;\n}\n\nexport interface AcceptPeerPullPaymentResponse {\n transactionId: TransactionIdStr;\n}\n\nexport const codecForConfirmPeerPushPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForString())\n .build(\"ConfirmPeerPushCreditRequest\");\n\nexport interface ConfirmPeerPullDebitRequest {\n transactionId: TransactionIdStr;\n}\n\nexport interface ApplyDevExperimentRequest {\n devExperimentUri: string;\n}\n\nexport const codecForApplyDevExperiment =\n (): Codec =>\n buildCodecForObject()\n .property(\"devExperimentUri\", codecForString())\n .build(\"ApplyDevExperimentRequest\");\n\nexport const codecForAcceptPeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"transactionId\", codecForTransactionIdStr())\n .build(\"ConfirmPeerPullDebitRequest\");\n\nexport interface CheckPeerPullCreditRequest {\n exchangeBaseUrl?: string;\n amount: AmountString;\n\n /**\n * ID provided by the client to cancel the request.\n *\n * If the same request is made again with the same clientCancellationId,\n * all previous requests are cancelled.\n *\n * The cancelled request will receive an error response with\n * an error code that indicates the cancellation.\n *\n * The cancellation is best-effort, responses might still arrive.\n */\n clientCancellationId?: string;\n}\n\nexport const codecForPreparePeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .property(\"clientCancellationId\", codecOptional(codecForString()))\n .build(\"CheckPeerPullCreditRequest\");\n\nexport interface CheckPeerPullCreditResponse {\n exchangeBaseUrl: string;\n amountRaw: AmountString;\n amountEffective: AmountString;\n\n /**\n * Number of coins that will be used,\n * can be used by the UI to warn if excessively large.\n */\n numCoins: number;\n}\n\nexport interface InitiatePeerPullCreditRequest {\n exchangeBaseUrl?: string;\n partialContractTerms: PeerContractTerms;\n}\n\nexport const codecForInitiatePeerPullPaymentRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"partialContractTerms\", codecForPeerContractTerms())\n .property(\"exchangeBaseUrl\", codecOptional(codecForCanonBaseUrl()))\n .build(\"InitiatePeerPullCreditRequest\");\n\nexport interface InitiatePeerPullCreditResponse {\n /**\n * Taler URI for the other party to make the payment\n * that was requested.\n *\n * @deprecated since it's not necessarily valid yet until the tx is in the right state\n */\n talerUri: string;\n\n transactionId: TransactionIdStr;\n}\n\nexport interface CanonicalizeBaseUrlRequest {\n url: string;\n}\n\nexport const codecForCanonicalizeBaseUrlRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"url\", codecForString())\n .build(\"CanonicalizeBaseUrlRequest\");\n\nexport interface CanonicalizeBaseUrlResponse {\n url: string;\n}\n\nexport interface ValidateIbanRequest {\n iban: string;\n}\n\nexport const codecForValidateIbanRequest = (): Codec =>\n buildCodecForObject()\n .property(\"iban\", codecForString())\n .build(\"ValidateIbanRequest\");\n\nexport interface ValidateIbanResponse {\n valid: boolean;\n}\n\nexport const codecForValidateIbanResponse = (): Codec =>\n buildCodecForObject()\n .property(\"valid\", codecForBoolean())\n .build(\"ValidateIbanResponse\");\n\nexport type TransactionStateFilter = \"nonfinal\";\n\nexport interface TransactionRecordFilter {\n onlyState?: TransactionStateFilter;\n onlyCurrency?: string;\n}\n\nexport interface StoredBackupList {\n storedBackups: {\n name: string;\n }[];\n}\n\nexport interface CreateStoredBackupResponse {\n name: string;\n}\n\nexport interface RecoverStoredBackupRequest {\n name: string;\n}\n\nexport interface DeleteStoredBackupRequest {\n name: string;\n}\n\nexport const codecForDeleteStoredBackupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .build(\"DeleteStoredBackupRequest\");\n\nexport const codecForRecoverStoredBackupRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .build(\"RecoverStoredBackupRequest\");\n\nexport interface TestingSetTimetravelRequest {\n offsetMs: number;\n}\n\nexport const codecForTestingSetTimetravelRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"offsetMs\", codecForNumber())\n .build(\"TestingSetTimetravelRequest\");\n\nexport interface AllowedAuditorInfo {\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport interface AllowedExchangeInfo {\n exchangeBaseUrl: string;\n exchangePub: string;\n}\n\n/**\n * Data extracted from the contract terms that is relevant for payment\n * processing in the wallet.\n */\nexport interface WalletContractData {\n /**\n * Fulfillment URL, or the empty string if the order has no fulfillment URL.\n *\n * Stored as a non-nullable string as we use this field for IndexedDB indexing.\n */\n fulfillmentUrl: string;\n\n contractTermsHash: string;\n fulfillmentMessage?: string;\n fulfillmentMessageI18n?: InternationalizedString;\n merchantSig: string;\n merchantPub: string;\n merchant: MerchantInfo;\n amount: AmountString;\n orderId: string;\n merchantBaseUrl: string;\n summary: string;\n summaryI18n: { [lang_tag: string]: string } | undefined;\n autoRefund: TalerProtocolDuration | undefined;\n payDeadline: TalerProtocolTimestamp;\n refundDeadline: TalerProtocolTimestamp;\n allowedExchanges: AllowedExchangeInfo[];\n timestamp: TalerProtocolTimestamp;\n wireMethod: string;\n wireInfoHash: string;\n maxDepositFee: AmountString;\n minimumAge?: number;\n}\n\nexport interface TestingWaitTransactionRequest {\n transactionId: TransactionIdStr;\n txState: TransactionState;\n}\n\nexport interface TestingGetReserveHistoryRequest {\n reservePub: string;\n exchangeBaseUrl: string;\n}\n\nexport const codecForTestingGetReserveHistoryRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"reservePub\", codecForString())\n .property(\"exchangeBaseUrl\", codecForString())\n .build(\"TestingGetReserveHistoryRequest\");\n\nexport interface TestingGetDenomStatsRequest {\n exchangeBaseUrl: string;\n}\n\nexport interface TestingGetDenomStatsResponse {\n numKnown: number;\n numOffered: number;\n numLost: number;\n}\n\nexport const codecForTestingGetDenomStatsRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .build(\"TestingGetDenomStatsRequest\");\n\nexport interface WithdrawalExchangeAccountDetails {\n /**\n * Payto URI to credit the exchange.\n *\n * Depending on whether the (manual!) withdrawal is accepted or just\n * being checked, this already includes the subject with the\n * reserve public key.\n */\n paytoUri: string;\n\n /**\n * Status that indicates whether the account can be used\n * by the user to send funds for a withdrawal.\n *\n * ok: account should be shown to the user\n * error: account should not be shown to the user, UIs might render the error (in conversionError),\n * especially in dev mode.\n */\n status: \"ok\" | \"error\";\n\n /**\n * Transfer amount. Might be in a different currency than the requested\n * amount for withdrawal.\n *\n * Absent if this is a conversion account and the conversion failed.\n */\n transferAmount?: AmountString;\n\n /**\n * Currency specification for the external currency.\n *\n * Only included if this account requires a currency conversion.\n */\n currencySpecification?: CurrencySpecification;\n\n /**\n * Further restrictions for sending money to the\n * exchange.\n */\n creditRestrictions?: AccountRestriction[];\n\n /**\n * Label given to the account or the account's bank by the exchange.\n */\n bankLabel?: string;\n\n /*\n * Display priority assigned to this bank account by the exchange.\n */\n priority?: number;\n\n /**\n * Error that happened when attempting to request the conversion rate.\n */\n conversionError?: TalerErrorDetail;\n}\n\nexport interface PrepareWithdrawExchangeRequest {\n /**\n * A taler://withdraw-exchange URI.\n */\n talerUri: string;\n}\n\nexport const codecForPrepareWithdrawExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"talerUri\", codecForString())\n .build(\"PrepareWithdrawExchangeRequest\");\n\nexport interface PrepareWithdrawExchangeResponse {\n /**\n * Base URL of the exchange that already existed\n * or was ephemerally added as an exchange entry to\n * the wallet.\n */\n exchangeBaseUrl: string;\n\n /**\n * Amount from the taler://withdraw-exchange URI.\n * Only present if specified in the URI.\n */\n amount?: AmountString;\n}\n\nexport interface ExchangeEntryState {\n tosStatus: ExchangeTosStatus;\n exchangeEntryStatus: ExchangeEntryStatus;\n exchangeUpdateStatus: ExchangeUpdateStatus;\n}\n\nexport interface ListGlobalCurrencyAuditorsResponse {\n auditors: {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n }[];\n}\n\nexport interface ListGlobalCurrencyExchangesResponse {\n exchanges: {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n }[];\n}\n\nexport interface AddGlobalCurrencyExchangeRequest {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n}\n\nexport const codecForAddGlobalCurrencyExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"exchangeMasterPub\", codecForString())\n .build(\"AddGlobalCurrencyExchangeRequest\");\n\nexport interface RemoveGlobalCurrencyExchangeRequest {\n currency: string;\n exchangeBaseUrl: string;\n exchangeMasterPub: string;\n}\n\nexport const codecForRemoveGlobalCurrencyExchangeRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"exchangeBaseUrl\", codecForCanonBaseUrl())\n .property(\"exchangeMasterPub\", codecForString())\n .build(\"RemoveGlobalCurrencyExchangeRequest\");\n\nexport interface AddGlobalCurrencyAuditorRequest {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport const codecForAddGlobalCurrencyAuditorRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"auditorBaseUrl\", codecForCanonBaseUrl())\n .property(\"auditorPub\", codecForString())\n .build(\"AddGlobalCurrencyAuditorRequest\");\n\nexport interface RemoveGlobalCurrencyAuditorRequest {\n currency: string;\n auditorBaseUrl: string;\n auditorPub: string;\n}\n\nexport const codecForRemoveGlobalCurrencyAuditorRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"auditorBaseUrl\", codecForCanonBaseUrl())\n .property(\"auditorPub\", codecForString())\n .build(\"RemoveGlobalCurrencyAuditorRequest\");\n\n/**\n * Information about one provider.\n *\n * We don't store the account key here,\n * as that's derived from the wallet root key.\n */\nexport interface ProviderInfo {\n active: boolean;\n syncProviderBaseUrl: string;\n name: string;\n terms?: BackupProviderTerms;\n /**\n * Last communication issue with the provider.\n */\n lastError?: TalerErrorDetail;\n lastSuccessfulBackupTimestamp?: TalerPreciseTimestamp;\n lastAttemptedBackupTimestamp?: TalerPreciseTimestamp;\n paymentProposalIds: string[];\n backupProblem?: BackupProblem;\n paymentStatus: ProviderPaymentStatus;\n}\n\nexport interface BackupProviderTerms {\n supportedProtocolVersion: string;\n annualFee: AmountString;\n storageLimitInMegabytes: number;\n}\n\nexport type BackupProblem =\n | BackupUnreadableProblem\n | BackupConflictingDeviceProblem;\n\nexport interface BackupUnreadableProblem {\n type: \"backup-unreadable\";\n}\n\nexport interface BackupConflictingDeviceProblem {\n type: \"backup-conflicting-device\";\n otherDeviceId: string;\n myDeviceId: string;\n backupTimestamp: AbsoluteTime;\n}\n\nexport type ProviderPaymentStatus =\n | ProviderPaymentTermsChanged\n | ProviderPaymentPaid\n | ProviderPaymentInsufficientBalance\n | ProviderPaymentUnpaid\n | ProviderPaymentPending;\n\nexport enum ProviderPaymentType {\n Unpaid = \"unpaid\",\n Pending = \"pending\",\n InsufficientBalance = \"insufficient-balance\",\n Paid = \"paid\",\n TermsChanged = \"terms-changed\",\n}\n\nexport interface ProviderPaymentUnpaid {\n type: ProviderPaymentType.Unpaid;\n}\n\nexport interface ProviderPaymentInsufficientBalance {\n type: ProviderPaymentType.InsufficientBalance;\n amount: AmountString;\n}\n\nexport interface ProviderPaymentPending {\n type: ProviderPaymentType.Pending;\n talerUri?: string;\n}\n\nexport interface ProviderPaymentPaid {\n type: ProviderPaymentType.Paid;\n paidUntil: AbsoluteTime;\n}\n\nexport interface ProviderPaymentTermsChanged {\n type: ProviderPaymentType.TermsChanged;\n paidUntil: AbsoluteTime;\n oldTerms: BackupProviderTerms;\n newTerms: BackupProviderTerms;\n}\n\n// FIXME: Does not really belong here, move to sync API\nexport interface SyncTermsOfServiceResponse {\n // maximum backup size supported\n storage_limit_in_megabytes: number;\n\n // Fee for an account, per year.\n annual_fee: AmountString;\n\n // protocol version supported by the server,\n // for now always \"0.0\".\n version: string;\n}\n\n// FIXME: Does not really belong here, move to sync API\nexport const codecForSyncTermsOfServiceResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"storage_limit_in_megabytes\", codecForNumber())\n .property(\"annual_fee\", codecForAmountString())\n .property(\"version\", codecForString())\n .build(\"SyncTermsOfServiceResponse\");\n\nexport interface HintNetworkAvailabilityRequest {\n isNetworkAvailable: boolean;\n}\n\nexport const codecForHintNetworkAvailabilityRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"isNetworkAvailable\", codecForBoolean())\n .build(\"HintNetworkAvailabilityRequest\");\n\nexport interface GetDepositWireTypesForCurrencyRequest {\n currency: string;\n /**\n * Optional scope info to further restrict the result.\n * Currency must match the currency field.\n */\n scopeInfo?: ScopeInfo;\n}\n\nexport const codecForGetDepositWireTypesForCurrencyRequest =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForString())\n .property(\"scopeInfo\", codecOptional(codecForScopeInfo()))\n .build(\"GetDepositWireTypesForCurrencyRequest\");\n\n/**\n * Response with wire types that are supported for a deposit.\n *\n * In the future, we might surface more information here, such as debit restrictions\n * by the exchange, which then can be shown by UIs to the user before they\n * enter their payment information.\n */\nexport interface GetDepositWireTypesForCurrencyResponse {\n wireTypes: string[];\n}\n\nexport interface GetQrCodesForPaytoRequest {\n paytoUri: string;\n}\n\nexport const codecForGetQrCodesForPaytoRequest = () =>\n buildCodecForObject()\n .property(\"paytoUri\", codecForString())\n .build(\"GetQrCodesForPaytoRequest\");\n\nexport interface GetQrCodesForPaytoResponse {\n codes: QrCodeSpec[];\n}\n\nexport type EmptyObject = Record;\n\nexport const codecForEmptyObject = (): Codec =>\n buildCodecForObject().build(\"EmptyObject\");\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport { AmountJson, Amounts } from \"../amounts.js\";\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport {\n ConversionRate,\n codecForCashinConversionResponse,\n codecForCashoutConversionResponse,\n codecForConversionBankConfig,\n} from \"../types-taler-bank-conversion.js\";\nimport { AccessToken } from \"../types-taler-common.js\";\nimport { codecForTalerErrorDetail } from \"../types-taler-wallet.js\";\nimport {\n CacheEvictor,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type TalerBankConversionResultByMethod<\n prop extends keyof TalerBankConversionHttpClient,\n> = ResultByMethod;\nexport type TalerBankConversionErrorsByMethod<\n prop extends keyof TalerBankConversionHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerBankConversionCacheEviction {\n UPDATE_RATE,\n}\n\n/**\n * The API is used by the wallets.\n */\nexport class TalerBankConversionHttpClient {\n public readonly PROTOCOL_VERSION = \"0:0:0\";\n\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForConversionBankConfig());\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--cashin-rate\n *\n */\n async getCashinRate(conversion: { debit?: AmountJson; credit?: AmountJson }) {\n const url = new URL(`cashin-rate`, this.baseUrl);\n if (conversion.debit) {\n url.searchParams.set(\"amount_debit\", Amounts.stringify(conversion.debit));\n }\n if (conversion.credit) {\n url.searchParams.set(\n \"amount_credit\",\n Amounts.stringify(conversion.credit),\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashinConversionResponse());\n case HttpStatusCode.BadRequest: {\n const body = await resp.json();\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.GENERIC_PARAMETER_MISSING:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_PARAMETER_MALFORMED:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_CURRENCY_MISMATCH:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, body);\n }\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#get--cashout-rate\n *\n */\n async getCashoutRate(conversion: {\n debit?: AmountJson;\n credit?: AmountJson;\n }) {\n const url = new URL(`cashout-rate`, this.baseUrl);\n if (conversion.debit) {\n url.searchParams.set(\"amount_debit\", Amounts.stringify(conversion.debit));\n }\n if (conversion.credit) {\n url.searchParams.set(\n \"amount_credit\",\n Amounts.stringify(conversion.credit),\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutConversionResponse());\n case HttpStatusCode.BadRequest: {\n const body = await resp.json();\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.GENERIC_PARAMETER_MISSING:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_PARAMETER_MALFORMED:\n return opKnownHttpFailure(resp.status, resp);\n case TalerErrorCode.GENERIC_CURRENCY_MISMATCH:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, body);\n }\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-conversion-info.html#post--conversion-rate\n *\n */\n async updateConversionRate(auth: AccessToken, body: ConversionRate) {\n const url = new URL(`conversion-rate`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerBankConversionCacheEviction.UPDATE_RATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport {\n Codec,\n buildCodecForObject,\n codecForBoolean,\n codecForConstString,\n codecForString,\n codecOptional,\n} from \"./codec.js\";\nimport {\n buildCodecForUnion,\n codecForAmountString,\n codecForEither,\n codecForList,\n codecForNumber,\n codecForTalerUriString,\n codecForTimestamp,\n codecOptionalDefault,\n} from \"./index.js\";\nimport { PaytoString, codecForPaytoString } from \"./payto.js\";\nimport { TalerUriString } from \"./taleruri.js\";\nimport { WithdrawalOperationStatus } from \"./types-taler-bank-integration.js\";\nimport {\n AmountString,\n CurrencySpecification,\n DecimalNumber,\n Integer,\n ShortHashCode,\n Timestamp,\n codecForCurrencySpecificiation,\n codecForDecimalNumber,\n} from \"./types-taler-common.js\";\n\nexport interface IntegrationConfig {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification: CurrencySpecification;\n\n // Name of the API.\n name: \"taler-bank-integration\";\n}\n\nexport interface TalerCorebankConfigResponse {\n /**\n * Name of this API, always \"taler-corebank\".\n *\n * For legacy reasons, libeufin-bank will also be accepted for some time.\n */\n name: \"libeufin-bank\" | \"taler-corebank\";\n\n // API version in the form $n:$n:$n\n version: string;\n\n // Bank display name to be used in user interfaces.\n // For consistency use \"Taler Bank\" if missing.\n // @since v4, will become mandatory in the next version.\n bank_name?: string;\n\n // Advertised base URL to use when you sharing an URL with another\n // program.\n // @since v4.\n base_url?: string;\n\n // If 'true' the server provides local currency conversion support\n // If 'false' some parts of the API are not supported and return 501\n allow_conversion?: boolean;\n\n // If 'true' anyone can register\n // If 'false' only the admin can\n allow_registrations?: boolean;\n\n // If 'true' account can delete themselves\n // If 'false' only the admin can delete accounts\n allow_deletions?: boolean;\n\n // If 'true' anyone can edit their name\n // If 'false' only admin can\n allow_edit_name?: boolean;\n\n // If 'true' anyone can edit their cashout account\n // If 'false' only the admin\n allow_edit_cashout_payto_uri?: boolean;\n\n // Default debt limit for newly created accounts\n default_debit_threshold?: AmountString;\n\n // Currency used by this bank.\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification: CurrencySpecification;\n\n // TAN channels supported by the server\n supported_tan_channels?: TanChannel[];\n\n // Wire transfer type supported by the bank.\n // Default to 'iban' is missing\n // @since v4, may become mandatory in the future.\n wire_type?: string;\n\n // Wire transfer execution fees.\n // @since v4, will become mandatory in the next version.\n wire_transfer_fees?: AmountString;\n}\n\nexport interface BankAccountCreateWithdrawalRequest {\n // Amount to withdraw. If given, the wallet\n // cannot change the amount.\n // Optional since **vC2EC**.\n amount?: AmountString;\n\n // Suggested amount to withdraw. The wallet can\n // still change the suggestion.\n // @since **vC2EC**\n suggested_amount?: AmountString;\n}\n\nexport interface BankAccountCreateWithdrawalResponse {\n // ID of the withdrawal, can be used to view/modify the withdrawal operation.\n withdrawal_id: string;\n\n // URI that can be passed to the wallet to initiate the withdrawal.\n taler_withdraw_uri: TalerUriString;\n}\nexport interface WithdrawalPublicInfo {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: WithdrawalOperationStatus;\n\n // Amount that will be withdrawn with this operation\n // (raw amount without fee considerations).\n amount?: AmountString;\n\n // Suggestion for the amount to be withdrawn with this\n // operation. Given if a suggestion was made but the\n // user may still change the amount.\n // Optional since **vC2EC**.\n suggested_amount?: AmountString;\n\n // Account username\n username: string;\n\n // Reserve public key selected by the exchange,\n // only non-null if status is selected or confirmed.\n selected_reserve_pub?: string;\n\n // Exchange account selected by the wallet\n // only non-null if status is selected or confirmed.\n selected_exchange_account?: PaytoString;\n}\n\nexport interface BankAccountTransactionsResponse {\n transactions: BankAccountTransactionInfo[];\n}\n\nexport interface BankAccountTransactionInfo {\n creditor_payto_uri: PaytoString;\n debtor_payto_uri: PaytoString;\n\n amount: AmountString;\n direction: \"debit\" | \"credit\";\n\n subject: string;\n\n // Transaction unique ID. Matches\n // $transaction_id from the URI.\n row_id: number;\n date: Timestamp;\n}\n\nexport interface CreateTransactionRequest {\n // Address in the Payto format of the wire transfer receiver.\n // It needs at least the 'message' query string parameter.\n payto_uri: PaytoString;\n\n // Transaction amount (in the $currency:x.y format), optional.\n // However, when not given, its value must occupy the 'amount'\n // query string parameter of the 'payto' field. In case it\n // is given in both places, the paytoUri's takes the precedence.\n amount?: AmountString;\n\n // Nonce to make the request idempotent. Requests with the same\n // request_uid that differ in any of the other fields\n // are rejected.\n // @since v4, will become mandatory in the next version.\n request_uid?: ShortHashCode;\n}\n\nexport interface CreateTransactionResponse {\n // ID identifying the transaction being created\n row_id: Integer;\n}\n\nexport interface RegisterAccountResponse {\n // Internal payto URI of this bank account.\n internal_payto_uri: PaytoString;\n}\n\nexport interface RegisterAccountRequest {\n // Username\n username: string;\n\n // Password.\n password: string;\n\n // Legal name of the account owner\n name: string;\n\n // Defaults to false.\n is_public?: boolean;\n\n // Is this a taler exchange account?\n // If true:\n // - incoming transactions to the account that do not\n // have a valid reserve public key are automatically\n // - the account provides the taler-wire-gateway-api endpoints\n // Defaults to false.\n is_taler_exchange?: boolean;\n\n // Addresses where to send the TAN for transactions.\n contact_data?: ChallengeContactData;\n\n // 'payto' address of a fiat bank account.\n // Payments will be sent to this bank account\n // when the user wants to convert the regional currency\n // back to fiat currency outside bank.\n cashout_payto_uri?: PaytoString;\n\n // Internal payto URI of this bank account.\n // Used mostly for testing.\n payto_uri?: PaytoString;\n\n // If present, set the max debit allowed for this user\n // Only admin can set this property.\n debit_threshold?: AmountString;\n\n // If present, set a custom minimum cashout amount for this account.\n // Only admin can set this property\n // @since v4\n min_cashout?: AmountString;\n\n // If present, enables 2FA and set the TAN channel used for challenges\n // Only admin can set this property, other user can reconfig their account\n // after creation.\n tan_channel?: TanChannel;\n}\n\nexport type EmailAddress = string;\nexport type PhoneNumber = string;\n\nexport interface ChallengeContactData {\n // E-Mail address\n email?: EmailAddress;\n\n // Phone number.\n phone?: PhoneNumber;\n}\n\nexport interface AccountReconfiguration {\n // Addresses where to send the TAN for transactions.\n // Currently only used for cashouts.\n // If missing, cashouts will fail.\n // In the future, might be used for other transactions\n // as well.\n // Only admin can change this property.\n contact_data?: ChallengeContactData;\n\n // 'payto' URI of a fiat bank account.\n // Payments will be sent to this bank account\n // when the user wants to convert the regional currency\n // back to fiat currency outside bank.\n // Only admin can change this property if not allowed in config\n cashout_payto_uri?: PaytoString;\n\n // If present, change the legal name associated with $username.\n // Only admin can change this property if not allowed in config\n name?: string;\n\n // Make this account visible to anyone?\n is_public?: boolean;\n\n // If present, change the max debit allowed for this user\n // Only admin can change this property.\n debit_threshold?: AmountString;\n\n // If present, change the custom minimum cashout amount for this account.\n // Only admin can set this property\n // @since v4\n min_cashout?: AmountString;\n\n // If present, enables 2FA and set the TAN channel used for challenges\n tan_channel?: TanChannel | null;\n}\n\nexport interface AccountPasswordChange {\n // New password.\n new_password: string;\n // Old password. If present, check that the old password matches.\n // Optional for admin account.\n old_password?: string;\n}\n\nexport interface PublicAccountsResponse {\n public_accounts: PublicAccount[];\n}\nexport interface PublicAccount {\n // Username of the account\n username: string;\n\n // Internal payto URI of this bank account.\n payto_uri: string;\n\n // Current balance of the account\n balance: Balance;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Opaque unique ID used for pagination.\n // @since v4, will become mandatory in the future.\n row_id?: Integer;\n}\n\nexport interface ListBankAccountsResponse {\n accounts: AccountMinimalData[];\n}\nexport interface Balance {\n amount: AmountString;\n credit_debit_indicator: \"credit\" | \"debit\";\n}\nexport interface AccountMinimalData {\n // Username\n username: string;\n\n // Legal name of the account owner.\n name: string;\n\n // Internal payto URI of this bank account.\n payto_uri: PaytoString;\n\n // current balance of the account\n balance: Balance;\n\n // Number indicating the max debit allowed for the requesting user.\n debit_threshold: AmountString;\n\n // Custom minimum cashout amount for this account.\n // If null or absent, the global conversion fee is used.\n // @since v4\n min_cashout?: AmountString;\n\n // Is this account visible to anyone?\n is_public: boolean;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Opaque unique ID used for pagination.\n // @since v4, will become mandatory in the future.\n row_id?: Integer;\n\n // Current status of the account\n // active: the account can be used\n // deleted: the account has been deleted but is retained for compliance\n // reasons, only the administrator can access it\n // Default to 'active' is missing\n // @since v4, will become mandatory in the next version.\n status?: \"active\" | \"deleted\";\n}\n\nexport interface AccountData {\n // Legal name of the account owner.\n name: string;\n\n // Available balance on the account.\n balance: Balance;\n\n // payto://-URI of the account.\n payto_uri: PaytoString;\n\n // Number indicating the max debit allowed for the requesting user.\n debit_threshold: AmountString;\n\n // Custom minimum cashout amount for this account.\n // If null or absent, the global conversion fee is used.\n // @since v4\n min_cashout?: AmountString;\n\n contact_data?: ChallengeContactData;\n\n // 'payto' address pointing the bank account\n // where to send cashouts. This field is optional\n // because not all the accounts are required to participate\n // in the merchants' circuit. One example is the exchange:\n // that never cashouts. Registering these accounts can\n // be done via the access API.\n cashout_payto_uri?: PaytoString;\n\n // Is this account visible to anyone?\n is_public: boolean;\n\n // Is this a taler exchange account?\n is_taler_exchange: boolean;\n\n // Is 2FA enabled and what channel is used for challenges?\n tan_channel?: TanChannel;\n\n // Current status of the account\n // active: the account can be used\n // deleted: the account has been deleted but is retained for compliance\n // reasons, only the administrator can access it\n // Default to 'active' is missing\n // @since v4, will become mandatory in the next version.\n status?: \"active\" | \"deleted\";\n}\n\nexport interface CashoutRequest {\n // Nonce to make the request idempotent. Requests with the same\n // request_uid that differ in any of the other fields\n // are rejected.\n request_uid: ShortHashCode;\n\n // Optional subject to associate to the\n // cashout operation. This data will appear\n // as the incoming wire transfer subject in\n // the user's fiat bank account.\n subject?: string;\n\n // That is the plain amount that the user specified\n // to cashout. Its $currency is the (regional) currency of the\n // bank instance.\n amount_debit: AmountString;\n\n // That is the amount that will effectively be\n // transferred by the bank to the user's bank\n // account, that is external to the regional currency.\n // It is expressed in the fiat currency and\n // is calculated after the cashout fee and the\n // exchange rate. See the /cashout-rates call.\n // The client needs to calculate this amount\n // correctly based on the amount_debit and the cashout rate,\n // otherwise the request will fail.\n amount_credit: AmountString;\n}\n\nexport interface CashoutResponse {\n // ID identifying the operation being created\n cashout_id: number;\n}\n\n/**\n * @deprecated since 4, use 2fa\n */\nexport interface CashoutConfirmRequest {\n // the TAN that confirms $CASHOUT_ID.\n tan: string;\n}\n\nexport interface Cashouts {\n // Every string represents a cash-out operation ID.\n cashouts: CashoutInfo[];\n}\n\nexport interface CashoutInfo {\n cashout_id: number;\n}\nexport interface GlobalCashouts {\n // Every string represents a cash-out operation ID.\n cashouts: GlobalCashoutInfo[];\n}\nexport interface GlobalCashoutInfo {\n cashout_id: number;\n username: string;\n}\n\nexport interface CashoutStatusResponse {\n // Amount debited to the internal\n // regional currency bank account.\n amount_debit: AmountString;\n\n // Amount credited to the external bank account.\n amount_credit: AmountString;\n\n // Transaction subject.\n subject: string;\n\n // Time when the cashout was created.\n creation_time: Timestamp;\n}\n\nexport interface ConversionRatesResponse {\n // Exchange rate to buy the local currency from the external one\n buy_at_ratio: DecimalNumber;\n\n // Exchange rate to sell the local currency for the external one\n sell_at_ratio: DecimalNumber;\n\n // Fee to subtract after applying the buy ratio.\n buy_in_fee: DecimalNumber;\n\n // Fee to subtract after applying the sell ratio.\n sell_out_fee: DecimalNumber;\n}\n\nexport enum MonitorTimeframeParam {\n hour,\n day,\n month,\n year,\n decade,\n}\n\nexport type MonitorResponse = MonitorNoConversion | MonitorWithConversion;\n\n// Monitoring stats when conversion is not supported\nexport interface MonitorNoConversion {\n type: \"no-conversions\";\n\n // How many payments were made to a Taler exchange by another\n // bank account.\n talerInCount: number;\n\n // Overall volume that has been paid to a Taler\n // exchange by another bank account.\n talerInVolume: AmountString;\n\n // How many payments were made by a Taler exchange to another\n // bank account.\n talerOutCount: number;\n\n // Overall volume that has been paid by a Taler\n // exchange to another bank account.\n talerOutVolume: AmountString;\n}\n// Monitoring stats when conversion is supported\nexport interface MonitorWithConversion {\n type: \"with-conversions\";\n\n // How many cashin operations were confirmed by a\n // wallet owner. Note: wallet owners\n // are NOT required to be customers of the libeufin-bank.\n cashinCount: number;\n\n // Overall regional currency that has been paid by the regional admin account\n // to regional bank accounts to fulfill all the confirmed cashin operations.\n cashinRegionalVolume: AmountString;\n\n // Overall fiat currency that has been paid to the fiat admin account\n // by fiat bank accounts to fulfill all the confirmed cashin operations.\n cashinFiatVolume: AmountString;\n\n // How many cashout operations were confirmed.\n cashoutCount: number;\n\n // Overall regional currency that has been paid to the regional admin account\n // by fiat bank accounts to fulfill all the confirmed cashout operations.\n cashoutRegionalVolume: AmountString;\n\n // Overall fiat currency that has been paid by the fiat admin account\n // to fiat bank accounts to fulfill all the confirmed cashout operations.\n cashoutFiatVolume: AmountString;\n\n // How many payments were made to a Taler exchange by another\n // bank account.\n talerInCount: number;\n\n // Overall volume that has been paid to a Taler\n // exchange by another bank account.\n talerInVolume: AmountString;\n\n // How many payments were made by a Taler exchange to another\n // bank account.\n talerOutCount: number;\n\n // Overall volume that has been paid by a Taler\n // exchange to another bank account.\n talerOutVolume: AmountString;\n}\nexport interface TanTransmission {\n // Channel of the last successful transmission of the TAN challenge.\n tan_channel: TanChannel;\n\n // Info of the last successful transmission of the TAN challenge.\n tan_info: string;\n}\n\nexport interface Challenge {\n // Unique identifier of the challenge to solve to run this protected\n // operation.\n challenge_id: number;\n}\n\nexport interface ChallengeSolve {\n // The TAN code that solves $CHALLENGE_ID\n tan: string;\n}\n\nexport enum TanChannel {\n SMS = \"sms\",\n EMAIL = \"email\",\n}\n\nexport const codecForIntegrationBankConfig = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForConstString(\"taler-bank-integration\"))\n .property(\"version\", codecForString())\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .build(\"TalerCorebankApi.IntegrationConfig\");\n\nexport const codecForCoreBankConfig = (): Codec =>\n buildCodecForObject()\n .property(\n \"name\",\n codecForEither(\n codecForConstString(\"taler-corebank\"),\n codecForConstString(\"libeufin-bank\"),\n ),\n )\n .property(\"version\", codecForString())\n .property(\"bank_name\", codecOptional(codecForString()))\n .property(\"base_url\", codecOptional(codecForString()))\n .property(\"allow_conversion\", codecOptional(codecForBoolean()))\n .property(\"allow_registrations\", codecOptional(codecForBoolean()))\n .property(\"allow_deletions\", codecOptional(codecForBoolean()))\n .property(\"allow_edit_name\", codecOptional(codecForBoolean()))\n .property(\"allow_edit_cashout_payto_uri\", codecOptional(codecForBoolean()))\n .property(\"default_debit_threshold\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecForString())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\n \"supported_tan_channels\",\n codecOptional(\n codecForList(\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n ),\n ),\n )\n .property(\"wire_type\", codecOptionalDefault(codecForString(), \"iban\"))\n .property(\"wire_transfer_fees\", codecOptional(codecForAmountString()))\n .build(\"TalerCorebankApi.Config\");\n\nconst codecForBalance = (): Codec =>\n buildCodecForObject()\n .property(\"amount\", codecForAmountString())\n .property(\n \"credit_debit_indicator\",\n codecForEither(\n codecForConstString(\"credit\"),\n codecForConstString(\"debit\"),\n ),\n )\n .build(\"TalerCorebankApi.Balance\");\n\nconst codecForPublicAccount = (): Codec =>\n buildCodecForObject()\n .property(\"username\", codecForString())\n .property(\"balance\", codecForBalance())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\"row_id\", codecOptional(codecForNumber()))\n .build(\"TalerCorebankApi.PublicAccount\");\n\nexport const codecForPublicAccountsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"public_accounts\", codecForList(codecForPublicAccount()))\n .build(\"TalerCorebankApi.PublicAccountsResponse\");\n\nexport const codecForAccountMinimalData = (): Codec =>\n buildCodecForObject()\n .property(\"username\", codecForString())\n .property(\"name\", codecForString())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"balance\", codecForBalance())\n .property(\"row_id\", codecForNumber())\n .property(\"debit_threshold\", codecForAmountString())\n .property(\"min_cashout\", codecOptional(codecForAmountString()))\n .property(\"is_public\", codecForBoolean())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\n \"status\",\n codecOptional(\n codecForEither(\n codecForConstString(\"active\"),\n codecForConstString(\"deleted\"),\n ),\n ),\n )\n .build(\"TalerCorebankApi.AccountMinimalData\");\n\nexport const codecForListBankAccountsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"accounts\", codecForList(codecForAccountMinimalData()))\n .build(\"TalerCorebankApi.ListBankAccountsResponse\");\n\nexport const codecForAccountData = (): Codec =>\n buildCodecForObject()\n .property(\"name\", codecForString())\n .property(\"balance\", codecForBalance())\n .property(\"payto_uri\", codecForPaytoString())\n .property(\"debit_threshold\", codecForAmountString())\n .property(\"min_cashout\", codecOptional(codecForAmountString()))\n .property(\"contact_data\", codecOptional(codecForChallengeContactData()))\n .property(\"cashout_payto_uri\", codecOptional(codecForPaytoString()))\n .property(\"is_public\", codecForBoolean())\n .property(\"is_taler_exchange\", codecForBoolean())\n .property(\n \"tan_channel\",\n codecOptional(\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n ),\n )\n .property(\n \"status\",\n codecOptional(\n codecForEither(\n codecForConstString(\"active\"),\n codecForConstString(\"deleted\"),\n ),\n ),\n )\n .build(\"TalerCorebankApi.AccountData\");\n\nexport const codecForChallengeContactData = (): Codec =>\n buildCodecForObject()\n .property(\"email\", codecOptional(codecForString()))\n .property(\"phone\", codecOptional(codecForString()))\n .build(\"TalerCorebankApi.ChallengeContactData\");\n\nexport const codecForWithdrawalPublicInfo = (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"username\", codecForString())\n .property(\"selected_reserve_pub\", codecOptional(codecForString()))\n .property(\"selected_exchange_account\", codecOptional(codecForPaytoString()))\n .build(\"TalerCorebankApi.WithdrawalPublicInfo\");\n\nexport const codecForBankAccountTransactionsResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"transactions\",\n codecForList(codecForBankAccountTransactionInfo()),\n )\n .build(\"TalerCorebankApi.BankAccountTransactionsResponse\");\n\nexport const codecForBankAccountTransactionInfo =\n (): Codec =>\n buildCodecForObject()\n .property(\"creditor_payto_uri\", codecForPaytoString())\n .property(\"debtor_payto_uri\", codecForPaytoString())\n .property(\"amount\", codecForAmountString())\n .property(\n \"direction\",\n codecForEither(\n codecForConstString(\"debit\"),\n codecForConstString(\"credit\"),\n ),\n )\n .property(\"subject\", codecForString())\n .property(\"row_id\", codecForNumber())\n .property(\"date\", codecForTimestamp)\n .build(\"TalerCorebankApi.BankAccountTransactionInfo\");\n\nexport const codecForCreateTransactionResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"row_id\", codecForNumber())\n .build(\"TalerCorebankApi.CreateTransactionResponse\");\n\nexport const codecForRegisterAccountResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"internal_payto_uri\", codecForPaytoString())\n .build(\"TalerCorebankApi.RegisterAccountResponse\");\n\nexport const codecForBankAccountCreateWithdrawalResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"taler_withdraw_uri\", codecForTalerUriString())\n .property(\"withdrawal_id\", codecForString())\n .build(\"TalerCorebankApi.BankAccountCreateWithdrawalResponse\");\n\nexport const codecForCashoutPending = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .build(\"TalerCorebankApi.CashoutPending\");\n\nexport const codecForCashouts = (): Codec =>\n buildCodecForObject()\n .property(\"cashouts\", codecForList(codecForCashoutInfo()))\n .build(\"TalerCorebankApi.Cashouts\");\n\nexport const codecForCashoutInfo = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .build(\"TalerCorebankApi.CashoutInfo\");\n\nexport const codecForGlobalCashouts = (): Codec =>\n buildCodecForObject()\n .property(\"cashouts\", codecForList(codecForGlobalCashoutInfo()))\n .build(\"TalerCorebankApi.GlobalCashouts\");\n\nexport const codecForGlobalCashoutInfo = (): Codec =>\n buildCodecForObject()\n .property(\"cashout_id\", codecForNumber())\n .property(\"username\", codecForString())\n .build(\"TalerCorebankApi.GlobalCashoutInfo\");\n\nexport const codecForCashoutStatusResponse = (): Codec =>\n buildCodecForObject()\n .property(\"amount_debit\", codecForAmountString())\n .property(\"amount_credit\", codecForAmountString())\n .property(\"subject\", codecForString())\n .property(\"creation_time\", codecForTimestamp)\n .build(\"TalerCorebankApi.CashoutStatusResponse\");\n\nexport const codecForConversionRatesResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\"buy_at_ratio\", codecForDecimalNumber())\n .property(\"buy_in_fee\", codecForDecimalNumber())\n .property(\"sell_at_ratio\", codecForDecimalNumber())\n .property(\"sell_out_fee\", codecForDecimalNumber())\n .build(\"TalerCorebankApi.ConversionRatesResponse\");\n\nexport const codecForMonitorResponse = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"no-conversions\", codecForMonitorNoConversion())\n .alternative(\"with-conversions\", codecForMonitorWithCashout())\n .build(\"TalerWireGatewayApi.IncomingBankTransaction\");\n\nexport const codecForMonitorNoConversion = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"no-conversions\"))\n .property(\"talerInCount\", codecForNumber())\n .property(\"talerInVolume\", codecForAmountString())\n .property(\"talerOutCount\", codecForNumber())\n .property(\"talerOutVolume\", codecForAmountString())\n .build(\"TalerCorebankApi.MonitorJustPayouts\");\n\nexport const codecForMonitorWithCashout = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"with-conversions\"))\n .property(\"cashinCount\", codecForNumber())\n .property(\"cashinFiatVolume\", codecForAmountString())\n .property(\"cashinRegionalVolume\", codecForAmountString())\n .property(\"cashoutCount\", codecForNumber())\n .property(\"cashoutFiatVolume\", codecForAmountString())\n .property(\"cashoutRegionalVolume\", codecForAmountString())\n .property(\"talerInCount\", codecForNumber())\n .property(\"talerInVolume\", codecForAmountString())\n .property(\"talerOutCount\", codecForNumber())\n .property(\"talerOutVolume\", codecForAmountString())\n .build(\"TalerCorebankApi.MonitorWithCashout\");\n\nexport const codecForChallenge = (): Codec =>\n buildCodecForObject()\n .property(\"challenge_id\", codecForNumber())\n .build(\"TalerCorebankApi.Challenge\");\n\nexport const codecForTanTransmission = (): Codec =>\n buildCodecForObject()\n .property(\n \"tan_channel\",\n codecForEither(\n codecForConstString(TanChannel.SMS),\n codecForConstString(TanChannel.EMAIL),\n ),\n )\n .property(\"tan_info\", codecForString())\n .build(\"TalerCorebankApi.TanTransmission\");\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n AccessToken,\n HttpStatusCode,\n LibtoolVersion,\n LongPollParams,\n OperationAlternative,\n OperationFail,\n OperationOk,\n PaginationParams,\n TalerError,\n TalerErrorCode,\n UserAndToken,\n codecForTalerCommonConfigResponse,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n opKnownTalerFailure,\n} from \"@gnu-taler/taler-util\";\nimport {\n HttpRequestLibrary,\n createPlatformHttpLib,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opFixedSuccess,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { WithdrawalOperationStatus } from \"../types-taler-bank-integration.js\";\nimport {\n codecForAccountData,\n codecForBankAccountCreateWithdrawalResponse,\n codecForBankAccountTransactionInfo,\n codecForBankAccountTransactionsResponse,\n codecForCashoutPending,\n codecForCashoutStatusResponse,\n codecForCashouts,\n codecForChallenge,\n codecForCoreBankConfig,\n codecForCreateTransactionResponse,\n codecForGlobalCashouts,\n codecForListBankAccountsResponse,\n codecForMonitorResponse,\n codecForPublicAccountsResponse,\n codecForRegisterAccountResponse,\n codecForTanTransmission,\n codecForWithdrawalPublicInfo,\n} from \"../types-taler-corebank.js\";\nimport {\n CacheEvictor,\n IdempotencyRetry,\n addLongPollingParam,\n addPaginationParams,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nimport * as TalerCorebankApi from \"../types-taler-corebank.js\";\n\nexport type TalerCoreBankResultByMethod<\n prop extends keyof TalerCoreBankHttpClient,\n> = ResultByMethod;\nexport type TalerCoreBankErrorsByMethod<\n prop extends keyof TalerCoreBankHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerCoreBankCacheEviction {\n DELETE_ACCOUNT,\n CREATE_ACCOUNT,\n UPDATE_ACCOUNT,\n UPDATE_PASSWORD,\n CREATE_TRANSACTION,\n CONFIRM_WITHDRAWAL,\n ABORT_WITHDRAWAL,\n CREATE_WITHDRAWAL,\n CREATE_CASHOUT,\n}\n\n/**\n * Protocol version spoken with the core bank.\n *\n * Endpoint must be ordered in the same way that in the docs\n * Response code (http and taler) must have the same order that in the docs\n * That way is easier to see changes\n *\n * Uses libtool's current:revision:age versioning.\n */\nexport class TalerCoreBankHttpClient {\n public readonly PROTOCOL_VERSION = \"4:0:0\";\n\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#config\n *\n */\n async getConfig(): Promise<\n OperationFail | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n // FIXME: Re-enable the check once fakebank and libeufin-bank return the name.\n // const expectedName = \"taler-corebank\";\n // if (minBody.name !== expectedName) {\n // throw TalerError.fromUncheckedDetail({\n // code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n // requestUrl: resp.requestUrl,\n // httpStatusCode: resp.status,\n // detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n // });\n // }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForCoreBankConfig(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // ACCOUNTS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts\n *\n */\n async createAccount(\n auth: AccessToken | undefined,\n body: TalerCorebankApi.RegisterAccountRequest,\n ) {\n const url = new URL(`accounts`, this.baseUrl);\n const headers: Record = {};\n if (auth) {\n headers.Authorization = makeBearerTokenAuthHeader(auth);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers: headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n TalerCoreBankCacheEviction.CREATE_ACCOUNT,\n );\n return opSuccessFromHttp(resp, codecForRegisterAccountResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_REGISTER_USERNAME_REUSE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_REGISTER_PAYTO_URI_REUSE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_TAN_CHANNEL:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHANNEL_NOT_SUPPORTED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_MISSING_TAN_INFO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-corebank.html#delete--accounts-$USERNAME\n *\n */\n async deleteAccount(auth: UserAndToken, cid?: string) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_RESERVED_USERNAME_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_ACCOUNT_BALANCE_NOT_ZERO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#patch--accounts-$USERNAME\n *\n */\n async updateAccount(\n auth: UserAndToken,\n body: TalerCorebankApi.AccountReconfiguration,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_LEGAL_NAME:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_NON_ADMIN_SET_MIN_CASHOUT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHANNEL_NOT_SUPPORTED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_MISSING_TAN_INFO:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#patch--accounts-$USERNAME-auth\n *\n */\n async updatePassword(\n auth: UserAndToken,\n body: TalerCorebankApi.AccountPasswordChange,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}/auth`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_PATCH_BAD_OLD_PASSWORD:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--public-accounts\n *\n */\n async getPublicAccounts(\n filter: { account?: string } = {},\n pagination?: PaginationParams,\n ) {\n const url = new URL(`public-accounts`, this.baseUrl);\n addPaginationParams(url, pagination);\n if (filter.account !== undefined) {\n url.searchParams.set(\"filter_name\", filter.account);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForPublicAccountsResponse());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ public_accounts: [] });\n case HttpStatusCode.NotFound:\n return opFixedSuccess({ public_accounts: [] });\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts\n *\n */\n async getAccounts(\n auth: AccessToken,\n filter: { account?: string } = {},\n pagination?: PaginationParams,\n ) {\n const url = new URL(`accounts`, this.baseUrl);\n addPaginationParams(url, pagination);\n if (filter.account !== undefined) {\n url.searchParams.set(\"filter_name\", filter.account);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForListBankAccountsResponse());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ accounts: [] });\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME\n *\n */\n async getAccount(auth: UserAndToken) {\n const url = new URL(`accounts/${auth.username}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAccountData());\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // TRANSACTIONS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-transactions\n *\n */\n async getTransactions(\n auth: UserAndToken,\n params?: PaginationParams & LongPollParams,\n ) {\n const url = new URL(`accounts/${auth.username}/transactions`, this.baseUrl);\n addPaginationParams(url, params);\n addLongPollingParam(url, params);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankAccountTransactionsResponse(),\n );\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ transactions: [] });\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-transactions-$TRANSACTION_ID\n *\n */\n async getTransactionById(auth: UserAndToken, txid: number) {\n const url = new URL(\n `accounts/${auth.username}/transactions/${String(txid)}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankAccountTransactionInfo());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-transactions\n *\n */\n async createTransaction(\n auth: UserAndToken,\n body: TalerCorebankApi.CreateTransactionRequest,\n idempotencyCheck: IdempotencyRetry | undefined,\n cid?: string,\n ): Promise<\n //manually definition all return types because of recursion\n | OperationOk\n | OperationAlternative\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n | OperationFail\n > {\n const url = new URL(`accounts/${auth.username}/transactions`, this.baseUrl);\n if (idempotencyCheck) {\n body.request_uid = idempotencyCheck.uid;\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCreateTransactionResponse());\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_ADMIN_CREDITOR:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_SAME_ACCOUNT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNKNOWN_CREDITOR:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED:\n if (!idempotencyCheck) {\n return opKnownTalerFailure(details.code, details);\n }\n const nextRetry = idempotencyCheck.next();\n return this.createTransaction(auth, body, nextRetry, cid);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // WITHDRAWALS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals\n *\n */\n async createWithdrawal(\n auth: UserAndToken,\n body: TalerCorebankApi.BankAccountCreateWithdrawalRequest,\n ) {\n const url = new URL(`accounts/${auth.username}/withdrawals`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankAccountCreateWithdrawalResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n //FIXME: missing in docs\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals-$WITHDRAWAL_ID-confirm\n *\n */\n async confirmWithdrawalById(auth: UserAndToken, wid: string, cid?: string) {\n const url = new URL(\n `accounts/${auth.username}/withdrawals/${wid}/confirm`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_CONFIRM_ABORT_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONFIRM_INCOMPLETE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-withdrawals-$WITHDRAWAL_ID-abort\n *\n */\n async abortWithdrawalById(auth: UserAndToken, wid: string) {\n const url = new URL(\n `accounts/${auth.username}/withdrawals/${wid}/abort`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--withdrawals-$WITHDRAWAL_ID\n *\n */\n async getWithdrawalById(\n wid: string,\n params?: {\n old_state?: WithdrawalOperationStatus;\n } & LongPollParams,\n ) {\n const url = new URL(`withdrawals/${wid}`, this.baseUrl);\n addLongPollingParam(url, params);\n if (params) {\n url.searchParams.set(\n \"old_state\",\n !params.old_state ? \"pending\" : params.old_state,\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWithdrawalPublicInfo());\n //FIXME: missing in docs\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // CASHOUTS\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-cashouts\n *\n */\n async createCashout(\n auth: UserAndToken,\n body: TalerCorebankApi.CashoutRequest,\n cid?: string,\n ) {\n const url = new URL(`accounts/${auth.username}/cashouts`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n \"X-Challenge-Id\": cid,\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutPending());\n case HttpStatusCode.Accepted:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForChallenge(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TRANSFER_REQUEST_UID_REUSED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONVERSION_AMOUNT_TO_SMALL:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_BAD_CONVERSION:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNALLOWED_DEBIT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_CONFIRM_INCOMPLETE:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.BadGateway: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHANNEL_SCRIPT_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-cashouts-$CASHOUT_ID\n *\n */\n async getCashoutById(auth: UserAndToken, cid: number) {\n const url = new URL(\n `accounts/${auth.username}/cashouts/${cid}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashoutStatusResponse());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--accounts-$USERNAME-cashouts\n *\n */\n async getAccountCashouts(auth: UserAndToken, pagination?: PaginationParams) {\n const url = new URL(`accounts/${auth.username}/cashouts`, this.baseUrl);\n addPaginationParams(url, pagination);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForCashouts());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ cashouts: [] });\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--cashouts\n *\n */\n async getGlobalCashouts(auth: AccessToken, pagination?: PaginationParams) {\n const url = new URL(`cashouts`, this.baseUrl);\n addPaginationParams(url, pagination);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForGlobalCashouts());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ cashouts: [] });\n case HttpStatusCode.NotImplemented:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // 2FA\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-challenge-$CHALLENGE_ID\n *\n */\n async sendChallenge(auth: UserAndToken, cid: string) {\n const url = new URL(\n `accounts/${auth.username}/challenge/${cid}`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTanTransmission());\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHANNEL_SCRIPT_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-challenge-$CHALLENGE_ID-confirm\n *\n */\n async confirmChallenge(\n auth: UserAndToken,\n cid: string,\n body: TalerCorebankApi.ChallengeSolve,\n ) {\n const url = new URL(\n `accounts/${auth.username}/challenge/${cid}/confirm`,\n this.baseUrl,\n );\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth.token),\n },\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const details = await readTalerErrorResponse(resp);\n switch (details.code) {\n case TalerErrorCode.BANK_TAN_CHALLENGE_EXPIRED:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_TAN_CHALLENGE_FAILED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // MONITOR\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#get--monitor\n *\n */\n async getMonitor(\n auth: AccessToken,\n params: {\n timeframe?: TalerCorebankApi.MonitorTimeframeParam;\n date?: AbsoluteTime;\n } = {},\n ) {\n const url = new URL(`monitor`, this.baseUrl);\n if (params.timeframe) {\n url.searchParams.set(\n \"timeframe\",\n TalerCorebankApi.MonitorTimeframeParam[params.timeframe],\n );\n }\n if (params.date) {\n const { t_s: seconds } = AbsoluteTime.toProtocolTimestamp(params.date);\n if (seconds !== \"never\") {\n url.searchParams.set(\"date_s\", String(seconds));\n }\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(auth),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForMonitorResponse());\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Others API\n //\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getIntegrationAPI(): URL {\n return new URL(`taler-integration/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getWireGatewayAPI(username: string): URL {\n return new URL(`accounts/${username}/taler-wire-gateway/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#taler-bank-integration-api\n *\n */\n getRevenueAPI(username: string): URL {\n return new URL(`accounts/${username}/taler-revenue/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token\n *\n */\n getAuthenticationAPI(username: string): URL {\n return new URL(`accounts/${username}/`, this.baseUrl);\n }\n\n /**\n * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token\n *\n */\n getConversionInfoAPI(): URL {\n return new URL(`conversion-info/`, this.baseUrl);\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { Codec, buildCodecForObject, codecForConstString, codecForEither, codecOptional } from \"./codec.js\";\nimport { codecForAmountString, codecForList, codecForString } from \"./index.js\";\nimport { PaytoString, codecForPaytoString } from \"./payto.js\";\nimport { AmountString, CurrencySpecification, codecForCurrencyName, codecForCurrencySpecificiation, codecForLibtoolVersion, codecForURLString } from \"./types-taler-common.js\";\n\nexport type WithdrawalOperationStatus =\n | \"pending\"\n | \"selected\"\n | \"aborted\"\n | \"confirmed\";\n\nexport interface BankVersion {\n // libtool-style representation of the Bank protocol version, see\n // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning\n // The format is \"current:revision:age\".\n version: string;\n\n // Currency used by this bank.\n currency: string;\n\n // How the bank SPA should render this currency.\n currency_specification?: CurrencySpecification;\n\n // Name of the API.\n name: \"taler-bank-integration\";\n}\n\nexport interface BankWithdrawalOperationStatus {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: WithdrawalOperationStatus;\n\n // Currency used for the withdrawal.\n // MUST be present when amount is absent.\n // @since v2, may become mandatory in the future.\n currency?: string;\n\n // Amount that will be withdrawn with this operation\n // (raw amount without fee considerations). Only\n // given once the amount is fixed and cannot be changed.\n // Optional since **vC2EC**.\n amount?: AmountString | undefined;\n\n // Suggestion for the amount to be withdrawn with this\n // operation. Given if a suggestion was made but the\n // user may still change the amount.\n // Optional since **vC2EC**.\n suggested_amount?: AmountString | undefined;\n\n // Maximum amount that the wallet can choose to withdraw.\n // Only applicable when the amount is not fixed.\n // @since **vC2EC**.\n max_amount?: AmountString | undefined;\n\n // The non-Taler card fees the customer will have\n // to pay to the bank / payment service provider\n // they are using to make the withdrawal.\n // @since **vC2EC**\n card_fees?: AmountString | undefined;\n\n // Bank account of the customer that is debiting, as an\n // RFC 8905 payto URI.\n sender_wire?: PaytoString;\n\n // Base URL of the suggested exchange. The bank may have\n // neither a suggestion nor a requirement for the exchange.\n // This value is typically set in the bank's configuration.\n suggested_exchange?: string;\n\n // Base URL of an exchange that must be used. Optional,\n // not given *unless* a particular exchange is mandatory.\n // This value is typically set in the bank's configuration.\n // @since **vC2EC**\n required_exchange?: string;\n\n // URL that the user needs to navigate to in order to\n // complete some final confirmation (e.g. 2FA).\n // Only applicable when status is selected or pending.\n // It may contain the withdrawal operation id.\n confirm_transfer_url?: string;\n\n // Wire transfer types supported by the bank.\n wire_types: string[];\n\n // Reserve public key selected by the exchange,\n // only non-null if status is selected or confirmed.\n selected_reserve_pub?: string;\n\n // Exchange account selected by the wallet;\n // only non-null if status is selected or confirmed.\n // @since **v1**\n selected_exchange_account?: string;\n}\n\nexport interface BankWithdrawalOperationPostRequest {\n // Reserve public key that should become the wire transfer\n // subject to fund the withdrawal.\n reserve_pub: string;\n\n // Payto address of the exchange selected for the withdrawal.\n selected_exchange: PaytoString;\n\n // Selected amount to be transferred. Optional if the\n // backend already knows the amount.\n // @since **vC2EC**\n amount?: AmountString | undefined;\n}\n\nexport interface BankWithdrawalOperationPostResponse {\n // Current status of the operation\n // pending: the operation is pending parameters selection (exchange and reserve public key)\n // selected: the operations has been selected and is pending confirmation\n // aborted: the operation has been aborted\n // confirmed: the transfer has been confirmed and registered by the bank\n status: Omit<\"pending\", WithdrawalOperationStatus>;\n\n // URL that the user needs to navigate to in order to\n // complete some final confirmation (e.g. 2FA).\n //\n // Only applicable when status is selected or pending.\n // It may contain withdrawal operation id\n confirm_transfer_url?: string;\n}\n\n\nexport const codecForBankVersion =\n (): Codec =>\n buildCodecForObject()\n .property(\"currency\", codecForCurrencyName())\n .property(\"currency_specification\", codecForCurrencySpecificiation())\n .property(\"name\", codecForConstString(\"taler-bank-integration\"))\n .property(\"version\", codecForLibtoolVersion())\n .build(\"TalerBankIntegrationApi.BankVersion\");\n\nexport const codecForBankWithdrawalOperationStatus =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"pending\"),\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"amount\", codecOptional(codecForAmountString()))\n .property(\"currency\", codecOptional(codecForCurrencyName()))\n .property(\"suggested_amount\", codecOptional(codecForAmountString()))\n .property(\"card_fees\", codecOptional(codecForAmountString()))\n .property(\"sender_wire\", codecOptional(codecForPaytoString()))\n .property(\"suggested_exchange\", codecOptional(codecForURLString()))\n .property(\"confirm_transfer_url\", codecOptional(codecForURLString()))\n .property(\"wire_types\", codecForList(codecForString()))\n .property(\"selected_reserve_pub\", codecOptional(codecForString()))\n .property(\"selected_exchange_account\", codecOptional(codecForString()))\n .property(\"max_amount\", codecOptional(codecForAmountString()))\n .build(\"TalerBankIntegrationApi.BankWithdrawalOperationStatus\");\n\nexport const codecForBankWithdrawalOperationPostResponse =\n (): Codec =>\n buildCodecForObject()\n .property(\n \"status\",\n codecForEither(\n codecForConstString(\"selected\"),\n codecForConstString(\"aborted\"),\n codecForConstString(\"confirmed\"),\n ),\n )\n .property(\"confirm_transfer_url\", codecOptional(codecForURLString()))\n .build(\"TalerBankIntegrationApi.BankWithdrawalOperationPostResponse\");", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport { Logger } from \"../logging.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opEmptySuccess,\n opKnownHttpFailure,\n opKnownTalerFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport {\n BankWithdrawalOperationPostRequest,\n WithdrawalOperationStatus,\n codecForBankWithdrawalOperationPostResponse,\n codecForBankWithdrawalOperationStatus,\n} from \"../types-taler-bank-integration.js\";\nimport { LongPollParams } from \"../types-taler-common.js\";\nimport { codecForIntegrationBankConfig } from \"../types-taler-corebank.js\";\nimport { codecForTalerErrorDetail } from \"../types-taler-wallet.js\";\nimport { addLongPollingParam } from \"./utils.js\";\n\nexport type TalerBankIntegrationResultByMethod<\n prop extends keyof TalerBankIntegrationHttpClient,\n> = ResultByMethod;\nexport type TalerBankIntegrationErrorsByMethod<\n prop extends keyof TalerBankIntegrationHttpClient,\n> = FailCasesByMethod;\n\nconst logger = new Logger(\"bank-integration.ts\");\n\n/**\n * The API is used by the wallets.\n */\nexport class TalerBankIntegrationHttpClient {\n public static readonly PROTOCOL_VERSION = \"2:0:1\";\n public readonly PROTOCOL_VERSION =\n TalerBankIntegrationHttpClient.PROTOCOL_VERSION;\n\n httpLib: HttpRequestLibrary;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForIntegrationBankConfig());\n default:\n logger.warn(`config request failed, status ${resp.status}`);\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#get--withdrawal-operation-$WITHDRAWAL_ID\n *\n */\n async getWithdrawalOperationById(\n woid: string,\n params?: {\n old_state?: WithdrawalOperationStatus;\n } & LongPollParams,\n ) {\n const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);\n addLongPollingParam(url, params);\n if (params) {\n url.searchParams.set(\n \"old_state\",\n !params.old_state ? \"pending\" : params.old_state,\n );\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankWithdrawalOperationStatus());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid\n *\n */\n async completeWithdrawalOperationById(\n woid: string,\n body: BankWithdrawalOperationPostRequest,\n ) {\n const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForBankWithdrawalOperationPostResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict: {\n const body = await readTalerErrorResponse(resp);\n const details = codecForTalerErrorDetail().decode(body);\n switch (details.code) {\n case TalerErrorCode.BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_DUPLICATE_RESERVE_PUB_SUBJECT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_UNKNOWN_ACCOUNT:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_ACCOUNT_IS_NOT_EXCHANGE:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_AMOUNT_DIFFERS:\n return opKnownTalerFailure(details.code, details);\n case TalerErrorCode.BANK_AMOUNT_REQUIRED:\n return opKnownTalerFailure(details.code, details);\n default:\n return opUnknownFailure(resp, details);\n }\n }\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid\n *\n */\n async abortWithdrawalOperationById(woid: string) {\n const url = new URL(`withdrawal-operation/${woid}/abort`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Taler; see the file COPYING. If not, see \n\n SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Imports.\n */\nimport { HttpRequestLibrary, readTalerErrorResponse } from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport {\n FailCasesByMethod,\n ResultByMethod,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport {\n codecForChallengeInvalidPinResponse,\n codecForChallengeResponse,\n codecForChallengeSetupResponse,\n codecForChallengeSolveResponse,\n codecForChallengeStatus,\n codecForChallengerAuthResponse,\n codecForChallengerInfoResponse,\n codecForChallengerTermsOfServiceResponse,\n} from \"../types-taler-challenger.js\";\nimport { AccessToken } from \"../types-taler-common.js\";\nimport {\n CacheEvictor,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type ChallengerResultByMethod =\n ResultByMethod;\nexport type ChallengerErrorsByMethod =\n FailCasesByMethod;\n\nexport enum ChallengerCacheEviction {\n CREATE_CHALLENGE,\n SOLVE_CHALLENGE,\n}\n\n/**\n */\nexport class ChallengerHttpClient {\n httpLib: HttpRequestLibrary;\n cacheEvictor: CacheEvictor;\n public readonly PROTOCOL_VERSION = \"1:0:0\";\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-challenger.html#get--config\n *\n */\n async getConfig() {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForChallengerTermsOfServiceResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-challenger.html#post--setup-$CLIENT_ID\n *\n */\n async setup(clientId: string, token: AccessToken) {\n const url = new URL(`setup/${clientId}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengeSetupResponse());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // LOGIN\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--authorize-$NONCE\n *\n */\n async login(\n nonce: string,\n clientId: string,\n redirectUri: string,\n state: string | undefined,\n ) {\n const url = new URL(`authorize/${nonce}`, this.baseUrl);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"client_id\", clientId);\n url.searchParams.set(\"redirect_uri\", redirectUri);\n if (state) {\n url.searchParams.set(\"state\", state);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengeStatus());\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // CHALLENGE\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--challenge-$NONCE\n *\n */\n async challenge(nonce: string, body: Record) {\n const url = new URL(`challenge/${nonce}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: new URLSearchParams(Object.entries(body)).toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n redirect: \"manual\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n ChallengerCacheEviction.CREATE_CHALLENGE,\n );\n return opSuccessFromHttp(resp, codecForChallengeResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // SOLVE\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--solve-$NONCE\n *\n */\n async solve(nonce: string, body: Record) {\n const url = new URL(`solve/${nonce}`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body: new URLSearchParams(Object.entries(body)).toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n redirect: \"manual\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n await this.cacheEvictor.notifySuccess(\n ChallengerCacheEviction.SOLVE_CHALLENGE,\n );\n return opSuccessFromHttp(resp, codecForChallengeSolveResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownAlternativeFailure(\n resp,\n HttpStatusCode.Forbidden,\n codecForChallengeInvalidPinResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.TooManyRequests:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.InternalServerError:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // AUTH\n\n /**\n * https://docs.taler.net/core/api-challenger.html#post--token\n *\n */\n async token(\n client_id: string,\n redirect_uri: string,\n client_secret: AccessToken,\n code: string,\n ) {\n const url = new URL(`token`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams(\n Object.entries({\n client_id,\n redirect_uri,\n client_secret,\n code,\n grant_type: \"authorization_code\",\n }),\n ).toString(),\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengerAuthResponse());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // INFO\n\n /**\n * https://docs.taler.net/core/api-challenger.html#get--info\n *\n */\n async info(token: AccessToken) {\n const url = new URL(`info`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n Authorization: makeBearerTokenAuthHeader(token),\n },\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForChallengerInfoResponse());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "import {\n HttpRequestLibrary,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"../http-common.js\";\nimport { HttpStatusCode } from \"../http-status-codes.js\";\nimport { createPlatformHttpLib } from \"../http.js\";\nimport { LibtoolVersion } from \"../libtool-version.js\";\nimport { hash } from \"../nacl-fast.js\";\nimport {\n FailCasesByMethod,\n OperationFail,\n OperationOk,\n ResultByMethod,\n opEmptySuccess,\n opFixedSuccess,\n opKnownHttpFailure,\n opSuccessFromHttp,\n opUnknownFailure,\n} from \"../operation.js\";\nimport {\n TalerSignaturePurpose,\n amountToBuffer,\n bufferForUint32,\n buildSigPS,\n decodeCrock,\n eddsaSign,\n encodeCrock,\n stringToBytes,\n timestampRoundedToBuffer,\n} from \"../taler-crypto.js\";\nimport {\n OfficerAccount,\n PaginationParams,\n SigningKey,\n codecForTalerCommonConfigResponse,\n} from \"../types-taler-common.js\";\nimport {\n codecForAmlDecisionDetails,\n codecForAmlRecords,\n codecForExchangeConfig,\n codecForExchangeKeys,\n} from \"../types-taler-exchange.js\";\nimport { CacheEvictor, addPaginationParams, nullEvictor } from \"./utils.js\";\n\nimport { TalerError } from \"../errors.js\";\nimport { TalerErrorCode } from \"../taler-error-codes.js\";\nimport * as TalerExchangeApi from \"../types-taler-exchange.js\";\n\nexport type TalerExchangeResultByMethod<\n prop extends keyof TalerExchangeHttpClient,\n> = ResultByMethod;\nexport type TalerExchangeErrorsByMethod<\n prop extends keyof TalerExchangeHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerExchangeCacheEviction {\n CREATE_DESCISION,\n}\n\n/**\n */\nexport class TalerExchangeHttpClient {\n httpLib: HttpRequestLibrary;\n public readonly PROTOCOL_VERSION = \"18:0:1\";\n cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n /**\n * https://docs.taler.net/core/api-exchange.html#get--seed\n *\n */\n async getSeed() {\n const url = new URL(`seed`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n const buffer = await resp.bytes();\n const uintar = new Uint8Array(buffer);\n\n return opFixedSuccess(uintar);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-exchange.html#get--config\n *\n */\n async getConfig(): Promise<\n | OperationFail\n | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n const expectedName = \"taler-exchange\";\n if (minBody.name !== expectedName) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n });\n }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForExchangeConfig(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n *\n * PARTIALLY IMPLEMENTED!!\n */\n async getKeys() {\n const url = new URL(`keys`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForExchangeKeys());\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n // TERMS\n\n //\n // AML operations\n //\n\n /**\n * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decisions-$STATE\n *\n */\n async getDecisionsByState(\n auth: OfficerAccount,\n state: TalerExchangeApi.AmlState,\n pagination?: PaginationParams,\n ) {\n const url = new URL(\n `aml/${auth.id}/decisions/${TalerExchangeApi.AmlState[state]}`,\n this.baseUrl,\n );\n addPaginationParams(url, pagination);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n \"Taler-AML-Officer-Signature\": buildQuerySignature(auth.signingKey),\n },\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAmlRecords());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ records: [] });\n //this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-decision-$H_PAYTO\n *\n */\n async getDecisionDetails(auth: OfficerAccount, account: string) {\n const url = new URL(`aml/${auth.id}/decision/${account}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers: {\n \"Taler-AML-Officer-Signature\": buildQuerySignature(auth.signingKey),\n },\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAmlDecisionDetails());\n case HttpStatusCode.NoContent:\n return opFixedSuccess({ aml_history: [], kyc_attributes: [] });\n //this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-exchange.html#post--aml-$OFFICER_PUB-decision\n *\n */\n async addDecisionDetails(\n auth: OfficerAccount,\n decision: Omit,\n ) {\n const url = new URL(`aml/${auth.id}/decision`, this.baseUrl);\n\n const body = buildDecisionSignature(auth.signingKey, decision);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n //FIXME: this should be unauthorized\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n //FIXME: this two need to be split by error code\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n\nfunction buildQuerySignature(key: SigningKey): string {\n const sigBlob = buildSigPS(\n TalerSignaturePurpose.TALER_SIGNATURE_AML_QUERY,\n ).build();\n\n return encodeCrock(eddsaSign(sigBlob, key));\n}\n\nfunction buildDecisionSignature(\n key: SigningKey,\n decision: Omit,\n): TalerExchangeApi.AmlDecision {\n const zero = new Uint8Array(new ArrayBuffer(64));\n\n const sigBlob = buildSigPS(TalerSignaturePurpose.TALER_SIGNATURE_AML_DECISION)\n //TODO: new need the null terminator, also in the exchange\n .put(hash(stringToBytes(decision.justification))) //check null\n .put(timestampRoundedToBuffer(decision.decision_time))\n .put(amountToBuffer(decision.new_threshold))\n .put(decodeCrock(decision.h_payto))\n .put(zero) //kyc_requirement\n .put(bufferForUint32(decision.new_state))\n .build();\n\n const officer_sig = encodeCrock(eddsaSign(sigBlob, key));\n return {\n ...decision,\n officer_sig,\n };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AccessToken,\n FailCasesByMethod,\n HttpStatusCode,\n LibtoolVersion,\n OperationFail,\n OperationOk,\n PaginationParams,\n ResultByMethod,\n TalerError,\n TalerErrorCode,\n TalerMerchantApi,\n TalerMerchantConfigResponse,\n codecForAbortResponse,\n codecForAccountAddResponse,\n codecForAccountKycRedirects,\n codecForAccountsSummaryResponse,\n codecForBankAccountDetail,\n codecForClaimResponse,\n codecForInstancesResponse,\n codecForInventorySummaryResponse,\n codecForMerchantOrderPrivateStatusResponse,\n codecForMerchantPosProductDetail,\n codecForMerchantRefundResponse,\n codecForOrderHistory,\n codecForOtpDeviceDetails,\n codecForOtpDeviceSummaryResponse,\n codecForOutOfStockResponse,\n codecForPaidRefundStatusResponse,\n codecForPaymentResponse,\n codecForPostOrderResponse,\n codecForProductDetail,\n codecForQueryInstancesResponse,\n codecForStatusGoto,\n codecForStatusPaid,\n codecForStatusStatusUnpaid,\n codecForTalerCommonConfigResponse,\n codecForTalerMerchantConfigResponse,\n codecForTansferList,\n codecForTemplateDetails,\n codecForTemplateSummaryResponse,\n codecForTokenFamiliesList,\n codecForTokenFamilyDetails,\n codecForWalletRefundResponse,\n codecForWalletTemplateDetails,\n codecForWebhookDetails,\n codecForWebhookSummaryResponse,\n opEmptySuccess,\n opKnownAlternativeFailure,\n opKnownHttpFailure,\n} from \"@gnu-taler/taler-util\";\nimport {\n HttpRequestLibrary,\n HttpResponse,\n createPlatformHttpLib,\n readSuccessResponseJsonOrThrow,\n readTalerErrorResponse,\n} from \"@gnu-taler/taler-util/http\";\nimport { opSuccessFromHttp, opUnknownFailure } from \"../operation.js\";\nimport {\n CacheEvictor,\n addMerchantPaginationParams,\n makeBearerTokenAuthHeader,\n nullEvictor,\n} from \"./utils.js\";\n\nexport type TalerMerchantInstanceResultByMethod<\n prop extends keyof TalerMerchantInstanceHttpClient,\n> = ResultByMethod;\nexport type TalerMerchantInstanceErrorsByMethod<\n prop extends keyof TalerMerchantInstanceHttpClient,\n> = FailCasesByMethod;\n\nexport enum TalerMerchantInstanceCacheEviction {\n CREATE_ORDER,\n UPDATE_ORDER,\n DELETE_ORDER,\n UPDATE_CURRENT_INSTANCE,\n DELETE_CURRENT_INSTANCE,\n CREATE_BANK_ACCOUNT,\n UPDATE_BANK_ACCOUNT,\n DELETE_BANK_ACCOUNT,\n CREATE_PRODUCT,\n UPDATE_PRODUCT,\n DELETE_PRODUCT,\n CREATE_TRANSFER,\n DELETE_TRANSFER,\n CREATE_DEVICE,\n UPDATE_DEVICE,\n DELETE_DEVICE,\n CREATE_TEMPLATE,\n UPDATE_TEMPLATE,\n DELETE_TEMPLATE,\n CREATE_WEBHOOK,\n UPDATE_WEBHOOK,\n DELETE_WEBHOOK,\n CREATE_TOKENFAMILY,\n UPDATE_TOKENFAMILY,\n DELETE_TOKENFAMILY,\n LAST,\n}\n\nexport enum TalerMerchantManagementCacheEviction {\n CREATE_INSTANCE = TalerMerchantInstanceCacheEviction.LAST + 1,\n UPDATE_INSTANCE,\n DELETE_INSTANCE,\n}\n\n/**\n * Protocol version spoken with the core bank.\n *\n * Endpoint must be ordered in the same way that in the docs\n * Response code (http and taler) must have the same order that in the docs\n * That way is easier to see changes\n *\n * Uses libtool's current:revision:age versioning.\n */\nexport class TalerMerchantInstanceHttpClient {\n public readonly PROTOCOL_VERSION = \"15:0:0\";\n\n readonly httpLib: HttpRequestLibrary;\n readonly cacheEvictor: CacheEvictor;\n\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n cacheEvictor?: CacheEvictor,\n ) {\n this.httpLib = httpClient ?? createPlatformHttpLib();\n this.cacheEvictor = cacheEvictor ?? nullEvictor;\n }\n\n isCompatible(version: string): boolean {\n const compare = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);\n return compare?.compatible ?? false;\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--config\n */\n async getConfig(): Promise<\n | OperationFail\n | OperationOk\n > {\n const url = new URL(`config`, this.baseUrl);\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n const minBody = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerCommonConfigResponse(),\n );\n const expectedName = \"taler-merchant\";\n if (minBody.name !== expectedName) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unexpected server component name (got ${minBody.name}, expected ${expectedName}})`,\n });\n }\n if (!this.isCompatible(minBody.version)) {\n throw TalerError.fromUncheckedDetail({\n code: TalerErrorCode.GENERIC_CLIENT_UNSUPPORTED_PROTOCOL_VERSION,\n requestUrl: resp.requestUrl,\n httpStatusCode: resp.status,\n detail: `Unsupported protocol version, client supports ${this.PROTOCOL_VERSION}, server supports ${minBody.version}`,\n });\n }\n // Now that we've checked the basic body, re-parse the full response.\n const body = await readSuccessResponseJsonOrThrow(\n resp,\n codecForTalerMerchantConfigResponse(),\n );\n return {\n type: \"ok\",\n body,\n };\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Wallet API\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-claim\n */\n async claimOrder(orderId: string, body: TalerMerchantApi.ClaimRequest) {\n const url = new URL(`orders/${orderId}/claim`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForClaimResponse());\n }\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-pay\n */\n async makePayment(orderId: string, body: TalerMerchantApi.PayRequest) {\n const url = new URL(`orders/${orderId}/pay`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPaymentResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.PaymentRequired:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.RequestTimeout:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.PreconditionFailed:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-orders-$ORDER_ID\n */\n\n async getPaymentStatus(\n orderId: string,\n params: TalerMerchantApi.PaymentStatusRequestParams = {},\n ) {\n const url = new URL(`orders/${orderId}`, this.baseUrl);\n\n if (params.allowRefundedForRepurchase !== undefined) {\n url.searchParams.set(\n \"allow_refunded_for_repurchase\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.awaitRefundObtained !== undefined) {\n url.searchParams.set(\n \"await_refund_obtained\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.claimToken !== undefined) {\n url.searchParams.set(\"token\", params.claimToken);\n }\n if (params.contractTermHash !== undefined) {\n url.searchParams.set(\"h_contract\", params.contractTermHash);\n }\n if (params.refund !== undefined) {\n url.searchParams.set(\"refund\", params.refund);\n }\n if (params.sessionId !== undefined) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout !== undefined) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n // body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForStatusPaid());\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForStatusGoto());\n // case HttpStatusCode.Found: not possible since content is not HTML\n case HttpStatusCode.PaymentRequired:\n return opSuccessFromHttp(resp, codecForStatusStatusUnpaid());\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotAcceptable:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#demonstrating-payment\n */\n async demostratePayment(orderId: string, body: TalerMerchantApi.PaidRequest) {\n const url = new URL(`orders/${orderId}/paid`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPaidRefundStatusResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#aborting-incomplete-payments\n */\n async abortIncompletePayment(\n orderId: string,\n body: TalerMerchantApi.AbortRequest,\n ) {\n const url = new URL(`orders/${orderId}/abort`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForAbortResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#obtaining-refunds\n */\n async obtainRefund(\n orderId: string,\n body: TalerMerchantApi.WalletRefundRequest,\n ) {\n const url = new URL(`orders/${orderId}/refund`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForWalletRefundResponse());\n }\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-auth\n */\n async updateCurrentInstanceAuthentication(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceAuthConfigurationMessage,\n ) {\n const url = new URL(`private/auth`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: // FIXME: missing in docs\n return opEmptySuccess(resp);\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private\n */\n async updateCurrentInstance(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceReconfigurationMessage,\n ) {\n const url = new URL(`private`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_CURRENT_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private\n *\n */\n async getCurrentInstanceDetails(token: AccessToken) {\n const url = new URL(`private`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForQueryInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private\n */\n async deleteCurrentInstance(\n token: AccessToken | undefined,\n params: { purge?: boolean } = {},\n ) {\n const url = new URL(`private`, this.baseUrl);\n\n if (params.purge !== undefined) {\n url.searchParams.set(\"purge\", params.purge ? \"YES\" : \"NO\");\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_CURRENT_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--instances-$INSTANCE-private-kyc\n */\n async getCurrentIntanceKycStatus(\n token: AccessToken | undefined,\n params: TalerMerchantApi.GetKycStatusRequestParams = {},\n ) {\n const url = new URL(`private/kyc`, this.baseUrl);\n\n if (params.wireHash) {\n url.searchParams.set(\"h_wire\", params.wireHash);\n }\n if (params.exchangeURL) {\n url.searchParams.set(\"exchange_url\", params.exchangeURL);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForAccountKycRedirects());\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForAccountKycRedirects(),\n );\n case HttpStatusCode.ServiceUnavailable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Bank Accounts\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-accounts\n */\n async addBankAccount(\n token: AccessToken | undefined,\n body: TalerMerchantApi.AccountAddDetails,\n ) {\n const url = new URL(`private/accounts`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_BANK_ACCOUNT,\n );\n return opSuccessFromHttp(resp, codecForAccountAddResponse());\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async updateBankAccount(\n token: AccessToken | undefined,\n wireAccount: string,\n body: TalerMerchantApi.AccountPatchDetails,\n ) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_BANK_ACCOUNT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts\n */\n async listBankAccounts(token: AccessToken, params?: PaginationParams) {\n const url = new URL(`private/accounts`, this.baseUrl);\n\n // addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForAccountsSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async getBankAccountDetails(\n token: AccessToken | undefined,\n wireAccount: string,\n ) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForBankAccountDetail());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-accounts-$H_WIRE\n */\n async deleteBankAccount(token: AccessToken | undefined, wireAccount: string) {\n const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_BANK_ACCOUNT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Inventory Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-products\n */\n async addProduct(\n token: AccessToken | undefined,\n body: TalerMerchantApi.ProductAddDetail,\n ) {\n const url = new URL(`private/products`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-products-$PRODUCT_ID\n */\n async updateProduct(\n token: AccessToken | undefined,\n productId: string,\n body: TalerMerchantApi.ProductPatchDetail,\n ) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products\n */\n async listProducts(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/products`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForInventorySummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: not in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-pos\n */\n async getPointOfSaleInventory(token: AccessToken | undefined) {\n const url = new URL(`private/pos`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForMerchantPosProductDetail());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products-$PRODUCT_ID\n */\n async getProductDetails(token: AccessToken | undefined, productId: string) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForProductDetail());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#reserving-inventory\n */\n async lockProduct(\n token: AccessToken | undefined,\n productId: string,\n body: TalerMerchantApi.LockRequest,\n ) {\n const url = new URL(`private/products/${productId}/lock`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#removing-products-from-inventory\n */\n async deleteProduct(token: AccessToken | undefined, productId: string) {\n const url = new URL(`private/products/${productId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_PRODUCT,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Payment processing\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders\n */\n async createOrder(\n token: AccessToken | undefined,\n body: TalerMerchantApi.PostOrderRequest,\n ) {\n const url = new URL(`private/orders`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n return this.procesOrderCreationResponse(resp);\n }\n\n private async procesOrderCreationResponse(resp: HttpResponse) {\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForPostOrderResponse());\n }\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForOutOfStockResponse(),\n );\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#inspecting-orders\n */\n async listOrders(\n token: AccessToken | undefined,\n params: TalerMerchantApi.ListOrdersRequestParams = {},\n ) {\n const url = new URL(`private/orders`, this.baseUrl);\n\n if (params.date) {\n url.searchParams.set(\"date_s\", String(params.date));\n }\n if (params.fulfillmentUrl) {\n url.searchParams.set(\"fulfillment_url\", params.fulfillmentUrl);\n }\n if (params.paid !== undefined) {\n url.searchParams.set(\"paid\", params.paid ? \"YES\" : \"NO\");\n }\n if (params.refunded !== undefined) {\n url.searchParams.set(\"refunded\", params.refunded ? \"YES\" : \"NO\");\n }\n if (params.sessionId) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout\", String(params.timeout));\n }\n if (params.wired !== undefined) {\n url.searchParams.set(\"wired\", params.wired ? \"YES\" : \"NO\");\n }\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOrderHistory());\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-orders-$ORDER_ID\n */\n async getOrderDetails(\n token: AccessToken | undefined,\n orderId: string,\n params: TalerMerchantApi.GetOrderRequestParams = {},\n ) {\n const url = new URL(`private/orders/${orderId}`, this.baseUrl);\n\n if (params.allowRefundedForRepurchase !== undefined) {\n url.searchParams.set(\n \"allow_refunded_for_repurchase\",\n params.allowRefundedForRepurchase ? \"YES\" : \"NO\",\n );\n }\n if (params.sessionId) {\n url.searchParams.set(\"session_id\", params.sessionId);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(\n resp,\n codecForMerchantOrderPrivateStatusResponse(),\n );\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.GatewayTimeout:\n return opKnownAlternativeFailure(\n resp,\n resp.status,\n codecForOutOfStockResponse(),\n );\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#private-order-data-cleanup\n */\n async forgetOrder(\n token: AccessToken | undefined,\n orderId: string,\n body: TalerMerchantApi.ForgetRequest,\n ) {\n const url = new URL(`private/orders/${orderId}/forget`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadRequest:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-orders-$ORDER_ID\n */\n async deleteOrder(token: AccessToken | undefined, orderId: string) {\n const url = new URL(`private/orders/${orderId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_ORDER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Refunds\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders-$ORDER_ID-refund\n */\n async addRefund(\n token: AccessToken | undefined,\n orderId: string,\n body: TalerMerchantApi.RefundRequest,\n ) {\n const url = new URL(`private/orders/${orderId}/refund`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_ORDER,\n );\n return opSuccessFromHttp(resp, codecForMerchantRefundResponse());\n }\n case HttpStatusCode.Forbidden:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Gone:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Wire Transfer\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-transfers\n */\n async informWireTransfer(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TransferInformation,\n ) {\n const url = new URL(`private/transfers`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TRANSFER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-transfers\n */\n async listWireTransfers(\n token: AccessToken | undefined,\n params: TalerMerchantApi.ListWireTransferRequestParams = {},\n ) {\n const url = new URL(`private/transfers`, this.baseUrl);\n\n if (params.after) {\n url.searchParams.set(\"after\", String(params.after));\n }\n if (params.before) {\n url.searchParams.set(\"before\", String(params.before));\n }\n if (params.paytoURI) {\n url.searchParams.set(\"payto_uri\", params.paytoURI);\n }\n if (params.verified !== undefined) {\n url.searchParams.set(\"verified\", params.verified ? \"YES\" : \"NO\");\n }\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTansferList());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-transfers-$TID\n */\n async deleteWireTransfer(token: AccessToken | undefined, transferId: string) {\n const url = new URL(`private/transfers/${transferId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TRANSFER,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // OTP Devices\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-otp-devices\n */\n async addOtpDevice(\n token: AccessToken | undefined,\n body: TalerMerchantApi.OtpDeviceAddDetails,\n ) {\n const url = new URL(`private/otp-devices`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async updateOtpDevice(\n token: AccessToken | undefined,\n deviceId: string,\n body: TalerMerchantApi.OtpDevicePatchDetails,\n ) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices\n */\n async listOtpDevices(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/otp-devices`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOtpDeviceSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async getOtpDeviceDetails(\n token: AccessToken | undefined,\n deviceId: string,\n params: TalerMerchantApi.GetOtpDeviceRequestParams = {},\n ) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n if (params.faketime) {\n url.searchParams.set(\"faketime\", String(params.faketime));\n }\n if (params.price) {\n url.searchParams.set(\"price\", params.price);\n }\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForOtpDeviceDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID\n */\n async deleteOtpDevice(token: AccessToken | undefined, deviceId: string) {\n const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_DEVICE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // Templates\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-templates\n */\n async addTemplate(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TemplateAddDetails,\n ) {\n const url = new URL(`private/templates`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async updateTemplate(\n token: AccessToken | undefined,\n templateId: string,\n body: TalerMerchantApi.TemplatePatchDetails,\n ) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#inspecting-template\n */\n async listTemplates(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/templates`, this.baseUrl);\n\n addMerchantPaginationParams(url, params);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTemplateSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async getTemplateDetails(token: AccessToken | undefined, templateId: string) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTemplateDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID\n */\n async deleteTemplate(token: AccessToken | undefined, templateId: string) {\n const url = new URL(`private/templates/${templateId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TEMPLATE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-templates-$TEMPLATE_ID\n */\n async useTemplateGetInfo(templateId: string) {\n const url = new URL(`templates/${templateId}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n });\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWalletTemplateDetails());\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-templates-$TEMPLATE_ID\n */\n async useTemplateCreateOrder(\n templateId: string,\n body: TalerMerchantApi.UsingTemplateDetails,\n ) {\n const url = new URL(`templates/${templateId}`, this.baseUrl);\n\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n });\n\n return this.procesOrderCreationResponse(resp);\n }\n\n //\n // Webhooks\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-webhooks\n */\n async addWebhook(\n token: AccessToken | undefined,\n body: TalerMerchantApi.WebhookAddDetails,\n ) {\n const url = new URL(`private/webhooks`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async updateWebhook(\n token: AccessToken | undefined,\n webhookId: string,\n body: TalerMerchantApi.WebhookPatchDetails,\n ) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks\n */\n async listWebhooks(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/webhooks`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForWebhookSummaryResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async getWebhookDetails(token: AccessToken | undefined, webhookId: string) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opSuccessFromHttp(resp, codecForWebhookDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID\n */\n async deleteWebhook(token: AccessToken | undefined, webhookId: string) {\n const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_WEBHOOK,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n //\n // token families\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-tokenfamilies\n */\n async createTokenFamily(\n token: AccessToken | undefined,\n body: TalerMerchantApi.TokenFamilyCreateRequest,\n ) {\n const url = new URL(`private/tokenfamilies`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.CREATE_TOKENFAMILY,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async updateTokenFamily(\n token: AccessToken | undefined,\n tokenSlug: string,\n body: TalerMerchantApi.TokenFamilyUpdateRequest,\n ) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Ok: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.UPDATE_TOKENFAMILY,\n );\n return opSuccessFromHttp(resp, codecForTokenFamilyDetails());\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies\n */\n async listTokenFamilies(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`private/tokenfamilies`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTokenFamiliesList());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async getTokenFamilyDetails(\n token: AccessToken | undefined,\n tokenSlug: string,\n ) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForTokenFamilyDetails());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG\n */\n async deleteTokenFamily(token: AccessToken | undefined, tokenSlug: string) {\n const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheEvictor.notifySuccess(\n TalerMerchantInstanceCacheEviction.DELETE_TOKENFAMILY,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * Get the auth api against the current instance\n *\n * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-token\n * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-token\n */\n getAuthenticationAPI(): URL {\n return new URL(`private/`, this.baseUrl);\n }\n}\n\nexport type TalerMerchantManagementResultByMethod<\n prop extends keyof TalerMerchantManagementHttpClient,\n> = ResultByMethod;\nexport type TalerMerchantManagementErrorsByMethod<\n prop extends keyof TalerMerchantManagementHttpClient,\n> = FailCasesByMethod;\n\nexport class TalerMerchantManagementHttpClient extends TalerMerchantInstanceHttpClient {\n readonly cacheManagementEvictor: CacheEvictor<\n TalerMerchantInstanceCacheEviction | TalerMerchantManagementCacheEviction\n >;\n constructor(\n readonly baseUrl: string,\n httpClient?: HttpRequestLibrary,\n // cacheManagementEvictor?: CacheEvictor,\n cacheEvictor?: CacheEvictor<\n TalerMerchantInstanceCacheEviction | TalerMerchantManagementCacheEviction\n >,\n ) {\n super(baseUrl, httpClient, cacheEvictor);\n this.cacheManagementEvictor = cacheEvictor ?? nullEvictor;\n }\n\n getSubInstanceAPI(instanceId: string) {\n return new URL(`instances/${instanceId}/`, this.baseUrl);\n }\n\n //\n // Instance Management\n //\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post--management-instances\n */\n async createInstance(\n token: AccessToken | undefined,\n body: TalerMerchantApi.InstanceConfigurationMessage,\n ) {\n const url = new URL(`management/instances`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.CREATE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#post--management-instances-$INSTANCE-auth\n */\n async updateInstanceAuthentication(\n token: AccessToken | undefined,\n instanceId: string,\n body: TalerMerchantApi.InstanceAuthConfigurationMessage,\n ) {\n const url = new URL(\n `management/instances/${instanceId}/auth`,\n this.baseUrl,\n );\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"POST\",\n body,\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#patch--management-instances-$INSTANCE\n */\n async updateInstance(\n token: AccessToken | undefined,\n instanceId: string,\n body: TalerMerchantApi.InstanceReconfigurationMessage,\n ) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"PATCH\",\n body,\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.UPDATE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances\n */\n async listInstances(\n token: AccessToken | undefined,\n params?: PaginationParams,\n ) {\n const url = new URL(`management/instances`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE\n *\n */\n async getInstanceDetails(token: AccessToken | undefined, instanceId: string) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n\n switch (resp.status) {\n case HttpStatusCode.Ok:\n return opSuccessFromHttp(resp, codecForQueryInstancesResponse());\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#delete--management-instances-$INSTANCE\n */\n async deleteInstance(\n token: AccessToken | undefined,\n instanceId: string,\n params: { purge?: boolean } = {},\n ) {\n const url = new URL(`management/instances/${instanceId}`, this.baseUrl);\n\n if (params.purge !== undefined) {\n url.searchParams.set(\"purge\", params.purge ? \"YES\" : \"NO\");\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"DELETE\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.NoContent: {\n this.cacheManagementEvictor.notifySuccess(\n TalerMerchantManagementCacheEviction.DELETE_INSTANCE,\n );\n return opEmptySuccess(resp);\n }\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.NotFound:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n\n /**\n * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE-kyc\n */\n async getIntanceKycStatus(\n token: AccessToken | undefined,\n instanceId: string,\n params: TalerMerchantApi.GetKycStatusRequestParams,\n ) {\n const url = new URL(`management/instances/${instanceId}/kyc`, this.baseUrl);\n\n if (params.wireHash) {\n url.searchParams.set(\"h_wire\", params.wireHash);\n }\n if (params.exchangeURL) {\n url.searchParams.set(\"exchange_url\", params.exchangeURL);\n }\n if (params.timeout) {\n url.searchParams.set(\"timeout_ms\", String(params.timeout));\n }\n\n const headers: Record = {};\n if (token) {\n headers.Authorization = makeBearerTokenAuthHeader(token);\n }\n const resp = await this.httpLib.fetch(url.href, {\n method: \"GET\",\n headers,\n });\n switch (resp.status) {\n case HttpStatusCode.Accepted:\n return opSuccessFromHttp(resp, codecForAccountKycRedirects());\n case HttpStatusCode.NoContent:\n return opEmptySuccess(resp);\n case HttpStatusCode.NotFound:\n return opEmptySuccess(resp);\n case HttpStatusCode.Unauthorized: // FIXME: missing in docs\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.BadGateway:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.ServiceUnavailable:\n return opKnownHttpFailure(resp.status, resp);\n case HttpStatusCode.Conflict:\n return opKnownHttpFailure(resp.status, resp);\n default:\n return opUnknownFailure(resp, await readTalerErrorResponse(resp));\n }\n }\n}\n", "// @ts-ignore: no type decl for this library\nimport * as jedLib from \"jed\";\nimport { Logger } from \"./logging.js\";\n\nconst logger = new Logger(\"i18n/index.ts\");\n\nexport let jed: any = undefined;\n\n/**\n * Set up jed library for internationalization,\n * based on browser language settings.\n */\nexport function setupI18n(lang: string, strings: { [s: string]: any }): void {\n lang = lang.replace(\"_\", \"-\");\n\n if (!strings[lang]) {\n strings[lang] = {};\n // logger.warn(`language ${lang} not found, defaulting to source strings`);\n }\n jed = new jedLib.Jed(strings[lang]);\n}\n\n/**\n * Use different translations for testing. Should not be used outside\n * of test cases.\n */\nexport function internalSetStrings(langStrings: any): void {\n jed = new jedLib.Jed(langStrings);\n}\n\ndeclare const __translated: unique symbol;\nexport type TranslatedString = string & { [__translated]: true };\n\n/**\n * Convert template strings to a msgid\n */\nfunction toI18nString(stringSeq: ReadonlyArray): TranslatedString {\n let s = \"\";\n for (let i = 0; i < stringSeq.length; i++) {\n s += stringSeq[i];\n if (i < stringSeq.length - 1) {\n s += `%${i + 1}$s`;\n }\n }\n return s as TranslatedString;\n}\n\n/**\n * Internationalize a string template with arbitrary serialized values.\n */\nexport function singular(\n stringSeq: TemplateStringsArray,\n ...values: any[]\n): TranslatedString {\n const s = toI18nString(stringSeq);\n const tr = jed\n .translate(s)\n .ifPlural(1, s)\n .fetch(...values);\n return tr;\n}\n\n/**\n * Internationalize a string template without serializing\n */\nexport function translate(\n stringSeq: TemplateStringsArray,\n ...values: any[]\n): TranslatedString[] {\n const s = toI18nString(stringSeq);\n if (!s) return [];\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n return replacePlaceholderWithValues(translation, values);\n}\n\n/**\n * Internationalize a string template without serializing\n */\nexport function Translate({\n children,\n debug,\n}: {\n children: any;\n debug?: boolean;\n}): any {\n const c = [].concat(children);\n const s = stringifyArray(c);\n if (!s) return [];\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n if (debug) {\n console.log(\"looking for \", s, \"got\", translation);\n }\n return replacePlaceholderWithValues(translation, c);\n}\n\n/**\n * Get an internationalized string (based on the globally set, current language)\n * from a JSON object. Fall back to the default language of the JSON object\n * if no match exists.\n */\nexport function getJsonI18n(\n obj: Record,\n key: K,\n): string {\n return obj[key];\n}\n\nexport function getTranslatedArray(array: Array) {\n const s = stringifyArray(array);\n const translation: TranslatedString = jed.ngettext(s, s, 1);\n return replacePlaceholderWithValues(translation, array);\n}\n\nfunction replacePlaceholderWithValues(\n translation: TranslatedString,\n childArray: Array,\n): Array {\n const tr = translation.split(/%(\\d+)\\$s/);\n // const childArray = toChildArray(children);\n // Merge consecutive string children.\n const placeholderChildren = [];\n for (let i = 0; i < childArray.length; i++) {\n const x = childArray[i];\n if (x === undefined) {\n continue;\n } else if (typeof x === \"string\") {\n continue;\n } else {\n placeholderChildren.push(x);\n }\n }\n const result = [];\n for (let i = 0; i < tr.length; i++) {\n if (i % 2 == 0) {\n // Text\n result.push(tr[i]);\n } else {\n const childIdx = Number.parseInt(tr[i]) - 1;\n result.push(placeholderChildren[childIdx]);\n }\n }\n return result;\n}\n\nfunction stringifyArray(children: Array): string {\n let n = 1;\n const ss = children.map((c) => {\n if (typeof c === \"string\") {\n return c;\n }\n return `%${n++}$s`;\n });\n const s = ss.join(\"\").replace(/ +/g, \" \").trim();\n return s;\n}\n\nexport const i18n = {\n str: singular,\n singular,\n Translate,\n translate,\n};\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * IBAN validation.\n *\n * Currently only validates the checksum.\n *\n * It does not validate:\n * - Country-specific length\n * - Country-specific checksums\n *\n * The country list is also not complete.\n *\n * @author Florian Dold \n */\n\nexport type IbanValidationResult =\n | { type: \"invalid\" }\n | {\n type: \"valid\";\n normalizedIban: string;\n };\n\nexport interface IbanCountryInfo {\n name: string;\n isSepa?: boolean;\n length?: number;\n}\n\n/**\n * Incomplete list, see https://www.swift.com/resource/iban-registry-pdf\n */\nexport const ibanCountryInfoTable: Record = {\n AE: { name: \"U.A.E.\" },\n AF: { name: \"Afghanistan\" },\n AL: { name: \"Albania\" },\n AM: { name: \"Armenia\" },\n AN: { name: \"Netherlands Antilles\" },\n AR: { name: \"Argentina\" },\n AT: { name: \"Austria\" },\n AU: { name: \"Australia\" },\n AZ: { name: \"Azerbaijan\" },\n BA: { name: \"Bosnia and Herzegovina\" },\n BD: { name: \"Bangladesh\" },\n BE: { name: \"Belgium\" },\n BG: { name: \"Bulgaria\" },\n BH: { name: \"Bahrain\" },\n BN: { name: \"Brunei Darussalam\" },\n BO: { name: \"Bolivia\" },\n BR: { name: \"Brazil\" },\n BT: { name: \"Bhutan\" },\n BY: { name: \"Belarus\" },\n BZ: { name: \"Belize\" },\n CA: { name: \"Canada\" },\n CG: { name: \"Congo\" },\n CH: { name: \"Switzerland\" },\n CI: { name: \"Cote d'Ivoire\" },\n CL: { name: \"Chile\" },\n CM: { name: \"Cameroon\" },\n CN: { name: \"People's Republic of China\" },\n CO: { name: \"Colombia\" },\n CR: { name: \"Costa Rica\" },\n CS: { name: \"Serbia and Montenegro\" },\n CZ: { name: \"Czech Republic\" },\n DE: { name: \"Germany\" },\n DK: { name: \"Denmark\" },\n DO: { name: \"Dominican Republic\" },\n DZ: { name: \"Algeria\" },\n EC: { name: \"Ecuador\" },\n EE: { name: \"Estonia\" },\n EG: { name: \"Egypt\" },\n ER: { name: \"Eritrea\" },\n ES: { name: \"Spain\" },\n ET: { name: \"Ethiopia\" },\n FI: { name: \"Finland\" },\n FO: { name: \"Faroe Islands\" },\n FR: { name: \"France\" },\n GB: { name: \"United Kingdom\" },\n GD: { name: \"Caribbean\" },\n GE: { name: \"Georgia\" },\n GL: { name: \"Greenland\" },\n GR: { name: \"Greece\" },\n GT: { name: \"Guatemala\" },\n HK: { name: \"Hong Kong S.A.R.\" },\n HN: { name: \"Honduras\" },\n HR: { name: \"Croatia\" },\n HT: { name: \"Haiti\" },\n HU: { name: \"Hungary\" },\n ID: { name: \"Indonesia\" },\n IE: { name: \"Ireland\" },\n IL: { name: \"Israel\" },\n IN: { name: \"India\" },\n IQ: { name: \"Iraq\" },\n IR: { name: \"Iran\" },\n IS: { name: \"Iceland\" },\n IT: { name: \"Italy\" },\n JM: { name: \"Jamaica\" },\n JO: { name: \"Jordan\" },\n JP: { name: \"Japan\" },\n KE: { name: \"Kenya\" },\n KG: { name: \"Kyrgyzstan\" },\n KH: { name: \"Cambodia\" },\n KR: { name: \"South Korea\" },\n KW: { name: \"Kuwait\" },\n KZ: { name: \"Kazakhstan\" },\n LA: { name: \"Laos\" },\n LB: { name: \"Lebanon\" },\n LI: { name: \"Liechtenstein\" },\n LK: { name: \"Sri Lanka\" },\n LT: { name: \"Lithuania\" },\n LU: { name: \"Luxembourg\" },\n LV: { name: \"Latvia\" },\n LY: { name: \"Libya\" },\n MA: { name: \"Morocco\" },\n MC: { name: \"Principality of Monaco\" },\n MD: { name: \"Moldava\" },\n ME: { name: \"Montenegro\" },\n MK: { name: \"Former Yugoslav Republic of Macedonia\" },\n ML: { name: \"Mali\" },\n MM: { name: \"Myanmar\" },\n MN: { name: \"Mongolia\" },\n MO: { name: \"Macau S.A.R.\" },\n MT: { name: \"Malta\" },\n MV: { name: \"Maldives\" },\n MX: { name: \"Mexico\" },\n MY: { name: \"Malaysia\" },\n NG: { name: \"Nigeria\" },\n NI: { name: \"Nicaragua\" },\n NL: { name: \"Netherlands\" },\n NO: { name: \"Norway\" },\n NP: { name: \"Nepal\" },\n NZ: { name: \"New Zealand\" },\n OM: { name: \"Oman\" },\n PA: { name: \"Panama\" },\n PE: { name: \"Peru\" },\n PH: { name: \"Philippines\" },\n PK: { name: \"Islamic Republic of Pakistan\" },\n PL: { name: \"Poland\" },\n PR: { name: \"Puerto Rico\" },\n PT: { name: \"Portugal\" },\n PY: { name: \"Paraguay\" },\n QA: { name: \"Qatar\" },\n RE: { name: \"Reunion\" },\n RO: { name: \"Romania\" },\n RS: { name: \"Serbia\" },\n RU: { name: \"Russia\" },\n RW: { name: \"Rwanda\" },\n SA: { name: \"Saudi Arabia\" },\n SE: { name: \"Sweden\" },\n SG: { name: \"Singapore\" },\n SI: { name: \"Slovenia\" },\n SK: { name: \"Slovak\" },\n SN: { name: \"Senegal\" },\n SO: { name: \"Somalia\" },\n SR: { name: \"Suriname\" },\n SV: { name: \"El Salvador\" },\n SY: { name: \"Syria\" },\n TH: { name: \"Thailand\" },\n TJ: { name: \"Tajikistan\" },\n TM: { name: \"Turkmenistan\" },\n TN: { name: \"Tunisia\" },\n TR: { name: \"Turkey\" },\n TT: { name: \"Trinidad and Tobago\" },\n TW: { name: \"Taiwan\" },\n TZ: { name: \"Tanzania\" },\n UA: { name: \"Ukraine\" },\n US: { name: \"United States\" },\n UY: { name: \"Uruguay\" },\n VA: { name: \"Vatican\" },\n VE: { name: \"Venezuela\" },\n VN: { name: \"Viet Nam\" },\n YE: { name: \"Yemen\" },\n ZA: { name: \"South Africa\" },\n ZW: { name: \"Zimbabwe\" },\n};\n\nlet ccZero = \"0\".charCodeAt(0);\nlet ccNine = \"9\".charCodeAt(0);\nlet ccA = \"A\".charCodeAt(0);\nlet ccZ = \"Z\".charCodeAt(0);\n\n/**\n * Append a IBAN digit(s) based on a char code.\n */\nfunction appendDigit(digits: number[], cc: number): boolean {\n if (cc >= ccZero && cc <= ccNine) {\n digits.push(cc - ccZero);\n } else if (cc >= ccA && cc <= ccZ) {\n const n = cc - ccA + 10;\n digits.push(Math.floor(n / 10) % 10);\n digits.push(n % 10);\n } else {\n return false;\n }\n return true;\n}\n\n/**\n * Compute MOD-97-10 as per ISO/IEC 7064:2003.\n */\nfunction mod97(digits: number[]): number {\n let i = 0;\n let modAccum = 0;\n while (i < digits.length) {\n let n = 0;\n while (n < 9 && i < digits.length) {\n modAccum = modAccum * 10 + digits[i];\n i++;\n n++;\n }\n modAccum = modAccum % 97;\n }\n return modAccum;\n}\n\nexport function validateIban(ibanString: string): IbanValidationResult {\n let myIban = ibanString.toLocaleUpperCase().replace(\" \", \"\");\n let countryCode = myIban.substring(0, 2);\n let countryInfo = ibanCountryInfoTable[countryCode];\n\n if (!countryInfo) {\n return {\n type: \"invalid\",\n };\n }\n\n let digits: number[] = [];\n\n for (let i = 4; i < myIban.length; i++) {\n const cc = myIban.charCodeAt(i);\n if (!appendDigit(digits, cc)) {\n return {\n type: \"invalid\",\n };\n }\n }\n\n for (let i = 0; i < 4; i++) {\n if (!appendDigit(digits, ibanString.charCodeAt(i))) {\n return {\n type: \"invalid\",\n };\n }\n }\n\n const rem = mod97(digits);\n if (rem === 1) {\n return {\n type: \"valid\",\n normalizedIban: myIban,\n };\n } else {\n return {\n type: \"invalid\",\n };\n }\n}\n\nexport function generateIban(countryCode: string, length: number): string {\n let ibanSuffix = \"\";\n let digits: number[] = [];\n\n for (let i = 0; i < length; i++) {\n const cc = ccZero + (Math.floor(Math.random() * 100) % 10);\n appendDigit(digits, cc);\n ibanSuffix += String.fromCharCode(cc);\n }\n\n appendDigit(digits, countryCode.charCodeAt(0));\n appendDigit(digits, countryCode.charCodeAt(1));\n\n // Try using \"00\" as check digits\n appendDigit(digits, ccZero);\n appendDigit(digits, ccZero);\n\n const requiredChecksum = 98 - mod97(digits);\n\n const checkDigit1 = Math.floor(requiredChecksum / 10) % 10;\n const checkDigit2 = requiredChecksum % 10;\n\n return countryCode + checkDigit1 + checkDigit2 + ibanSuffix;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2019-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type and schema definitions for notifications from the wallet to clients\n * of the wallet.\n */\n\n/**\n * Imports.\n */\nimport { AbsoluteTime } from \"./time.js\";\nimport { TransactionState } from \"./types-taler-wallet-transactions.js\";\nimport {\n ExchangeEntryState,\n TalerErrorDetail,\n TransactionIdStr,\n} from \"./types-taler-wallet.js\";\n\nexport enum NotificationType {\n BalanceChange = \"balance-change\",\n BackupOperationError = \"backup-error\",\n TransactionStateTransition = \"transaction-state-transition\",\n /**\n * @deprecated\n */\n WithdrawalOperationTransition = \"withdrawal-operation-transition\",\n ExchangeStateTransition = \"exchange-state-transition\",\n Idle = \"idle\",\n TaskObservabilityEvent = \"task-observability-event\",\n RequestObservabilityEvent = \"request-observability-event\",\n}\n\nexport interface ErrorInfoSummary {\n code: number;\n hint?: string;\n message?: string;\n}\n\nexport interface TransactionStateTransitionNotification {\n type: NotificationType.TransactionStateTransition;\n transactionId: string;\n oldTxState: TransactionState;\n newTxState: TransactionState;\n errorInfo?: ErrorInfoSummary;\n\n /**\n * Additional \"user data\" that is dependent on the\n * state transition.\n *\n * Usage should be avoided.\n *\n * Currently used to notify the iOS app about\n * the KYC URL.\n */\n experimentalUserData?: any;\n}\n\nexport interface ExchangeStateTransitionNotification {\n type: NotificationType.ExchangeStateTransition;\n /**\n * Identification of the exchange entry that this\n * notification is about.\n */\n exchangeBaseUrl: string;\n\n /**\n * If missing, the notification means that\n * the exchange entry is newly created.\n */\n oldExchangeState?: ExchangeEntryState;\n\n /**\n * New state of the exchange.\n */\n newExchangeState: ExchangeEntryState;\n\n /**\n * Summary of the error that occurred when trying to update the exchange entry,\n * if applicable.\n */\n errorInfo?: ErrorInfoSummary;\n}\n\nexport interface BalanceChangeNotification {\n type: NotificationType.BalanceChange;\n\n /**\n * Transaction ID of the transaction that caused the balance update.\n *\n * Only used as a hint for debugging, should not be relied upon by clients.\n */\n hintTransactionId: string;\n}\n\nexport interface TaskProgressNotification {\n type: NotificationType.TaskObservabilityEvent;\n taskId: string;\n event: ObservabilityEvent;\n}\n\nexport interface RequestProgressNotification {\n type: NotificationType.RequestObservabilityEvent;\n requestId: string;\n operation: string;\n event: ObservabilityEvent;\n}\n\nexport enum ObservabilityEventType {\n HttpFetchStart = \"http-fetch-start\",\n HttpFetchFinishError = \"http-fetch-finish-error\",\n HttpFetchFinishSuccess = \"http-fetch-finish-success\",\n DbQueryStart = \"db-query-start\",\n DbQueryFinishSuccess = \"db-query-finish-success\",\n DbQueryFinishError = \"db-query-finish-error\",\n RequestStart = \"request-start\",\n RequestFinishSuccess = \"request-finish-success\",\n RequestFinishError = \"request-finish-error\",\n TaskStart = \"task-start\",\n TaskStop = \"task-stop\",\n TaskReset = \"task-reset\",\n ShepherdTaskResult = \"shepherd-task-result\",\n DeclareTaskDependency = \"declare-task-dependency\",\n CryptoStart = \"crypto-start\",\n CryptoFinishSuccess = \"crypto-finish-success\",\n CryptoFinishError = \"crypto-finish-error\",\n Message = \"message\",\n /**\n * Declare that an observability event is relevant to a particular transaction.\n * If emitted from a request/task, all past/future events for that request/task\n * should be shown for the transaction as well.\n */\n DeclareConcernsTransaction = \"declare-concerns-transaction\",\n}\n\nexport type ObservabilityEvent =\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchStart;\n url: string;\n }\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchFinishSuccess;\n url: string;\n status: number;\n }\n | {\n id: string;\n when: AbsoluteTime;\n type: ObservabilityEventType.HttpFetchFinishError;\n url: string;\n error: TalerErrorDetail;\n }\n | {\n type: ObservabilityEventType.DbQueryStart;\n name: string;\n location: string;\n }\n | {\n type: ObservabilityEventType.DbQueryFinishSuccess;\n name: string;\n location: string;\n }\n | {\n type: ObservabilityEventType.DbQueryFinishError;\n name: string;\n location: string;\n error: TalerErrorDetail;\n }\n | {\n type: ObservabilityEventType.RequestStart;\n }\n | {\n type: ObservabilityEventType.RequestFinishSuccess;\n durationMs: number;\n }\n | {\n type: ObservabilityEventType.RequestFinishError;\n }\n | {\n type: ObservabilityEventType.TaskStart;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.TaskStop;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.TaskReset;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.DeclareTaskDependency;\n taskId: string;\n }\n | {\n type: ObservabilityEventType.CryptoStart;\n operation: string;\n }\n | {\n type: ObservabilityEventType.CryptoFinishSuccess;\n operation: string;\n }\n | {\n type: ObservabilityEventType.CryptoFinishError;\n operation: string;\n }\n | {\n type: ObservabilityEventType.ShepherdTaskResult;\n resultType: string;\n }\n | {\n type: ObservabilityEventType.Message;\n contents: string;\n }\n | {\n type: ObservabilityEventType.DeclareConcernsTransaction;\n transactionId: TransactionIdStr;\n };\n\nexport interface BackupOperationErrorNotification {\n type: NotificationType.BackupOperationError;\n error: TalerErrorDetail;\n}\n/**\n * This notification is required to signal UI that\n * the withdrawal operation changed the state.\n *\n * https://bugs.gnunet.org/view.php?id=8099\n */\nexport interface WithdrawalOperationTransitionNotification {\n type: NotificationType.WithdrawalOperationTransition;\n uri: string;\n}\n\nexport interface IdleNotification {\n type: NotificationType.Idle;\n}\n\nexport type WalletNotification =\n | BalanceChangeNotification\n | WithdrawalOperationTransitionNotification\n | BackupOperationErrorNotification\n | ExchangeStateTransitionNotification\n | TransactionStateTransitionNotification\n | TaskProgressNotification\n | RequestProgressNotification\n | IdleNotification;\n", "/*\n This file is part of GNU Taler\n (C) 2019-2020 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * @fileoverview\n * Construction and parsing of taler:// URIs.\n * Specification: https://lsd.gnunet.org/lsd0006/\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, DecodingError, renderContext } from \"./codec.js\";\nimport { canonicalizeBaseUrl } from \"./helpers.js\";\nimport { opFixedSuccess, opKnownTalerFailure } from \"./operation.js\";\nimport { TalerErrorCode } from \"./taler-error-codes.js\";\nimport { AmountString } from \"./types-taler-common.js\";\nimport { URL, URLSearchParams } from \"./url.js\";\n\n/**\n * A parsed taler URI.\n */\nexport type TalerUri =\n | PayUriResult\n | PayTemplateUriResult\n | DevExperimentUri\n | PayPullUriResult\n | PayPushUriResult\n | BackupRestoreUri\n | RefundUriResult\n | WithdrawUriResult\n | WithdrawExchangeUri\n | AddExchangeUri;\n\ndeclare const __action_str: unique symbol;\nexport type TalerUriString = string & { [__action_str]: true };\n\nexport function codecForTalerUriString(): Codec {\n return {\n decode(x: any, c?: Context): TalerUriString {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (parseTalerUri(x) === undefined) {\n throw new DecodingError(\n `invalid taler URI at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n return x as TalerUriString;\n },\n };\n}\n\nexport interface PayUriResult {\n type: TalerUriAction.Pay;\n merchantBaseUrl: string;\n orderId: string;\n sessionId: string;\n claimToken?: string;\n noncePriv?: string;\n}\n\nexport type TemplateParams = {\n amount?: string;\n summary?: string;\n};\n\nexport interface PayTemplateUriResult {\n type: TalerUriAction.PayTemplate;\n merchantBaseUrl: string;\n templateId: string;\n}\n\nexport interface WithdrawUriResult {\n type: TalerUriAction.Withdraw;\n bankIntegrationApiBaseUrl: string;\n withdrawalOperationId: string;\n externalConfirmation?: boolean;\n}\n\nexport interface RefundUriResult {\n type: TalerUriAction.Refund;\n merchantBaseUrl: string;\n orderId: string;\n}\n\nexport interface PayPushUriResult {\n type: TalerUriAction.PayPush;\n exchangeBaseUrl: string;\n contractPriv: string;\n}\n\nexport interface PayPullUriResult {\n type: TalerUriAction.PayPull;\n exchangeBaseUrl: string;\n contractPriv: string;\n}\n\nexport interface DevExperimentUri {\n type: TalerUriAction.DevExperiment;\n devExperimentId: string;\n}\n\nexport interface BackupRestoreUri {\n type: TalerUriAction.Restore;\n walletRootPriv: string;\n providers: Array;\n}\n\nexport interface WithdrawExchangeUri {\n type: TalerUriAction.WithdrawExchange;\n exchangeBaseUrl: string;\n amount?: AmountString;\n}\n\nexport interface AddExchangeUri {\n type: TalerUriAction.AddExchange;\n exchangeBaseUrl: string;\n}\n\n/**\n * Parse a taler[+http]://withdraw URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseWithdrawUriWithError(s: string) {\n const pi = parseProtoInfoWithError(s, \"withdraw\");\n if (pi.type === \"fail\") {\n return pi;\n }\n\n const c = pi.body.rest.split(\"?\", 2);\n const path = c[0];\n const q = new URLSearchParams(c[1] ?? \"\");\n\n const parts = path.split(\"/\");\n\n if (parts.length < 2) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n\n const host = parts[0].toLowerCase();\n const pathSegments = parts.slice(1, parts.length - 1);\n /**\n * The statement below does not tolerate a slash-ended URI.\n * This results in (1) the withdrawalId being passed as the\n * empty string, and (2) the bankIntegrationApi ending with the\n * actual withdrawal operation ID. That can be fixed by\n * trimming the parts-list. FIXME\n */\n const withdrawId = parts[parts.length - 1];\n const p = [host, ...pathSegments].join(\"/\");\n\n const result: WithdrawUriResult = {\n type: TalerUriAction.Withdraw,\n bankIntegrationApiBaseUrl: canonicalizeBaseUrl(\n `${pi.body.innerProto}://${p}/`,\n ),\n withdrawalOperationId: withdrawId,\n externalConfirmation: q.get(\"external-confirmation\") == \"1\",\n };\n return opFixedSuccess(result);\n}\n\n/**\n *\n * @deprecated use parseWithdrawUriWithError\n */\nexport function parseWithdrawUri(s: string): WithdrawUriResult | undefined {\n const r = parseWithdrawUriWithError(s);\n if (r.type === \"fail\") return undefined;\n return r.body;\n}\n\n/**\n * Parse a taler[+http]://withdraw URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseAddExchangeUriWithError(s: string) {\n const pi = parseProtoInfoWithError(s, \"add-exchange\");\n if (pi.type === \"fail\") {\n return pi;\n }\n const parts = pi.body.rest.split(\"/\");\n\n if (parts.length < 2) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n\n const host = parts[0].toLowerCase();\n const pathSegments = parts.slice(1, parts.length - 1);\n /**\n * The statement below does not tolerate a slash-ended URI.\n * This results in (1) the withdrawalId being passed as the\n * empty string, and (2) the bankIntegrationApi ending with the\n * actual withdrawal operation ID. That can be fixed by\n * trimming the parts-list. FIXME\n */\n const p = [host, ...pathSegments].join(\"/\");\n\n const result: AddExchangeUri = {\n type: TalerUriAction.AddExchange,\n exchangeBaseUrl: canonicalizeBaseUrl(`${pi.body.innerProto}://${p}/`),\n };\n return opFixedSuccess(result);\n}\n\n/**\n *\n * @deprecated use parseWithdrawUriWithError\n */\nexport function parseAddExchangeUri(s: string): AddExchangeUri | undefined {\n const r = parseAddExchangeUriWithError(s);\n if (r.type === \"fail\") return undefined;\n return r.body;\n}\n\n/**\n * @deprecated use TalerUriAction\n */\nexport enum TalerUriType {\n TalerPay = \"taler-pay\",\n TalerTemplate = \"taler-template\",\n TalerPayTemplate = \"taler-pay-template\",\n TalerWithdraw = \"taler-withdraw\",\n TalerTip = \"taler-tip\",\n TalerRefund = \"taler-refund\",\n TalerPayPush = \"taler-pay-push\",\n TalerPayPull = \"taler-pay-pull\",\n TalerRecovery = \"taler-recovery\",\n TalerDevExperiment = \"taler-dev-experiment\",\n Unknown = \"unknown\",\n}\n\nexport enum TalerUriAction {\n Pay = \"pay\",\n Withdraw = \"withdraw\",\n Refund = \"refund\",\n PayPull = \"pay-pull\",\n PayPush = \"pay-push\",\n PayTemplate = \"pay-template\",\n Restore = \"restore\",\n DevExperiment = \"dev-experiment\",\n WithdrawExchange = \"withdraw-exchange\",\n AddExchange = \"add-exchange\",\n}\n\ninterface TalerUriProtoInfo {\n innerProto: \"http\" | \"https\";\n rest: string;\n}\n\nfunction parseProtoInfo(\n s: string,\n action: string,\n): TalerUriProtoInfo | undefined {\n const pfxPlain = `taler://${action}/`;\n const pfxHttp = `taler+http://${action}/`;\n if (s.toLowerCase().startsWith(pfxPlain)) {\n return {\n innerProto: \"https\",\n rest: s.substring(pfxPlain.length),\n };\n } else if (s.toLowerCase().startsWith(pfxHttp)) {\n return {\n innerProto: \"http\",\n rest: s.substring(pfxHttp.length),\n };\n } else {\n return undefined;\n }\n}\n\nfunction parseProtoInfoWithError(s: string, action: string) {\n if (\n !s.toLowerCase().startsWith(\"taler://\") &&\n !s.toLowerCase().startsWith(\"taler+http://\")\n ) {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n const pfxPlain = `taler://${action}/`;\n const pfxHttp = `taler+http://${action}/`;\n if (s.toLowerCase().startsWith(pfxPlain)) {\n return opFixedSuccess({\n innerProto: \"https\",\n rest: s.substring(pfxPlain.length),\n });\n } else if (s.toLowerCase().startsWith(pfxHttp)) {\n return opFixedSuccess({\n innerProto: \"http\",\n rest: s.substring(pfxHttp.length),\n });\n } else {\n return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {\n code: TalerErrorCode.WALLET_TALER_URI_MALFORMED,\n });\n }\n}\n\ntype Parser = (s: string) => TalerUri | undefined;\nconst parsers: { [A in TalerUriAction]: Parser } = {\n [TalerUriAction.Pay]: parsePayUri,\n [TalerUriAction.PayPull]: parsePayPullUri,\n [TalerUriAction.PayPush]: parsePayPushUri,\n [TalerUriAction.PayTemplate]: parsePayTemplateUri,\n [TalerUriAction.Restore]: parseRestoreUri,\n [TalerUriAction.Refund]: parseRefundUri,\n [TalerUriAction.Withdraw]: parseWithdrawUri,\n [TalerUriAction.DevExperiment]: parseDevExperimentUri,\n [TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri,\n [TalerUriAction.AddExchange]: parseAddExchangeUri,\n};\n\nexport function parseTalerUri(string: string): TalerUri | undefined {\n const https = string.startsWith(\"taler://\");\n const http = string.startsWith(\"taler+http://\");\n if (!https && !http) return undefined;\n const actionStart = https ? 8 : 13;\n const actionEnd = string.indexOf(\"/\", actionStart + 1);\n const action = string.substring(actionStart, actionEnd);\n const found = Object.values(TalerUriAction).find((x) => x === action);\n if (!found) return undefined;\n return parsers[found](string);\n}\n\nexport function stringifyTalerUri(uri: TalerUri): string {\n switch (uri.type) {\n case TalerUriAction.DevExperiment: {\n return stringifyDevExperimentUri(uri);\n }\n case TalerUriAction.Pay: {\n return stringifyPayUri(uri);\n }\n case TalerUriAction.PayPull: {\n return stringifyPayPullUri(uri);\n }\n case TalerUriAction.PayPush: {\n return stringifyPayPushUri(uri);\n }\n case TalerUriAction.PayTemplate: {\n return stringifyPayTemplateUri(uri);\n }\n case TalerUriAction.Restore: {\n return stringifyRestoreUri(uri);\n }\n case TalerUriAction.Refund: {\n return stringifyRefundUri(uri);\n }\n case TalerUriAction.Withdraw: {\n return stringifyWithdrawUri(uri);\n }\n case TalerUriAction.WithdrawExchange: {\n return stringifyWithdrawExchange(uri);\n }\n case TalerUriAction.AddExchange: {\n return stringifyAddExchange(uri);\n }\n }\n}\n\n/**\n * Parse a taler[+http]://pay URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parsePayUri(s: string): PayUriResult | undefined {\n const pi = parseProtoInfo(s, \"pay\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const q = new URLSearchParams(c[1] ?? \"\");\n const claimToken = q.get(\"c\") ?? undefined;\n const noncePriv = q.get(\"n\") ?? undefined;\n const parts = c[0].split(\"/\");\n if (parts.length < 3) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const sessionId = parts[parts.length - 1];\n const orderId = parts[parts.length - 2];\n const pathSegments = parts.slice(1, parts.length - 2);\n const p = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${p}/`);\n\n return {\n type: TalerUriAction.Pay,\n merchantBaseUrl,\n orderId,\n sessionId,\n claimToken,\n noncePriv,\n };\n}\n\nexport function parsePayTemplateUri(\n uriString: string,\n): PayTemplateUriResult | undefined {\n const pi = parseProtoInfo(uriString, TalerUriAction.PayTemplate);\n if (!pi) {\n return undefined;\n }\n const c = pi.rest.split(\"?\");\n\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n\n const q = new URLSearchParams(c[1] ?? \"\");\n const params: Record = {};\n q.forEach((v, k) => {\n params[k] = v;\n });\n\n const host = parts[0].toLowerCase();\n const templateId = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayTemplate,\n merchantBaseUrl,\n templateId,\n };\n}\n\nexport function parsePayPushUri(s: string): PayPushUriResult | undefined {\n const pi = parseProtoInfo(s, TalerUriAction.PayPush);\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const contractPriv = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayPush,\n exchangeBaseUrl,\n contractPriv,\n };\n}\n\nexport function parsePayPullUri(s: string): PayPullUriResult | undefined {\n const pi = parseProtoInfo(s, TalerUriAction.PayPull);\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const contractPriv = parts[parts.length - 1];\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.PayPull,\n exchangeBaseUrl,\n contractPriv,\n };\n}\n\nexport function parseWithdrawExchangeUri(\n s: string,\n): WithdrawExchangeUri | undefined {\n const pi = parseProtoInfo(s, \"withdraw-exchange\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 1) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n // Used to be the reserve public key, now it's empty!\n const lastPathComponent =\n parts.length > 1 ? parts[parts.length - 1] : undefined;\n\n if (lastPathComponent) {\n // invalid taler://withdraw-exchange URI, must end with a slash\n return undefined;\n }\n const pathSegments = parts.slice(1, parts.length - 1);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const exchangeBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n const q = new URLSearchParams(c[1] ?? \"\");\n const amount = (q.get(\"a\") ?? undefined) as AmountString | undefined;\n\n return {\n type: TalerUriAction.WithdrawExchange,\n exchangeBaseUrl,\n amount,\n };\n}\n\n/**\n * Parse a taler[+http]://refund URI.\n * Return undefined if not passed a valid URI.\n */\nexport function parseRefundUri(s: string): RefundUriResult | undefined {\n const pi = parseProtoInfo(s, \"refund\");\n if (!pi) {\n return undefined;\n }\n const c = pi?.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 3) {\n return undefined;\n }\n const host = parts[0].toLowerCase();\n const sessionId = parts[parts.length - 1];\n const orderId = parts[parts.length - 2];\n const pathSegments = parts.slice(1, parts.length - 2);\n const hostAndSegments = [host, ...pathSegments].join(\"/\");\n const merchantBaseUrl = canonicalizeBaseUrl(\n `${pi.innerProto}://${hostAndSegments}/`,\n );\n\n return {\n type: TalerUriAction.Refund,\n merchantBaseUrl,\n orderId,\n };\n}\n\nexport function parseDevExperimentUri(s: string): DevExperimentUri | undefined {\n const pi = parseProtoInfo(s, \"dev-experiment\");\n const c = pi?.rest.split(\"?\");\n if (!c) {\n return undefined;\n }\n const parts = c[0].split(\"/\");\n return {\n type: TalerUriAction.DevExperiment,\n devExperimentId: parts[0],\n };\n}\n\nexport function parseRestoreUri(uri: string): BackupRestoreUri | undefined {\n const pi = parseProtoInfo(uri, \"restore\");\n if (!pi) {\n return undefined;\n }\n const c = pi.rest.split(\"?\");\n const parts = c[0].split(\"/\");\n if (parts.length < 2) {\n return undefined;\n }\n\n const walletRootPriv = parts[0];\n if (!walletRootPriv) return undefined;\n const providers = new Array();\n parts[1].split(\",\").map((name) => {\n const url = canonicalizeBaseUrl(\n `${pi.innerProto}://${decodeURIComponent(name)}/`,\n );\n providers.push(url);\n });\n return {\n type: TalerUriAction.Restore,\n walletRootPriv,\n providers,\n };\n}\n\n// ================================================\n// To string functions\n// ================================================\n\nexport function stringifyPayUri({\n merchantBaseUrl,\n orderId,\n sessionId,\n claimToken,\n noncePriv,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(merchantBaseUrl, {\n c: claimToken,\n n: noncePriv,\n });\n return `${proto}://pay/${path}${orderId}/${sessionId}${query}`;\n}\n\nexport function stringifyPayPullUri({\n contractPriv,\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n return `${proto}://pay-pull/${path}${contractPriv}`;\n}\n\nexport function stringifyPayPushUri({\n contractPriv,\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n\n return `${proto}://pay-push/${path}${contractPriv}`;\n}\n\nexport function stringifyRestoreUri({\n providers,\n walletRootPriv,\n}: Omit): string {\n const list = providers\n .map((url) => `${encodeURIComponent(new URL(url).href)}`)\n .join(\",\");\n return `taler://restore/${walletRootPriv}/${list}`;\n}\n\nexport function stringifyWithdrawExchange({\n exchangeBaseUrl,\n amount,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(exchangeBaseUrl, {\n a: amount,\n });\n return `${proto}://withdraw-exchange/${path}${query}`;\n}\n\nexport function stringifyAddExchange({\n exchangeBaseUrl,\n}: Omit): string {\n const { proto, path } = getUrlInfo(exchangeBaseUrl);\n return `${proto}://add-exchange/${path}`;\n}\n\nexport function stringifyDevExperimentUri({\n devExperimentId,\n}: Omit): string {\n return `taler://dev-experiment/${devExperimentId}`;\n}\n\nexport function stringifyPayTemplateUri({\n merchantBaseUrl,\n templateId,\n}: Omit): string {\n const { proto, path, query } = getUrlInfo(merchantBaseUrl);\n return `${proto}://pay-template/${path}${templateId}${query}`;\n}\n\nexport function stringifyRefundUri({\n merchantBaseUrl,\n orderId,\n}: Omit): string {\n const { proto, path } = getUrlInfo(merchantBaseUrl);\n return `${proto}://refund/${path}${orderId}/`;\n}\n\nexport function stringifyWithdrawUri({\n bankIntegrationApiBaseUrl,\n withdrawalOperationId,\n}: Omit): string {\n const { proto, path } = getUrlInfo(bankIntegrationApiBaseUrl);\n return `${proto}://withdraw/${path}${withdrawalOperationId}`;\n}\n\n/**\n * Use baseUrl to defined http or https\n * create path using host+port+pathname\n * use params to create a query parameter string or empty\n */\nfunction getUrlInfo(\n baseUrl: string,\n params: Record = {},\n): { proto: string; path: string; query: string } {\n const url = new URL(baseUrl);\n let proto: string;\n if (url.protocol === \"https:\") {\n proto = \"taler\";\n } else if (url.protocol === \"http:\") {\n proto = \"taler+http\";\n } else {\n throw Error(`Unsupported URL protocol in ${baseUrl}`);\n }\n let path = url.hostname;\n if (url.port) {\n path = path + \":\" + url.port;\n }\n if (url.pathname) {\n path = path + url.pathname;\n }\n if (!path.endsWith(\"/\")) {\n path = path + \"/\";\n }\n\n const qp = new URLSearchParams();\n let withParams = false;\n Object.entries(params).forEach(([name, value]) => {\n if (value !== undefined) {\n withParams = true;\n qp.append(name, value);\n }\n });\n const query = withParams ? \"?\" + qp.toString() : \"\";\n\n return { proto, path, query };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Cross-platform timers.\n *\n * NodeJS and the browser use slightly different timer API,\n * this abstracts over these differences.\n */\n\n/**\n * Imports.\n */\nimport { Logger, Duration } from \"@gnu-taler/taler-util\";\n\nconst logger = new Logger(\"timer.ts\");\n\n/**\n * Cancelable timer.\n */\nexport interface TimerHandle {\n clear(): void;\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void;\n}\n\nclass IntervalHandle {\n constructor(public h: any) {}\n\n clear(): void {\n clearInterval(this.h);\n }\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void {\n if (typeof this.h === \"object\" && \"unref\" in this.h) {\n this.h.unref();\n }\n }\n}\n\nclass TimeoutHandle {\n constructor(public h: any) {}\n\n clear(): void {\n clearTimeout(this.h);\n }\n\n /**\n * Make sure the event loop exits when the timer is the\n * only event left. Has no effect in the browser.\n */\n unref(): void {\n if (typeof this.h === \"object\" && \"unref\" in this.h) {\n this.h.unref();\n }\n }\n}\n\n/**\n * Get a performance counter in nanoseconds.\n */\nexport const performanceNow: () => bigint = (() => {\n // @ts-ignore\n if (typeof process !== \"undefined\" && process.hrtime) {\n return () => {\n return process.hrtime.bigint();\n };\n }\n\n // @ts-ignore\n if (typeof performance !== \"undefined\") {\n // @ts-ignore\n return () => BigInt(Math.floor(performance.now() * 1000)) * BigInt(1000);\n }\n\n return () => BigInt(new Date().getTime()) * BigInt(1000) * BigInt(1000);\n})();\n\nconst nullTimerHandle = {\n clear() {\n // do nothing\n return;\n },\n unref() {\n // do nothing\n return;\n },\n};\n\n/**\n * Group of timers that can be destroyed at once.\n */\nexport interface TimerAPI {\n after(delayMs: number, callback: () => void): TimerHandle;\n every(delayMs: number, callback: () => void): TimerHandle;\n}\n\nexport class SetTimeoutTimerAPI implements TimerAPI {\n /**\n * Call a function every time the delay given in milliseconds passes.\n */\n every(delayMs: number, callback: () => void): TimerHandle {\n return new IntervalHandle(setInterval(callback, delayMs));\n }\n\n /**\n * Call a function after the delay given in milliseconds passes.\n */\n after(delayMs: number, callback: () => void): TimerHandle {\n return new TimeoutHandle(setTimeout(callback, delayMs));\n }\n}\n\nexport const timer = new SetTimeoutTimerAPI();\n\n/**\n * Implementation of [[TimerGroup]] using setTimeout\n */\nexport class TimerGroup {\n private stopped = false;\n\n private readonly timerMap: { [index: number]: TimerHandle } = {};\n\n private idGen = 1;\n\n constructor(public readonly timerApi: TimerAPI) {}\n\n stopCurrentAndFutureTimers(): void {\n this.stopped = true;\n for (const x in this.timerMap) {\n if (!this.timerMap.hasOwnProperty(x)) {\n continue;\n }\n this.timerMap[x].clear();\n delete this.timerMap[x];\n }\n }\n\n resolveAfter(delayMs: Duration): Promise {\n return new Promise((resolve, reject) => {\n if (delayMs.d_ms !== \"forever\") {\n this.after(delayMs.d_ms, () => {\n resolve();\n });\n }\n });\n }\n\n after(delayMs: number, callback: () => void): TimerHandle {\n if (this.stopped) {\n logger.warn(\"dropping timer since timer group is stopped\");\n return nullTimerHandle;\n }\n const h = this.timerApi.after(delayMs, callback);\n const myId = this.idGen++;\n this.timerMap[myId] = h;\n\n const tm = this.timerMap;\n\n return {\n clear() {\n h.clear();\n delete tm[myId];\n },\n unref() {\n h.unref();\n },\n };\n }\n\n every(delayMs: number, callback: () => void): TimerHandle {\n if (this.stopped) {\n logger.warn(\"dropping timer since timer group is stopped\");\n return nullTimerHandle;\n }\n const h = this.timerApi.every(delayMs, callback);\n const myId = this.idGen++;\n this.timerMap[myId] = h;\n\n const tm = this.timerMap;\n\n return {\n clear() {\n h.clear();\n delete tm[myId];\n },\n unref() {\n h.unref();\n },\n };\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n TransactionType,\n PaymentStatus,\n TransactionMajorState,\n} from \"./types-taler-wallet-transactions.js\";\nimport { RefreshReason } from \"./types-taler-wallet.js\";\n\n/**\n * Sample transaction list entries.\n */\nexport const sampleWalletCoreTransactions = [\n {\n type: TransactionType.Payment,\n txState: {\n major: TransactionMajorState.Done,\n },\n amountRaw: \"KUDOS:10\",\n amountEffective: \"KUDOS:10\",\n totalRefundRaw: \"KUDOS:0\",\n totalRefundEffective: \"KUDOS:0\",\n status: PaymentStatus.Paid,\n refundPending: undefined,\n posConfirmation: undefined,\n pending: false,\n refunds: [],\n timestamp: {\n t_s: 1677166045,\n },\n transactionId:\n \"txn:payment:NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0\",\n proposalId: \"NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0\",\n info: {\n merchant: {\n name: \"woocommerce\",\n website: \"woocommerce.demo.taler.net\",\n email: \"foo@example.com\",\n address: {},\n jurisdiction: {},\n },\n orderId: \"wc_order_KQCRldghIgDRB-100\",\n products: [\n {\n description: \"Using GCC\",\n quantity: 1,\n price: \"KUDOS:10\",\n product_id: \"28\",\n },\n ],\n summary: \"WooTalerShop #100\",\n contractTermsHash:\n \"A02E1M6ARWKBJ87K2TV4S6WQ4X5YH7BRVR6MYCHCTVAED8MBXTFD6PZ5Q50Y7Z5K18PYBTDA14NQ56XPC1VCQW1EVRWTSB7ZYT65B5G\",\n fulfillmentUrl:\n \"https://woocommerce.demo.taler.net/?wc-api=wc_gnutaler_gateway&order_id=wc_order_KQCRldghIgDRB-100\",\n },\n refundQueryActive: false,\n frozen: false,\n },\n {\n type: TransactionType.Refresh,\n txState: {\n major: TransactionMajorState.Pending,\n },\n refreshReason: RefreshReason.PayMerchant,\n amountEffective: \"KUDOS:0\",\n amountRaw: \"KUDOS:0\",\n refreshInputAmount: \"KUDOS:1.5\",\n refreshOutputAmount: \"KUDOS:1.4\",\n originatingTransactionId:\n \"txn:proposal:ZCGBZFE8KZ1CBYYGSC3ZC8E40KVJWV16VYCTHGC8FFSVZ5HD24BG\",\n pending: true,\n timestamp: {\n t_s: 1681376214,\n },\n transactionId:\n \"txn:refresh:QQSWHHXCRQ269G0E3RW14JMC6F7NFDYDW26NSFHRTXSKDS6CMCZ0\",\n frozen: false,\n error: {\n code: 7029,\n when: {\n t_ms: 1681376473665,\n },\n hint: \"Error (WALLET_REFRESH_GROUP_INCOMPLETE)\",\n numErrors: 1,\n errors: [\n {\n code: 7001,\n when: {\n t_ms: 1681376473189,\n },\n hint: \"unexpected exception (message: exchange wire fee signature invalid)\",\n stack:\n \" at validateWireInfo (../taler-wallet-core-qjs.mjs:23166)\\n\",\n },\n ],\n },\n },\n];\n", "/*\n This file is part of GNU Taler\n (C) 2021 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n// Entry point for the browser.\n\nimport { loadBrowserPrng } from \"./prng-browser.js\";\nloadBrowserPrng();\nexport * from \"./index.js\";\n\n// The web stuff doesn't support package.json export declarations yet,\n// so we export more stuff here than we should.\nexport * from \"./http-common.js\";\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { AbsoluteTime, Codec, codecForString } from \"@gnu-taler/taler-util\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport {\n ObservableMap,\n browserStorageMap,\n localStorageMap,\n memoryMap,\n} from \"../utils/observable.js\";\n\ndeclare const opaque_StorageKey: unique symbol;\n\nexport type StorageKey = {\n id: string;\n [opaque_StorageKey]: true;\n codec: Codec;\n};\n\nexport function buildStorageKey(\n name: string,\n codec: Codec,\n): StorageKey;\nexport function buildStorageKey(name: string): StorageKey;\nexport function buildStorageKey(\n name: string,\n codec?: Codec,\n): StorageKey {\n return {\n id: name,\n codec: codec ?? (codecForString() as Codec),\n } as StorageKey;\n}\n\nexport interface StorageState {\n value?: Type;\n update: (s: Type) => void;\n reset: () => void;\n}\n\nconst supportLocalStorage = typeof window !== \"undefined\";\nconst supportBrowserStorage =\n typeof chrome !== \"undefined\" && typeof chrome.storage !== \"undefined\";\n\n/**\n * Build setting storage\n */\nconst storage: ObservableMap = (function buildStorage() {\n if (supportBrowserStorage) {\n //browser storage is like local storage but\n //with app sync.\n //Works for almost every browser\n if (supportLocalStorage) {\n return browserStorageMap(localStorageMap());\n } else {\n // service worker doesn't have local storage\n return browserStorageMap(memoryMap());\n }\n } else if (supportLocalStorage) {\n // fallback if browser is too old\n return localStorageMap();\n } else {\n // new need to save settings somewhere\n return memoryMap();\n }\n})();\n//with initial value\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue: Type,\n): Required>;\n//without initial value\nexport function useLocalStorage(\n key: StorageKey,\n): StorageState;\n// impl\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue?: Type,\n): StorageState {\n const current = convert(storage.get(key.id), key, defaultValue);\n\n const [_, setStoredValue] = useState(AbsoluteTime.now().t_ms);\n\n useEffect(() => {\n return storage.onUpdate(key.id, () => {\n // const newValue = storage.get(key.id);\n setStoredValue(AbsoluteTime.now().t_ms);\n });\n }, [key.id]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n storage.delete(key.id);\n } else {\n storage.set(\n key.id,\n key.codec ? JSON.stringify(value) : (value as string),\n );\n }\n };\n\n return {\n value: current,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n\nfunction convert(updated: string | undefined, key: StorageKey, defaultValue?: Type): Type | undefined {\n if (updated === undefined) return defaultValue; //optional\n try {\n return key.codec.decode(JSON.parse(updated));\n } catch (e) {\n //decode error\n return defaultValue;\n }\n}\n", "import { isArrayBufferView } from \"util/types\";\n\nexport type ObservableMap = Map & {\n onAnyUpdate: (callback: () => void) => () => void;\n onUpdate: (key: string, callback: () => void) => () => void;\n};\n\n//FIXME: allow different type for different properties\nexport function memoryMap(\n backend: Map = new Map(),\n): ObservableMap {\n const obs = new EventTarget();\n const theMemoryMap: ObservableMap = {\n onAnyUpdate: (handler) => {\n obs.addEventListener(`update`, handler);\n obs.addEventListener(`clear`, handler);\n return () => {\n obs.removeEventListener(`update`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n onUpdate: (key, handler) => {\n obs.addEventListener(`update-${key}`, handler);\n obs.addEventListener(`clear`, handler);\n return () => {\n obs.removeEventListener(`update-${key}`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n delete: (key: string) => {\n const result = backend.delete(key);\n //@ts-ignore\n theMemoryMap.size = backend.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return result;\n },\n set: (key: string, value: T) => {\n backend.set(key, value);\n //@ts-ignore\n theMemoryMap.size = backend.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return theMemoryMap;\n },\n clear: () => {\n backend.clear();\n obs.dispatchEvent(new Event(`clear`));\n },\n entries: backend.entries.bind(backend),\n forEach: backend.forEach.bind(backend),\n get: backend.get.bind(backend),\n has: backend.has.bind(backend),\n keys: backend.keys.bind(backend),\n size: backend.size,\n values: backend.values.bind(backend),\n [Symbol.iterator]: backend[Symbol.iterator],\n [Symbol.toStringTag]: \"theMemoryMap\",\n };\n return theMemoryMap;\n}\n\n//FIXME: change this implementation to match the\n// browser storage. instead of creating a sync implementation\n// of observable map it should reuse the memoryMap and\n// sync the state with local storage\nexport function localStorageMap(): ObservableMap {\n const obs = new EventTarget();\n const theLocalStorageMap: ObservableMap = {\n onAnyUpdate: (handler) => {\n obs.addEventListener(`update`, handler);\n obs.addEventListener(`clear`, handler);\n window.addEventListener(\"storage\", handler);\n return () => {\n window.removeEventListener(\"storage\", handler);\n obs.removeEventListener(`update`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n onUpdate: (key, handler) => {\n obs.addEventListener(`update-${key}`, handler);\n obs.addEventListener(`clear`, handler);\n function handleStorageEvent(ev: StorageEvent) {\n if (ev.key === null || ev.key === key) {\n handler();\n }\n }\n window.addEventListener(\"storage\", handleStorageEvent);\n return () => {\n window.removeEventListener(\"storage\", handleStorageEvent);\n obs.removeEventListener(`update-${key}`, handler);\n obs.removeEventListener(`clear`, handler);\n };\n },\n delete: (key: string) => {\n const exists = localStorage.getItem(key) !== null;\n localStorage.removeItem(key);\n //@ts-ignore\n theLocalStorageMap.size = localStorage.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return exists;\n },\n set: (key: string, v: string) => {\n localStorage.setItem(key, v);\n //@ts-ignore\n theLocalStorageMap.size = localStorage.length;\n obs.dispatchEvent(new Event(`update-${key}`));\n obs.dispatchEvent(new Event(`update`));\n return theLocalStorageMap;\n },\n clear: () => {\n localStorage.clear();\n obs.dispatchEvent(new Event(`clear`));\n },\n entries: (): IterableIterator<[string, string]> => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n index = index + 1;\n return { done: false, value: [key, item] };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n forEach: (cb) => {\n for (let index = 0; index < localStorage.length; index++) {\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n cb(key, item, theLocalStorageMap);\n }\n },\n get: (key: string) => {\n const item = localStorage.getItem(key);\n if (item === null) return undefined;\n return item;\n },\n has: (key: string) => {\n return localStorage.getItem(key) === null;\n },\n keys: () => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n index = index + 1;\n return { done: false, value: key };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n size: localStorage.length,\n values: () => {\n let index = 0;\n const total = localStorage.length;\n return {\n next() {\n if (index === total) return { done: true, value: undefined };\n const key = localStorage.key(index);\n if (key === null) {\n //we are going from 0 until last, this should not happen\n throw Error(\"key cant be null\");\n }\n const item = localStorage.getItem(key);\n if (item === null) {\n //the key exist, this should not happen\n throw Error(\"value cant be null\");\n }\n index = index + 1;\n return { done: false, value: item };\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n },\n [Symbol.iterator]: function (): IterableIterator<[string, string]> {\n return theLocalStorageMap.entries();\n },\n [Symbol.toStringTag]: \"theLocalStorageMap\",\n };\n return theLocalStorageMap;\n}\n\nconst isFirefox =\n typeof (window as any) !== \"undefined\" &&\n typeof (window as any)[\"InstallTrigger\"] !== \"undefined\";\n\nasync function getAllContent() {\n //Firefox and Chrome has different storage api\n if (isFirefox) {\n // @ts-ignore\n return browser.storage.local.get();\n } else {\n return chrome.storage.local.get();\n }\n}\n\nasync function updateContent(obj: Record) {\n if (isFirefox) {\n // @ts-ignore\n return browser.storage.local.set(obj);\n } else {\n return chrome.storage.local.set(obj);\n }\n}\ntype Changes = { [key: string]: { oldValue?: any; newValue?: any } };\nfunction onBrowserStorageUpdate(cb: (changes: Changes) => void): void {\n if (isFirefox) {\n // @ts-ignore\n browser.storage.local.onChanged.addListener(cb);\n } else {\n chrome.storage.local.onChanged.addListener(cb);\n }\n}\n\nexport function browserStorageMap(\n backend: ObservableMap,\n): ObservableMap {\n getAllContent().then(content => {\n Object.entries(content ?? {}).forEach(([k, v]) => {\n backend.set(k, v as string);\n });\n })\n\n backend.onAnyUpdate(async () => {\n const result: Record = {};\n for (const [key, value] of backend.entries()) {\n result[key] = value;\n }\n await updateContent(result);\n });\n\n onBrowserStorageUpdate((changes) => {\n //another chrome instance made the change\n const changedItems = Object.keys(changes);\n if (changedItems.length === 0) {\n backend.clear();\n } else {\n for (const key of changedItems) {\n if (!changes[key].newValue) {\n backend.delete(key);\n } else {\n if (changes[key].newValue !== changes[key].oldValue) {\n backend.set(key, changes[key].newValue);\n }\n }\n }\n }\n });\n\n return backend;\n}\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\nimport {\n StorageState,\n buildStorageKey,\n useLocalStorage,\n} from \"./useLocalStorage.js\";\n\nconst MIN_LANG_COVERAGE_THRESHOLD = 90;\n/**\n * choose the best from the browser config based on the completeness\n * on the translation\n */\nfunction getBrowserLang(completeness: Record): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n\n if (window.navigator.language) {\n if (completeness[window.navigator.language] >= MIN_LANG_COVERAGE_THRESHOLD) {\n return window.navigator.language\n }\n }\n if (window.navigator.languages) {\n const match = Object.entries(completeness).filter(([code, value]) => {\n if (value < MIN_LANG_COVERAGE_THRESHOLD) return false; //do not consider langs below 90%\n return window.navigator.languages.findIndex(l => l.startsWith(code)) !== -1\n }).map(([code, value]) => ({ code, value }))\n\n if (match.length > 0) {\n let max = match[0]\n match.forEach(v => {\n if (v.value > max.value) {\n max = v\n }\n })\n return max.code\n }\n };\n\n return undefined;\n}\n\nconst langPreferenceKey = buildStorageKey(\"lang-preference\");\n\nexport function useLang(initial: string | undefined, completeness: Record): Required {\n const defaultValue = (getBrowserLang(completeness) || initial || \"en\").substring(0, 2);\n return useLocalStorage(langPreferenceKey, defaultValue);\n}\n", "/*\n This file is part of GNU Anastasis\n (C) 2021-2022 Anastasis SARL\n\n GNU Anastasis is free software; you can redistribute it and/or modify it under the\n terms of the GNU Affero General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\n You should have received a copy of the GNU Affero General Public License along with\n GNU Anastasis; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { useEffect, useState } from \"preact/hooks\";\nimport { ObservableMap, memoryMap } from \"../utils/observable.js\";\nimport { StorageKey, StorageState } from \"./useLocalStorage.js\";\n\nconst storage: ObservableMap = memoryMap();\n\n//with initial value\nexport function useMemoryStorage(\n key: string,\n defaultValue: Type,\n): Required>;\n//with initial value\nexport function useMemoryStorage(\n key: string,\n): StorageState;\n// impl\nexport function useMemoryStorage(\n key: string,\n defaultValue?: Type,\n): StorageState {\n const [storedValue, setStoredValue] = useState(\n (): Type | undefined => {\n const prev = storage.get(key);\n return prev === undefined ? defaultValue : prev;\n },\n );\n\n useEffect(() => {\n return storage.onUpdate(key, () => {\n const newValue = storage.get(key);\n setStoredValue(newValue === undefined ? defaultValue : newValue);\n });\n }, [key]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n storage.delete(key);\n } else {\n storage.set(key, value);\n }\n };\n\n return {\n value: storedValue,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n", "import {\n AbsoluteTime,\n Duration,\n OperationAlternative,\n OperationFail,\n OperationOk,\n OperationResult,\n TalerError,\n TalerErrorCode,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { ButtonHandler, OnOperationFailReturnType, OnOperationSuccesReturnType } from \"../components/Button.js\";\nimport {\n InternationalizationAPI,\n memoryMap,\n useTranslationContext,\n} from \"../index.browser.js\";\n\nexport type NotificationMessage = ErrorNotification | InfoNotification;\n\nexport interface ErrorNotification {\n type: \"error\";\n title: TranslatedString;\n ack?: boolean;\n timeout?: boolean;\n description?: TranslatedString;\n debug?: any;\n when: AbsoluteTime;\n}\nexport interface InfoNotification {\n type: \"info\";\n title: TranslatedString;\n ack?: boolean;\n timeout?: boolean;\n when: AbsoluteTime;\n}\n\nconst storage = memoryMap>();\nconst NOTIFICATION_KEY = \"notification\";\n\nexport const GLOBAL_NOTIFICATION_TIMEOUT = Duration.fromSpec({\n seconds: 5,\n});\n\nfunction updateInStorage(n: NotificationMessage) {\n const h = hash(n);\n const mem = storage.get(NOTIFICATION_KEY) ?? new Map();\n const newState = new Map(mem);\n newState.set(h, n);\n storage.set(NOTIFICATION_KEY, newState);\n}\n\nexport function notify(notif: NotificationMessage): void {\n const currentState: Map =\n storage.get(NOTIFICATION_KEY) ?? new Map();\n const newState = currentState.set(hash(notif), notif);\n\n if (GLOBAL_NOTIFICATION_TIMEOUT.d_ms !== \"forever\") {\n setTimeout(() => {\n notif.timeout = true;\n updateInStorage(notif);\n }, GLOBAL_NOTIFICATION_TIMEOUT.d_ms);\n }\n\n storage.set(NOTIFICATION_KEY, newState);\n}\nexport function notifyError(\n title: TranslatedString,\n description: TranslatedString | undefined,\n debug?: any,\n) {\n notify({\n type: \"error\" as const,\n title,\n description,\n debug,\n when: AbsoluteTime.now(),\n });\n}\nexport function notifyException(title: TranslatedString, ex: Error) {\n notify({\n type: \"error\" as const,\n title,\n description: ex.message as TranslatedString,\n debug: ex.stack,\n when: AbsoluteTime.now(),\n });\n}\nexport function notifyInfo(title: TranslatedString) {\n notify({\n type: \"info\" as const,\n title,\n when: AbsoluteTime.now(),\n });\n}\n\nexport type Notification = {\n message: NotificationMessage;\n acknowledge: () => void;\n};\n\nexport function useNotifications(): Notification[] {\n const [, setLastUpdate] = useState();\n const value = storage.get(NOTIFICATION_KEY) ?? new Map();\n\n useEffect(() => {\n return storage.onUpdate(NOTIFICATION_KEY, () => {\n setLastUpdate(Date.now())\n // const mem = storage.get(NOTIFICATION_KEY) ?? new Map();\n // setter(structuredClone(mem));\n });\n });\n\n return Array.from(value.values()).map((message, idx) => {\n return {\n message,\n acknowledge: () => {\n message.ack = true;\n updateInStorage(message);\n },\n };\n });\n}\n\nfunction hashCode(str: string): string {\n if (str.length === 0) return \"0\";\n let hash = 0;\n let chr;\n for (let i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash.toString(16);\n}\n\nfunction hash(msg: NotificationMessage): string {\n let str = (msg.type + \":\" + msg.title) as string;\n if (msg.type === \"error\") {\n if (msg.description) {\n str += \":\" + msg.description;\n }\n if (msg.debug) {\n str += \":\" + msg.debug;\n }\n }\n return hashCode(str);\n}\n\nfunction errorMap>(\n resp: T,\n map: (d: T[\"case\"]) => TranslatedString,\n): void {\n notify({\n type: \"error\",\n title: map(resp.case),\n description: resp.detail.hint as TranslatedString,\n debug: resp.detail,\n when: AbsoluteTime.now(),\n });\n}\n\nexport type ErrorNotificationHandler = (\n cb: (notify: typeof errorMap) => Promise,\n) => Promise;\n\n/**\n * @deprecated use useLocalNotificationHandler\n *\n * @returns\n */\nexport function useLocalNotification(): [\n Notification | undefined,\n (n: NotificationMessage) => void,\n ErrorNotificationHandler,\n] {\n const { i18n } = useTranslationContext();\n\n const [value, setter] = useState();\n const notif = !value\n ? undefined\n : {\n message: value,\n acknowledge: () => {\n setter(undefined);\n },\n };\n\n async function errorHandling(cb: (notify: typeof errorMap) => Promise) {\n try {\n return await cb(errorMap);\n } catch (error: unknown) {\n if (error instanceof TalerError) {\n notify(buildUnifiedRequestErrorMessage(i18n, error));\n } else {\n notifyError(\n i18n.str`Operation failed, please report`,\n (error instanceof Error\n ? error.message\n : JSON.stringify(error)) as TranslatedString,\n );\n }\n }\n }\n return [notif, setter, errorHandling];\n}\n\ntype HandlerMaker = , A, B>(\n onClick: () => Promise,\n onOperationSuccess: OnOperationSuccesReturnType,\n onOperationFail?: OnOperationFailReturnType,\n onOperationComplete?: () => void,\n) => ButtonHandler;\n\nexport function useLocalNotificationHandler(): [\n Notification | undefined,\n HandlerMaker,\n (n: NotificationMessage) => void,\n] {\n const [value, setter] = useState();\n const notif = !value\n ? undefined\n : {\n message: value,\n acknowledge: () => {\n setter(undefined);\n },\n };\n\n function makeHandler, A, B>(\n onClick: () => Promise,\n onOperationSuccess:OnOperationSuccesReturnType,\n onOperationFail?: OnOperationFailReturnType,\n onOperationComplete?: () => void,\n ): ButtonHandler {\n return {\n onClick,\n onNotification: setter,\n onOperationFail,\n onOperationSuccess,\n onOperationComplete,\n };\n }\n\n return [notif, makeHandler, setter];\n}\n\nexport function buildUnifiedRequestErrorMessage(\n i18n: InternationalizationAPI,\n cause: TalerError,\n): ErrorNotification {\n let result: ErrorNotification;\n switch (cause.errorDetail.code) {\n case TalerErrorCode.GENERIC_TIMEOUT: {\n result = {\n type: \"error\",\n title: i18n.str`Request timeout`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Request cancelled`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT: {\n result = {\n type: \"error\",\n title: i18n.str`Request timeout`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED: {\n result = {\n type: \"error\",\n title: i18n.str`Request throttled`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE: {\n result = {\n type: \"error\",\n title: i18n.str`Malformed response`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_NETWORK_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Network error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n result = {\n type: \"error\",\n title: i18n.str`Unexpected request error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n default: {\n result = {\n type: \"error\",\n title: i18n.str`Unexpected error`,\n description: cause.message as TranslatedString,\n debug: JSON.stringify(cause.errorDetail, undefined, 2),\n when: AbsoluteTime.now(),\n };\n break;\n }\n }\n return result;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nimport { TalerErrorDetail } from \"@gnu-taler/taler-util\";\n// import { TalerError } from \"@gnu-taler/taler-wallet-core\";\nimport { useEffect, useMemo, useState } from \"preact/hooks\";\n\nexport interface HookOk {\n hasError: false;\n response: T;\n}\n\nexport type HookError = HookGenericError | HookOperationalError;\n\nexport interface HookGenericError {\n hasError: true;\n operational: false;\n message: string;\n}\n\nexport interface HookOperationalError {\n hasError: true;\n operational: true;\n details: TalerErrorDetail;\n}\n\ninterface WithRetry {\n retry: () => void;\n}\n\nexport type HookResponse = HookOk | HookError | undefined;\nexport type HookResponseWithRetry =\n | ((HookOk | HookError) & WithRetry)\n | undefined;\n\nexport function useAsyncAsHook(\n fn: () => Promise,\n deps?: any[],\n): HookResponseWithRetry {\n const [result, setHookResponse] = useState>(undefined);\n\n const args = useMemo(\n () => ({\n fn,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }),\n deps || [],\n );\n\n async function doAsync(): Promise {\n try {\n const response = await args.fn();\n if (response === false) return;\n setHookResponse({ hasError: false, response });\n } catch (e) {\n // if (e instanceof TalerError) {\n // setHookResponse({\n // hasError: true,\n // operational: true,\n // details: e.errorDetail,\n // });\n // } else\n if (e instanceof Error) {\n setHookResponse({\n hasError: true,\n operational: false,\n message: e.message,\n });\n }\n }\n }\n\n useEffect(() => {\n doAsync();\n }, [args]);\n\n if (!result) return undefined;\n return { ...result, retry: doAsync };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n\nexport function base64encode(str: string): string {\n return base64EncArr(strToUTF8Arr(str))\n}\n\nexport function base64decode(str: string): string {\n return UTF8ArrToStr(base64DecToArr(str))\n}\n\n// from https://developer.mozilla.org/en-US/docs/Glossary/Base64\n\n// Array of bytes to Base64 string decoding\nfunction b64ToUint6(nChr: number): number {\n return nChr > 64 && nChr < 91\n ? nChr - 65\n : nChr > 96 && nChr < 123\n ? nChr - 71\n : nChr > 47 && nChr < 58\n ? nChr + 4\n : nChr === 43\n ? 62\n : nChr === 47\n ? 63\n : 0;\n}\n\nfunction base64DecToArr(sBase64: string, nBlocksSize?: number): Uint8Array {\n const sB64Enc = sBase64.replace(/[^A-Za-z0-9+/]/g, \"\"); // Only necessary if the base64 includes whitespace such as line breaks.\n const nInLen = sB64Enc.length;\n const nOutLen = nBlocksSize\n ? Math.ceil(((nInLen * 3 + 1) >> 2) / nBlocksSize) * nBlocksSize\n : (nInLen * 3 + 1) >> 2;\n const taBytes = new Uint8Array(nOutLen);\n\n let nMod3;\n let nMod4;\n let nUint24 = 0;\n let nOutIdx = 0;\n for (let nInIdx = 0; nInIdx < nInLen; nInIdx++) {\n nMod4 = nInIdx & 3;\n nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << (6 * (3 - nMod4));\n if (nMod4 === 3 || nInLen - nInIdx === 1) {\n nMod3 = 0;\n while (nMod3 < 3 && nOutIdx < nOutLen) {\n taBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255;\n nMod3++;\n nOutIdx++;\n }\n nUint24 = 0;\n }\n }\n\n return taBytes;\n}\n\n/* Base64 string to array encoding */\nfunction uint6ToB64(nUint6: number): number {\n return nUint6 < 26\n ? nUint6 + 65\n : nUint6 < 52\n ? nUint6 + 71\n : nUint6 < 62\n ? nUint6 - 4\n : nUint6 === 62\n ? 43\n : nUint6 === 63\n ? 47\n : 65;\n}\n\nfunction base64EncArr(aBytes: Uint8Array): string {\n let nMod3 = 2;\n let sB64Enc = \"\";\n\n const nLen = aBytes.length;\n let nUint24 = 0;\n for (let nIdx = 0; nIdx < nLen; nIdx++) {\n nMod3 = nIdx % 3;\n // To break your base64 into several 80-character lines, add:\n // if (nIdx > 0 && ((nIdx * 4) / 3) % 76 === 0) {\n // sB64Enc += \"\\r\\n\";\n // }\n\n nUint24 |= aBytes[nIdx] << ((16 >>> nMod3) & 24);\n if (nMod3 === 2 || aBytes.length - nIdx === 1) {\n sB64Enc += String.fromCodePoint(\n uint6ToB64((nUint24 >>> 18) & 63),\n uint6ToB64((nUint24 >>> 12) & 63),\n uint6ToB64((nUint24 >>> 6) & 63),\n uint6ToB64(nUint24 & 63)\n );\n nUint24 = 0;\n }\n }\n return (\n sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) +\n (nMod3 === 2 ? \"\" : nMod3 === 1 ? \"=\" : \"==\")\n );\n}\n\n/* UTF-8 array to JS string and vice versa */\n\nfunction UTF8ArrToStr(aBytes: Uint8Array): string {\n let sView = \"\";\n let nPart;\n const nLen = aBytes.length;\n for (let nIdx = 0; nIdx < nLen; nIdx++) {\n nPart = aBytes[nIdx];\n sView += String.fromCodePoint(\n nPart > 251 && nPart < 254 && nIdx + 5 < nLen /* six bytes */\n ? /* (nPart - 252 << 30) may be not so safe in ECMAScript! So\u2026: */\n (nPart - 252) * 1073741824 +\n ((aBytes[++nIdx] - 128) << 24) +\n ((aBytes[++nIdx] - 128) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 247 && nPart < 252 && nIdx + 4 < nLen /* five bytes */\n ? ((nPart - 248) << 24) +\n ((aBytes[++nIdx] - 128) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 239 && nPart < 248 && nIdx + 3 < nLen /* four bytes */\n ? ((nPart - 240) << 18) +\n ((aBytes[++nIdx] - 128) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 223 && nPart < 240 && nIdx + 2 < nLen /* three bytes */\n ? ((nPart - 224) << 12) +\n ((aBytes[++nIdx] - 128) << 6) +\n aBytes[++nIdx] -\n 128\n : nPart > 191 && nPart < 224 && nIdx + 1 < nLen /* two bytes */\n ? ((nPart - 192) << 6) + aBytes[++nIdx] - 128\n : /* nPart < 127 ? */ /* one byte */\n nPart\n );\n }\n return sView;\n}\n\nfunction strToUTF8Arr(sDOMStr: string): Uint8Array {\n let nChr;\n const nStrLen = sDOMStr.length;\n let nArrLen = 0;\n\n /* mapping\u2026 */\n for (let nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {\n nChr = sDOMStr.codePointAt(nMapIdx);\n if (nChr === undefined) {\n throw Error(`No char at ${nMapIdx} on string with length: ${sDOMStr.length}`)\n }\n\n if (nChr >= 0x10000) {\n nMapIdx++;\n }\n\n nArrLen +=\n nChr < 0x80\n ? 1\n : nChr < 0x800\n ? 2\n : nChr < 0x10000\n ? 3\n : nChr < 0x200000\n ? 4\n : nChr < 0x4000000\n ? 5\n : 6;\n }\n\n const aBytes = new Uint8Array(nArrLen);\n\n /* transcription\u2026 */\n let nIdx = 0;\n let nChrIdx = 0;\n while (nIdx < nArrLen) {\n nChr = sDOMStr.codePointAt(nChrIdx);\n if (nChr === undefined) {\n throw Error(`No char at ${nChrIdx} on string with length: ${sDOMStr.length}`)\n }\n if (nChr < 128) {\n /* one byte */\n aBytes[nIdx++] = nChr;\n } else if (nChr < 0x800) {\n /* two bytes */\n aBytes[nIdx++] = 192 + (nChr >>> 6);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x10000) {\n /* three bytes */\n aBytes[nIdx++] = 224 + (nChr >>> 12);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x200000) {\n /* four bytes */\n aBytes[nIdx++] = 240 + (nChr >>> 18);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n } else if (nChr < 0x4000000) {\n /* five bytes */\n aBytes[nIdx++] = 248 + (nChr >>> 24);\n aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n } /* if (nChr <= 0x7fffffff) */ else {\n /* six bytes */\n aBytes[nIdx++] = 252 + (nChr >>> 30);\n aBytes[nIdx++] = 128 + ((nChr >>> 24) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);\n aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n nChrIdx++;\n }\n nChrIdx++;\n }\n\n return aBytes;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { HttpStatusCode } from \"@gnu-taler/taler-util\";\nimport { base64encode } from \"./base64.js\";\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport enum ErrorType {\n CLIENT,\n SERVER,\n UNREADABLE,\n TIMEOUT,\n UNEXPECTED,\n}\n\n\n\n/**\n *\n * @param baseUrl URL where the service is located\n * @param endpoint endpoint of the service to be called\n * @param options auth, method and params\n * @deprecated do not use it, it will be removed\n * @returns\n */\nexport async function defaultRequestHandler(\n baseUrl: string,\n endpoint: string,\n options: RequestOptions = {},\n): Promise> {\n const requestHeaders: Record = {};\n if (options.token) {\n requestHeaders.Authorization = `Bearer secret-token:${options.token}`;\n } else if (options.basicAuth) {\n requestHeaders.Authorization = `Basic ${base64encode(\n `${options.basicAuth.username}:${options.basicAuth.password}`,\n )}`;\n }\n\n requestHeaders[\"Content-Type\"] =\n !options.contentType || options.contentType === \"json\" ? \"application/json\" : \"text/plain\";\n\n if (options.talerAmlOfficerSignature) {\n requestHeaders[\"Taler-AML-Officer-Signature\"] =\n options.talerAmlOfficerSignature;\n }\n\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.data;\n const requestTimeout = options?.timeout ?? 5 * 1000;\n const requestParams = options.params ?? {};\n const requestPreventCache = options.preventCache ?? false;\n const requestPreventCors = options.preventCors ?? false;\n\n const validURL = validateURL(baseUrl, endpoint);\n\n if (!validURL) {\n const error: HttpResponseUnexpectedError = {\n info: {\n url: `${baseUrl}${endpoint}`,\n payload: {},\n hasToken: !!options.token,\n status: 0,\n options,\n },\n type: ErrorType.UNEXPECTED,\n exception: undefined,\n loading: false,\n message: `invalid URL: \"${baseUrl}${endpoint}\"`,\n };\n throw new RequestError(error)\n }\n\n Object.entries(requestParams).forEach(([key, value]) => {\n validURL.searchParams.set(key, String(value));\n });\n\n let payload: BodyInit | undefined = undefined;\n if (requestBody != null) {\n if (typeof requestBody === \"string\") {\n payload = requestBody;\n } else if (requestBody instanceof ArrayBuffer) {\n payload = requestBody;\n } else if (ArrayBuffer.isView(requestBody)) {\n payload = requestBody;\n } else if (typeof requestBody === \"object\") {\n payload = JSON.stringify(requestBody);\n } else {\n const error: HttpResponseUnexpectedError = {\n info: {\n url: validURL.href,\n payload: {},\n hasToken: !!options.token,\n status: 0,\n options,\n },\n type: ErrorType.UNEXPECTED,\n exception: undefined,\n loading: false,\n message: `unsupported request body type: \"${typeof requestBody}\"`,\n };\n throw new RequestError(error)\n }\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => {\n controller.abort(\"HTTP_REQUEST_TIMEOUT\");\n }, requestTimeout);\n\n let response;\n try {\n response = await fetch(validURL.href, {\n headers: requestHeaders,\n method: requestMethod,\n credentials: \"omit\",\n mode: requestPreventCors ? \"no-cors\" : \"cors\",\n cache: requestPreventCache ? \"no-cache\" : \"default\",\n body: payload,\n signal: controller.signal,\n });\n } catch (ex) {\n const info: RequestInfo = {\n payload,\n url: validURL.href,\n hasToken: !!options.token,\n status: 0,\n options,\n };\n\n if (ex instanceof Error) {\n if (ex.message === \"HTTP_REQUEST_TIMEOUT\") {\n const error: HttpRequestTimeoutError = {\n info,\n type: ErrorType.TIMEOUT,\n message: \"request timeout\",\n };\n throw new RequestError(error);\n }\n }\n\n const error: HttpResponseUnexpectedError = {\n info,\n type: ErrorType.UNEXPECTED,\n exception: ex,\n loading: false,\n message: (ex instanceof Error ? ex.message : \"\"),\n };\n throw new RequestError(error);\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n const headerMap = new Headers();\n response.headers.forEach((value, key) => {\n headerMap.set(key, value);\n });\n\n if (response.ok) {\n const result = await buildRequestOk(\n response,\n validURL.href,\n payload,\n !!options.token,\n options,\n );\n return result;\n } else {\n const dataTxt = await response.text();\n const error = buildRequestFailed(\n validURL.href,\n dataTxt,\n response.status,\n payload,\n options,\n );\n throw new RequestError(error);\n }\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponse =\n | HttpResponseOk\n | HttpResponseLoading\n | HttpError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponsePaginated =\n | HttpResponseOkPaginated\n | HttpResponseLoading\n | HttpError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface RequestInfo {\n url: string;\n hasToken: boolean;\n payload: any;\n status: number;\n options: RequestOptions;\n}\n\ninterface HttpResponseLoading {\n ok?: false;\n loading: true;\n clientError?: false;\n serverError?: false;\n\n data?: T;\n}\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface HttpResponseOk {\n ok: true;\n loading?: false;\n clientError?: false;\n serverError?: false;\n\n data: T;\n info?: RequestInfo;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpResponseOkPaginated = HttpResponseOk & WithPagination;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface WithPagination {\n loadMore: () => void;\n loadMorePrev: () => void;\n isReachingEnd?: boolean;\n isReachingStart?: boolean;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport type HttpError =\n | HttpRequestTimeoutError\n | HttpResponseClientError\n | HttpResponseServerError\n | HttpResponseUnreadableError\n | HttpResponseUnexpectedError;\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface HttpResponseServerError {\n ok?: false;\n loading?: false;\n type: ErrorType.SERVER;\n payload: ErrorDetail;\n status: HttpStatusCode;\n message: string;\n info: RequestInfo;\n}\ninterface HttpRequestTimeoutError {\n ok?: false;\n loading?: false;\n type: ErrorType.TIMEOUT;\n\n info: RequestInfo;\n\n message: string;\n}\ninterface HttpResponseClientError {\n ok?: false;\n loading?: false;\n type: ErrorType.CLIENT;\n\n info: RequestInfo;\n status: HttpStatusCode;\n payload: ErrorDetail;\n message: string;\n}\n\ninterface HttpResponseUnexpectedError {\n ok?: false;\n loading: false;\n type: ErrorType.UNEXPECTED;\n\n info: RequestInfo;\n status?: HttpStatusCode;\n exception: unknown;\n message: string;\n}\n\ninterface HttpResponseUnreadableError {\n ok?: false;\n loading: false;\n type: ErrorType.UNREADABLE;\n\n info: RequestInfo;\n status: HttpStatusCode;\n exception: unknown;\n body: string;\n message: string;\n}\n/**\n * @deprecated do not use it, it will be removed\n */\nexport class RequestError extends Error {\n /**\n * @deprecated use cause\n */\n info: HttpError;\n cause: HttpError;\n constructor(d: HttpError) {\n super(d.message);\n this.info = d;\n this.cause = d;\n }\n}\n\ntype Methods = \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport interface RequestOptions {\n method?: Methods;\n token?: string;\n basicAuth?: {\n username: string;\n password: string;\n };\n preventCache?: boolean;\n preventCors?: boolean;\n data?: any;\n params?: unknown;\n timeout?: number;\n contentType?: \"text\" | \"json\";\n talerAmlOfficerSignature?: string;\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nasync function buildRequestOk(\n response: Response,\n url: string,\n payload: any,\n hasToken: boolean,\n options: RequestOptions,\n): Promise> {\n const dataTxt = await response.text();\n const data = dataTxt ? JSON.parse(dataTxt) : undefined;\n return {\n ok: true,\n data,\n info: {\n payload,\n url,\n hasToken,\n options,\n status: response.status,\n },\n };\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nexport function buildRequestFailed(\n url: string,\n dataTxt: string,\n status: number,\n payload: any,\n maybeOptions?: RequestOptions,\n):\n | HttpResponseClientError\n | HttpResponseServerError\n | HttpResponseUnreadableError\n | HttpResponseUnexpectedError {\n const options = maybeOptions ?? {};\n const info: RequestInfo = {\n payload,\n url,\n hasToken: !!options.token,\n options,\n status: status || 0,\n };\n\n // const dataTxt = await response.text();\n try {\n const data = dataTxt ? JSON.parse(dataTxt) : undefined;\n const errorCode = !data || !data.code ? \"\" : `(code: ${data.code})`;\n const errorHint =\n !data || !data.hint ? \"Not hint.\" : `${data.hint} ${errorCode}`;\n\n if (status && status >= 400 && status < 500) {\n const message =\n data === undefined\n ? `Client error (${status}) without data.`\n : errorHint;\n\n const error: HttpResponseClientError = {\n type: ErrorType.CLIENT,\n status,\n info,\n message,\n payload: data,\n };\n return error;\n }\n if (status && status >= 500 && status < 600) {\n const message =\n data === undefined\n ? `Server error (${status}) without data.`\n : errorHint;\n const error: HttpResponseServerError = {\n type: ErrorType.SERVER,\n status,\n info,\n message,\n payload: data,\n };\n return error;\n }\n return {\n info,\n loading: false,\n type: ErrorType.UNEXPECTED,\n status,\n exception: undefined,\n message: `http status code not handled: ${status}`,\n };\n } catch (ex) {\n const error: HttpResponseUnreadableError = {\n info,\n loading: false,\n status,\n type: ErrorType.UNREADABLE,\n exception: ex,\n body: dataTxt,\n message: \"Could not parse body as json\",\n };\n\n return error;\n }\n}\n\n/**\n * @deprecated do not use it, it will be removed\n */\nfunction validateURL(baseUrl: string, endpoint: string): URL | undefined {\n try {\n return new URL(`${baseUrl}${endpoint}`)\n } catch (ex) {\n return undefined\n }\n\n}", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n Logger,\n RequestThrottler,\n TalerErrorCode,\n TalerError,\n Duration,\n} from \"@gnu-taler/taler-util\";\n\nimport {\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n Headers,\n getDefaultHeaders,\n encodeBody,\n DEFAULT_REQUEST_TIMEOUT_MS,\n HttpLibArgs,\n} from \"@gnu-taler/taler-util/http\";\n\nconst logger = new Logger(\"browserHttpLib\");\n\n/**\n * An implementation of the [[HttpRequestLibrary]] using the\n * browser's XMLHttpRequest.\n * \n * @deprecated use BrowserFetchHttpLib\n */\nexport class BrowserHttpLibDepreacted implements HttpRequestLibrary {\n private throttle = new RequestThrottler();\n private throttlingEnabled = true;\n private requireTls = false;\n\n constructor(args?: HttpLibArgs) {\n this.throttlingEnabled = args?.enableThrottling ?? true;\n this.requireTls = args?.requireTls ?? false;\n }\n\n fetch(\n requestUrl: string,\n options?: HttpRequestOptions,\n ): Promise {\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.body;\n const requestHeader = options?.headers;\n const requestTimeout =\n options?.timeout ?? Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);\n\n const parsedUrl = new URL(requestUrl);\n if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED,\n {\n requestMethod,\n requestUrl,\n throttleStats: this.throttle.getThrottleStats(requestUrl),\n },\n `request to origin ${parsedUrl.origin} was throttled`,\n );\n }\n if (this.requireTls && parsedUrl.protocol !== \"https:\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestMethod: requestMethod,\n requestUrl: requestUrl,\n },\n `request to ${parsedUrl.origin} is not possible with protocol ${parsedUrl.protocol}`,\n );\n }\n\n let myBody: ArrayBuffer | undefined =\n requestMethod === \"POST\" || requestMethod === \"PUT\" || requestMethod === \"PATCH\"\n ? encodeBody(requestBody)\n : undefined;\n\n const requestHeadersMap = getDefaultHeaders(requestMethod);\n if (requestHeader) {\n Object.entries(requestHeader).forEach(([key, value]) => {\n if (value === undefined) return;\n requestHeadersMap[key] = value\n })\n }\n\n return new Promise((resolve, reject) => {\n const myRequest = new XMLHttpRequest();\n\n myRequest.onerror = (e) => {\n logger.error(\"http request error\");\n reject(\n TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestUrl,\n requestMethod,\n },\n \"Could not make request\",\n ),\n );\n };\n\n myRequest.open(requestMethod, requestUrl);\n\n let timeoutId: any | undefined;\n if (requestTimeout.d_ms !== \"forever\") {\n timeoutId = setTimeout(() => {\n myRequest.abort();\n reject(\n TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT,\n {\n requestUrl,\n requestMethod,\n timeoutMs: requestTimeout.d_ms === \"forever\" ? 0 : requestTimeout.d_ms\n },\n `request to ${requestUrl} timed out`,\n ),\n );\n }, requestTimeout.d_ms);\n }\n\n Object.keys(requestHeadersMap).forEach((headerName) => {\n myRequest.setRequestHeader(headerName, requestHeadersMap[headerName]);\n });\n\n myRequest.responseType = \"arraybuffer\";\n myRequest.send(myBody);\n\n myRequest.addEventListener(\"readystatechange\", (e) => {\n if (myRequest.readyState === XMLHttpRequest.DONE) {\n if (myRequest.status === 0) {\n const exc = TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestUrl,\n requestMethod,\n },\n \"HTTP request failed (status 0, maybe URI scheme was wrong?)\",\n );\n reject(exc);\n return;\n }\n const makeText = async (): Promise => {\n const td = new TextDecoder();\n return td.decode(myRequest.response);\n };\n let responseJson: unknown = undefined;\n const makeJson = async (): Promise => {\n if (responseJson === undefined) {\n try {\n const td = new TextDecoder();\n const responseString = td.decode(myRequest.response);\n responseJson = JSON.parse(responseString);\n } catch (e) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: myRequest.status,\n },\n \"Invalid JSON from HTTP response\",\n );\n }\n }\n if (responseJson === null || typeof responseJson !== \"object\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: myRequest.status,\n },\n \"Invalid JSON from HTTP response\",\n );\n }\n return responseJson;\n };\n\n const headers = myRequest.getAllResponseHeaders();\n const arr = headers.trim().split(/[\\r\\n]+/);\n\n // Create a map of header names to values\n const headerMap: Headers = new Headers();\n arr.forEach(function (line) {\n const parts = line.split(\": \");\n const headerName = parts.shift();\n if (!headerName) {\n logger.warn(\"skipping invalid header\");\n return;\n }\n const value = parts.join(\": \");\n headerMap.set(headerName, value);\n });\n const resp: HttpResponse = {\n requestUrl: requestUrl,\n status: myRequest.status,\n headers: headerMap,\n requestMethod: requestMethod,\n json: makeJson,\n text: makeText,\n bytes: async () => myRequest.response,\n };\n resolve(resp);\n }\n });\n });\n }\n\n get(url: string, opt?: HttpRequestOptions): Promise {\n return this.fetch(url, {\n method: \"GET\",\n ...opt,\n });\n }\n\n postJson(\n url: string,\n body: any,\n opt?: HttpRequestOptions,\n ): Promise {\n return this.fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n ...opt,\n });\n }\n\n stop(): void {\n // Nothing to do\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Imports.\n */\nimport {\n Duration,\n RequestThrottler,\n TalerError,\n TalerErrorCode,\n} from \"@gnu-taler/taler-util\";\n\nimport {\n DEFAULT_REQUEST_TIMEOUT_MS,\n Headers,\n HttpLibArgs,\n HttpRequestLibrary,\n HttpRequestOptions,\n HttpResponse,\n encodeBody,\n getDefaultHeaders,\n} from \"@gnu-taler/taler-util/http\";\n\n/**\n * An implementation of the [[HttpRequestLibrary]] using the\n * browser's XMLHttpRequest.\n */\nexport class BrowserFetchHttpLib implements HttpRequestLibrary {\n private throttle = new RequestThrottler();\n private throttlingEnabled = true;\n private requireTls = false;\n\n public constructor(args?: HttpLibArgs) {\n this.throttlingEnabled = args?.enableThrottling ?? true;\n this.requireTls = args?.requireTls ?? false;\n }\n\n async fetch(\n requestUrl: string,\n options?: HttpRequestOptions,\n ): Promise {\n const requestMethod = options?.method ?? \"GET\";\n const requestBody = options?.body;\n const requestHeader = options?.headers;\n const requestTimeout =\n options?.timeout ?? Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);\n const requestCancel = options?.cancellationToken;\n const requestRedirect = options?.redirect;\n\n const parsedUrl = new URL(requestUrl);\n if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED,\n {\n requestMethod,\n requestUrl,\n throttleStats: this.throttle.getThrottleStats(requestUrl),\n },\n `request to origin ${parsedUrl.origin} was throttled`,\n );\n }\n if (this.requireTls && parsedUrl.protocol !== \"https:\") {\n throw TalerError.fromDetail(\n TalerErrorCode.WALLET_NETWORK_ERROR,\n {\n requestMethod: requestMethod,\n requestUrl: requestUrl,\n },\n `request to ${parsedUrl.origin} is not possible with protocol ${parsedUrl.protocol}`,\n );\n }\n\n const myBody: ArrayBuffer | undefined =\n requestMethod === \"POST\" ||\n requestMethod === \"PUT\" ||\n requestMethod === \"PATCH\"\n ? encodeBody(requestBody)\n : undefined;\n\n const requestHeadersMap = getDefaultHeaders(requestMethod);\n if (requestHeader) {\n Object.entries(requestHeader).forEach(([key, value]) => {\n if (value === undefined) return;\n requestHeadersMap[key] = value;\n });\n }\n\n const controller = new AbortController();\n let timeoutId: ReturnType | undefined;\n if (requestTimeout.d_ms !== \"forever\") {\n timeoutId = setTimeout(() => {\n controller.abort(TalerErrorCode.GENERIC_TIMEOUT);\n }, requestTimeout.d_ms);\n }\n if (requestCancel) {\n requestCancel.onCancelled(() => {\n controller.abort(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR);\n });\n }\n\n try {\n const response = await fetch(requestUrl, {\n headers: requestHeadersMap,\n body: myBody,\n method: requestMethod,\n signal: controller.signal,\n redirect: requestRedirect,\n });\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n const headerMap = new Headers();\n response.headers.forEach((value, key) => {\n headerMap.set(key, value);\n });\n const text = makeTextHandler(response, requestUrl, requestMethod);\n const json = makeJsonHandler(response, requestUrl, requestMethod, text);\n return {\n headers: headerMap,\n status: response.status,\n requestMethod,\n requestUrl,\n json,\n text,\n bytes: async () => (await response.blob()).arrayBuffer(),\n };\n } catch (e) {\n if (controller.signal) {\n throw TalerError.fromDetail(\n controller.signal.reason,\n {\n requestUrl,\n requestMethod,\n timeoutMs:\n requestTimeout.d_ms === \"forever\" ? 0 : requestTimeout.d_ms,\n },\n `HTTP request failed.`,\n );\n }\n throw e;\n }\n }\n}\n\nfunction makeTextHandler(\n response: Response,\n requestUrl: string,\n requestMethod: string,\n) {\n let firstTime = true;\n let respText: string;\n let error: TalerError | undefined;\n return async function getTextFromResponse(): Promise {\n if (firstTime) {\n firstTime = false;\n try {\n respText = await response.text();\n } catch (e) {\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n \"Invalid text from HTTP response\",\n );\n }\n }\n if (error !== undefined) {\n throw error;\n }\n return respText;\n };\n}\n\nfunction makeJsonHandler(\n response: Response,\n requestUrl: string,\n requestMethod: string,\n readTextHandler: () => Promise,\n) {\n let firstTime = true;\n let responseJson: string | undefined = undefined;\n let error: TalerError | undefined;\n return async function getJsonFromResponse(): Promise {\n if (firstTime) {\n let responseText: string;\n try {\n responseText = await readTextHandler();\n } catch (e) {\n const message =\n e instanceof Error\n ? `Couldn't read HTTP response: ${e.message}`\n : \"Couldn't read HTTP response\";\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n message,\n );\n }\n if (!error) {\n try {\n // @ts-expect-error no error then text is initialized\n responseJson = JSON.parse(responseText);\n } catch (e) {\n const message =\n e instanceof Error\n ? `Invalid JSON from HTTP response: ${e.message}`\n : \"Invalid JSON from HTTP response\";\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n // @ts-expect-error no error then text is initialized\n response: responseText,\n httpStatusCode: response.status,\n validationError: e instanceof Error ? e.message : String(e),\n },\n message,\n );\n }\n if (responseJson === null || typeof responseJson !== \"object\") {\n error = TalerError.fromDetail(\n TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,\n {\n requestUrl,\n requestMethod,\n response: JSON.stringify(responseJson),\n httpStatusCode: response.status,\n },\n \"Invalid JSON from HTTP response: null or not object\",\n );\n }\n }\n }\n if (error !== undefined) {\n throw error;\n }\n return responseJson;\n };\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\ndeclare const __location: unique symbol;\n/**\n * special string that defined a location in the application\n *\n * this help to prevent wrong path\n */\nexport type AppLocation = string & {\n [__location]: true;\n};\n\nexport type EmptyObject = Record;\n\nexport function urlPattern<\n T extends Record = EmptyObject,\n>(pattern: RegExp, reverse: (p: T) => string): RouteDefinition {\n const url = reverse as (p: T) => AppLocation;\n return {\n pattern: new RegExp(pattern),\n url,\n };\n}\n\n/**\n * defines a location in the app\n *\n * pattern: how a string will trigger this location\n * url(): how a state serialize to a location\n */\n\nexport type ObjectOf = Record | EmptyObject;\n\nexport type RouteDefinition<\n T extends ObjectOf = EmptyObject,\n> = {\n pattern: RegExp;\n url: (p: T) => AppLocation;\n};\n\nconst nullRountDef = {\n pattern: new RegExp(/.*/),\n url: () => \"\" as AppLocation,\n};\nexport function buildNullRoutDefinition<\n T extends ObjectOf,\n>(): RouteDefinition {\n return nullRountDef;\n}\n\n/**\n * Search path in the pageList\n * get the values from the path found\n * add params from searchParams\n *\n * @param path\n * @param params\n */\nexport function findMatch>(\n pagesMap: T,\n pageList: Array,\n path: string,\n params: Record,\n): Location | LocationNotFound {\n for (let idx = 0; idx < pageList.length; idx++) {\n const name = pageList[idx];\n const found = pagesMap[name].pattern.exec(path);\n if (found !== null) {\n const values = {} as Record;\n\n if (found.groups !== undefined) {\n Object.entries(found.groups).forEach(([key, value]) => {\n values[key] = value;\n });\n }\n\n // @ts-expect-error values is a map string which is equivalent to the RouteParamsType\n return { name, parent: pagesMap, values, params };\n }\n }\n // @ts-expect-error values is a map string which is equivalent to the RouteParamsType\n return { name: undefined, parent: pagesMap, values: {}, params };\n}\n\n/**\n * get the type of the params of a location\n *\n */\ntype RouteParamsType<\n RouteType,\n Key extends keyof RouteType,\n> = RouteType[Key] extends RouteDefinition ? ParamType : never;\n\n/**\n * Helps to create a map of a type with the key\n */\ntype MapKeyValue = {\n [Key in keyof Type]: Key extends string\n ? {\n parent: Type;\n name: Key;\n values: RouteParamsType;\n params: Record;\n }\n : never;\n};\n\n/**\n * create a enumeration of value of a mapped type\n */\ntype EnumerationOf = T[keyof T];\n\nexport type Location = EnumerationOf>;\nexport type LocationNotFound = {\n parent: Type;\n name: undefined;\n values: RouteParamsType;\n params: Record;\n};\n", "/*\n This file is part of GNU Taler\n (C) 2021-2023 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { TalerBankIntegrationHttpClient, TalerCoreBankHttpClient, TalerRevenueHttpClient, TalerWireGatewayHttpClient } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\nimport { defaultRequestHandler } from \"../utils/request.js\";\n\ninterface Type {\n /**\n * @deprecated this show not be used\n */\n request: typeof defaultRequestHandler;\n bankCore: TalerCoreBankHttpClient,\n bankIntegration: TalerBankIntegrationHttpClient,\n bankWire: TalerWireGatewayHttpClient,\n bankRevenue: TalerRevenueHttpClient,\n}\n\nconst Context = createContext({ request: defaultRequestHandler } as any);\n\nexport const useApiContext = (): Type => useContext(Context);\nexport const ApiContextProvider = ({\n children,\n value,\n}: {\n value: Type;\n children: ComponentChildren;\n}): VNode => {\n return h(Context.Provider, { value, children });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { i18n, setupI18n } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext, useEffect } from \"preact/hooks\";\nimport { useLang } from \"../hooks/index.js\";\nimport { Locale } from \"date-fns\";\nimport {\n es as esLocale,\n enGB as enLocale,\n fr as frLocale,\n de as deLocale\n} from \"date-fns/locale\"\n\nexport type InternationalizationAPI = typeof i18n;\n\ninterface Type {\n lang: string;\n supportedLang: { [id in keyof typeof supportedLang]: string };\n changeLanguage: (l: string) => void;\n i18n: InternationalizationAPI;\n dateLocale: Locale,\n completeness: { [id in keyof typeof supportedLang]: number }\n}\n\nconst supportedLang = {\n es: \"Espanol [es]\",\n en: \"English [en]\",\n fr: \"Francais [fr]\",\n de: \"Deutsch [de]\",\n sv: \"Svenska [sv]\",\n it: \"Italiane [it]\",\n};\n\nconst initial: Type = {\n lang: \"en\",\n supportedLang,\n changeLanguage: () => {\n // do not change anything\n },\n i18n,\n dateLocale: enLocale,\n completeness: {\n de: 0,\n en: 0,\n es: 0,\n fr: 0,\n it: 0,\n sv: 0,\n }\n};\nconst Context = createContext(initial);\n\ninterface Props {\n initial?: string;\n children: ComponentChildren;\n forceLang?: string;\n source: Record;\n completeness?: Record;\n}\n\n// Outmost UI wrapper.\nexport const TranslationProvider = ({\n initial,\n children,\n forceLang,\n source,\n completeness: completenessProp\n}: Props): VNode => {\n const completeness = {\n en: 100,\n de: !completenessProp || !completenessProp[\"de\"] ? 0 : completenessProp[\"de\"],\n es: !completenessProp || !completenessProp[\"es\"] ? 0 : completenessProp[\"es\"],\n fr: !completenessProp || !completenessProp[\"fr\"] ? 0 : completenessProp[\"fr\"],\n it: !completenessProp || !completenessProp[\"it\"] ? 0 : completenessProp[\"it\"],\n sv: !completenessProp || !completenessProp[\"sv\"] ? 0 : completenessProp[\"sv\"],\n }\n const { value: lang, update: changeLanguage } = useLang(initial, completeness);\n\n useEffect(() => {\n if (forceLang) {\n changeLanguage(forceLang);\n }\n },[forceLang]);\n useEffect(() => {\n setupI18n(lang, source);\n }, [lang]);\n if (forceLang) {\n setupI18n(forceLang, source);\n } else {\n setupI18n(lang, source);\n }\n\n const dateLocale = lang === \"es\" ? esLocale :\n lang === \"fr\" ? frLocale :\n lang === \"de\" ? deLocale :\n enLocale;\n\n return h(Context.Provider, {\n value: { lang, changeLanguage, supportedLang, i18n, dateLocale, completeness },\n children,\n });\n};\n\nexport const useTranslationContext = (): Type => useContext(Context);\n", "export default function buildFormatLongFn(args) {\n return function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // TODO: Remove String()\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}", "export default function buildLocalizeFn(args) {\n return function (dirtyIndex, options) {\n var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';\n var valuesArray;\n\n if (context === 'formatting' && args.formattingValues) {\n var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;\n valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n var _defaultWidth = args.defaultWidth;\n\n var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[_width] || args.values[_defaultWidth];\n }\n\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n\n return valuesArray[index];\n };\n}", "export default function buildMatchFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n }) : findKey(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n });\n var value;\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\n\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (var key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n\n return undefined;\n}", "export default function buildMatchPatternFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}", "export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n\n var number = Number(dirtyNumber);\n\n if (isNaN(number)) {\n return number;\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}", "export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\n\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument); // Clone the date\n\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\"); // eslint-disable-next-line no-console\n\n console.warn(new Error().stack);\n }\n\n return new Date(NaN);\n }\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\n\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n date.setDate(date.getDate() + amount);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\n\nexport default function addMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n\n var endOfDesiredMonth = new Date(date.getTime());\n endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);\n var daysInMonth = endOfDesiredMonth.getDate();\n\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);\n return date;\n }\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport addDays from \"../addDays/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n\n/**\n * @name add\n * @category Common Helpers\n * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @description\n * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n *\n * | Key | Description |\n * |----------------|------------------------------------|\n * | years | Amount of years to be added |\n * | months | Amount of months to be added |\n * | weeks | Amount of weeks to be added |\n * | days | Amount of days to be added |\n * | hours | Amount of hours to be added |\n * | minutes | Amount of minutes to be added |\n * | seconds | Amount of seconds to be added |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add the following duration to 1 September 2014, 10:19:50\n * const result = add(new Date(2014, 8, 1, 10, 19, 50), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30,\n * })\n * //=> Thu Jun 15 2017 15:29:20\n */\nexport default function add(dirtyDate, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Add years and months\n\n var date = toDate(dirtyDate);\n var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date; // Add weeks and days\n\n var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths; // Add days, hours, minutes and seconds\n\n var minutesToAdd = minutes + hours * 60;\n var secondsToAdd = seconds + minutesToAdd * 60;\n var msToAdd = secondsToAdd * 1000;\n var finalDate = new Date(dateWithDays.getTime() + msToAdd);\n return finalDate;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\n\nexport default function addMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var timestamp = toDate(dirtyDate).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}", "var defaultOptions = {};\nexport function getDefaultOptions() {\n return defaultOptions;\n}\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}", "import toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the start of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setDate(date.getDate() - diff);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\n\nexport default function startOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\n\nexport default function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var startOfDayLeft = startOfDay(dirtyDateLeft);\n var startOfDayRight = startOfDay(dirtyDateRight);\n var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);\n var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); // Round the number of days to the nearest integer\n // because the number of milliseconds in a day is not constant\n // (e.g. it's different in the day of the daylight saving time clock shift)\n\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\n\nexport default function compareAsc(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var diff = dateLeft.getTime() - dateRight.getTime();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "/**\n * Days in 1 week.\n *\n * @name daysInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInWeek = 7;\n/**\n * Days in 1 year\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n *\n * @name daysInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var daysInYear = 365.2425;\n/**\n * Maximum allowed time.\n *\n * @name maxTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n/**\n * Milliseconds in 1 minute\n *\n * @name millisecondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInMinute = 60000;\n/**\n * Milliseconds in 1 hour\n *\n * @name millisecondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInHour = 3600000;\n/**\n * Milliseconds in 1 second\n *\n * @name millisecondsInSecond\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInSecond = 1000;\n/**\n * Minimum allowed time.\n *\n * @name minTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minTime = -maxTime;\n/**\n * Minutes in 1 hour\n *\n * @name minutesInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minutesInHour = 60;\n/**\n * Months in 1 quarter\n *\n * @name monthsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInQuarter = 3;\n/**\n * Months in 1 year\n *\n * @name monthsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInYear = 12;\n/**\n * Quarters in 1 year\n *\n * @name quartersInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var quartersInYear = 4;\n/**\n * Seconds in 1 hour\n *\n * @name secondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInHour = 3600;\n/**\n * Seconds in 1 minute\n *\n * @name secondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMinute = 60;\n/**\n * Seconds in 1 day\n *\n * @name secondsInDay\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInDay = secondsInHour * 24;\n/**\n * Seconds in 1 week\n *\n * @name secondsInWeek\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInWeek = secondsInDay * 7;\n/**\n * Seconds in 1 year\n *\n * @name secondsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInYear = secondsInDay * daysInYear;\n/**\n * Seconds in 1 month\n *\n * @name secondsInMonth\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMonth = secondsInYear / 12;\n/**\n * Seconds in 1 quarter\n *\n * @name secondsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInQuarter = secondsInMonth * 3;", "import startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameDay\n * @category Day Helpers\n * @summary Are the given dates in the same day (and year and month)?\n *\n * @description\n * Are the given dates in the same day (and year and month)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same day (and year and month)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))\n * //=> true\n *\n * @example\n * // Are 4 September and 4 October in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))\n * //=> false\n *\n * @example\n * // Are 4 September, 2014 and 4 September, 2015 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))\n * //=> false\n */\n\nexport default function isSameDay(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeftStartOfDay = startOfDay(dirtyDateLeft);\n var dateRightStartOfDay = startOfDay(dirtyDateRight);\n return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\n\nexport default function isDate(value) {\n requiredArgs(1, arguments);\n return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';\n}", "import isDate from \"../isDate/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\n\nexport default function isValid(dirtyDate) {\n requiredArgs(1, arguments);\n\n if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {\n return false;\n }\n\n var date = toDate(dirtyDate);\n return !isNaN(Number(date));\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\n\nexport default function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();\n var monthDiff = dateLeft.getMonth() - dateRight.getMonth();\n return yearDiff * 12 + monthDiff;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\n\nexport default function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() - dateRight.getFullYear();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarDays from \"../differenceInCalendarDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\"; // Like `compareAsc` but uses local time not UTC, which is needed\n// for accurate equality comparisons of UTC timestamps that end up\n// having the same representation in local time, e.g. one hour before\n// DST ends vs. the instant that DST ends.\n\nfunction compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}\n/**\n * @name differenceInDays\n * @category Day Helpers\n * @summary Get the number of full days between the given dates.\n *\n * @description\n * Get the number of full day periods between two dates. Fractional days are\n * truncated towards zero.\n *\n * One \"full day\" is the distance between a local time in one day to the same\n * local time on the next or previous day. A full day can sometimes be less than\n * or more than 24 hours if a daylight savings change happens between two dates.\n *\n * To ignore DST and only measure exact 24-hour periods, use this instead:\n * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.\n *\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full days according to the local timezone\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 365\n * // How many full days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 0\n * // How many full days are between\n * // 1 March 2020 0:00 and 1 June 2020 0:00 ?\n * // Note: because local time is used, the\n * // result will always be 92 days, even in\n * // time zones where DST starts and the\n * // period has only 92*24-1 hours.\n * const result = differenceInDays(\n * new Date(2020, 5, 1),\n * new Date(2020, 2, 1)\n * )\n//=> 92\n */\n\n\nexport default function differenceInDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareLocalAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));\n dateLeft.setDate(dateLeft.getDate() - sign * difference); // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);\n var result = sign * (difference - isLastDayNotFull); // Prevent negative zero\n\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\n\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}", "var roundingMap = {\n ceil: Math.ceil,\n round: Math.round,\n floor: Math.floor,\n trunc: function trunc(value) {\n return value < 0 ? Math.ceil(value) : Math.floor(value);\n } // Math.trunc is not supported by IE\n\n};\nvar defaultRoundingMethod = 'trunc';\nexport function getRoundingMethod(method) {\n return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];\n}", "import { millisecondsInHour } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInHours\n * @category Hour Helpers\n * @summary Get the number of hours between the given dates.\n *\n * @description\n * Get the number of hours between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of hours\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?\n * const result = differenceInHours(\n * new Date(2014, 6, 2, 19, 0),\n * new Date(2014, 6, 2, 6, 50)\n * )\n * //=> 12\n */\n\nexport default function differenceInHours(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import { millisecondsInMinute } from \"../constants/index.js\";\nimport differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInMinutes\n * @category Minute Helpers\n * @summary Get the number of minutes between the given dates.\n *\n * @description\n * Get the signed number of full (rounded towards 0) minutes between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of minutes\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?\n * const result = differenceInMinutes(\n * new Date(2014, 6, 2, 12, 20, 0),\n * new Date(2014, 6, 2, 12, 7, 59)\n * )\n * //=> 12\n *\n * @example\n * // How many minutes are between 10:01:59 and 10:00:00\n * const result = differenceInMinutes(\n * new Date(2000, 0, 1, 10, 0, 0),\n * new Date(2000, 0, 1, 10, 1, 59)\n * )\n * //=> -1\n */\n\nexport default function differenceInMinutes(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\n\nexport default function endOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\n\nexport default function endOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n date.setFullYear(date.getFullYear(), month + 1, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import toDate from \"../toDate/index.js\";\nimport endOfDay from \"../endOfDay/index.js\";\nimport endOfMonth from \"../endOfMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isLastDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the last day of a month?\n *\n * @description\n * Is the given date the last day of a month?\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is the last day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 28 February 2014 the last day of a month?\n * const result = isLastDayOfMonth(new Date(2014, 1, 28))\n * //=> true\n */\n\nexport default function isLastDayOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n return endOfDay(date).getTime() === endOfMonth(date).getTime();\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarMonths from \"../differenceInCalendarMonths/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport isLastDayOfMonth from \"../isLastDayOfMonth/index.js\";\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\n\nexport default function differenceInMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));\n var result; // Check for the difference of less than month\n\n if (difference < 1) {\n result = 0;\n } else {\n if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {\n // This will check if the date is end of Feb and assign a higher end of month date\n // to compare it with Jan\n dateLeft.setDate(30);\n }\n\n dateLeft.setMonth(dateLeft.getMonth() - sign * difference); // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign; // Check for cases of one full calendar month\n\n if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {\n isLastMonthNotFull = false;\n }\n\n result = sign * (difference - Number(isLastMonthNotFull));\n } // Prevent negative zero\n\n\n return result === 0 ? 0 : result;\n}", "import differenceInMilliseconds from \"../differenceInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getRoundingMethod } from \"../_lib/roundingMethods/index.js\";\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\n\nexport default function differenceInSeconds(dateLeft, dateRight, options) {\n requiredArgs(2, arguments);\n var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);\n}", "import toDate from \"../toDate/index.js\";\nimport differenceInCalendarYears from \"../differenceInCalendarYears/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInYears\n * @category Year Helpers\n * @summary Get the number of full years between the given dates.\n *\n * @description\n * Get the number of full years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))\n * //=> 1\n */\n\nexport default function differenceInYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var sign = compareAsc(dateLeft, dateRight);\n var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight)); // Set both dates to a valid leap year for accurate comparison when dealing\n // with leap days\n\n dateLeft.setFullYear(1584);\n dateRight.setFullYear(1584); // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full\n // If so, result must be decreased by 1 in absolute value\n\n var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;\n var result = sign * (difference - Number(isLastYearNotFull)); // Prevent negative zero\n\n return result === 0 ? 0 : result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name eachDayOfInterval\n * @category Interval Helpers\n * @summary Return the array of dates within the specified time interval.\n *\n * @description\n * Return the array of dates within the specified time interval.\n *\n * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.\n * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.step` must be a number greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each day between 6 October 2014 and 10 October 2014:\n * const result = eachDayOfInterval({\n * start: new Date(2014, 9, 6),\n * end: new Date(2014, 9, 10)\n * })\n * //=> [\n * // Mon Oct 06 2014 00:00:00,\n * // Tue Oct 07 2014 00:00:00,\n * // Wed Oct 08 2014 00:00:00,\n * // Thu Oct 09 2014 00:00:00,\n * // Fri Oct 10 2014 00:00:00\n * // ]\n */\n\nexport default function eachDayOfInterval(dirtyInterval, options) {\n var _options$step;\n\n requiredArgs(1, arguments);\n var interval = dirtyInterval || {};\n var startDate = toDate(interval.start);\n var endDate = toDate(interval.end);\n var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`\n\n if (!(startDate.getTime() <= endTime)) {\n throw new RangeError('Invalid interval');\n }\n\n var dates = [];\n var currentDate = startDate;\n currentDate.setHours(0, 0, 0, 0);\n var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);\n if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');\n\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate));\n currentDate.setDate(currentDate.getDate() + step);\n currentDate.setHours(0, 0, 0, 0);\n }\n\n return dates;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n}", "import { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name endOfWeek\n * @category Week Helpers\n * @summary Return the end of a week for the given date.\n *\n * @description\n * Return the end of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the end of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The end of a week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 23:59:59.999\n *\n * @example\n * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport default function endOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);\n date.setDate(date.getDate() + diff);\n date.setHours(23, 59, 59, 999);\n return date;\n}", "import addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\n\nexport default function subMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount);\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\nexport default function getUTCDayOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nexport default function getUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCISOWeekYear from \"../getUTCISOWeekYear/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var year = getUTCISOWeekYear(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport startOfUTCISOWeekYear from \"../startOfUTCISOWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function getUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}", "import getUTCWeekYear from \"../getUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n var year = getUTCWeekYear(dirtyDate, options);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, options);\n return date;\n}", "import toDate from \"../../toDate/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport startOfUTCWeekYear from \"../startOfUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCWeek(dirtyDate, options) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}", "export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n\n while (output.length < targetLength) {\n output = '0' + output;\n }\n\n return sign + output;\n}", "import addLeadingZeros from \"../../addLeadingZeros/index.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nvar formatters = {\n // Year\n y: function y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);\n },\n // Month\n M: function M(date, token) {\n var month = date.getUTCMonth();\n return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n // Day of the month\n d: function d(date, token) {\n return addLeadingZeros(date.getUTCDate(), token.length);\n },\n // AM or PM\n a: function a(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return dayPeriodEnumValue.toUpperCase();\n\n case 'aaa':\n return dayPeriodEnumValue;\n\n case 'aaaaa':\n return dayPeriodEnumValue[0];\n\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';\n }\n },\n // Hour [1-12]\n h: function h(date, token) {\n return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);\n },\n // Hour [0-23]\n H: function H(date, token) {\n return addLeadingZeros(date.getUTCHours(), token.length);\n },\n // Minute\n m: function m(date, token) {\n return addLeadingZeros(date.getUTCMinutes(), token.length);\n },\n // Second\n s: function s(date, token) {\n return addLeadingZeros(date.getUTCSeconds(), token.length);\n },\n // Fraction of second\n S: function S(date, token) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, token.length);\n }\n};\nexport default formatters;", "import getUTCDayOfYear from \"../../../_lib/getUTCDayOfYear/index.js\";\nimport getUTCISOWeek from \"../../../_lib/getUTCISOWeek/index.js\";\nimport getUTCISOWeekYear from \"../../../_lib/getUTCISOWeekYear/index.js\";\nimport getUTCWeek from \"../../../_lib/getUTCWeek/index.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport addLeadingZeros from \"../../addLeadingZeros/index.js\";\nimport lightFormatters from \"../lightFormatters/index.js\";\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n }\n\n return lightFormatters.y(date, token);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year\n\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n } // Ordinal number\n\n\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n } // Padding\n\n\n return addLeadingZeros(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token) {\n var isoWeekYear = getUTCISOWeekYear(date); // Padding\n\n return addLeadingZeros(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'QQ':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'qq':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n case 'M':\n case 'MM':\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n\n case 'LL':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = getUTCWeek(date, options);\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize) {\n var isoWeek = getUTCISOWeek(date);\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), {\n unit: 'date'\n });\n }\n\n return lightFormatters.d(date, token);\n },\n // Day of year\n D: function D(date, token, localize) {\n var dayOfYear = getUTCDayOfYear(date);\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return lightFormatters.h(date, token);\n },\n // Hour [0-23]\n H: function H(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), {\n unit: 'hour'\n });\n }\n\n return lightFormatters.H(date, token);\n },\n // Hour [0-11]\n K: function K(date, token, localize) {\n var hours = date.getUTCHours() % 12;\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize) {\n var hours = date.getUTCHours();\n if (hours === 0) hours = 24;\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), {\n unit: 'minute'\n });\n }\n\n return lightFormatters.m(date, token);\n },\n // Second\n s: function s(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), {\n unit: 'second'\n });\n }\n\n return lightFormatters.s(date, token);\n },\n // Fraction of second\n S: function S(date, token) {\n return lightFormatters.S(date, token);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return 'Z';\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length);\n }\n};\n\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n\n if (minutes === 0) {\n return sign + String(hours);\n }\n\n var delimiter = dirtyDelimiter || '';\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n\n return formatTimezone(offset, dirtyDelimiter);\n}\n\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n\nexport default formatters;", "var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n};\n\nvar timeLongFormatter = function timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n};\n\nvar dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/) || [];\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n var dateTimeFormat;\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n};\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\nexport default longFormatters;", "var protectedDayOfYearTokens = ['D', 'DD'];\nvar protectedWeekYearTokens = ['YY', 'YYYY'];\nexport function isProtectedDayOfYearToken(token) {\n return protectedDayOfYearTokens.indexOf(token) !== -1;\n}\nexport function isProtectedWeekYearToken(token) {\n return protectedWeekYearTokens.indexOf(token) !== -1;\n}\nexport function throwProtectedError(token, format, input) {\n if (token === 'YYYY') {\n throw new RangeError(\"Use `yyyy` instead of `YYYY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'YY') {\n throw new RangeError(\"Use `yy` instead of `YY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'D') {\n throw new RangeError(\"Use `d` instead of `D` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'DD') {\n throw new RangeError(\"Use `dd` instead of `DD` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n }\n}", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXWeeks: {\n one: 'about 1 week',\n other: 'about {{count}} weeks'\n },\n xWeeks: {\n one: '1 week',\n other: '{{count}} weeks'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n}; // Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n var rem100 = number % 100;\n\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n\n case 2:\n return number + 'nd';\n\n case 3:\n return number + 'rd';\n }\n }\n\n return number + 'th';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n code: 'en-US',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0\n /* Sunday */\n ,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;", "import defaultLocale from \"../../locale/en-US/index.js\";\nexport default defaultLocale;", "import isValid from \"../isValid/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport formatters from \"../_lib/format/formatters/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\n\nexport default function format(dirtyDate, dirtyFormatStr, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(2, arguments);\n var formatStr = String(dirtyFormatStr);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n\n var originalDate = toDate(dirtyDate);\n\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value');\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n\n\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n\n var firstCharacter = substring[0];\n\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n\n var formatter = formatters[firstCharacter];\n\n if (formatter) {\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n\n return substring;\n }).join('');\n return result;\n}\n\nfunction cleanEscapedString(input) {\n var matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}", "export default function assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n\n return target;\n}", "import { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nvar defaultFormat = ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'];\n/**\n * @name formatDuration\n * @category Common Helpers\n * @summary Formats a duration in human-readable format\n *\n * @description\n * Return human-readable duration string i.e. \"9 months 2 days\"\n *\n * @param {Duration} duration - the duration to format\n * @param {Object} [options] - an object with options.\n * @param {string[]} [options.format=['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']] - the array of units to format\n * @param {boolean} [options.zero=false] - should zeros be included in the output?\n * @param {string} [options.delimiter=' '] - delimiter string\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {string} the formatted date string\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Format full duration\n * formatDuration({\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> '2 years 9 months 1 week 7 days 5 hours 9 minutes 30 seconds'\n *\n * @example\n * // Format partial duration\n * formatDuration({ months: 9, days: 2 })\n * //=> '9 months 2 days'\n *\n * @example\n * // Customize the format\n * formatDuration(\n * {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * },\n * { format: ['months', 'weeks'] }\n * ) === '9 months 1 week'\n *\n * @example\n * // Customize the zeros presence\n * formatDuration({ years: 0, months: 9 })\n * //=> '9 months'\n * formatDuration({ years: 0, months: 9 }, { zero: true })\n * //=> '0 years 9 months'\n *\n * @example\n * // Customize the delimiter\n * formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' })\n * //=> '2 years, 9 months, 3 weeks'\n */\n\nexport default function formatDuration(duration, options) {\n var _ref, _options$locale, _options$format, _options$zero, _options$delimiter;\n\n if (arguments.length < 1) {\n throw new TypeError(\"1 argument required, but only \".concat(arguments.length, \" present\"));\n }\n\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var format = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat;\n var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false;\n var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : ' ';\n\n if (!locale.formatDistance) {\n return '';\n }\n\n var result = format.reduce(function (acc, unit) {\n var token = \"x\".concat(unit.replace(/(^.)/, function (m) {\n return m.toUpperCase();\n }));\n var value = duration[unit];\n\n if (typeof value === 'number' && (zero || duration[unit])) {\n return acc.concat(locale.formatDistance(token, value));\n }\n\n return acc;\n }, []).join(delimiter);\n return result;\n}", "import toDate from \"../toDate/index.js\";\nimport addLeadingZeros from \"../_lib/addLeadingZeros/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatISO\n * @category Common Helpers\n * @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).\n *\n * @description\n * Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {'extended'|'basic'} [options.format='extended'] - if 'basic', hide delimiters between date and time values.\n * @param {'complete'|'date'|'time'} [options.representation='complete'] - format date, time with local time zone, or both.\n * @returns {String} the formatted date string (in local time zone)\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.format` must be 'extended' or 'basic'\n * @throws {RangeError} `options.representation` must be 'date', 'time' or 'complete'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))\n * //=> '2019-09-18T19:00:52Z'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })\n * //=> '20190918T190052'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, date only:\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })\n * //=> '2019-09-18'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })\n * //=> '19:00:52Z'\n */\n\nexport default function formatISO(date, options) {\n var _options$format, _options$representati;\n\n requiredArgs(1, arguments);\n var originalDate = toDate(date);\n\n if (isNaN(originalDate.getTime())) {\n throw new RangeError('Invalid time value');\n }\n\n var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : 'extended');\n var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : 'complete');\n\n if (format !== 'extended' && format !== 'basic') {\n throw new RangeError(\"format must be 'extended' or 'basic'\");\n }\n\n if (representation !== 'date' && representation !== 'time' && representation !== 'complete') {\n throw new RangeError(\"representation must be 'date', 'time', or 'complete'\");\n }\n\n var result = '';\n var tzOffset = '';\n var dateDelimiter = format === 'extended' ? '-' : '';\n var timeDelimiter = format === 'extended' ? ':' : ''; // Representation is either 'date' or 'complete'\n\n if (representation !== 'time') {\n var day = addLeadingZeros(originalDate.getDate(), 2);\n var month = addLeadingZeros(originalDate.getMonth() + 1, 2);\n var year = addLeadingZeros(originalDate.getFullYear(), 4); // yyyyMMdd or yyyy-MM-dd.\n\n result = \"\".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);\n } // Representation is either 'time' or 'complete'\n\n\n if (representation !== 'date') {\n // Add the timezone.\n var offset = originalDate.getTimezoneOffset();\n\n if (offset !== 0) {\n var absoluteOffset = Math.abs(offset);\n var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2);\n var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2); // If less than 0, the sign is +, because it is ahead of time.\n\n var sign = offset < 0 ? '+' : '-';\n tzOffset = \"\".concat(sign).concat(hourOffset, \":\").concat(minuteOffset);\n } else {\n tzOffset = 'Z';\n }\n\n var hour = addLeadingZeros(originalDate.getHours(), 2);\n var minute = addLeadingZeros(originalDate.getMinutes(), 2);\n var second = addLeadingZeros(originalDate.getSeconds(), 2); // If there's also date, separate it with time with 'T'\n\n var separator = result === '' ? '' : 'T'; // Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.\n\n var time = [hour, minute, second].join(timeDelimiter); // HHmmss or HH:mm:ss.\n\n result = \"\".concat(result).concat(separator).concat(time).concat(tzOffset);\n }\n\n return result;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getHours\n * @category Hour Helpers\n * @summary Get the hours of the given date.\n *\n * @description\n * Get the hours of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the hours\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the hours of 29 February 2012 11:45:00:\n * const result = getHours(new Date(2012, 1, 29, 11, 45))\n * //=> 11\n */\n\nexport default function getHours(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var hours = date.getHours();\n return hours;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMinutes\n * @category Minute Helpers\n * @summary Get the minutes of the given date.\n *\n * @description\n * Get the minutes of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the minutes\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the minutes of 29 February 2012 11:45:05:\n * const result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 45\n */\n\nexport default function getMinutes(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var minutes = date.getMinutes();\n return minutes;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMonth\n * @category Month Helpers\n * @summary Get the month of the given date.\n *\n * @description\n * Get the month of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which month is 29 February 2012?\n * const result = getMonth(new Date(2012, 1, 29))\n * //=> 1\n */\n\nexport default function getMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n return month;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getSeconds\n * @category Second Helpers\n * @summary Get the seconds of the given date.\n *\n * @description\n * Get the seconds of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the seconds\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the seconds of 29 February 2012 11:45:05.123:\n * const result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 5\n */\n\nexport default function getSeconds(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var seconds = date.getSeconds();\n return seconds;\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getYear\n * @category Year Helpers\n * @summary Get the year of the given date.\n *\n * @description\n * Get the year of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which year is 2 July 2014?\n * const result = getYear(new Date(2014, 6, 2))\n * //=> 2014\n */\n\nexport default function getYear(dirtyDate) {\n requiredArgs(1, arguments);\n return toDate(dirtyDate).getFullYear();\n}", "import compareAsc from \"../compareAsc/index.js\";\nimport add from \"../add/index.js\";\nimport differenceInDays from \"../differenceInDays/index.js\";\nimport differenceInHours from \"../differenceInHours/index.js\";\nimport differenceInMinutes from \"../differenceInMinutes/index.js\";\nimport differenceInMonths from \"../differenceInMonths/index.js\";\nimport differenceInSeconds from \"../differenceInSeconds/index.js\";\nimport differenceInYears from \"../differenceInYears/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name intervalToDuration\n * @category Common Helpers\n * @summary Convert interval to duration\n *\n * @description\n * Convert a interval object to a duration object.\n *\n * @param {Interval} interval - the interval to convert to duration\n *\n * @returns {Duration} The duration Object\n * @throws {TypeError} Requires 2 arguments\n * @throws {RangeError} `start` must not be Invalid Date\n * @throws {RangeError} `end` must not be Invalid Date\n *\n * @example\n * // Get the duration between January 15, 1929 and April 4, 1968.\n * intervalToDuration({\n * start: new Date(1929, 0, 15, 12, 0, 0),\n * end: new Date(1968, 3, 4, 19, 5, 0)\n * })\n * // => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }\n */\n\nexport default function intervalToDuration(interval) {\n requiredArgs(1, arguments);\n var start = toDate(interval.start);\n var end = toDate(interval.end);\n if (isNaN(start.getTime())) throw new RangeError('Start Date is invalid');\n if (isNaN(end.getTime())) throw new RangeError('End Date is invalid');\n var duration = {};\n duration.years = Math.abs(differenceInYears(end, start));\n var sign = compareAsc(end, start);\n var remainingMonths = add(start, {\n years: sign * duration.years\n });\n duration.months = Math.abs(differenceInMonths(end, remainingMonths));\n var remainingDays = add(remainingMonths, {\n months: sign * duration.months\n });\n duration.days = Math.abs(differenceInDays(end, remainingDays));\n var remainingHours = add(remainingDays, {\n days: sign * duration.days\n });\n duration.hours = Math.abs(differenceInHours(end, remainingHours));\n var remainingMinutes = add(remainingHours, {\n hours: sign * duration.hours\n });\n duration.minutes = Math.abs(differenceInMinutes(end, remainingMinutes));\n var remainingSeconds = add(remainingMinutes, {\n minutes: sign * duration.minutes\n });\n duration.seconds = Math.abs(differenceInSeconds(end, remainingSeconds));\n return duration;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar TIMEZONE_UNIT_PRIORITY = 10;\nexport var Setter = /*#__PURE__*/function () {\n function Setter() {\n _classCallCheck(this, Setter);\n\n _defineProperty(this, \"subPriority\", 0);\n }\n\n _createClass(Setter, [{\n key: \"validate\",\n value: function validate(_utcDate, _options) {\n return true;\n }\n }]);\n\n return Setter;\n}();\nexport var ValueSetter = /*#__PURE__*/function (_Setter) {\n _inherits(ValueSetter, _Setter);\n\n var _super = _createSuper(ValueSetter);\n\n function ValueSetter(value, validateValue, setValue, priority, subPriority) {\n var _this;\n\n _classCallCheck(this, ValueSetter);\n\n _this = _super.call(this);\n _this.value = value;\n _this.validateValue = validateValue;\n _this.setValue = setValue;\n _this.priority = priority;\n\n if (subPriority) {\n _this.subPriority = subPriority;\n }\n\n return _this;\n }\n\n _createClass(ValueSetter, [{\n key: \"validate\",\n value: function validate(utcDate, options) {\n return this.validateValue(utcDate, this.value, options);\n }\n }, {\n key: \"set\",\n value: function set(utcDate, flags, options) {\n return this.setValue(utcDate, flags, this.value, options);\n }\n }]);\n\n return ValueSetter;\n}(Setter);\nexport var DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter2) {\n _inherits(DateToSystemTimezoneSetter, _Setter2);\n\n var _super2 = _createSuper(DateToSystemTimezoneSetter);\n\n function DateToSystemTimezoneSetter() {\n var _this2;\n\n _classCallCheck(this, DateToSystemTimezoneSetter);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this2 = _super2.call.apply(_super2, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this2), \"priority\", TIMEZONE_UNIT_PRIORITY);\n\n _defineProperty(_assertThisInitialized(_this2), \"subPriority\", -1);\n\n return _this2;\n }\n\n _createClass(DateToSystemTimezoneSetter, [{\n key: \"set\",\n value: function set(date, flags) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n }\n }]);\n\n return DateToSystemTimezoneSetter;\n}(Setter);", "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { ValueSetter } from \"./Setter.js\";\nexport var Parser = /*#__PURE__*/function () {\n function Parser() {\n _classCallCheck(this, Parser);\n }\n\n _createClass(Parser, [{\n key: \"run\",\n value: function run(dateString, token, match, options) {\n var result = this.parse(dateString, token, match, options);\n\n if (!result) {\n return null;\n }\n\n return {\n setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),\n rest: result.rest\n };\n }\n }, {\n key: \"validate\",\n value: function validate(_utcDate, _value, _options) {\n return true;\n }\n }]);\n\n return Parser;\n}();", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nexport var EraParser = /*#__PURE__*/function (_Parser) {\n _inherits(EraParser, _Parser);\n\n var _super = _createSuper(EraParser);\n\n function EraParser() {\n var _this;\n\n _classCallCheck(this, EraParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 140);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['R', 'u', 't', 'T']);\n\n return _this;\n }\n\n _createClass(EraParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n // A, B\n\n case 'GGGGG':\n return match.era(dateString, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return match.era(dateString, {\n width: 'wide'\n }) || match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n flags.era = value;\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return EraParser;\n}(Parser);", "export var numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n\n};\nexport var timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};", "import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n if (!parseFnResult) {\n return parseFnResult;\n }\n\n return {\n value: mapFn(parseFnResult.value),\n rest: parseFnResult.rest\n };\n}\nexport function parseNumericPattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n }\n\n return {\n value: parseInt(matchResult[0], 10),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n } // Input is 'Z'\n\n\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: dateString.slice(1)\n };\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseAnyDigitsSigned(dateString) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function parseNDigitsSigned(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n switch (dayPeriod) {\n case 'morning':\n return 4;\n\n case 'evening':\n return 17;\n\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0; // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, normalizeTwoDigitYear, parseNDigits } from \"../utils.js\";\n// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n// | Year | y | yy | yyy | yyyy | yyyyy |\n// |----------|-------|----|-------|-------|-------|\n// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\nexport var YearParser = /*#__PURE__*/function (_Parser) {\n _inherits(YearParser, _Parser);\n\n var _super = _createSuper(YearParser);\n\n function YearParser() {\n var _this;\n\n _classCallCheck(this, YearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(YearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n\n switch (token) {\n case 'y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return YearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits, normalizeTwoDigitYear, mapValue } from \"../utils.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\";\n// Local week-numbering year\nexport var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekYearParser, _Parser);\n\n var _super = _createSuper(LocalWeekYearParser);\n\n function LocalWeekYearParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n\n switch (token) {\n case 'Y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'Yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n }]);\n\n return LocalWeekYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week-numbering year\n\nexport var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekYearParser, _Parser);\n\n var _super = _createSuper(ISOWeekYearParser);\n\n function ISOWeekYearParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'R') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n }\n }]);\n\n return ISOWeekYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nexport var ExtendedYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ExtendedYearParser, _Parser);\n\n var _super = _createSuper(ExtendedYearParser);\n\n function ExtendedYearParser() {\n var _this;\n\n _classCallCheck(this, ExtendedYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ExtendedYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'u') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ExtendedYearParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var QuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(QuarterParser, _Parser);\n\n var _super = _createSuper(QuarterParser);\n\n function QuarterParser() {\n var _this;\n\n _classCallCheck(this, QuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(QuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return QuarterParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneQuarterParser, _Parser);\n\n var _super = _createSuper(StandAloneQuarterParser);\n\n function StandAloneQuarterParser() {\n var _this;\n\n _classCallCheck(this, StandAloneQuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneQuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneQuarterParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { mapValue, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nexport var MonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(MonthParser, _Parser);\n\n var _super = _createSuper(MonthParser);\n\n function MonthParser() {\n var _this;\n\n _classCallCheck(this, MonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n return _this;\n }\n\n _createClass(MonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'MM':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return MonthParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, mapValue } from \"../utils.js\";\nexport var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneMonthParser, _Parser);\n\n var _super = _createSuper(StandAloneMonthParser);\n\n function StandAloneMonthParser() {\n var _this;\n\n _classCallCheck(this, StandAloneMonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneMonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'LL':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneMonthParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCWeek from \"../getUTCWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, options) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCWeek from \"../../../_lib/setUTCWeek/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\"; // Local week of year\n\nexport var LocalWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekParser, _Parser);\n\n var _super = _createSuper(LocalWeekParser);\n\n function LocalWeekParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'wo':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n }\n }]);\n\n return LocalWeekParser;\n}(Parser);", "import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCISOWeek from \"../getUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCISOWeek from \"../../../_lib/setUTCISOWeek/index.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week of year\n\nexport var ISOWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekParser, _Parser);\n\n var _super = _createSuper(ISOWeekParser);\n\n function ISOWeekParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'Io':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value));\n }\n }]);\n\n return ISOWeekParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { isLeapYearIndex, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Day of the month\n\nexport var DateParser = /*#__PURE__*/function (_Parser) {\n _inherits(DateParser, _Parser);\n\n var _super = _createSuper(DateParser);\n\n function DateParser() {\n var _this;\n\n _classCallCheck(this, DateParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subPriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DateParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, dateString);\n\n case 'do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n var month = date.getUTCMonth();\n\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month];\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DateParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, isLeapYearIndex } from \"../utils.js\";\nexport var DayOfYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayOfYearParser, _Parser);\n\n var _super = _createSuper(DayOfYearParser);\n\n function DayOfYearParser() {\n var _this;\n\n _classCallCheck(this, DayOfYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subpriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayOfYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, dateString);\n\n case 'Do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayOfYearParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function setUTCDay(dirtyDate, dirtyDay, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(2, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Day of week\n\nexport var DayParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayParser, _Parser);\n\n var _super = _createSuper(DayParser);\n\n function DayParser() {\n var _this;\n\n _classCallCheck(this, DayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Local day of week\n\nexport var LocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalDayParser, _Parser);\n\n var _super = _createSuper(LocalDayParser);\n\n function LocalDayParser() {\n var _this;\n\n _classCallCheck(this, LocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'eo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'eee':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return LocalDayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Stand-alone local day of week\n\nexport var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneLocalDayParser, _Parser);\n\n var _super = _createSuper(StandAloneLocalDayParser);\n\n function StandAloneLocalDayParser() {\n var _this;\n\n _classCallCheck(this, StandAloneLocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneLocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'co':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'ccc':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneLocalDayParser;\n}(Parser);", "import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n requiredArgs(2, arguments);\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCISODay from \"../../../_lib/setUTCISODay/index.js\"; // ISO day of week\n\nexport var ISODayParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISODayParser, _Parser);\n\n var _super = _createSuper(ISODayParser);\n\n function ISODayParser() {\n var _this;\n\n _classCallCheck(this, ISODayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISODayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n if (value === 0) {\n return 7;\n }\n\n return value;\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, dateString);\n // 2nd\n\n case 'io':\n return match.ordinalNumber(dateString, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return mapValue(match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // T\n\n case 'iiiii':\n return mapValue(match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tu\n\n case 'iiiiii':\n return mapValue(match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tuesday\n\n case 'iiii':\n default:\n return mapValue(match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 7;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date = setUTCISODay(date, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ISODayParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMParser, _Parser);\n\n var _super = _createSuper(AMPMParser);\n\n function AMPMParser() {\n var _this;\n\n _classCallCheck(this, AMPMParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['b', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMMidnightParser, _Parser);\n\n var _super = _createSuper(AMPMMidnightParser);\n\n function AMPMMidnightParser() {\n var _this;\n\n _classCallCheck(this, AMPMMidnightParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMMidnightParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMMidnightParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\"; // in the morning, in the afternoon, in the evening, at night\n\nexport var DayPeriodParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayPeriodParser, _Parser);\n\n var _super = _createSuper(DayPeriodParser);\n\n function DayPeriodParser() {\n var _this;\n\n _classCallCheck(this, DayPeriodParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayPeriodParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return DayPeriodParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1to12Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1to12Parser, _Parser);\n\n var _super = _createSuper(Hour1to12Parser);\n\n function Hour1to12Parser() {\n var _this;\n\n _classCallCheck(this, Hour1to12Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['H', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1to12Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, dateString);\n\n case 'ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 12;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour1to12Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0to23Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0to23Parser, _Parser);\n\n var _super = _createSuper(Hour0to23Parser);\n\n function Hour0to23Parser() {\n var _this;\n\n _classCallCheck(this, Hour0to23Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0to23Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, dateString);\n\n case 'Ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 23;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour0to23Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0To11Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0To11Parser, _Parser);\n\n var _super = _createSuper(Hour0To11Parser);\n\n function Hour0To11Parser() {\n var _this;\n\n _classCallCheck(this, Hour0To11Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['h', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0To11Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, dateString);\n\n case 'Ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour0To11Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1To24Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1To24Parser, _Parser);\n\n var _super = _createSuper(Hour1To24Parser);\n\n function Hour1To24Parser() {\n var _this;\n\n _classCallCheck(this, Hour1To24Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'H', 'K', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1To24Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, dateString);\n\n case 'ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 24;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour1To24Parser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var MinuteParser = /*#__PURE__*/function (_Parser) {\n _inherits(MinuteParser, _Parser);\n\n var _super = _createSuper(MinuteParser);\n\n function MinuteParser() {\n var _this;\n\n _classCallCheck(this, MinuteParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 60);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(MinuteParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, dateString);\n\n case 'mo':\n return match.ordinalNumber(dateString, {\n unit: 'minute'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n }\n }]);\n\n return MinuteParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var SecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(SecondParser, _Parser);\n\n var _super = _createSuper(SecondParser);\n\n function SecondParser() {\n var _this;\n\n _classCallCheck(this, SecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 50);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(SecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, dateString);\n\n case 'so':\n return match.ordinalNumber(dateString, {\n unit: 'second'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCSeconds(value, 0);\n return date;\n }\n }]);\n\n return SecondParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nexport var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(FractionOfSecondParser, _Parser);\n\n var _super = _createSuper(FractionOfSecondParser);\n\n function FractionOfSecondParser() {\n var _this;\n\n _classCallCheck(this, FractionOfSecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 30);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(FractionOfSecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n var valueCallback = function valueCallback(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMilliseconds(value);\n return date;\n }\n }]);\n\n return FractionOfSecondParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601. +00:00 is `'Z'`)\n\nexport var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneWithZParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneWithZParser);\n\n function ISOTimezoneWithZParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneWithZParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'x']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneWithZParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneWithZParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601)\n\nexport var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneParser);\n\n function ISOTimezoneParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'X']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampSecondsParser, _Parser);\n\n var _super = _createSuper(TimestampSecondsParser);\n\n function TimestampSecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampSecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 40);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampSecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value * 1000), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampSecondsParser;\n}(Parser);", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampMillisecondsParser, _Parser);\n\n var _super = _createSuper(TimestampMillisecondsParser);\n\n function TimestampMillisecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampMillisecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 20);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampMillisecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampMillisecondsParser;\n}(Parser);", "import { EraParser } from \"./EraParser.js\";\nimport { YearParser } from \"./YearParser.js\";\nimport { LocalWeekYearParser } from \"./LocalWeekYearParser.js\";\nimport { ISOWeekYearParser } from \"./ISOWeekYearParser.js\";\nimport { ExtendedYearParser } from \"./ExtendedYearParser.js\";\nimport { QuarterParser } from \"./QuarterParser.js\";\nimport { StandAloneQuarterParser } from \"./StandAloneQuarterParser.js\";\nimport { MonthParser } from \"./MonthParser.js\";\nimport { StandAloneMonthParser } from \"./StandAloneMonthParser.js\";\nimport { LocalWeekParser } from \"./LocalWeekParser.js\";\nimport { ISOWeekParser } from \"./ISOWeekParser.js\";\nimport { DateParser } from \"./DateParser.js\";\nimport { DayOfYearParser } from \"./DayOfYearParser.js\";\nimport { DayParser } from \"./DayParser.js\";\nimport { LocalDayParser } from \"./LocalDayParser.js\";\nimport { StandAloneLocalDayParser } from \"./StandAloneLocalDayParser.js\";\nimport { ISODayParser } from \"./ISODayParser.js\";\nimport { AMPMParser } from \"./AMPMParser.js\";\nimport { AMPMMidnightParser } from \"./AMPMMidnightParser.js\";\nimport { DayPeriodParser } from \"./DayPeriodParser.js\";\nimport { Hour1to12Parser } from \"./Hour1to12Parser.js\";\nimport { Hour0to23Parser } from \"./Hour0to23Parser.js\";\nimport { Hour0To11Parser } from \"./Hour0To11Parser.js\";\nimport { Hour1To24Parser } from \"./Hour1To24Parser.js\";\nimport { MinuteParser } from \"./MinuteParser.js\";\nimport { SecondParser } from \"./SecondParser.js\";\nimport { FractionOfSecondParser } from \"./FractionOfSecondParser.js\";\nimport { ISOTimezoneWithZParser } from \"./ISOTimezoneWithZParser.js\";\nimport { ISOTimezoneParser } from \"./ISOTimezoneParser.js\";\nimport { TimestampSecondsParser } from \"./TimestampSecondsParser.js\";\nimport { TimestampMillisecondsParser } from \"./TimestampMillisecondsParser.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\n\nexport var parsers = {\n G: new EraParser(),\n y: new YearParser(),\n Y: new LocalWeekYearParser(),\n R: new ISOWeekYearParser(),\n u: new ExtendedYearParser(),\n Q: new QuarterParser(),\n q: new StandAloneQuarterParser(),\n M: new MonthParser(),\n L: new StandAloneMonthParser(),\n w: new LocalWeekParser(),\n I: new ISOWeekParser(),\n d: new DateParser(),\n D: new DayOfYearParser(),\n E: new DayParser(),\n e: new LocalDayParser(),\n c: new StandAloneLocalDayParser(),\n i: new ISODayParser(),\n a: new AMPMParser(),\n b: new AMPMMidnightParser(),\n B: new DayPeriodParser(),\n h: new Hour1to12Parser(),\n H: new Hour0to23Parser(),\n K: new Hour0To11Parser(),\n k: new Hour1To24Parser(),\n m: new MinuteParser(),\n s: new SecondParser(),\n S: new FractionOfSecondParser(),\n X: new ISOTimezoneWithZParser(),\n x: new ISOTimezoneParser(),\n t: new TimestampSecondsParser(),\n T: new TimestampMillisecondsParser()\n};", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(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(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(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; }\n\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport assign from \"../_lib/assign/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { DateToSystemTimezoneSetter } from \"./_lib/Setter.js\";\nimport { parsers } from \"./_lib/parsers/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar notWhitespaceRegExp = /\\S/;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited\n * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:\n *\n * ```javascript\n * parse('23 AM', 'HH a', new Date())\n * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time\n * ```\n *\n * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 7 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Long localized date | NA | P | 05/29/1453 | 5,8 |\n * | | | PP | May 29, 1453 | |\n * | | | PPP | May 29th, 1453 | |\n * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |\n * | Long localized time | NA | p | 12:00 AM | 5,8 |\n * | | | pp | 12:00:00 AM | |\n * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |\n * | | | PPpp | May 29, 1453, 12:00:00 AM | |\n * | | | PPPpp | May 29th, 1453 at ... | |\n * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based\n * on the given locale.\n *\n * using `en-US` locale: `P` => `MM/dd/yyyy`\n * using `en-US` locale: `p` => `hh:mm a`\n * using `pt-BR` locale: `P` => `dd/MM/yyyy`\n * using `pt-BR` locale: `p` => `HH:mm`\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.\n *\n * `referenceDate` must be passed for correct work of the function.\n * If you're not sure which `referenceDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} referenceDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\n\nexport default function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(3, arguments);\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyReferenceDate);\n } else {\n return new Date(NaN);\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }; // If timezone isn't specified, it will be set to the system timezone\n\n var setters = [new DateToSystemTimezoneSetter()];\n var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter in longFormatters) {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp);\n var usedTokens = [];\n\n var _iterator = _createForOfIteratorHelper(tokens),\n _step;\n\n try {\n var _loop = function _loop() {\n var token = _step.value;\n\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n\n if (parser) {\n var incompatibleTokens = parser.incompatibleTokens;\n\n if (Array.isArray(incompatibleTokens)) {\n var incompatibleToken = usedTokens.find(function (usedToken) {\n return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;\n });\n\n if (incompatibleToken) {\n throw new RangeError(\"The format string mustn't contain `\".concat(incompatibleToken.fullToken, \"` and `\").concat(token, \"` at the same time\"));\n }\n } else if (parser.incompatibleTokens === '*' && usedTokens.length > 0) {\n throw new RangeError(\"The format string mustn't contain `\".concat(token, \"` and any other token at the same time\"));\n }\n\n usedTokens.push({\n token: firstCharacter,\n fullToken: token\n });\n var parseResult = parser.run(dateString, token, locale.match, subFnOptions);\n\n if (!parseResult) {\n return {\n v: new Date(NaN)\n };\n }\n\n setters.push(parseResult.setter);\n dateString = parseResult.rest;\n } else {\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n } // Replace two single quote characters with one single quote character\n\n\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token);\n } // Cut token from string, or, if string doesn't match the token, return Invalid Date\n\n\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return {\n v: new Date(NaN)\n };\n }\n }\n };\n\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n } // Check if the remaining input contains something other than whitespace\n\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).sort(function (a, b) {\n return b.subPriority - a.subPriority;\n });\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyReferenceDate);\n\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n var flags = {};\n\n var _iterator2 = _createForOfIteratorHelper(uniquePrioritySetters),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var setter = _step2.value;\n\n if (!setter.validate(utcDate, subFnOptions)) {\n return new Date(NaN);\n }\n\n var result = setter.set(utcDate, flags, subFnOptions); // Result is tuple (date, flags)\n\n if (Array.isArray(result)) {\n utcDate = result[0];\n assign(flags, result[1]); // Result is date\n } else {\n utcDate = result;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return utcDate;\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}", "import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameMonth\n * @category Month Helpers\n * @summary Are the given dates in the same month (and year)?\n *\n * @description\n * Are the given dates in the same month (and year)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same month (and year)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n *\n * @example\n * // Are 2 September 2014 and 25 September 2015 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))\n * //=> false\n */\n\nexport default function isSameMonth(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();\n}", "import addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @description\n * Subtract the specified number of days from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the days subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * const result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\n\nexport default function subDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addDays(dirtyDate, -amount);\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} hours - the hours of the new date\n * @returns {Date} the new date with the hours set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\n\nexport default function setHours(dirtyDate, dirtyHours) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var hours = toInteger(dirtyHours);\n date.setHours(hours);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function subMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, -amount);\n}", "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport subDays from \"../subDays/index.js\";\nimport subMonths from \"../subMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name sub\n * @category Common Helpers\n * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @description\n * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be subtracted\n *\n * | Key | Description |\n * |---------|------------------------------------|\n * | years | Amount of years to be subtracted |\n * | months | Amount of months to be subtracted |\n * | weeks | Amount of weeks to be subtracted |\n * | days | Amount of days to be subtracted |\n * | hours | Amount of hours to be subtracted |\n * | minutes | Amount of minutes to be subtracted |\n * | seconds | Amount of seconds to be subtracted |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract the following duration from 15 June 2017 15:29:20\n * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> Mon Sep 1 2014 10:19:50\n */\n\nexport default function sub(date, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Subtract years and months\n\n var dateWithoutMonths = subMonths(date, months + years * 12); // Subtract weeks and days\n\n var dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7); // Subtract hours, minutes and seconds\n\n var minutestoSub = minutes + hours * 60;\n var secondstoSub = seconds + minutestoSub * 60;\n var mstoSub = secondstoSub * 1000;\n var finalDate = new Date(dateWithoutDays.getTime() - mstoSub);\n return finalDate;\n}", "var formatDistanceLocale = {\n lessThanXSeconds: {\n standalone: {\n one: 'weniger als 1 Sekunde',\n other: 'weniger als {{count}} Sekunden'\n },\n withPreposition: {\n one: 'weniger als 1 Sekunde',\n other: 'weniger als {{count}} Sekunden'\n }\n },\n xSeconds: {\n standalone: {\n one: '1 Sekunde',\n other: '{{count}} Sekunden'\n },\n withPreposition: {\n one: '1 Sekunde',\n other: '{{count}} Sekunden'\n }\n },\n halfAMinute: {\n standalone: 'halbe Minute',\n withPreposition: 'halben Minute'\n },\n lessThanXMinutes: {\n standalone: {\n one: 'weniger als 1 Minute',\n other: 'weniger als {{count}} Minuten'\n },\n withPreposition: {\n one: 'weniger als 1 Minute',\n other: 'weniger als {{count}} Minuten'\n }\n },\n xMinutes: {\n standalone: {\n one: '1 Minute',\n other: '{{count}} Minuten'\n },\n withPreposition: {\n one: '1 Minute',\n other: '{{count}} Minuten'\n }\n },\n aboutXHours: {\n standalone: {\n one: 'etwa 1 Stunde',\n other: 'etwa {{count}} Stunden'\n },\n withPreposition: {\n one: 'etwa 1 Stunde',\n other: 'etwa {{count}} Stunden'\n }\n },\n xHours: {\n standalone: {\n one: '1 Stunde',\n other: '{{count}} Stunden'\n },\n withPreposition: {\n one: '1 Stunde',\n other: '{{count}} Stunden'\n }\n },\n xDays: {\n standalone: {\n one: '1 Tag',\n other: '{{count}} Tage'\n },\n withPreposition: {\n one: '1 Tag',\n other: '{{count}} Tagen'\n }\n },\n aboutXWeeks: {\n standalone: {\n one: 'etwa 1 Woche',\n other: 'etwa {{count}} Wochen'\n },\n withPreposition: {\n one: 'etwa 1 Woche',\n other: 'etwa {{count}} Wochen'\n }\n },\n xWeeks: {\n standalone: {\n one: '1 Woche',\n other: '{{count}} Wochen'\n },\n withPreposition: {\n one: '1 Woche',\n other: '{{count}} Wochen'\n }\n },\n aboutXMonths: {\n standalone: {\n one: 'etwa 1 Monat',\n other: 'etwa {{count}} Monate'\n },\n withPreposition: {\n one: 'etwa 1 Monat',\n other: 'etwa {{count}} Monaten'\n }\n },\n xMonths: {\n standalone: {\n one: '1 Monat',\n other: '{{count}} Monate'\n },\n withPreposition: {\n one: '1 Monat',\n other: '{{count}} Monaten'\n }\n },\n aboutXYears: {\n standalone: {\n one: 'etwa 1 Jahr',\n other: 'etwa {{count}} Jahre'\n },\n withPreposition: {\n one: 'etwa 1 Jahr',\n other: 'etwa {{count}} Jahren'\n }\n },\n xYears: {\n standalone: {\n one: '1 Jahr',\n other: '{{count}} Jahre'\n },\n withPreposition: {\n one: '1 Jahr',\n other: '{{count}} Jahren'\n }\n },\n overXYears: {\n standalone: {\n one: 'mehr als 1 Jahr',\n other: 'mehr als {{count}} Jahre'\n },\n withPreposition: {\n one: 'mehr als 1 Jahr',\n other: 'mehr als {{count}} Jahren'\n }\n },\n almostXYears: {\n standalone: {\n one: 'fast 1 Jahr',\n other: 'fast {{count}} Jahre'\n },\n withPreposition: {\n one: 'fast 1 Jahr',\n other: 'fast {{count}} Jahren'\n }\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = options !== null && options !== void 0 && options.addSuffix ? formatDistanceLocale[token].withPreposition : formatDistanceLocale[token].standalone;\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', String(count));\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return 'vor ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\n// DIN 5008: https://de.wikipedia.org/wiki/Datumsformat#DIN_5008\nvar dateFormats = {\n full: 'EEEE, do MMMM y',\n // Montag, 7. Januar 2018\n long: 'do MMMM y',\n // 7. Januar 2018\n medium: 'do MMM y',\n // 7. Jan. 2018\n short: 'dd.MM.y' // 07.01.2018\n\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'um' {{time}}\",\n long: \"{{date}} 'um' {{time}}\",\n medium: '{{date}} {{time}}',\n short: '{{date}} {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'letzten' eeee 'um' p\",\n yesterday: \"'gestern um' p\",\n today: \"'heute um' p\",\n tomorrow: \"'morgen um' p\",\n nextWeek: \"eeee 'um' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['v.Chr.', 'n.Chr.'],\n abbreviated: ['v.Chr.', 'n.Chr.'],\n wide: ['vor Christus', 'nach Christus']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1. Quartal', '2. Quartal', '3. Quartal', '4. Quartal']\n}; // Note: in German, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'M\u00E4r', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],\n wide: ['Januar', 'Februar', 'M\u00E4rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']\n}; // https://st.unicode.org/cldr-apps/v#/de/Gregorian/\n\nvar formattingMonthValues = {\n narrow: monthValues.narrow,\n abbreviated: ['Jan.', 'Feb.', 'M\u00E4rz', 'Apr.', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Dez.'],\n wide: monthValues.wide\n};\nvar dayValues = {\n narrow: ['S', 'M', 'D', 'M', 'D', 'F', 'S'],\n short: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],\n abbreviated: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'],\n wide: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']\n}; // https://www.unicode.org/cldr/charts/32/summary/de.html#1881\n\nvar dayPeriodValues = {\n narrow: {\n am: 'vm.',\n pm: 'nm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachm.',\n evening: 'Abend',\n night: 'Nacht'\n },\n abbreviated: {\n am: 'vorm.',\n pm: 'nachm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachmittag',\n evening: 'Abend',\n night: 'Nacht'\n },\n wide: {\n am: 'vormittags',\n pm: 'nachmittags',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'Morgen',\n afternoon: 'Nachmittag',\n evening: 'Abend',\n night: 'Nacht'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'vm.',\n pm: 'nm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachm.',\n evening: 'abends',\n night: 'nachts'\n },\n abbreviated: {\n am: 'vorm.',\n pm: 'nachm.',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachmittags',\n evening: 'abends',\n night: 'nachts'\n },\n wide: {\n am: 'vormittags',\n pm: 'nachmittags',\n midnight: 'Mitternacht',\n noon: 'Mittag',\n morning: 'morgens',\n afternoon: 'nachmittags',\n evening: 'abends',\n night: 'nachts'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber) {\n var number = Number(dirtyNumber);\n return number + '.';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n formattingValues: formattingMonthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(\\.)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,\n abbreviated: /^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,\n wide: /^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i\n};\nvar parseEraPatterns = {\n any: [/^v/i, /^n/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](\\.)? Quartal/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(j[a\u00E4]n|feb|m\u00E4r[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\\.?/i,\n wide: /^(januar|februar|m\u00E4rz|april|mai|juni|juli|august|september|oktober|november|dezember)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^j[a\u00E4]/i, /^f/i, /^m\u00E4r/i, /^ap/i, /^mai/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smdmf]/i,\n short: /^(so|mo|di|mi|do|fr|sa)/i,\n abbreviated: /^(son?|mon?|die?|mit?|don?|fre?|sam?)\\.?/i,\n wide: /^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i\n};\nvar parseDayPatterns = {\n any: [/^so/i, /^mo/i, /^di/i, /^mi/i, /^do/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(vm\\.?|nm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,\n abbreviated: /^(vorm\\.?|nachm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,\n wide: /^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^v/i,\n pm: /^n/i,\n midnight: /^Mitte/i,\n noon: /^Mitta/i,\n morning: /morgens/i,\n afternoon: /nachmittags/i,\n // will never be matched. Afternoon is matched by `pm`\n evening: /abends/i,\n night: /nachts/i // will never be matched. Night is matched by `pm`\n\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary German locale.\n * @language German\n * @iso-639-2 deu\n * @author Thomas Eilmsteiner [@DeMuu]{@link https://github.com/DeMuu}\n * @author Asia [@asia-t]{@link https://github.com/asia-t}\n * @author Van Vuong Ngo [@vanvuongngo]{@link https://github.com/vanvuongngo}\n * @author RomanErnst [@pex]{@link https://github.com/pex}\n * @author Philipp Keck [@Philipp91]{@link https://github.com/Philipp91}\n */\nvar locale = {\n code: 'de',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, d MMMM yyyy',\n long: 'd MMMM yyyy',\n medium: 'd MMM yyyy',\n short: 'dd/MM/yyyy'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "import formatDistance from \"../en-US/_lib/formatDistance/index.js\";\nimport formatRelative from \"../en-US/_lib/formatRelative/index.js\";\nimport localize from \"../en-US/_lib/localize/index.js\";\nimport match from \"../en-US/_lib/match/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United Kingdom).\n * @language English\n * @iso-639-2 eng\n * @author Alex [@glintik]{@link https://github.com/glintik}\n */\n\nvar locale = {\n code: 'en-GB',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'menos de un segundo',\n other: 'menos de {{count}} segundos'\n },\n xSeconds: {\n one: '1 segundo',\n other: '{{count}} segundos'\n },\n halfAMinute: 'medio minuto',\n lessThanXMinutes: {\n one: 'menos de un minuto',\n other: 'menos de {{count}} minutos'\n },\n xMinutes: {\n one: '1 minuto',\n other: '{{count}} minutos'\n },\n aboutXHours: {\n one: 'alrededor de 1 hora',\n other: 'alrededor de {{count}} horas'\n },\n xHours: {\n one: '1 hora',\n other: '{{count}} horas'\n },\n xDays: {\n one: '1 d\u00EDa',\n other: '{{count}} d\u00EDas'\n },\n aboutXWeeks: {\n one: 'alrededor de 1 semana',\n other: 'alrededor de {{count}} semanas'\n },\n xWeeks: {\n one: '1 semana',\n other: '{{count}} semanas'\n },\n aboutXMonths: {\n one: 'alrededor de 1 mes',\n other: 'alrededor de {{count}} meses'\n },\n xMonths: {\n one: '1 mes',\n other: '{{count}} meses'\n },\n aboutXYears: {\n one: 'alrededor de 1 a\u00F1o',\n other: 'alrededor de {{count}} a\u00F1os'\n },\n xYears: {\n one: '1 a\u00F1o',\n other: '{{count}} a\u00F1os'\n },\n overXYears: {\n one: 'm\u00E1s de 1 a\u00F1o',\n other: 'm\u00E1s de {{count}} a\u00F1os'\n },\n almostXYears: {\n one: 'casi 1 a\u00F1o',\n other: 'casi {{count}} a\u00F1os'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'en ' + result;\n } else {\n return 'hace ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: \"EEEE, d 'de' MMMM 'de' y\",\n long: \"d 'de' MMMM 'de' y\",\n medium: 'd MMM y',\n short: 'dd/MM/y'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'a las' {{time}}\",\n long: \"{{date}} 'a las' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"'el' eeee 'pasado a la' p\",\n yesterday: \"'ayer a la' p\",\n today: \"'hoy a la' p\",\n tomorrow: \"'ma\u00F1ana a la' p\",\n nextWeek: \"eeee 'a la' p\",\n other: 'P'\n};\nvar formatRelativeLocalePlural = {\n lastWeek: \"'el' eeee 'pasado a las' p\",\n yesterday: \"'ayer a las' p\",\n today: \"'hoy a las' p\",\n tomorrow: \"'ma\u00F1ana a las' p\",\n nextWeek: \"eeee 'a las' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, date, _baseDate, _options) {\n if (date.getUTCHours() !== 1) {\n return formatRelativeLocalePlural[token];\n } else {\n return formatRelativeLocale[token];\n }\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['AC', 'DC'],\n abbreviated: ['AC', 'DC'],\n wide: ['antes de cristo', 'despu\u00E9s de cristo']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['T1', 'T2', 'T3', 'T4'],\n wide: ['1\u00BA trimestre', '2\u00BA trimestre', '3\u00BA trimestre', '4\u00BA trimestre']\n};\nvar monthValues = {\n narrow: ['e', 'f', 'm', 'a', 'm', 'j', 'j', 'a', 's', 'o', 'n', 'd'],\n abbreviated: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],\n wide: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']\n};\nvar dayValues = {\n narrow: ['d', 'l', 'm', 'm', 'j', 'v', 's'],\n short: ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 's\u00E1'],\n abbreviated: ['dom', 'lun', 'mar', 'mi\u00E9', 'jue', 'vie', 's\u00E1b'],\n wide: ['domingo', 'lunes', 'martes', 'mi\u00E9rcoles', 'jueves', 'viernes', 's\u00E1bado']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mn',\n noon: 'md',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'ma\u00F1ana',\n afternoon: 'tarde',\n evening: 'tarde',\n night: 'noche'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mn',\n noon: 'md',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'medianoche',\n noon: 'mediodia',\n morning: 'de la ma\u00F1ana',\n afternoon: 'de la tarde',\n evening: 'de la tarde',\n night: 'de la noche'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber);\n return number + '\u00BA';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return Number(quarter) - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nimport buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(\u00BA)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(ac|dc|a|d)/i,\n abbreviated: /^(a\\.?\\s?c\\.?|a\\.?\\s?e\\.?\\s?c\\.?|d\\.?\\s?c\\.?|e\\.?\\s?c\\.?)/i,\n wide: /^(antes de cristo|antes de la era com[u\u00FA]n|despu[e\u00E9]s de cristo|era com[u\u00FA]n)/i\n};\nvar parseEraPatterns = {\n any: [/^ac/i, /^dc/i],\n wide: [/^(antes de cristo|antes de la era com[u\u00FA]n)/i, /^(despu[e\u00E9]s de cristo|era com[u\u00FA]n)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^T[1234]/i,\n wide: /^[1234](\u00BA)? trimestre/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[efmajsond]/i,\n abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,\n wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^e/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^en/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]\n};\nvar matchDayPatterns = {\n narrow: /^[dlmjvs]/i,\n short: /^(do|lu|ma|mi|ju|vi|s[\u00E1a])/i,\n abbreviated: /^(dom|lun|mar|mi[\u00E9e]|jue|vie|s[\u00E1a]b)/i,\n wide: /^(domingo|lunes|martes|mi[\u00E9e]rcoles|jueves|viernes|s[\u00E1a]bado)/i\n};\nvar parseDayPatterns = {\n narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],\n any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mn|md|(de la|a las) (ma\u00F1ana|tarde|noche))/i,\n any: /^([ap]\\.?\\s?m\\.?|medianoche|mediodia|(de la|a las) (ma\u00F1ana|tarde|noche))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mn/i,\n noon: /^md/i,\n morning: /ma\u00F1ana/i,\n afternoon: /tarde/i,\n evening: /tarde/i,\n night: /noche/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary Spanish locale.\n * @language Spanish\n * @iso-639-2 spa\n * @author Juan Angosto [@juanangosto]{@link https://github.com/juanangosto}\n * @author Guillermo Grau [@guigrpa]{@link https://github.com/guigrpa}\n * @author Fernando Ag\u00FCero [@fjaguero]{@link https://github.com/fjaguero}\n * @author Gast\u00F3n Haro [@harogaston]{@link https://github.com/harogaston}\n * @author Yago Carballo [@YagoCarballo]{@link https://github.com/YagoCarballo}\n */\nvar locale = {\n code: 'es',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;", "var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'moins d\u2019une seconde',\n other: 'moins de {{count}} secondes'\n },\n xSeconds: {\n one: '1 seconde',\n other: '{{count}} secondes'\n },\n halfAMinute: '30 secondes',\n lessThanXMinutes: {\n one: 'moins d\u2019une minute',\n other: 'moins de {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'environ 1 heure',\n other: 'environ {{count}} heures'\n },\n xHours: {\n one: '1 heure',\n other: '{{count}} heures'\n },\n xDays: {\n one: '1 jour',\n other: '{{count}} jours'\n },\n aboutXWeeks: {\n one: 'environ 1 semaine',\n other: 'environ {{count}} semaines'\n },\n xWeeks: {\n one: '1 semaine',\n other: '{{count}} semaines'\n },\n aboutXMonths: {\n one: 'environ 1 mois',\n other: 'environ {{count}} mois'\n },\n xMonths: {\n one: '1 mois',\n other: '{{count}} mois'\n },\n aboutXYears: {\n one: 'environ 1 an',\n other: 'environ {{count}} ans'\n },\n xYears: {\n one: '1 an',\n other: '{{count}} ans'\n },\n overXYears: {\n one: 'plus d\u2019un an',\n other: 'plus de {{count}} ans'\n },\n almostXYears: {\n one: 'presqu\u2019un an',\n other: 'presque {{count}} ans'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var form = formatDistanceLocale[token];\n\n if (typeof form === 'string') {\n result = form;\n } else if (count === 1) {\n result = form.one;\n } else {\n result = form.other.replace('{{count}}', String(count));\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'dans ' + result;\n } else {\n return 'il y a ' + result;\n }\n }\n\n return result;\n};\n\nexport default formatDistance;", "import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE d MMMM y',\n long: 'd MMMM y',\n medium: 'd MMM y',\n short: 'dd/MM/y'\n};\nvar timeFormats = {\n full: 'HH:mm:ss zzzz',\n long: 'HH:mm:ss z',\n medium: 'HH:mm:ss',\n short: 'HH:mm'\n};\nvar dateTimeFormats = {\n full: \"{{date}} '\u00E0' {{time}}\",\n long: \"{{date}} '\u00E0' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;", "var formatRelativeLocale = {\n lastWeek: \"eeee 'dernier \u00E0' p\",\n yesterday: \"'hier \u00E0' p\",\n today: \"'aujourd\u2019hui \u00E0' p\",\n tomorrow: \"'demain \u00E0' p'\",\n nextWeek: \"eeee 'prochain \u00E0' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;", "import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['av. J.-C', 'ap. J.-C'],\n abbreviated: ['av. J.-C', 'ap. J.-C'],\n wide: ['avant J\u00E9sus-Christ', 'apr\u00E8s J\u00E9sus-Christ']\n};\nvar quarterValues = {\n narrow: ['T1', 'T2', 'T3', 'T4'],\n abbreviated: ['1er trim.', '2\u00E8me trim.', '3\u00E8me trim.', '4\u00E8me trim.'],\n wide: ['1er trimestre', '2\u00E8me trimestre', '3\u00E8me trimestre', '4\u00E8me trimestre']\n};\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['janv.', 'f\u00E9vr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'ao\u00FBt', 'sept.', 'oct.', 'nov.', 'd\u00E9c.'],\n wide: ['janvier', 'f\u00E9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao\u00FBt', 'septembre', 'octobre', 'novembre', 'd\u00E9cembre']\n};\nvar dayValues = {\n narrow: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],\n short: ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'],\n abbreviated: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],\n wide: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'mat.',\n afternoon: 'ap.m.',\n evening: 'soir',\n night: 'mat.'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'matin',\n afternoon: 'apr\u00E8s-midi',\n evening: 'soir',\n night: 'matin'\n },\n wide: {\n am: 'AM',\n pm: 'PM',\n midnight: 'minuit',\n noon: 'midi',\n morning: 'du matin',\n afternoon: 'de l\u2019apr\u00E8s-midi',\n evening: 'du soir',\n night: 'du matin'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, options) {\n var number = Number(dirtyNumber);\n var unit = options === null || options === void 0 ? void 0 : options.unit;\n if (number === 0) return '0';\n var feminineUnits = ['year', 'week', 'hour', 'minute', 'second'];\n var suffix;\n\n if (number === 1) {\n suffix = unit && feminineUnits.includes(unit) ? '\u00E8re' : 'er';\n } else {\n suffix = '\u00E8me';\n }\n\n return number + suffix;\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide'\n })\n};\nexport default localize;", "import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(i\u00E8me|\u00E8re|\u00E8me|er|e)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(av\\.J\\.C|ap\\.J\\.C|ap\\.J\\.-C)/i,\n abbreviated: /^(av\\.J\\.-C|av\\.J-C|apr\\.J\\.-C|apr\\.J-C|ap\\.J-C)/i,\n wide: /^(avant J\u00E9sus-Christ|apr\u00E8s J\u00E9sus-Christ)/i\n};\nvar parseEraPatterns = {\n any: [/^av/i, /^ap/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^T?[1234]/i,\n abbreviated: /^[1234](er|\u00E8me|e)? trim\\.?/i,\n wide: /^[1234](er|\u00E8me|e)? trimestre/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(janv|f\u00E9vr|mars|avr|mai|juin|juill|juil|ao\u00FBt|sept|oct|nov|d\u00E9c)\\.?/i,\n wide: /^(janvier|f\u00E9vrier|mars|avril|mai|juin|juillet|ao\u00FBt|septembre|octobre|novembre|d\u00E9cembre)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^av/i, /^ma/i, /^juin/i, /^juil/i, /^ao/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[lmjvsd]/i,\n short: /^(di|lu|ma|me|je|ve|sa)/i,\n abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\\.?/i,\n wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i\n};\nvar parseDayPatterns = {\n narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],\n any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|minuit|midi|mat\\.?|ap\\.?m\\.?|soir|nuit)/i,\n any: /^([ap]\\.?\\s?m\\.?|du matin|de l'apr\u00E8s[-\\s]midi|du soir|de la nuit)/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^min/i,\n noon: /^mid/i,\n morning: /mat/i,\n afternoon: /ap/i,\n evening: /soir/i,\n night: /nuit/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;", "import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n/**\n * @type {Locale}\n * @category Locales\n * @summary French locale.\n * @language French\n * @iso-639-2 fra\n * @author Jean Dupouy [@izeau]{@link https://github.com/izeau}\n * @author Fran\u00E7ois B [@fbonzon]{@link https://github.com/fbonzon}\n */\n\nvar locale = {\n code: 'fr',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 1\n /* Monday */\n ,\n firstWeekContainsDate: 4\n }\n};\nexport default locale;", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n TalerCorebankConfigResponse,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerAuthenticationHttpClient,\n TalerBankConversionCacheEviction,\n TalerBankConversionHttpClient,\n TalerCoreBankCacheEviction,\n TalerCoreBankHttpClient,\n TalerError,\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading } from \"../index.browser.js\";\nimport { APIClient, ActiviyTracker, BankLib, Subscriber } from \"./activity.js\";\nimport { useTranslationContext } from \"./translation.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type BankContextType = {\n url: URL;\n config: TalerCorebankConfigResponse;\n lib: BankLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst BankContext = createContext(undefined);\n\nexport const useBankCoreApiContext = (): BankContextType =>\n useContext(BankContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n conversion?: CacheEvictor;\n bank?: CacheEvictor;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const BankApiProvider = ({\n baseUrl,\n children,\n frameOnError,\n evictors = {},\n}: {\n baseUrl: URL;\n children: ComponentChildren;\n evictors?: Evictors;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildBankApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: BankContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(BankContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildBankApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const bank = new TalerCoreBankHttpClient(url.href, httpLib, evictors.bank);\n const conversion = new TalerBankConversionHttpClient(\n bank.getConversionInfoAPI().href,\n httpLib,\n evictors.conversion,\n );\n const auth = (user: string) =>\n new TalerAuthenticationHttpClient(\n bank.getAuthenticationAPI(user).href,\n httpLib,\n );\n\n async function getRemoteConfig(): Promise {\n const resp = await bank.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: bank.PROTOCOL_VERSION,\n lib: {\n bank,\n conversion,\n auth,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const BankApiProviderTesting = ({\n children,\n value,\n}: {\n value: BankContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(BankContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ChallengerHttpClient, ObservabilityEvent, TalerAuthenticationHttpClient, TalerBankConversionHttpClient, TalerCoreBankHttpClient, TalerExchangeHttpClient, TalerMerchantInstanceHttpClient, TalerMerchantManagementHttpClient } from \"@gnu-taler/taler-util\";\n\ntype Listener = (e: Event) => void;\ntype Unsuscriber = () => void;\nexport type Subscriber = (fn: Listener) => Unsuscriber;\n\nexport class ActiviyTracker {\n private observers = new Array>();\n constructor() {\n this.notify = this.notify.bind(this)\n this.subscribe = this.subscribe.bind(this)\n }\n notify(data: Event): void {\n this.observers.forEach((observer) => observer(data))\n }\n subscribe(func: Listener): Unsuscriber {\n this.observers.push(func);\n return () => {\n this.observers.forEach((observer, index) => {\n if (observer === func) {\n this.observers.splice(index, 1);\n }\n });\n };\n }\n}\n\n/**\n * build http client with cache breaker due to SWR\n * @param url\n * @returns\n */\nexport interface APIClient {\n getRemoteConfig(): Promise;\n VERSION: string;\n lib: T,\n onActivity: Subscriber;\n cancelRequest(id: string): void;\n}\n\nexport interface MerchantLib {\n instance: TalerMerchantManagementHttpClient;\n authenticate: TalerAuthenticationHttpClient;\n subInstanceApi: (instanceId: string) => MerchantLib;\n}\n\nexport interface ExchangeLib {\n exchange: TalerExchangeHttpClient;\n}\n\nexport interface BankLib {\n bank: TalerCoreBankHttpClient;\n conversion: TalerBankConversionHttpClient;\n auth: (user: string) => TalerAuthenticationHttpClient;\n}\n\nexport interface ChallengerLib {\n challenger: ChallengerHttpClient;\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n ChallengerApi,\n ChallengerCacheEviction,\n ChallengerHttpClient,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerError\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n ChallengerLib,\n Subscriber\n} from \"./activity.js\";\nimport { useTranslationContext } from \"./translation.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type ChallengerContextType = {\n url: URL;\n config: ChallengerApi.ChallengerTermsOfServiceResponse;\n lib: ChallengerLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst ChallengerContext = createContext(undefined);\n\nexport const useChallengerApiContext = (): ChallengerContextType =>\n useContext(ChallengerContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n challenger?: CacheEvictor;\n}\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const ChallengerApiProvider = ({\n baseUrl,\n children,\n frameOnError,\n evictors = {},\n}: {\n baseUrl: URL;\n children: ComponentChildren;\n evictors?: Evictors;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildChallengerApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: ChallengerContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(ChallengerContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildChallengerApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const challenger = new ChallengerHttpClient(url.href, httpLib, evictors.challenger);\n\n async function getRemoteConfig(): Promise {\n const resp = await challenger.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: challenger.PROTOCOL_VERSION,\n lib: {\n challenger,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const ChallengerApiProviderTesting = ({\n children,\n value,\n}: {\n value: ChallengerContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(ChallengerContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerAuthenticationHttpClient,\n TalerError,\n TalerMerchantApi,\n TalerMerchantInstanceCacheEviction,\n TalerMerchantManagementCacheEviction,\n TalerMerchantManagementHttpClient,\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n MerchantLib,\n Subscriber,\n} from \"./activity.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type MerchantContextType = {\n url: URL;\n config: TalerMerchantApi.TalerMerchantConfigResponse;\n lib: MerchantLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n changeBackend: (url: URL) => void;\n};\n\n// FIXME: below\n// @ts-expect-error default value to undefined, should it be another thing?\nconst MerchantContext = createContext(undefined);\n\nexport const useMerchantApiContext = (): MerchantContextType =>\n useContext(MerchantContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n management?: CacheEvictor<\n TalerMerchantManagementCacheEviction | TalerMerchantInstanceCacheEviction\n >;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | ConfigResultFail;\n\nexport type ConfigResultFail =\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const MerchantApiProvider = ({\n baseUrl,\n children,\n evictors = {},\n frameOnError,\n}: {\n baseUrl: URL;\n evictors?: Evictors;\n children: ComponentChildren;\n frameOnError: FunctionComponent<{\n state:\n | ConfigResultFail\n | undefined;\n }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n\n const [merchantEndpoint, changeMerchantEndpoint] = useState(baseUrl);\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildMerchantApiClient(merchantEndpoint, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (!checked || checked.type !== \"ok\") {\n return h(frameOnError, { state: checked }, []);\n }\n\n const value: MerchantContextType = {\n url: merchantEndpoint,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n changeBackend: changeMerchantEndpoint,\n hints: checked.hints,\n };\n return h(MerchantContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildMerchantApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const instance = new TalerMerchantManagementHttpClient(\n url.href,\n httpLib,\n evictors.management,\n );\n const authenticate = new TalerAuthenticationHttpClient(\n instance.getAuthenticationAPI().href,\n httpLib,\n );\n\n function getSubInstanceAPI(instanceId: string): MerchantLib {\n const api = buildMerchantApiClient(\n instance.getSubInstanceAPI(instanceId) as URL,\n evictors,\n );\n return api.lib;\n }\n\n async function getRemoteConfig(): Promise {\n const resp = await instance.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: instance.PROTOCOL_VERSION,\n lib: {\n instance,\n authenticate,\n subInstanceApi: getSubInstanceAPI,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const MerchantApiProviderTesting = ({\n children,\n value,\n}: {\n value: MerchantContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(MerchantContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n CacheEvictor,\n LibtoolVersion,\n ObservabilityEvent,\n ObservableHttpClientLibrary,\n TalerError,\n TalerExchangeApi,\n TalerExchangeCacheEviction,\n TalerExchangeHttpClient\n} from \"@gnu-taler/taler-util\";\nimport {\n ComponentChildren,\n FunctionComponent,\n VNode,\n createContext,\n h,\n} from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport { BrowserFetchHttpLib, ErrorLoading, useTranslationContext } from \"../index.browser.js\";\nimport {\n APIClient,\n ActiviyTracker,\n ExchangeLib,\n Subscriber,\n} from \"./activity.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type ExchangeContextType = {\n url: URL;\n config: TalerExchangeApi.ExchangeVersionResponse;\n lib: ExchangeLib;\n hints: VersionHint[];\n onActivity: Subscriber;\n cancelRequest: (eventId: string) => void;\n};\n\n// FIXME: below\n// @ts-expect-error default value to undefined, should it be another thing?\nconst ExchangeContext = createContext(undefined);\n\nexport const useExchangeApiContext = (): ExchangeContextType =>\n useContext(ExchangeContext);\n\nenum VersionHint {\n NONE,\n}\n\ntype Evictors = {\n exchange?: CacheEvictor;\n};\n\ntype ConfigResult =\n | undefined\n | { type: \"ok\"; config: T; hints: VersionHint[] }\n | ConfigResultFail;\n\ntype ConfigResultFail =\n | { type: \"incompatible\"; result: T; supported: string }\n | { type: \"error\"; error: TalerError };\n\nconst CONFIG_FAIL_TRY_AGAIN_MS = 5000;\n\nexport const ExchangeApiProvider = ({\n baseUrl,\n children,\n evictors = {},\n frameOnError,\n}: {\n baseUrl: URL;\n evictors?: Evictors;\n children: ComponentChildren;\n frameOnError: FunctionComponent<{ children: ComponentChildren }>;\n}): VNode => {\n const [checked, setChecked] =\n useState>();\n const { i18n } = useTranslationContext();\n\n const { getRemoteConfig, VERSION, lib, cancelRequest, onActivity } =\n buildExchangeApiClient(baseUrl, evictors);\n\n useEffect(() => {\n let keepRetrying = true;\n async function testConfig(): Promise {\n try {\n const config = await getRemoteConfig();\n if (LibtoolVersion.compare(VERSION, config.version)) {\n setChecked({ type: \"ok\", config, hints: [] });\n } else {\n setChecked({\n type: \"incompatible\",\n result: config,\n supported: VERSION,\n });\n }\n } catch (error) {\n if (error instanceof TalerError) {\n if (keepRetrying) {\n setTimeout(() => {\n testConfig();\n }, CONFIG_FAIL_TRY_AGAIN_MS);\n }\n setChecked({ type: \"error\", error });\n } else {\n setChecked({ type: \"error\", error: TalerError.fromException(error) });\n }\n }\n }\n testConfig();\n return () => {\n // on unload, stop retry\n keepRetrying = false;\n };\n }, []);\n\n if (checked === undefined) {\n return h(frameOnError, {\n children: h(\"div\", {}, \"checking compatibility with server...\"),\n });\n }\n if (checked.type === \"error\") {\n return h(frameOnError, {\n children: h(ErrorLoading, { error: checked.error, showDetail: true }),\n });\n }\n if (checked.type === \"incompatible\") {\n return h(frameOnError, {\n children: h(\n \"div\",\n {},\n i18n.str`The server version is not supported. Supported version \"${checked.supported}\", server version \"${checked.result.version}\"`,\n ),\n });\n }\n\n const value: ExchangeContextType = {\n url: baseUrl,\n config: checked.config,\n onActivity: onActivity,\n lib,\n cancelRequest,\n hints: checked.hints,\n };\n return h(ExchangeContext.Provider, {\n value,\n children,\n });\n};\n\nfunction buildExchangeApiClient(\n url: URL,\n evictors: Evictors,\n): APIClient {\n const httpFetch = new BrowserFetchHttpLib({\n enableThrottling: true,\n requireTls: false,\n });\n const tracker = new ActiviyTracker();\n\n const httpLib = new ObservableHttpClientLibrary(httpFetch, {\n observe(ev) {\n tracker.notify(ev);\n },\n });\n\n const ex = new TalerExchangeHttpClient(url.href, httpLib, evictors.exchange);\n\n async function getRemoteConfig(): Promise {\n const resp = await ex.getConfig();\n if (resp.type === \"fail\") {\n throw TalerError.fromUncheckedDetail(resp.detail);\n }\n return resp.body;\n }\n\n return {\n getRemoteConfig,\n VERSION: ex.PROTOCOL_VERSION,\n lib: {\n exchange: ex,\n },\n onActivity: tracker.subscribe,\n cancelRequest: httpLib.cancelRequest,\n };\n}\n\nexport const ExchangeApiProviderTesting = ({\n children,\n value,\n}: {\n value: ExchangeContextType;\n children: ComponentChildren;\n}): VNode => {\n return h(ExchangeContext.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext, useEffect, useState } from \"preact/hooks\";\nimport {\n AppLocation,\n ObjectOf,\n Location,\n findMatch,\n RouteDefinition,\n LocationNotFound,\n} from \"../utils/route.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type Type = {\n path: string;\n params: Record;\n navigateTo: (path: AppLocation) => void;\n // addNavigationListener: (listener: (path: string, params: Record) => void) => (() => void);\n};\n\n// @ts-expect-error should not be used without provider\nconst Context = createContext(undefined);\n\nexport const useNavigationContext = (): Type => useContext(Context);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCurrentLocation>>(\n pagesMap: T,\n): Location | LocationNotFound {\n const pageList = Object.keys(pagesMap as object) as Array;\n const { path, params } = useNavigationContext();\n\n return findMatch(pagesMap, pageList, path, params);\n}\n\nfunction getPathAndParamsFromWindow(): {\n path: string;\n params: Record;\n} {\n const path =\n typeof window !== \"undefined\" ? window.location.hash.substring(1) : \"/\";\n const params: Record = {};\n if (typeof window !== \"undefined\") {\n for (const [key, value] of new URLSearchParams(window.location.search)) {\n if (!params[key]) {\n params[key] = [];\n }\n params[key].push(value);\n }\n }\n return { path, params };\n}\n\nconst { path: initialPath, params: initialParams } =\n getPathAndParamsFromWindow();\n\n// there is a possibility that if the browser does a redirection\n// (which doesn't go through navigatTo function) and that executed\n// too early (before addEventListener runs) it won't be taking\n// into account\nconst PopStateEventType = \"popstate\";\n\nexport const BrowserHashNavigationProvider = ({\n children,\n}: {\n children: ComponentChildren;\n}): VNode => {\n const [{ path, params }, setState] = useState({\n path: initialPath,\n params: initialParams,\n });\n if (typeof window === \"undefined\") {\n throw Error(\n \"Can't use BrowserHashNavigationProvider if there is no window object\",\n );\n }\n function navigateTo(path: string): void {\n const { params } = getPathAndParamsFromWindow();\n setState({ path, params });\n window.location.href = path;\n }\n\n useEffect(() => {\n function eventListener(): void {\n setState(getPathAndParamsFromWindow());\n }\n window.addEventListener(PopStateEventType, eventListener);\n return () => {\n window.removeEventListener(PopStateEventType, eventListener);\n };\n }, []);\n return h(Context.Provider, {\n value: { path, params, navigateTo },\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { stringifyTalerUri, TalerUri } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\n\n/**\n * https://docs.taler.net/design-documents/039-taler-browser-integration.html\n *\n * @param uri\n */\nfunction createHeadMetaTag(uri: TalerUri, onNotFound?: () => void) {\n const meta = document.createElement(\"meta\");\n meta.setAttribute(\"name\", \"taler-uri\");\n meta.setAttribute(\"content\", stringifyTalerUri(uri));\n\n document.head.appendChild(meta);\n\n let walletFound = false;\n window.addEventListener(\"beforeunload\", () => {\n walletFound = true;\n });\n setTimeout(() => {\n if (!walletFound && onNotFound) {\n onNotFound();\n }\n }, 10); //very short timeout\n}\ninterface Type {\n /**\n * Tell the active wallet that an action is found\n *\n * @param uri\n * @returns\n */\n publishTalerAction: (uri: TalerUri, onNotFound?: () => void) => void;\n}\n\n// @ts-expect-error default value to undefined, should it be another thing?\nconst Context = createContext(undefined);\n\nexport const useTalerWalletIntegrationAPI = (): Type => useContext(Context);\n\nexport const TalerWalletIntegrationBrowserProvider = ({\n children,\n}: {\n children: ComponentChildren;\n}): VNode => {\n const value: Type = {\n publishTalerAction: createHeadMetaTag,\n };\n return h(Context.Provider, {\n value,\n children,\n });\n};\n\nexport const TalerWalletIntegrationTestingProvider = ({\n children,\n value,\n}: {\n children: ComponentChildren;\n value: Type;\n}): VNode => {\n return h(Context.Provider, {\n value,\n children,\n });\n};\n", "import { createElement, VNode } from \"preact\";\n\nexport type StateFunc = (p: S) => VNode;\n\nexport type StateViewMap = {\n [S in StateType as S[\"status\"]]: StateFunc;\n};\n\nexport type RecursiveState = S | (() => RecursiveState);\n\nexport function compose(\n hook: (p: PType) => RecursiveState,\n viewMap: StateViewMap,\n): (p: PType) => VNode {\n\n function withHook(stateHook: () => RecursiveState): () => VNode {\n function ComposedComponent(): VNode {\n const state = stateHook();\n\n if (typeof state === \"function\") {\n const subComponent = withHook(state);\n return createElement(subComponent, {});\n }\n\n const statusName = state.status as unknown as SType[\"status\"];\n const viewComponent = viewMap[statusName] as unknown as StateFunc;\n return createElement(viewComponent, state);\n }\n\n return ComposedComponent;\n }\n\n return (p: PType) => {\n const h = withHook(() => hook(p));\n return h();\n };\n}\n\nexport function recursive(\n hook: (p: PType) => RecursiveState,\n): (p: PType) => VNode {\n\n function withHook(stateHook: () => RecursiveState): () => VNode {\n function ComposedComponent(): VNode {\n const state = stateHook();\n\n if (typeof state === \"function\") {\n const subComponent = withHook(state);\n return createElement(subComponent, {});\n }\n\n return state;\n }\n\n return ComposedComponent;\n }\n\n return (p: PType) => {\n const h = withHook(() => hook(p));\n return h();\n };\n}\n\n\n\n/**\n *\n * @param obj VNode\n * @returns\n */\nexport function saveVNodeForInspection(obj: T): T {\n // @ts-ignore\n window[\"showVNodeInfo\"] = function showVNodeInfo() {\n inspect(obj);\n };\n return obj;\n}\nfunction inspect(obj: any) {\n if (!obj) return;\n if (obj.__c && obj.__c.__H) {\n const componentName = obj.__c.constructor.name;\n const hookState = obj.__c.__H;\n const stateList = hookState.__ as Array;\n console.log(\"==============\", componentName);\n stateList.forEach((hook) => {\n const { __: value, c: context, __h: factory, __H: args } = hook;\n if (typeof context !== \"undefined\") {\n const { __c: contextId } = context;\n console.log(\"context:\", contextId, hook);\n } else if (typeof factory === \"function\") {\n console.log(\"memo:\", value, \"deps:\", args);\n } else if (typeof value === \"function\") {\n const effectName = value.name;\n console.log(\"effect:\", effectName, \"deps:\", args);\n } else if (typeof value.current !== \"undefined\") {\n const ref = value.current;\n console.log(\"ref:\", ref instanceof Element ? ref.outerHTML : ref);\n } else if (value instanceof Array) {\n console.log(\"state:\", value[0]);\n } else {\n console.log(hook);\n }\n });\n }\n const children = obj.__k;\n if (children instanceof Array) {\n children.forEach((e) => inspect(e));\n } else {\n inspect(children);\n }\n}\n", "import { Duration, TranslatedString, assertUnreachable } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\n\ninterface Props {\n type?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"low\",\n onClose?: () => void,\n title: TranslatedString,\n children?: ComponentChildren,\n timeout?: Duration,\n}\nexport function Attention({ type = \"info\", title, children, onClose, timeout = Duration.getForever() }: Props): VNode {\n\n return
    \n {timeout.d_ms === \"forever\" ? undefined : \n }\n\n
    \n
    \n
    \n {type === \"low\" ? undefined :\n \n {(() => {\n switch (type) {\n case \"info\":\n return \n case \"warning\":\n return \n case \"danger\":\n return \n case \"success\":\n return \n default:\n assertUnreachable(type)\n }\n })()}\n \n }\n
    \n
    \n

    \n {title}\n

    \n
    \n {children}\n
    \n
    \n {onClose &&\n
    \n \n
    \n }\n
    \n
    \n {timeout.d_ms === \"forever\" ? undefined :\n
    \n \n
    \n }\n\n
    \n}\n", "import { ComponentChildren, h, VNode } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\n\nexport function CopyIcon(): VNode {\n return (\n \n \n \n )\n};\n\nexport function CopiedIcon(): VNode {\n return (\n \n \n \n )\n};\n\nexport function CopyButton({ class: clazz, children, getContent }: { children?: ComponentChildren, class: string, getContent: () => string }): VNode {\n const [copied, setCopied] = useState(false);\n function copyText(): void {\n if (!navigator.clipboard && !window.isSecureContext) {\n prompt(\"Clipboard is not available on insecure context (http).\", getContent());\n }\n if (navigator.clipboard) {\n navigator.clipboard.writeText(getContent() || \"\");\n setCopied(true);\n }\n }\n useEffect(() => {\n if (copied) {\n setTimeout(() => {\n setCopied(false);\n }, 1000);\n }\n }, [copied]);\n\n if (!copied) {\n return (\n \n );\n }\n return (\n \n );\n}\n", "/*\n/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { TalerError, TalerErrorCode, assertUnreachable } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { Attention } from \"./Attention.js\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\nexport function ErrorLoading({ error, showDetail }: { error: TalerError, showDetail?: boolean }): VNode {\n const { i18n } = useTranslationContext()\n switch (error.errorDetail.code) {\n //////////////////\n // Every error that can be produce in a Http Request\n //////////////////\n case TalerErrorCode.GENERIC_TIMEOUT: {\n if (error.hasErrorCode(TalerErrorCode.GENERIC_TIMEOUT)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT)) {\n const { requestMethod, requestUrl, timeoutMs } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, timeoutMs }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED)) {\n const { requestMethod, requestUrl, throttleStats } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, throttleStats }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE)) {\n const { requestMethod, requestUrl, httpStatusCode, validationError } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, httpStatusCode, validationError }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_NETWORK_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_NETWORK_ERROR)) {\n const { requestMethod, requestUrl } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n if (error.hasErrorCode(TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR)) {\n const { requestMethod, requestUrl, httpStatusCode, errorResponse } = error.errorDetail\n return \n {error.message}\n {showDetail &&\n
    \n              {JSON.stringify({ requestMethod, requestUrl, httpStatusCode, errorResponse }, undefined, 2)}\n            
    \n }\n
    \n }\n assertUnreachable(1 as never)\n }\n //////////////////\n // Every other error \n //////////////////\n // case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {\n // return \n // \n // }\n //////////////////\n // Default message for unhandled case\n //////////////////\n default: return \n {error.message}\n {showDetail &&\n
    \n          {JSON.stringify(error.errorDetail, undefined, 2)}\n        
    \n }\n
    \n }\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nimport { Fragment, h, VNode } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\n// import { strings as messages } from \"../i18n/strings.js\";\nimport langIcon from \"../assets/lang.svg\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\ntype LangsNames = {\n [P: string]: string;\n};\n\nconst names: LangsNames = {\n es: \"Espa\u00F1ol [es]\",\n en: \"English [en]\",\n fr: \"Fran\u00E7ais [fr]\",\n de: \"Deutsch [de]\",\n sv: \"Svenska [sv]\",\n it: \"Italiano [it]\",\n};\n\nfunction getLangName(s: keyof LangsNames | string): string {\n if (names[s]) return names[s];\n return String(s);\n}\n\nexport function LangSelector({ }: {}): VNode {\n const [updatingLang, setUpdatingLang] = useState(false);\n const { lang, changeLanguage, completeness, supportedLang } = useTranslationContext();\n const [hidden, setHidden] = useState(true);\n\n useEffect(() => {\n function bodyKeyPress(event: KeyboardEvent) {\n if (event.code === \"Escape\") setHidden(true);\n }\n function bodyOnClick(event: Event) {\n setHidden(true);\n }\n document.body.addEventListener(\"click\", bodyOnClick);\n document.body.addEventListener(\"keydown\", bodyKeyPress as any);\n return () => {\n document.body.removeEventListener(\"keydown\", bodyKeyPress as any);\n document.body.removeEventListener(\"click\", bodyOnClick);\n };\n }, []);\n return (\n
    \n
    \n \n\n {!hidden &&\n
      \n {Object.keys(supportedLang)\n .filter((l) => l !== lang)\n .map((lang) => (\n
    • {\n changeLanguage(lang);\n setUpdatingLang(false);\n setHidden(true)\n }}\n >\n \n {getLangName(lang)}\n {(completeness as any)[lang]}%\n \n\n \n {/* \n \n */}\n \n
    • \n ))}\n\n
    \n }\n\n
    \n
    \n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { h, VNode } from \"preact\";\n\nexport function Loading(): VNode {\n return (\n \n \n
    \n );\n}\n\nfunction Spinner(): VNode {\n return (\n
    \n
    \n
    \n
    \n
    \n
    \n );\n}\n", "import { useState } from \"preact/hooks\";\nimport { LangSelector, useNotifications, useTranslationContext } from \"../index.browser.js\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\nimport logo from \"../assets/logo-2021.svg\";\n\ninterface Props {\n title: string;\n iconLinkURL: string;\n profileURL?: string;\n notificationURL?: string;\n children?: ComponentChildren;\n onLogout: (() => void) | undefined;\n sites: Array>;\n supportedLangs: string[]\n}\n\nexport function Header({ title, profileURL, notificationURL, iconLinkURL, sites, onLogout, children }: Props): VNode {\n const { i18n } = useTranslationContext();\n const [open, setOpen] = useState(false)\n const ns = useNotifications();\n\n return \n
    \n
    \n
    \n
    \n \n \n \n
    \n \n {title}\n \n
    \n
    \n
    \n {sites.map((site) => {\n if (site.length !== 2) return;\n const [name, url] = site\n return {name}\n })}\n
    \n
    \n
    \n {!notificationURL ? undefined :\n \n \n Show notifications\n {ns.length > 0 ?\n \n \n \n \n :\n \n \n \n }\n \n }\n {!profileURL ? undefined :\n \n \n Open profile\n \n \n \n \n }\n \n
    \n
    \n
    \n\n {\n open &&\n
    {\n setOpen(false)\n }}>\n
    \n\n
    \n
    \n
    \n
    \n
    {\n //do not trigger close if clicking inside the sidebar\n e.stopPropagation();\n }}>\n
    \n
    \n

    \n Menu\n

    \n
    \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n }\n
    \n}\n", "import { useTranslationContext } from \"../index.browser.js\";\nimport { h } from \"preact\";\n\nexport function Footer({ testingUrlKey, VERSION, GIT_HASH }: { VERSION?: string, GIT_HASH?: string, testingUrlKey?: string }) {\n const { i18n } = useTranslationContext()\n\n const testingUrl = (testingUrlKey && typeof localStorage !== \"undefined\") && localStorage.getItem(testingUrlKey) ?\n localStorage.getItem(testingUrlKey) ?? undefined :\n undefined\n const versionText = VERSION\n ? GIT_HASH\n ? \n Version {VERSION} ({GIT_HASH.substring(0, 8)})\n \n : VERSION\n : \"\";\n return (\n
    \n
    \n

    \n \n Learn more about GNU Taler\n \n

    \n
    \n
    \n

    \n Copyright © 2014—2023 Taler Systems SA. {versionText}{\" \"}\n

    \n {testingUrlKey && testingUrl &&\n\n

    \n Testing with {testingUrl}{\" \"}\n {\n e.preventDefault();\n localStorage.removeItem(testingUrlKey);\n window.location.reload();\n }}\n >\n stop testing\n \n

    \n }\n
    \n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n OperationAlternative,\n OperationFail,\n OperationOk,\n OperationResult,\n TalerError,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\n// import { NotificationMessage, notifyInfo } from \"@gnu-taler/web-util/browser\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { HTMLAttributes, useState } from \"preact/compat\";\nimport {\n NotificationMessage,\n buildUnifiedRequestErrorMessage,\n notifyInfo,\n useTranslationContext,\n} from \"../index.browser.js\";\n// import { useBankCoreApiContext } from \"../context/config.js\";\n\n// function errorMap>(resp: T, map: (d: T[\"case\"]) => TranslatedString): void {\n\nexport type OnOperationSuccesReturnType = (\n result: T extends OperationOk ? T : never,\n) => TranslatedString | void;\nexport type OnOperationFailReturnType = (\n (d: (T extends OperationFail ? T : never) | (T extends OperationAlternative ? T : never)) => TranslatedString)\n\nexport interface ButtonHandler, A, B> {\n onClick: () => Promise;\n onNotification: (n: NotificationMessage) => void;\n onOperationSuccess: OnOperationSuccesReturnType;\n onOperationFail?: OnOperationFailReturnType;\n onOperationComplete?: () => void;\n}\n\ninterface Props, A, B>\n extends HTMLAttributes {\n handler: ButtonHandler | undefined;\n}\n\n/**\n * This button accept an async function and report a notification\n * on error or success.\n *\n * When the async function is running the inner text will change into\n * a \"loading\" animation.\n *\n * @param param0\n * @returns\n */\nexport function Button, A, B>({\n handler,\n children,\n disabled,\n onClick: clickEvent,\n ...rest\n}: Props): VNode {\n const { i18n } = useTranslationContext();\n const [running, setRunning] = useState(false);\n return (\n {\n e.preventDefault();\n if (!handler) {\n return;\n }\n setRunning(true);\n handler\n .onClick()\n .then((resp) => {\n if (resp) {\n if (resp.type === \"ok\") {\n const result: OperationOk = resp;\n // @ts-expect-error this is an operationOk\n const msg = handler.onOperationSuccess(result);\n if (msg) {\n notifyInfo(msg);\n }\n }\n if (resp.type === \"fail\") {\n const d = 'detail' in resp ? resp.detail : undefined\n \n const title = !handler.onOperationFail ? \"Unexpected error.\" as TranslatedString : handler.onOperationFail(resp as any);\n handler.onNotification({\n title,\n type: \"error\",\n description: d && d.hint ? d.hint as TranslatedString : undefined,\n debug: d,\n when: AbsoluteTime.now(),\n });\n }\n }\n if (handler.onOperationComplete) {\n handler.onOperationComplete();\n }\n setRunning(false);\n })\n .catch((error) => {\n console.error(error);\n\n if (error instanceof TalerError) {\n handler.onNotification(\n buildUnifiedRequestErrorMessage(i18n, error),\n );\n } else {\n const description = (\n error instanceof Error ? error.message : String(error)\n ) as TranslatedString;\n\n handler.onNotification({\n title: i18n.str`Operation failed`,\n type: \"error\",\n description,\n when: AbsoluteTime.now(),\n });\n }\n\n if (handler.onOperationComplete) {\n handler.onOperationComplete();\n }\n setRunning(false);\n });\n }}\n >\n {running ? : children}\n \n );\n}\n\nfunction Wait(): VNode {\n return (\n \n \n
    \n \n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Fragment, h, VNode } from \"preact\";\n\nexport function ShowInputErrorLabel({\n isDirty,\n message,\n}: {\n message: string | undefined;\n isDirty: boolean;\n}): VNode {\n if (message && isDirty)\n return
    {message}
    ;\n return
    ;\n}\n", "import { h, Fragment, VNode } from \"preact\";\nimport { Attention } from \"./Attention.js\";\nimport { Notification } from \"../index.browser.js\";\n\nexport function LocalNotificationBanner({ notification, showDebug }: { notification?: Notification, showDebug?: boolean }): VNode {\n if (!notification) return \n switch (notification.message.type) {\n case \"error\":\n return
    \n
    \n {\n notification.acknowledge()\n }}>\n {notification.message.description &&\n
    \n {notification.message.description}\n
    \n }\n {showDebug &&
    \n              {notification.message.debug}\n            
    }\n
    \n
    \n
    \n case \"info\":\n return
    \n
    \n {\n notification.acknowledge();\n }} />
    \n }\n}\n\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nimport { Fragment, VNode, h } from \"preact\"\nimport { Attention, GLOBAL_NOTIFICATION_TIMEOUT as GLOBAL_TOAST_TIMEOUT, Notification, useNotifications } from \"../index.browser.js\"\n\n/**\n * Toasts should be considered when displaying these types of information to the user:\n * \n * Low attention messages that do not require user action\n * Singular status updates\n * Confirmations\n * Information that does not need to be followed up\n * \n * Do not use toasts if the information contains the following:\n * \n * High attention and crtitical information\n * Time-sensitive information\n * Requires user action or input\n * Batch updates\n * \n * @returns \n */\nexport function ToastBanner(): VNode {\n const notifs = useNotifications()\n if (notifs.length === 0) return \n const show = notifs.filter(e => !e.message.ack && !e.message.timeout)\n if (show.length === 0) return \n return \n}\n\nfunction AttentionByType({ msg }: { msg: Notification }) {\n switch (msg.message.type) {\n case \"error\":\n return {\n msg.acknowledge()\n }} timeout={GLOBAL_TOAST_TIMEOUT}>\n {msg.message.description &&\n
    \n {msg.message.description}\n
    \n }\n
    \n case \"info\":\n return {\n msg.acknowledge();\n }} timeout={GLOBAL_TOAST_TIMEOUT} />\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { AbsoluteTime, Duration } from \"@gnu-taler/taler-util\";\nimport {\n formatISO,\n format,\n formatDuration,\n intervalToDuration,\n} from \"date-fns\";\nimport { Fragment, h, VNode } from \"preact\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\n/**\n *\n * @param timestamp time to be formatted\n * @param relative duration threshold, if the difference is lower\n * the timestamp will be formatted as relative time from \"now\"\n *\n * @returns\n */\nexport function Time({\n timestamp,\n relative,\n format: formatString,\n}: {\n timestamp: AbsoluteTime | undefined;\n relative?: Duration;\n format: string;\n}): VNode {\n const { i18n, dateLocale } = useTranslationContext();\n if (!timestamp) return ;\n\n if (timestamp.t_ms === \"never\") {\n return ;\n }\n\n const now = AbsoluteTime.now();\n const diff = AbsoluteTime.difference(now, timestamp);\n if (relative && now.t_ms !== \"never\" && Duration.cmp(diff, relative) === -1) {\n const d = intervalToDuration({\n start: now.t_ms,\n end: timestamp.t_ms,\n });\n d.seconds = 0;\n const duration = formatDuration(d, { locale: dateLocale });\n const isFuture = AbsoluteTime.cmp(now, timestamp) < 0;\n if (isFuture) {\n return (\n \n );\n } else {\n return (\n \n );\n }\n }\n return (\n \n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\";\nimport {\n add as dateAdd,\n sub as dateSub,\n eachDayOfInterval,\n endOfMonth,\n endOfWeek,\n format,\n getMonth,\n getYear,\n isSameDay,\n isSameMonth,\n startOfDay,\n startOfMonth,\n startOfWeek,\n} from \"date-fns\";\nimport { VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { useTranslationContext } from \"../index.browser.js\";\n\nexport function Calendar({\n value,\n onChange,\n}: {\n value: AbsoluteTime | undefined;\n onChange: (v: AbsoluteTime) => void;\n}): VNode {\n const today = startOfDay(new Date());\n const selected = !value ? today : new Date(AbsoluteTime.toStampMs(value));\n const [showingDate, setShowingDate] = useState(selected);\n const month = getMonth(showingDate);\n const year = getYear(showingDate);\n\n const start = startOfWeek(startOfMonth(showingDate));\n const end = endOfWeek(endOfMonth(showingDate));\n const daysInMonth = eachDayOfInterval({ start, end });\n const { i18n } = useTranslationContext();\n const monthNames = [\n i18n.str`January`,\n i18n.str`February`,\n i18n.str`March`,\n i18n.str`April`,\n i18n.str`May`,\n i18n.str`June`,\n i18n.str`July`,\n i18n.str`August`,\n i18n.str`September`,\n i18n.str`October`,\n i18n.str`November`,\n i18n.str`December`,\n ];\n return (\n
    \n
    \n {\n setShowingDate(dateSub(showingDate, { years: 1 }));\n }}\n >\n {i18n.str`Previous year`}\n \n \n \n \n
    {year}
    \n {\n setShowingDate(dateAdd(showingDate, { years: 1 }));\n }}\n >\n {i18n.str`Next year`}\n \n \n \n \n
    \n
    \n {\n setShowingDate(dateSub(showingDate, { months: 1 }));\n }}\n >\n {i18n.str`Previous month`}\n \n \n \n \n
    {monthNames[month]}
    \n {\n setShowingDate(dateAdd(showingDate, { months: 1 }));\n }}\n >\n {i18n.str`Next month`}\n \n \n \n \n
    \n
    \n
    M
    \n
    T
    \n
    W
    \n
    T
    \n
    F
    \n
    S
    \n
    S
    \n
    \n
    \n
    \n {daysInMonth.map((current, idx) => (\n {\n onChange(AbsoluteTime.fromStampMs(current.getTime()));\n }}\n class=\"text-gray-400 hover:bg-gray-700 focus:z-10 py-1.5 \n data-[month=false]:bg-gray-100 data-[month=true]:bg-white \n data-[today=true]:font-semibold \n data-[month=true]:text-gray-900\n data-[today=true]:bg-red-300 data-[today=true]:hover:bg-red-200\n data-[month=true]:hover:bg-gray-200\n data-[selected=true]:!bg-blue-400 data-[selected=true]:hover:!bg-blue-300 \"\n >\n \n {format(current, \"dd\")}\n \n \n ))}\n
    \n {daysInMonth.length < 40 ?
    : undefined}\n
    \n
    \n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { LabelWithTooltipMaybeRequired, RenderAddon } from \"./InputLine.js\";\nimport { Addon } from \"./FormProvider.js\";\n\ninterface Props {\n label: TranslatedString;\n tooltip?: TranslatedString;\n help?: TranslatedString;\n before?: Addon;\n after?: Addon;\n}\n\nexport function Caption({ before, after, label, tooltip, help }: Props): VNode {\n return (\n
    \n {before !== undefined && }\n \n {after !== undefined && }\n {help && (\n

    \n {help}\n

    \n )}\n
    \n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\nimport { Addon, UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { useField } from \"./useField.js\";\n\n//@ts-ignore\nconst TooltipIcon = (\n \n \n \n);\n\nexport function LabelWithTooltipMaybeRequired({\n label,\n required,\n tooltip,\n}: {\n label: TranslatedString;\n required?: boolean;\n tooltip?: TranslatedString;\n}): VNode {\n const Label = (\n \n
    \n \n {label}\n \n
    \n
    \n );\n const WithTooltip = tooltip ? (\n
    \n {Label}\n \n {TooltipIcon}\n \n \n
    \n ) : (\n Label\n );\n if (required) {\n return (\n
    \n {WithTooltip}\n *\n
    \n );\n }\n return WithTooltip;\n}\n\nexport function RenderAddon({ disabled, addon }: { disabled?: boolean, addon: Addon }): VNode {\n switch (addon.type) {\n case \"text\": {\n return (\n \n {addon.text}\n \n );\n }\n case \"icon\": {\n return (\n
    \n {addon.icon}\n
    \n );\n }\n case \"button\": {\n return (\n \n {addon.children}\n \n );\n }\n }\n}\n\nfunction InputWrapper({\n children,\n label,\n tooltip,\n before,\n after,\n help,\n error,\n disabled,\n required,\n}: {\n error?: string;\n disabled: boolean;\n children: ComponentChildren;\n} & UIFormProps): VNode {\n return (\n
    \n \n
    \n {before && }\n\n {children}\n\n {after && }\n
    \n {error && (\n

    \n {error}\n

    \n )}\n {help && (\n

    \n {help}\n

    \n )}\n
    \n );\n}\n\nfunction defaultToString(v: unknown) {\n return v === undefined ? \"\" : typeof v !== \"object\" ? String(v) : \"\";\n}\nfunction defaultFromString(v: string) {\n return v;\n}\n\ntype InputType = \"text\" | \"text-area\" | \"password\" | \"email\" | \"number\";\n\nexport function InputLine(\n props: { type: InputType } & UIFormProps,\n): VNode {\n const { name, placeholder, before, after, converter, type } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state, error } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n // const [text, setText] = useState(\"\");\n const fromString: (s: string) => any =\n converter?.fromStringUI ?? defaultFromString;\n const toString: (s: any) => string = converter?.toStringUI ?? defaultToString;\n\n // useEffect(() => {\n // const newValue = toString(value);\n // if (newValue) {\n // setText(newValue);\n // }\n // }, [value]);\n\n if (state.hidden) return
    ;\n\n let clazz =\n \"block w-full rounded-md border-0 py-1.5 shadow-sm ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200\";\n if (before) {\n switch (before.type) {\n case \"icon\": {\n clazz += \" pl-10\";\n break;\n }\n case \"button\": {\n clazz += \" rounded-none rounded-r-md \";\n break;\n }\n case \"text\": {\n clazz += \" min-w-0 flex-1 rounded-r-md rounded-none \";\n break;\n }\n }\n }\n if (after) {\n switch (after.type) {\n case \"icon\": {\n clazz += \" pr-10\";\n break;\n }\n case \"button\": {\n clazz += \" rounded-none rounded-l-md\";\n break;\n }\n case \"text\": {\n clazz += \" min-w-0 flex-1 rounded-l-md rounded-none \";\n break;\n }\n }\n }\n const showError = value !== undefined && error;\n if (showError) {\n clazz +=\n \" text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500\";\n } else {\n clazz +=\n \" text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-indigo-600\";\n }\n\n if (type === \"text-area\") {\n return (\n \n {...props}\n help={props.help ?? state.help}\n disabled={state.disabled ?? false}\n error={showError ? error : undefined}\n >\n {\n onChange(fromString(e.currentTarget.value));\n }}\n placeholder={placeholder ? placeholder : undefined}\n value={toString(value) ?? \"\"}\n // defaultValue={toString(value)}\n disabled={state.disabled}\n aria-invalid={showError}\n // aria-describedby=\"email-error\"\n class={clazz}\n />\n \n );\n }\n\n return (\n \n {...props}\n help={props.help ?? state.help}\n disabled={state.disabled ?? false}\n error={showError ? error : undefined}\n >\n {\n onChange(fromString(e.currentTarget.value));\n }}\n placeholder={placeholder ? placeholder : undefined}\n value={toString(value) ?? \"\"}\n // onBlur={() => {\n // onChange(fromString(value as any));\n // }}\n // defaultValue={toString(value)}\n disabled={state.disabled}\n aria-invalid={showError}\n // aria-describedby=\"email-error\"\n class={clazz}\n />\n \n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { FormProvider, UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField } from \"./forms.js\";\nimport { useField } from \"./useField.js\";\n\nfunction Option({\n label,\n disabled,\n isFirst,\n isLast,\n isSelected,\n onClick,\n}: {\n label: TranslatedString;\n isFirst?: boolean;\n isLast?: boolean;\n isSelected?: boolean;\n disabled?: boolean;\n onClick: () => void;\n}): VNode {\n let clazz = \"relative flex border p-4 focus:outline-none disabled:text-grey\";\n if (isFirst) {\n clazz += \" rounded-tl-md rounded-tr-md \";\n }\n if (isLast) {\n clazz += \" rounded-bl-md rounded-br-md \";\n }\n if (isSelected) {\n clazz += \" z-10 border-indigo-200 bg-indigo-50 \";\n } else {\n clazz += \" border-gray-200\";\n }\n if (disabled) {\n clazz +=\n \" cursor-not-allowed bg-gray-50 text-gray-500 ring-gray-200 text-gray\";\n } else {\n clazz += \" cursor-pointer\";\n }\n return (\n \n );\n}\n\nexport function noHandlerPropsAndNoContextForField(\n field: string | number | symbol,\n): never {\n throw Error(\n `Field ${field.toString()} doesn't have handler and is not in a form provider context.`,\n );\n}\n\nexport function InputArray(\n props: {\n fields: UIFormField[];\n labelField: string;\n } & UIFormProps,\n): VNode {\n const { fields, labelField, name, label, required, tooltip } = props;\n // const { value, onChange, state } = useField(name);\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n if (!props.handler && !fieldCtx) {\n throw Error(\"\");\n }\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const list = (value ?? []) as Array>;\n const [selectedIndex, setSelected] = useState(undefined);\n const selected =\n selectedIndex === undefined ? undefined : list[selectedIndex];\n \n return (\n
    \n \n\n
    \n {list.map((v, idx) => {\n const label = getValueDeeper(v, labelField.split(\".\"))\n return (\n {\n setSelected(selectedIndex === idx ? undefined : idx);\n }}\n />\n );\n })}\n {!state.disabled && (\n
    \n {\n setSelected(\n selectedIndex === list.length ? undefined : list.length,\n );\n }}\n />\n
    \n )}\n
    \n {selectedIndex !== undefined && (\n /**\n * This form provider act as a substate of the parent form\n * Consider creating an InnerFormProvider since not every feature is expected\n */\n {\n // current state is ignored\n // the state is defined by the parent form\n\n // elements should be present in the state object since this is expected to be an array\n //@ts-ignore\n // return state.elements[selectedIndex];\n return {};\n }}\n onSubmit={(v) => {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1, v);\n onChange(newValue as any);\n setSelected(undefined);\n }}\n onUpdate={(v) => {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1, v);\n onChange(newValue as any);\n }}\n >\n
    \n
    \n \n
    \n
    \n \n )}\n {selectedIndex !== undefined && (\n
    \n
    \n {selected !== undefined && (\n {\n const newValue = [...list];\n newValue.splice(selectedIndex, 1);\n onChange(newValue as any);\n setSelected(undefined);\n }}\n class=\"block rounded-md bg-red-600 px-3 py-2 text-center text-sm text-white shadow-sm hover:bg-red-500 \"\n >\n Remove\n \n )}\n
    \n
    \n )}\n
    \n );\n}\n\n\n\nexport function getValueDeeper(\n object: Record,\n names: string[],\n): string {\n if (names.length === 0) {\n return object as any as string;\n }\n const [head, ...rest] = names;\n if (!head) {\n return getValueDeeper(object, rest);\n }\n if (object === undefined) {\n return \"\"\n }\n return getValueDeeper(object[head], rest);\n}\n\n\n", "import {\n AbsoluteTime,\n AmountJson,\n TranslatedString,\n} from \"@gnu-taler/taler-util\";\nimport { ComponentChildren, VNode, createContext, h } from \"preact\";\nimport { MutableRef, useState } from \"preact/hooks\";\n\nexport interface FormType {\n value: MutableRef>;\n initial?: Partial;\n readOnly?: boolean;\n onUpdate?: (v: Partial) => void;\n computeFormState?: (v: Partial) => FormState;\n}\n\nexport const FormContext = createContext| undefined>(undefined);\n\n/**\n * Map of {[field]:FieldUIOptions}\n * for every field of type\n * - any native (string, number, etc...)\n * - absoluteTime\n * - amountJson\n *\n * except for:\n * - object => recurse into\n * - array => behavior result and element field\n */\nexport type FormState = {\n [field in keyof T]?: T[field] extends AbsoluteTime\n ? FieldUIOptions\n : T[field] extends AmountJson\n ? FieldUIOptions\n : T[field] extends Array\n ? InputArrayFieldState

    \n : T[field] extends object | undefined\n ? FormState\n : FieldUIOptions;\n};\n\n/**\n * Properties that can be defined by design or by computing state\n */\nexport type FieldUIOptions = {\n /* instruction to be shown in the field */\n placeholder?: TranslatedString;\n /* long text help to be shown on demand */\n tooltip?: TranslatedString;\n /* short text to be shown next to the field*/\n\n help?: TranslatedString;\n /* should show as disabled and readonly */\n disabled?: boolean;\n /* should not show */\n hidden?: boolean;\n\n /* show a mark as required*/\n required?: boolean;\n};\n\n/**\n * properties only to be defined on design time\n */\nexport interface UIFormProps\n extends FieldUIOptions {\n // property name of the object\n name: K;\n\n // label if the field\n label: TranslatedString;\n before?: Addon;\n after?: Addon;\n\n // converter to string and back\n converter?: StringConverter;\n\n handler?: UIFieldHandler;\n}\n\nexport type UIFieldHandler = {\n value: string | undefined;\n onChange: (s: string) => void;\n state: FieldUIOptions;\n error?: TranslatedString;\n};\n\nexport interface IconAddon {\n type: \"icon\";\n icon: VNode;\n}\nexport interface ButtonAddon {\n type: \"button\";\n onClick: () => void;\n children: ComponentChildren;\n}\nexport interface TextAddon {\n type: \"text\";\n text: TranslatedString;\n}\nexport type Addon = IconAddon | ButtonAddon | TextAddon;\n\nexport interface StringConverter {\n toStringUI: (v?: T) => string;\n fromStringUI: (v?: string) => T;\n}\n\nexport interface InputArrayFieldState

    extends FieldUIOptions {\n elements?: FormState

    [];\n}\n\nexport type FormProviderProps = Omit, \"value\"> & {\n onSubmit?: (v: Partial, s: FormState | undefined) => void;\n children?: ComponentChildren;\n};\n\nexport function FormProvider({\n children,\n initial,\n onUpdate: notify,\n onSubmit,\n computeFormState,\n readOnly,\n}: FormProviderProps): VNode {\n const [state, setState] = useState>(initial ?? {});\n const value = { current: state };\n const onUpdate = (v: typeof state) => {\n setState(v);\n if (notify) notify(v);\n };\n return (\n \n {\n e.preventDefault();\n //@ts-ignore\n if (onSubmit)\n onSubmit(\n value.current,\n !computeFormState ? undefined : computeFormState(value.current),\n );\n }}\n >\n {children}\n \n \n );\n}\n", "import { h as create, Fragment, VNode } from \"preact\";\nimport { Caption } from \"./Caption.js\";\nimport { Group } from \"./Group.js\";\nimport { InputAbsoluteTime } from \"./InputAbsoluteTime.js\";\nimport { InputAmount } from \"./InputAmount.js\";\nimport { InputArray } from \"./InputArray.js\";\nimport { InputChoiceHorizontal } from \"./InputChoiceHorizontal.js\";\nimport { InputChoiceStacked } from \"./InputChoiceStacked.js\";\nimport { InputFile } from \"./InputFile.js\";\nimport { InputInteger } from \"./InputInteger.js\";\nimport { InputSelectMultiple } from \"./InputSelectMultiple.js\";\nimport { InputSelectOne } from \"./InputSelectOne.js\";\nimport { InputText } from \"./InputText.js\";\nimport { InputTextArea } from \"./InputTextArea.js\";\nimport { InputToggle } from \"./InputToggle.js\";\nimport { Addon, StringConverter, UIFieldHandler } from \"./FormProvider.js\";\nimport { InternationalizationAPI, UIFieldElementDescription } from \"../index.browser.js\";\nimport { assertUnreachable, TranslatedString } from \"@gnu-taler/taler-util\";\nimport {UIFormFieldBaseConfig, UIFormElementConfig} from \"./ui-form.js\";\n/**\n * Constrain the type with the ui props\n */\ntype FieldType = {\n group: Parameters[0];\n caption: Parameters[0];\n array: Parameters>[0];\n file: Parameters>[0];\n selectOne: Parameters>[0];\n selectMultiple: Parameters>[0];\n text: Parameters>[0];\n textArea: Parameters>[0];\n choiceStacked: Parameters>[0];\n choiceHorizontal: Parameters>[0];\n absoluteTimeText: Parameters>[0];\n integer: Parameters>[0];\n toggle: Parameters>[0];\n amount: Parameters>[0];\n};\n\n/**\n * List all the form fields so typescript can type-check the form instance\n */\nexport type UIFormField =\n | { type: \"group\"; properties: FieldType[\"group\"] }\n | { type: \"caption\"; properties: FieldType[\"caption\"] }\n | { type: \"array\"; properties: FieldType[\"array\"] }\n | { type: \"file\"; properties: FieldType[\"file\"] }\n | { type: \"amount\"; properties: FieldType[\"amount\"] }\n | { type: \"selectOne\"; properties: FieldType[\"selectOne\"] }\n | {\n type: \"selectMultiple\";\n properties: FieldType[\"selectMultiple\"];\n }\n | { type: \"text\"; properties: FieldType[\"text\"] }\n | { type: \"textArea\"; properties: FieldType[\"textArea\"] }\n | {\n type: \"choiceStacked\";\n properties: FieldType[\"choiceStacked\"];\n }\n | {\n type: \"choiceHorizontal\";\n properties: FieldType[\"choiceHorizontal\"];\n }\n | { type: \"integer\"; properties: FieldType[\"integer\"] }\n | { type: \"toggle\"; properties: FieldType[\"toggle\"] }\n | {\n type: \"absoluteTimeText\";\n properties: FieldType[\"absoluteTimeText\"];\n };\n\ntype FieldComponentFunction = (\n props: FieldType[key],\n) => VNode;\n\ntype UIFormFieldMap = {\n [key in keyof FieldType]: FieldComponentFunction;\n};\n\n/**\n * Maps input type with component implementation\n */\nconst UIFormConfiguration: UIFormFieldMap = {\n group: Group,\n caption: Caption,\n //@ts-ignore\n array: InputArray,\n text: InputText,\n //@ts-ignore\n file: InputFile,\n textArea: InputTextArea,\n //@ts-ignore\n absoluteTimeText: InputAbsoluteTime,\n //@ts-ignore\n choiceStacked: InputChoiceStacked,\n //@ts-ignore\n choiceHorizontal: InputChoiceHorizontal,\n integer: InputInteger,\n //@ts-ignore\n selectOne: InputSelectOne,\n //@ts-ignore\n selectMultiple: InputSelectMultiple,\n //@ts-ignore\n toggle: InputToggle,\n //@ts-ignore\n amount: InputAmount,\n};\n\nexport function RenderAllFieldsByUiConfig({\n fields,\n}: {\n fields: UIFormField[];\n}): VNode {\n return create(\n Fragment,\n {},\n fields.map((field, i) => {\n const Component = UIFormConfiguration[\n field.type\n ] as FieldComponentFunction;\n return Component(field.properties);\n }),\n );\n}\n\n// type FormSet = {\n// Provider: typeof FormProvider;\n// InputLine: () => typeof InputLine;\n// InputChoiceHorizontal: () => typeof InputChoiceHorizontal;\n// };\n\n/**\n * Helper function that created a typed object.\n *\n * @returns\n */\n// export function createNewForm() {\n// const res: FormSet = {\n// Provider: FormProvider,\n// InputLine: () => InputLine,\n// InputChoiceHorizontal: () => InputChoiceHorizontal,\n// };\n// return {\n// Provider: res.Provider,\n// InputLine: res.InputLine(),\n// InputChoiceHorizontal: res.InputChoiceHorizontal(),\n// };\n// }\n\n/**\n * convert field configuration to render function\n * \n * @param i18n_ \n * @param fieldConfig \n * @param form \n * @returns \n */\nexport function convertUiField(\n i18n_: InternationalizationAPI,\n fieldConfig: UIFormElementConfig[],\n form: object,\n getConverterById: GetConverterById,\n): UIFormField[] {\n return fieldConfig.map((config) => {\n // NON input fields\n switch (config.type) {\n case \"caption\": {\n const resp: UIFormField = {\n type: config.type,\n properties: converBaseFieldsProps(i18n_, config),\n };\n return resp;\n }\n case \"group\": {\n const resp: UIFormField = {\n type: config.type,\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n fields: convertUiField(i18n_, config.fields, form, getConverterById),\n },\n };\n return resp;\n }\n }\n // Input Fields\n switch (config.type) {\n case \"array\": {\n return {\n type: \"array\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n labelField: config.labelFieldId,\n fields: convertUiField(i18n_, config.fields, form, getConverterById),\n },\n } as UIFormField;\n }\n case \"absoluteTimeText\": {\n return {\n type: \"absoluteTimeText\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"amount\": {\n return {\n type: \"amount\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById), \n currency: config.currency, \n },\n } as UIFormField;\n }\n case \"choiceHorizontal\": {\n return {\n type: \"choiceHorizontal\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"choiceStacked\": {\n return {\n type: \"choiceStacked\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n \n },\n }as UIFormField;\n }\n case \"file\":{\n return {\n type: \"file\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n accept: config.accept,\n maxBites: config.maxBytes,\n },\n } as UIFormField;\n }\n case \"integer\":{\n return {\n type: \"integer\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"selectMultiple\":{\n return {\n type: \"selectMultiple\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"selectOne\": {\n return {\n type: \"selectOne\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n choices: config.choices,\n },\n } as UIFormField;\n }\n case \"text\": {\n return {\n type: \"text\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"textArea\": {\n return {\n type: \"text\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n case \"toggle\": {\n return {\n type: \"toggle\",\n properties: {\n ...converBaseFieldsProps(i18n_, config),\n ...converInputFieldsProps(form, config, getConverterById),\n },\n } as UIFormField;\n }\n default: {\n assertUnreachable(config);\n }\n }\n });\n}\n\n\n\nfunction getAddonById(_id: string | undefined): Addon {\n return undefined!;\n}\n\n\ntype GetConverterById = (\n id: string | undefined,\n config: unknown,\n) => StringConverter;\n\n\nfunction converInputFieldsProps(\n form: object,\n p: UIFormFieldBaseConfig,\n getConverterById: GetConverterById,\n) {\n return {\n converter: getConverterById(p.converterId, p),\n handler: getValueDeeper2(form, p.id.split(\".\")),\n name: p.name,\n required: p.required,\n disabled: p.disabled,\n help: p.help,\n placeholder: p.placeholder,\n tooltip: p.tooltip,\n label: p.label as TranslatedString,\n };\n}\n\nfunction converBaseFieldsProps(\n i18n_: InternationalizationAPI,\n p: UIFieldElementDescription,\n) {\n return {\n after: getAddonById(p.addonAfterId),\n before: getAddonById(p.addonBeforeId),\n hidden: p.hidden,\n name: p.name,\n help: i18n_.str`${p.help}`,\n label: i18n_.str`${p.label}`,\n tooltip: i18n_.str`${p.tooltip}`,\n };\n}\n\nexport function getValueDeeper2(\n object: Record,\n names: string[],\n): UIFieldHandler {\n if (names.length === 0) return object as UIFieldHandler;\n const [head, ...rest] = names;\n if (!head) {\n return getValueDeeper2(object, rest);\n }\n if (object === undefined) {\n throw Error(\"handler not found\");\n }\n return getValueDeeper2(object[head], rest);\n}\n\n\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { LabelWithTooltipMaybeRequired, RenderAddon } from \"./InputLine.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField, convertUiField } from \"./forms.js\";\nimport { Addon, FormProvider } from \"./FormProvider.js\";\nimport { useField } from \"./useField.js\";\nimport { useTranslationContext } from \"../index.browser.js\";\nimport { getConverterById } from \"./converter.js\";\n\ninterface Props {\n label: TranslatedString;\n tooltip?: TranslatedString;\n help?: TranslatedString;\n before?: Addon;\n after?: Addon;\n fields: UIFormField[];\n}\n\nexport function Group({\n before,\n after,\n label,\n tooltip,\n help,\n fields,\n}: Props): VNode {\n return (\n

    \n {before !== undefined && }\n \n {after !== undefined && }\n {help && (\n

    \n {help}\n

    \n )}\n
    \n \n
    \n
    \n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\";\nimport { format, parse } from \"date-fns\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { Calendar } from \"./Calendar.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputAbsoluteTime(\n properties: { pattern?: string } & UIFormProps,\n): VNode {\n const pattern = properties.pattern ?? \"dd/MM/yyyy\";\n const [open, setOpen] = useState(false);\n\n //FIXME: remove deprecated\n const fieldCtx = useField(properties.name);\n const { value, onChange } =\n properties.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(properties.name);\n return (\n \n \n type=\"text\"\n after={{\n type: \"button\",\n onClick: () => {\n setOpen(true);\n },\n // icon: ,\n children: (\n \n \n \n ),\n }}\n converter={{\n //@ts-ignore\n fromStringUI: (v): AbsoluteTime | undefined => {\n if (!v) return undefined;\n try {\n const t_ms = parse(v, pattern, Date.now()).getTime();\n return AbsoluteTime.fromMilliseconds(t_ms);\n } catch (e) {\n return undefined;\n }\n },\n //@ts-ignore\n toStringUI: (v: AbsoluteTime | undefined) => {\n return !v || !v.t_ms\n ? undefined\n : v.t_ms === \"never\"\n ? \"never\"\n : format(v.t_ms, pattern);\n },\n }}\n {...properties}\n />\n {open && (\n setOpen(false)}>\n {\n onChange(v as any);\n setOpen(false);\n }}\n />\n \n )}\n {/* {open &&\n setOpen(false)} >\n {\n onChange(v as any)\n }}\n onConfirm={() => {\n setOpen(false)\n }} />\n } */}\n \n );\n}\n", "import { ComponentChildren, VNode, h } from \"preact\";\n\nexport function Dialog({ children, onClose }: { onClose?: () => void; children: ComponentChildren }): VNode {\n return
    \n
    \n\n
    \n
    \n
    e.stopPropagation()}>\n {children}\n
    \n
    \n
    \n
    \n}\n", "import { useContext } from \"preact/compat\";\nimport { FieldUIOptions, FormContext } from \"./FormProvider.js\";\nimport { TranslatedString } from \"@gnu-taler/taler-util\";\n\nexport interface InputFieldHandler {\n value: Type;\n onChange: (s: Type) => void;\n state: FieldUIOptions;\n error?: TranslatedString | undefined;\n}\n\n/**\n * @deprecated removing this so we don't depend on context to create a form\n * @param name \n * @returns \n */\nexport function useField(\n name: K,\n): InputFieldHandler | undefined {\n const ctx = useContext(FormContext);\n if (!ctx) {\n //no context, can't be used\n return undefined;\n }\n const {\n value: formValue,\n computeFormState,\n onUpdate: notifyUpdate,\n readOnly: readOnlyForm,\n } = ctx\n\n type P = typeof name;\n type V = T[P];\n const formState = computeFormState ? computeFormState(formValue.current) : {};\n\n const fieldValue = readField(formValue.current, String(name)) as V;\n\n const fieldState =\n readField>(formState, String(name)) ?? {};\n\n //compute default state\n const state = {\n disabled: readOnlyForm ? true : (fieldState.disabled ?? false),\n hidden: fieldState.hidden ?? false,\n help: fieldState.help,\n elements: \"elements\" in fieldState ? fieldState.elements ?? [] : [],\n };\n\n function onChange(value: V): void {\n // setCurrentValue(value);\n formValue.current = setValueDeeper(\n formValue.current,\n String(name).split(\".\"),\n value,\n );\n if (notifyUpdate) {\n notifyUpdate(formValue.current);\n }\n }\n\n return {\n value: fieldValue,\n onChange,\n state,\n };\n}\n\n/**\n * read the field of an object an support accessing it using '.'\n *\n * @param object\n * @param name\n * @returns\n */\nfunction readField(\n object: any,\n name: string,\n): T | undefined {\n return name.split(\".\").reduce((prev, current) => {\n return prev ? prev[current] : undefined;\n }, object);\n}\n\nfunction setValueDeeper(object: any, names: string[], value: any): any {\n if (names.length === 0) return value;\n const [head, ...rest] = names;\n if (object === undefined) {\n return { [head]: setValueDeeper({}, rest, value) };\n }\n return { ...object, [head]: setValueDeeper(object[head] ?? {}, rest, value) };\n}\n", "import { AmountJson, Amounts, TranslatedString } from \"@gnu-taler/taler-util\";\nimport { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputAmount(\n props: { currency?: string } & UIFormProps,\n): VNode {\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n const currency =\n !value || !(value as any).currency\n ? props.currency\n : (value as any).currency;\n return (\n \n {...props}\n type=\"text\"\n before={{\n type: \"text\",\n text: currency as TranslatedString,\n }}\n //@ts-ignore\n converter={\n props.converter ?? {\n fromStringUI: (v): AmountJson => {\n return (\n Amounts.parse(`${currency}:${v}`) ??\n Amounts.zeroOfCurrency(currency)\n );\n },\n toStringUI: (v: AmountJson) => {\n return v === undefined ? \"\" : Amounts.stringifyValue(v);\n },\n }\n }\n />\n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport interface ChoiceH {\n label: TranslatedString;\n value: V;\n}\n\nexport function InputChoiceHorizontal(\n props: {\n choices: ChoiceH[];\n } & UIFormProps,\n): VNode {\n const { choices, label, tooltip, help, required, converter } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n if (state.hidden) {\n return ;\n }\n\n return (\n
    \n \n
    \n
    \n {choices.map((choice, idx) => {\n const convertedValue = converter?.fromStringUI(choice.value as any)\n const isFirst = idx === 0;\n const isLast = idx === choices.length - 1;\n let clazz =\n \"relative inline-flex items-center px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 focus:z-10\";\n if (convertedValue !== undefined && convertedValue === value) {\n clazz +=\n \" text-white bg-indigo-600 hover:bg-indigo-500 ring-2 ring-indigo-600 hover:ring-indigo-500\";\n } else {\n clazz += \" hover:bg-gray-100 border-gray-300\";\n }\n if (isFirst) {\n clazz += \" rounded-l-md\";\n } else {\n clazz += \" -ml-px\";\n }\n if (isLast) {\n clazz += \" rounded-r-md\";\n }\n return (\n {\n onChange(\n (value === choice.value ? undefined : convertedValue) as any,\n );\n }}\n >\n {choice.label}\n \n );\n })}\n
    \n
    \n {help && (\n

    \n {help}\n

    \n )}\n
    \n );\n}\n", "import { TranslatedString } from \"@gnu-taler/taler-util\";\nimport { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport interface ChoiceS {\n label: TranslatedString;\n description?: TranslatedString;\n value: V;\n}\n\nexport function InputChoiceStacked(\n props: {\n choices: ChoiceS[];\n } & UIFormProps,\n): VNode {\n const {\n choices,\n name,\n label,\n tooltip,\n help,\n placeholder,\n required,\n before,\n after,\n converter,\n } = props;\n\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n if (state.hidden) {\n return ;\n }\n\n return (\n
    \n \n
    \n
    \n {choices.map((choice, idx) => {\n // const currentValue = !converter\n // ? choice.value\n // : converter.fromStringUI(choice.value) ?? \"\";\n\n let clazz =\n \"border relative block cursor-pointer rounded-lg bg-white px-6 py-4 shadow-sm focus:outline-none sm:flex sm:justify-between\";\n if (choice.value === value) {\n clazz +=\n \" border-transparent border-indigo-600 ring-2 ring-indigo-600\";\n } else {\n clazz += \" border-gray-300\";\n }\n\n return (\n \n );\n })}\n
    \n
    \n {help && (\n

    \n {help}\n

    \n )}\n
    \n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputFile(\n props: { maxBites: number; accept?: string } & UIFormProps,\n): VNode {\n const {\n label,\n tooltip,\n required,\n help: propsHelp,\n maxBites,\n accept,\n } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const help = propsHelp ?? state.help;\n if (state.hidden) {\n return
    ;\n }\n\n const valueStr = !value ? \"\" : value.toString();\n const firstColon = valueStr.indexOf(\";\");\n\n const { fileName, dataUri } = valueStr.startsWith(\"file:\")\n ? {\n fileName: valueStr.substring(5, firstColon),\n dataUri: valueStr.substring(firstColon + 1),\n }\n : {\n fileName: \"\",\n dataUri: valueStr,\n };\n\n return (\n
    \n \n {!dataUri ? (\n
    \n
    \n \n \n \n {!state.disabled && (\n
    \n \n Upload a file\n {\n const f: FileList | null = e.currentTarget.files;\n if (!f || f.length != 1) {\n return onChange(undefined!);\n }\n if (f[0].size > maxBites) {\n return onChange(undefined!);\n }\n const fileName = f[0].name;\n return f[0].arrayBuffer().then((b) => {\n const b64 = window.btoa(\n new Uint8Array(b).reduce(\n (data, byte) => data + String.fromCharCode(byte),\n \"\",\n ),\n );\n if (fileName) {\n return onChange(\n `file:${fileName};data:${f[0].type};base64,${b64}` as any,\n );\n } else {\n return onChange(\n `data:${f[0].type};base64,${b64}` as any,\n );\n }\n });\n }}\n />\n \n {/*

    or drag and drop

    */}\n
    \n )}\n
    \n
    \n ) : (\n
    \n {(dataUri as string).startsWith(\"data:image/\") ? (\n \n ) : (\n
    \n )}\n {fileName ? (\n
    \n {fileName}\n
    \n ) : (\n \n )}\n\n {!state.disabled && (\n {\n onChange(undefined!);\n }}\n >\n Clear\n
    \n )}\n
    \n )}\n {help &&

    {help}

    }\n
    \n );\n}\n", "import { VNode, h } from \"preact\";\nimport { InputLine } from \"./InputLine.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\n\nexport function InputInteger(\n props: UIFormProps,\n): VNode {\n return (\n {\n return !v ? 0 : Number.parseInt(v, 10);\n },\n //@ts-ignore\n toStringUI: (v?: number): string => {\n return v === undefined ? \"\" : String(v);\n },\n }}\n {...props}\n />\n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { ChoiceS } from \"./InputChoiceStacked.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputSelectMultiple(\n props: {\n choices: ChoiceS[];\n unique?: boolean;\n max?: number;\n } & UIFormProps,\n): VNode {\n const { converter, label, choices, placeholder, tooltip, required, unique, max } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange, state } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const [filter, setFilter] = useState(undefined);\n const regex = new RegExp(`.*${filter}.*`, \"i\");\n const choiceMap = choices.reduce(\n (prev, curr) => {\n return { ...prev, [curr.value as string]: curr.label };\n },\n {} as Record,\n );\n\n const list = (value ?? []) as string[];\n const filteredChoices =\n filter === undefined\n ? undefined\n : choices.filter((v) => {\n return regex.test(v.label);\n });\n return (\n
    \n \n {list.map((v, idx) => {\n return (\n \n {choiceMap[v]}\n {\n const newValue = [...list];\n newValue.splice(idx, 1);\n onChange(newValue as any);\n setFilter(undefined);\n }}\n class=\"group relative h-5 w-5 rounded-sm hover:bg-gray-500/20\"\n >\n Remove\n \n \n \n \n \n \n );\n })}\n\n {!state.disabled && (\n
    \n {\n setFilter(e.currentTarget.value);\n }}\n placeholder={placeholder}\n class=\"w-full rounded-md border-0 bg-white py-1.5 pl-3 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6\"\n role=\"combobox\"\n aria-controls=\"options\"\n aria-expanded=\"false\"\n />\n {\n setFilter(filter === undefined ? \"\" : undefined);\n }}\n class=\"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none\"\n >\n \n \n \n \n\n {filteredChoices !== undefined && (\n \n {filteredChoices.map((v, idx) => {\n return (\n {\n setFilter(undefined);\n if (unique && list.indexOf(v.value as string) !== -1) {\n return;\n }\n if (max !== undefined && list.length >= max) {\n return;\n }\n const newValue = [...list];\n newValue.splice(0, 0, v.value as string);\n onChange(newValue as any);\n }}\n\n // tabindex=\"-1\"\n >\n {/* */}\n {v.label}\n\n {/* */}\n \n );\n })}\n\n {/* */}\n\n {/* */}\n \n )}\n
    \n )}\n
    \n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { useState } from \"preact/hooks\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { ChoiceS } from \"./InputChoiceStacked.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\n\nexport function InputSelectOne(\n props: {\n choices: ChoiceS[];\n } & UIFormProps,\n): VNode {\n const { label, choices, placeholder, tooltip, required } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n\n const [filter, setFilter] = useState(undefined);\n const regex = new RegExp(`.*${filter}.*`, \"i\");\n const choiceMap = choices.reduce(\n (prev, curr) => {\n return { ...prev, [curr.value as string]: curr.label };\n },\n {} as Record,\n );\n\n const filteredChoices =\n filter === undefined\n ? undefined\n : choices.filter((v) => {\n return regex.test(v.label);\n });\n return (\n
    \n \n {value ? (\n \n {choiceMap[value as string]}\n {\n onChange(undefined!);\n }}\n class=\"group relative h-5 w-5 rounded-sm hover:bg-gray-500/20\"\n >\n Remove\n \n \n \n \n \n \n ) : (\n
    \n {\n setFilter(e.currentTarget.value);\n }}\n placeholder={placeholder}\n class=\"w-full rounded-md border-0 bg-white py-1.5 pl-3 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6\"\n role=\"combobox\"\n aria-controls=\"options\"\n aria-expanded=\"false\"\n />\n {\n setFilter(filter === undefined ? \"\" : undefined);\n }}\n class=\"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none\"\n >\n \n \n \n \n\n {filteredChoices !== undefined && (\n \n {filteredChoices.map((v, idx) => {\n return (\n {\n setFilter(undefined);\n onChange(v.value as any);\n }}\n\n // tabindex=\"-1\"\n >\n {/* */}\n {v.label}\n\n {/* */}\n \n );\n })}\n\n {/* */}\n\n {/* */}\n \n )}\n
    \n )}\n
    \n );\n}\n", "import { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { InputLine } from \"./InputLine.js\";\n\nexport function InputText(\n props: UIFormProps,\n): VNode {\n return ;\n}\n", "import { VNode, h } from \"preact\";\nimport { InputLine } from \"./InputLine.js\";\nimport { UIFormProps } from \"./FormProvider.js\";\n\nexport function InputTextArea(\n props: UIFormProps,\n): VNode {\n return ;\n}\n", "import { VNode, h } from \"preact\";\nimport { UIFormProps } from \"./FormProvider.js\";\nimport { noHandlerPropsAndNoContextForField } from \"./InputArray.js\";\nimport { LabelWithTooltipMaybeRequired } from \"./InputLine.js\";\nimport { useField } from \"./useField.js\";\n\nexport function InputToggle(\n props: UIFormProps,\n): VNode {\n const {\n name,\n label,\n tooltip,\n help,\n placeholder,\n required,\n before,\n after,\n converter,\n } = props;\n //FIXME: remove deprecated\n const fieldCtx = useField(props.name);\n const { value, onChange } =\n props.handler ?? fieldCtx ?? noHandlerPropsAndNoContextForField(props.name);\n\n const isOn = !!value;\n return (\n
    \n
    \n \n {\n onChange(!isOn as any);\n }}\n >\n \n \n
    \n
    \n );\n}\n", "import { Fragment, VNode, h } from \"preact\";\nimport { FormProvider, FormProviderProps, FormState } from \"./FormProvider.js\";\nimport { RenderAllFieldsByUiConfig, UIFormField } from \"./forms.js\";\nimport { TranslatedString } from \"@gnu-taler/taler-util\";\n// import { FlexibleForm } from \"./ui-form.js\";\n\n/**\n * Flexible form uses a DoubleColumForm for design\n * and may have a dynamic properties defined by \n * behavior function.\n */\nexport interface FlexibleForm_Deprecated {\n design: DoubleColumnForm_Deprecated;\n behavior?: (form: Partial) => FormState;\n}\n\n/**\n * Double column form\n * \n * Form with sections, every sections have a title and may\n * have a description.\n * Every sections contain a set of fields.\n */\nexport type DoubleColumnForm_Deprecated = Array;\n\nexport type DoubleColumnFormSection_Deprecated = {\n title: TranslatedString;\n description?: TranslatedString;\n fields: UIFormField[];\n};\n\n/**\n * Form Provider implementation that use FlexibleForm\n * to defined behavior and fields.\n */\nexport function DefaultForm({\n initial,\n onUpdate,\n form,\n onSubmit,\n children,\n readOnly,\n}: Omit, \"computeFormState\"> & { form: FlexibleForm_Deprecated }): VNode {\n return (\n \n
    \n {form.design.map((section, i) => {\n if (!section) return ;\n return (\n
    \n
    \n

    \n {section.title}\n

    \n {section.description && (\n

    \n {section.description}\n

    \n )}\n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n );\n })}\n
    \n {children}\n \n );\n}\n", "import { AbsoluteTime } from \"@gnu-taler/taler-util\"\nimport { getHours, getMinutes, getSeconds, setHours } from \"date-fns\"\nimport { Fragment, VNode, h } from \"preact\"\nimport { useTranslationContext } from \"../index.browser.js\"\n\nexport function TimePicker({ value, onChange, onConfirm }: { value: AbsoluteTime | undefined, onChange: (v: AbsoluteTime) => void, onConfirm: () => void }): VNode {\n const date = !value ? new Date() : new Date(AbsoluteTime.toStampMs(value))\n const hours = getHours(date) % 12\n const minutes = getMinutes(date)\n const seconds = getSeconds(date)\n\n const { i18n } = useTranslationContext()\n\n return \n
    \n {/* time selection */}\n
    \n
    \n
    \n \n \n \n :\n \n \n \n :\n \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n {/* clock */}\n
    \n
    \n\n \n
    \n {/*
    */}\n
    \n\n onChange(AbsoluteTime.fromStampMs(setHours(date, 12).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 114px; bottom: 224px;\">\n 0\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 1).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 169px; bottom: 209.263px;\">\n 1\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 2).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" data-selected={true} style=\"left: 209.263px; bottom: 169px;\" >\n 2\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 3).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 224px; bottom: 114px;\">\n 3\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 4).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 209.263px; bottom: 59px;\">\n 4\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 5).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 169px; bottom: 18.7372px;\">\n 5\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 6).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 114px; bottom: 4px;\">\n 6\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 7).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 59px; bottom: 18.7372px;\">\n 7\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 8).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 18.7372px; bottom: 59px;\">\n 8\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 9).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 4px; bottom: 114px;\">\n 9\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 10).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 18.7372px; bottom: 169px;\">\n 10\n \n onChange(AbsoluteTime.fromStampMs(setHours(date, 11).getTime()))} class=\"absolute rounded-[100%] w-[32px] h-[32px] text-center cursor-pointer text-[1.1rem] bg-transparent flex justify-center items-center font-light focus:outline-none selection:bg-transparent data-[selected=true]:text-white data-[selected=true]:bg-[#3b71ca] data-[selected=true]:font-normal\" style=\"left: 59px; bottom: 209.263px;\">\n 11\n \n
    \n
    \n
    \n
    \n
    \n \n Confirm\n \n
    \n
    \n
    \n}\n", "import {\n buildCodecForObject,\n buildCodecForUnion,\n Codec,\n codecForBoolean,\n codecForConstString,\n codecForLazy,\n codecForList,\n codecForNumber,\n codecForString,\n codecForTimestamp,\n codecOptional,\n Integer,\n TalerProtocolTimestamp,\n} from \"@gnu-taler/taler-util\";\n\nexport type FormConfiguration = DoubleColumnForm;\n\nexport type DoubleColumnForm = {\n type: \"double-column\";\n design: DoubleColumnFormSection[];\n // behavior?: (form: Partial) => FormState;\n};\n\nexport type DoubleColumnFormSection = {\n title: string;\n description?: string;\n fields: UIFormElementConfig[];\n};\n\n// export interface BaseForm {\n// state: TalerExchangeApi.AmlState;\n// threshold: AmountJson;\n// }\n\nexport type UIFormElementConfig =\n | UIFormElementGroup\n | UIFormElementCaption\n | UIFormFieldAbsoluteTime\n | UIFormFieldAmount\n | UIFormFieldArray\n | UIFormFieldChoiseHorizontal\n | UIFormFieldChoiseStacked\n | UIFormFieldFile\n | UIFormFieldInteger\n | UIFormFieldSelectMultiple\n | UIFormFieldSelectOne\n | UIFormFieldText\n | UIFormFieldTextArea\n | UIFormFieldToggle;\n\ntype UIFormFieldAbsoluteTime = {\n type: \"absoluteTimeText\";\n max?: TalerProtocolTimestamp;\n min?: TalerProtocolTimestamp;\n pattern: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldAmount = {\n type: \"amount\";\n max?: Integer;\n min?: Integer;\n currency: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldArray = {\n type: \"array\";\n // id of the field shown when the array is collapsed\n labelFieldId: UIHandlerId;\n fields: UIFormElementConfig[];\n} & UIFormFieldBaseConfig;\n\ntype UIFormElementCaption = { type: \"caption\" } & UIFieldElementDescription;\n\ntype UIFormElementGroup = {\n type: \"group\";\n fields: UIFormElementConfig[];\n} & UIFieldElementDescription;\n\ntype UIFormFieldChoiseHorizontal = {\n type: \"choiceHorizontal\";\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldChoiseStacked = {\n type: \"choiceStacked\";\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldFile = {\n type: \"file\";\n maxBytes?: Integer;\n minBytes?: Integer;\n // comma-separated list of one or more file types\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers\n accept?: string;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldInteger = {\n type: \"integer\";\n max?: Integer;\n min?: Integer;\n} & UIFormFieldBaseConfig;\n\ninterface SelectUiChoice {\n label: string;\n description?: string;\n value: string;\n}\n\ntype UIFormFieldSelectMultiple = {\n type: \"selectMultiple\";\n max?: Integer;\n min?: Integer;\n unique?: boolean;\n choices: Array;\n} & UIFormFieldBaseConfig;\n\ntype UIFormFieldSelectOne = {\n type: \"selectOne\";\n choices: Array;\n} & UIFormFieldBaseConfig;\ntype UIFormFieldText = { type: \"text\" } & UIFormFieldBaseConfig;\ntype UIFormFieldTextArea = { type: \"textArea\" } & UIFormFieldBaseConfig;\ntype UIFormFieldToggle = { type: \"toggle\" } & UIFormFieldBaseConfig;\n\nexport type UIFieldElementDescription = {\n /* label if the field, visible for the user */\n label: string;\n\n /* long text to be shown on user demand */\n tooltip?: string;\n\n /* short text to be shown close to the field, usually below and dimmer*/\n help?: string;\n\n /* name of the field, useful for a11y */\n name: string;\n\n /* if the field should be initially hidden */\n hidden?: boolean;\n\n /* ui element to show before */\n addonBeforeId?: string;\n\n /* ui element to show after */\n addonAfterId?: string;\n};\n\nexport type UIFormFieldBaseConfig = UIFieldElementDescription & {\n /* example to be shown inside the field */\n placeholder?: string;\n\n /* show a mark as required */\n required?: boolean;\n\n /* readonly and dim */\n disabled?: boolean;\n\n /* conversion id to convert the string into the value type\n the id should be known to the ui impl\n */\n converterId?: string;\n\n /* property id of the form */\n id: UIHandlerId;\n};\n\ndeclare const __handlerId: unique symbol;\nexport type UIHandlerId = string & { [__handlerId]: true };\n\n// FIXME: validate well formed ui field id\nconst codecForUiFieldId = codecForString as () => Codec;\n\nconst codecForUIFormFieldBaseDescriptionTemplate = <\n T extends UIFieldElementDescription,\n>() =>\n buildCodecForObject()\n .property(\"addonAfterId\", codecOptional(codecForString()))\n .property(\"addonBeforeId\", codecOptional(codecForString()))\n .property(\"hidden\", codecOptional(codecForBoolean()))\n .property(\"help\", codecOptional(codecForString()))\n .property(\"label\", codecForString())\n .property(\"name\", codecForString())\n .property(\"tooltip\", codecOptional(codecForString()));\n\nconst codecForUIFormFieldBaseConfigTemplate = <\n T extends UIFormFieldBaseConfig,\n>() =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"id\", codecForUiFieldId())\n .property(\"converterId\", codecOptional(codecForString()))\n .property(\"disabled\", codecOptional(codecForBoolean()))\n .property(\"required\", codecOptional(codecForBoolean()))\n .property(\"placeholder\", codecOptional(codecForString()));\n\nconst codecForUiFormFieldAbsoluteTime = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"absoluteTimeText\"))\n .property(\"pattern\", codecForString())\n .property(\"max\", codecOptional(codecForTimestamp))\n .property(\"min\", codecOptional(codecForTimestamp))\n .build(\"UIFormFieldAbsoluteTime\");\n\nconst codecForUiFormFieldAmount = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"amount\"))\n .property(\"currency\", codecForString())\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldAmount\");\n\nconst codecForUiFormFieldArray = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"array\"))\n .property(\"labelFieldId\", codecForUiFieldId())\n .property(\"tooltip\", codecOptional(codecForString()))\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"UIFormFieldArray\");\n\nconst codecForUiFormFieldCaption = (): Codec =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"type\", codecForConstString(\"caption\"))\n .build(\"UIFormFieldCaption\");\n\nconst codecForUiFormSelectUiChoice = (): Codec =>\n buildCodecForObject()\n .property(\"description\", codecOptional(codecForString()))\n .property(\"label\", codecForString())\n .property(\"value\", codecForString())\n .build(\"SelectUiChoice\");\n\nconst codecForUiFormFieldChoiceHorizontal =\n (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"choiceHorizontal\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldChoiseHorizontal\");\n\nconst codecForUiFormFieldChoiceStacked = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"choiceStacked\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldChoiseStacked\");\n\nconst codecForUiFormFieldFile = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"file\"))\n .property(\"accept\", codecOptional(codecForString()))\n .property(\"maxBytes\", codecOptional(codecForNumber()))\n .property(\"minBytes\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldFile\");\n\nconst codecForUiFormFieldGroup = (): Codec =>\n codecForUIFormFieldBaseDescriptionTemplate()\n .property(\"type\", codecForConstString(\"group\"))\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"UiFormFieldGroup\");\n\nconst codecForUiFormFieldInteger = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"integer\"))\n // .property(\"properties\", codecForUIFormFieldBaseConfig())\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .build(\"UIFormFieldInteger\");\n\nconst codecForUiFormFieldSelectMultiple =\n (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"selectMultiple\"))\n .property(\"max\", codecOptional(codecForNumber()))\n .property(\"min\", codecOptional(codecForNumber()))\n .property(\"unique\", codecOptional(codecForBoolean()))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UiFormFieldSelectMultiple\");\n\nconst codecForUiFormFieldSelectOne = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"selectOne\"))\n .property(\"choices\", codecForList(codecForUiFormSelectUiChoice()))\n .build(\"UIFormFieldSelectOne\");\n\nconst codecForUiFormFieldText = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"text\"))\n .build(\"UIFormFieldText\");\n\nconst codecForUiFormFieldTextArea = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"textArea\"))\n .build(\"UIFormFieldTextArea\");\n\nconst codecForUiFormFieldToggle = (): Codec =>\n codecForUIFormFieldBaseConfigTemplate()\n .property(\"type\", codecForConstString(\"toggle\"))\n .build(\"UIFormFieldToggle\");\n\nconst codecForUiFormField = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"array\", codecForLazy(codecForUiFormFieldArray))\n .alternative(\"group\", codecForLazy(codecForUiFormFieldGroup))\n .alternative(\"absoluteTimeText\", codecForUiFormFieldAbsoluteTime())\n .alternative(\"amount\", codecForUiFormFieldAmount())\n .alternative(\"caption\", codecForUiFormFieldCaption())\n .alternative(\"choiceHorizontal\", codecForUiFormFieldChoiceHorizontal())\n .alternative(\"choiceStacked\", codecForUiFormFieldChoiceStacked())\n .alternative(\"file\", codecForUiFormFieldFile())\n .alternative(\"integer\", codecForUiFormFieldInteger())\n .alternative(\"selectMultiple\", codecForUiFormFieldSelectMultiple())\n .alternative(\"selectOne\", codecForUiFormFieldSelectOne())\n .alternative(\"text\", codecForUiFormFieldText())\n .alternative(\"textArea\", codecForUiFormFieldTextArea())\n .alternative(\"toggle\", codecForUiFormFieldToggle())\n .build(\"UIFormField\");\n\nconst codecForDoubleColumnFormSection = (): Codec =>\n buildCodecForObject()\n .property(\"title\", codecForString())\n .property(\"description\", codecOptional(codecForString()))\n .property(\"fields\", codecForList(codecForUiFormField()))\n .build(\"DoubleColumnFormSection\");\n\nconst codecForDoubleColumnForm = (): Codec =>\n buildCodecForObject()\n .property(\"type\", codecForConstString(\"double-column\"))\n .property(\"design\", codecForList(codecForDoubleColumnFormSection()))\n .build(\"DoubleColumnForm\");\n\nconst codecForFormConfiguration = (): Codec =>\n buildCodecForUnion()\n .discriminateOn(\"type\")\n .alternative(\"double-column\", codecForDoubleColumnForm())\n .build(\"FormConfiguration\");\n\nconst codecForFormMetadata = (): Codec =>\n buildCodecForObject()\n .property(\"label\", codecForString())\n .property(\"id\", codecForString())\n .property(\"version\", codecForNumber())\n .property(\"config\", codecForFormConfiguration())\n .build(\"FormMetadata\");\n\nexport const codecForUIForms = (): Codec =>\n buildCodecForObject()\n .property(\"forms\", codecForList(codecForFormMetadata()))\n .build(\"UiForms\");\n\nexport type FormMetadata = {\n label: string;\n id: string;\n version: number;\n config: FormConfiguration;\n};\n\nexport interface UiForms {\n // Where libeufin backend is localted\n // default: window.origin without \"webui/\"\n forms: Array;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n AbsoluteTime,\n AmountJson,\n Amounts,\n TalerExchangeApi,\n} from \"@gnu-taler/taler-util\";\nimport { format, parse } from \"date-fns\";\nimport { StringConverter } from \"./FormProvider.js\";\n\nexport const amlStateConverter = {\n toStringUI: stringifyAmlState,\n fromStringUI: parseAmlState,\n};\n\nfunction stringifyAmlState(s: TalerExchangeApi.AmlState | undefined): string {\n if (s === undefined) return \"\";\n switch (s) {\n case TalerExchangeApi.AmlState.normal:\n return \"normal\";\n case TalerExchangeApi.AmlState.pending:\n return \"pending\";\n case TalerExchangeApi.AmlState.frozen:\n return \"frozen\";\n }\n}\n\nfunction parseAmlState(s: string | undefined): TalerExchangeApi.AmlState {\n switch (s) {\n case \"normal\":\n return TalerExchangeApi.AmlState.normal;\n case \"pending\":\n return TalerExchangeApi.AmlState.pending;\n case \"frozen\":\n return TalerExchangeApi.AmlState.frozen;\n default:\n throw Error(`unknown AML state: ${s}`);\n }\n}\n\nconst nullConverter: StringConverter = {\n fromStringUI(v: string | undefined): string {\n return v ?? \"\";\n },\n toStringUI(v: unknown): string {\n return v as string;\n },\n};\n\nfunction amountConverter(config: any): StringConverter {\n const currency = config[\"currency\"];\n if (!currency || typeof currency !== \"string\") {\n throw Error(`amount converter needs a currency`);\n }\n return {\n fromStringUI(v: string | undefined): AmountJson {\n // FIXME: requires currency\n return (\n Amounts.parse(`${currency}:${v}`) ?? Amounts.zeroOfCurrency(currency)\n );\n },\n toStringUI(v: unknown): string {\n return v === undefined ? \"\" : Amounts.stringifyValue(v as AmountJson);\n },\n };\n}\n\nfunction absTimeConverter(config: any): StringConverter {\n const pattern = config[\"pattern\"];\n if (!pattern || typeof pattern !== \"string\") {\n throw Error(`absTime converter needs a pattern`);\n }\n return {\n fromStringUI(v: string | undefined): AbsoluteTime {\n if (v === undefined) {\n return AbsoluteTime.never();\n }\n try {\n const time = parse(v, pattern, new Date());\n return AbsoluteTime.fromMilliseconds(time.getTime());\n } catch (e) {\n return AbsoluteTime.never();\n }\n },\n toStringUI(v: unknown): string {\n if (v === undefined) return \"\";\n const d = v as AbsoluteTime;\n if (d.t_ms === \"never\") return \"never\";\n try {\n return format(d.t_ms, pattern);\n } catch (e) {\n return \"\";\n }\n },\n };\n}\n\nexport function getConverterById(\n id: string | undefined,\n config: unknown,\n): StringConverter {\n if (id === \"Taler.AbsoluteTime\") {\n // @ts-expect-error check this\n return absTimeConverter(config);\n }\n if (id === \"Taler.Amount\") {\n // @ts-expect-error check this\n return amountConverter(config);\n }\n if (id === \"TalerExchangeApi.AmlState\") {\n // @ts-expect-error check this\n return amlStateConverter;\n }\n return nullConverter as StringConverter;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\nimport { setupI18n } from \"@gnu-taler/taler-util\";\nimport {\n ComponentChild,\n ComponentChildren,\n Fragment,\n FunctionalComponent,\n FunctionComponent,\n h,\n JSX,\n render,\n VNode,\n} from \"preact\";\nimport { useEffect, useErrorBoundary, useState } from \"preact/hooks\";\nimport { ExampleItemSetup } from \"./tests/hook.js\";\n\nconst Page: FunctionalComponent = ({ children }): VNode => {\n return (\n \n {children}\n
    \n );\n};\n\nconst SideBar: FunctionalComponent<{ width: number }> = ({\n width,\n children,\n}): VNode => {\n return (\n \n {children}\n
    \n );\n};\n\nconst ResizeHandleDiv: FunctionalComponent<\n JSX.HTMLAttributes\n> = ({ children, ...props }): VNode => {\n return (\n \n {children}\n
    \n );\n};\n\nconst Content: FunctionalComponent = ({ children }): VNode => {\n return (\n \n {children}\n
    \n );\n};\n\nfunction findByGroupComponentName(\n allExamples: Group[],\n group: string,\n component: string,\n name: string,\n): ExampleItem | undefined {\n const gl = allExamples.filter((e) => e.title === group);\n if (gl.length === 0) {\n return undefined;\n }\n const cl = gl[0].list.filter((l) => l.name === component);\n if (cl.length === 0) {\n return undefined;\n }\n const el = cl[0].examples.filter((c) => c.name === name);\n if (el.length === 0) {\n return undefined;\n }\n return el[0];\n}\n\nfunction getContentForExample(\n item: ExampleItem | undefined,\n allExamples: Group[],\n): FunctionalComponent {\n if (!item)\n return function SelectExampleMessage() {\n return
    select example from the list on the left
    ;\n };\n const example = findByGroupComponentName(\n allExamples,\n item.group,\n item.component,\n item.name,\n );\n if (!example) {\n return function ExampleNotFoundMessage() {\n return
    example not found
    ;\n };\n }\n return () => example.render.component(example.render.props);\n}\n\nfunction ExampleList({\n name,\n list,\n selected,\n onSelectStory,\n}: {\n name: string;\n list: {\n name: string;\n examples: ExampleItem[];\n }[];\n selected: ExampleItem | undefined;\n onSelectStory: (i: ExampleItem, id: string) => void;\n}): VNode {\n const [isOpen, setOpen] = useState(selected && selected.group === name);\n return (\n
      \n setOpen(!isOpen)}\n >\n {name}\n
    \n
    \n {list.map((k) => (\n
  • \n
    \n
    {k.name}
    \n {k.examples.map((r, i) => {\n const e = encodeURIComponent;\n const eId = `${e(r.group)}-${e(r.component)}-${e(r.name)}`;\n const isSelected =\n selected &&\n selected.component === r.component &&\n selected.group === r.group &&\n selected.name === r.name;\n return (\n \n {\n e.preventDefault();\n location.hash = `#${eId}`;\n onSelectStory(r, eId);\n history.pushState({}, \"\", `#${eId}`);\n }}\n >\n {r.name}\n \n \n );\n })}\n
    \n
  • \n ))}\n
    \n \n );\n}\n\n/**\n * Prevents the UI from redirecting and inform the dev\n * where the should have redirected\n * @returns\n */\nfunction PreventLinkNavigation({\n children,\n}: {\n children: ComponentChildren;\n}): VNode {\n return (\n {\n let t: any = e.target;\n do {\n if (t.localName === \"a\" && t.getAttribute(\"href\")) {\n alert(`should navigate to: ${t.attributes.href.value}`);\n e.stopImmediatePropagation();\n e.stopPropagation();\n e.preventDefault();\n return false;\n }\n } while ((t = t.parentNode));\n return true;\n }}\n >\n {children}\n
    \n );\n}\n\nfunction ErrorReport({\n children,\n selected,\n}: {\n children: ComponentChild;\n selected: ExampleItem | undefined;\n}): VNode {\n const [error, resetError] = useErrorBoundary();\n //if there is an error, reset when unloading this component\n useEffect(() => (error ? resetError : undefined));\n if (error) {\n return (\n
    \n

    Error was thrown trying to render

    \n {selected && (\n
      \n
    • \n group: {selected.group}\n
    • \n
    • \n component: {selected.component}\n
    • \n
    • \n example: {selected.name}\n
    • \n
    • \n args:{\" \"}\n
      {JSON.stringify(selected.render.props, undefined, 2)}
      \n
    • \n
    \n )}\n

    {error.message}

    \n
    {error.stack}
    \n
    \n );\n }\n return {children};\n}\n\nfunction getSelectionFromLocationHash(\n hash: string,\n allExamples: Group[],\n): ExampleItem | undefined {\n if (!hash) return undefined;\n const parts = hash.substring(1).split(\"-\");\n if (parts.length < 3) return undefined;\n return findByGroupComponentName(\n allExamples,\n decodeURIComponent(parts[0]),\n decodeURIComponent(parts[1]),\n decodeURIComponent(parts[2]),\n );\n}\n\nfunction parseExampleImport(\n group: string,\n componentName: string,\n im: MaybeComponent,\n): ComponentItem {\n const examples: ExampleItem[] = Object.entries(im)\n .filter(([k]) => k !== \"default\")\n .map(([exampleName, exampleValue]): ExampleItem => {\n if (!exampleValue) {\n throw Error(\n `example \"${exampleName}\" from component \"${componentName}\" in group \"${group}\" is undefined`,\n );\n }\n\n if (typeof exampleValue === \"function\") {\n return {\n group,\n component: componentName,\n name: exampleName,\n render: {\n component: exampleValue as FunctionComponent,\n props: {},\n contextProps: {},\n },\n };\n }\n const v: any = exampleValue;\n if (\n \"component\" in v &&\n typeof v.component === \"function\" &&\n \"props\" in v\n ) {\n return {\n group,\n component: componentName,\n name: exampleName,\n render: v,\n };\n }\n throw Error(\n `example \"${exampleName}\" from component \"${componentName}\" in group \"${group}\" doesn't follow one of the two ways of example`,\n );\n });\n return {\n name: componentName,\n examples,\n };\n}\n\nexport function parseGroupImport(\n groups: Record,\n): Group[] {\n return Object.entries(groups).map(([groupName, value]) => {\n return {\n title: groupName,\n list: Object.entries(value).flatMap(([key, value]) =>\n folder(groupName, value),\n ),\n };\n });\n}\n\nexport interface Group {\n title: string;\n list: ComponentItem[];\n}\n\nexport interface ComponentItem {\n name: string;\n examples: ExampleItem[];\n}\n\nexport interface ExampleItem {\n group: string;\n component: string;\n name: string;\n render: ExampleItemSetup;\n}\n\ntype ComponentOrFolder = MaybeComponent | MaybeFolder;\ninterface MaybeFolder {\n default?: { title: string };\n // [exampleName: string]: FunctionalComponent;\n}\ninterface MaybeComponent {\n // default?: undefined;\n [exampleName: string]: undefined | object;\n}\n\nfunction folder(groupName: string, value: ComponentOrFolder): ComponentItem[] {\n let title: string | undefined = undefined;\n try {\n title =\n typeof value === \"object\" &&\n typeof value.default === \"object\" &&\n value.default !== undefined &&\n \"title\" in value.default &&\n typeof value.default.title === \"string\"\n ? value.default.title\n : undefined;\n } catch (e) {\n throw Error(\n `Could not defined if it is component or folder ${groupName}: ${JSON.stringify(\n value,\n undefined,\n 2,\n )}`,\n );\n }\n if (title) {\n const c = parseExampleImport(groupName, title, value as MaybeComponent);\n return [c];\n }\n return Object.entries(value).flatMap(([subkey, value]) =>\n folder(groupName, value),\n );\n}\n\ninterface Props {\n getWrapperForGroup: (name: string) => FunctionComponent;\n examplesInGroups: Group[];\n langs: Record;\n}\n\nfunction Application({\n langs,\n examplesInGroups,\n getWrapperForGroup,\n}: Props): VNode {\n const url = new URL(window.location.href);\n const initialSelection = getSelectionFromLocationHash(\n url.hash,\n examplesInGroups,\n );\n\n const currentLang = url.searchParams.get(\"lang\") || \"en\";\n\n if (!langs[\"en\"]) {\n langs[\"en\"] = {};\n }\n setupI18n(currentLang, langs);\n\n const [selected, updateSelected] = useState(\n initialSelection,\n );\n const [sidebarWidth, setSidebarWidth] = useState(200);\n useEffect(() => {\n if (url.hash) {\n const hash = url.hash.substring(1);\n const found = document.getElementById(hash);\n if (found) {\n setTimeout(() => {\n found.scrollIntoView({\n block: \"center\",\n });\n }, 50);\n }\n }\n }, []);\n\n const GroupWrapper = getWrapperForGroup(selected?.group || \"default\");\n const ExampleContent = getContentForExample(selected, examplesInGroups);\n\n //style={{ \"--with-size\": `${sidebarWidth}px` }}\n return (\n \n {/* */}\n \n
    \n Language:\n {\n const url = new URL(window.location.href);\n url.searchParams.set(\"lang\", e.currentTarget.value);\n window.location.href = url.href;\n }}\n >\n {Object.keys(langs).map((l) => (\n \n ))}\n \n
    \n {examplesInGroups.map((group) => (\n {\n document.getElementById(htmlId)?.scrollIntoView({\n block: \"center\",\n });\n updateSelected(item);\n }}\n />\n ))}\n
    \n
    \n {/* {\n setSidebarWidth((s) => s + x);\n }}\n /> */}\n \n \n \n \n \n \n \n \n \n
    \n );\n}\n\nexport interface Options {\n id?: string;\n strings?: any;\n getWrapperForGroup?: (name: string) => FunctionComponent;\n}\n\nexport function renderStories(\n groups: Record,\n options: Options = {},\n): void {\n const examples = parseGroupImport(groups);\n\n try {\n const cid = options.id ?? \"container\";\n const container = document.getElementById(cid);\n if (!container) {\n throw Error(\n `container with id ${cid} not found, can't mount page contents`,\n );\n }\n render(\n Fragment)}\n langs={options.strings ?? { en: {} }}\n />,\n container,\n );\n } catch (e) {\n console.error(\"got error\", e);\n if (e instanceof Error) {\n document.body.innerText = `Fatal error: \"${e.message}\". Please report this bug at https://bugs.gnunet.org/.`;\n }\n }\n}\n\nfunction ResizeHandle({ onUpdate }: { onUpdate: (x: number) => void }): VNode {\n const [start, setStart] = useState(undefined);\n return (\n {\n setStart(e.pageX);\n console.log(\"active\", e.pageX);\n return false;\n }}\n onMouseMove={(e: any) => {\n if (start !== undefined) {\n onUpdate(e.pageX - start);\n }\n return false;\n }}\n onMouseUp={() => {\n setStart(undefined);\n return false;\n }}\n />\n );\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n BrowserHashNavigationProvider,\n Loading,\n TalerWalletIntegrationBrowserProvider,\n TranslationProvider\n} from \"@gnu-taler/web-util/browser\";\nimport { h } from \"preact\";\nimport { useEffect, useState } from \"preact/hooks\";\nimport { SWRConfig } from \"swr\";\nimport { Routing } from \"./Routing.js\";\nimport { SettingsProvider } from \"./context/settings.js\";\nimport { strings } from \"./i18n/strings.js\";\nimport { AppUiSettings, fetchSettings } from \"./settings.js\";\nimport { canonicalizeBaseUrl } from \"./utils.js\";\nconst WITH_LOCAL_STORAGE_CACHE = false;\n\nexport function App() {\n const [settings, setSettings] = useState();\n useEffect(() => {\n fetchSettings(setSettings);\n }, []);\n if (!settings) return ;\n\n // const baseUrl = getInitialBackendBaseURL(settings.backendBaseURL);\n return (\n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\n// // @ts-expect-error creating a new property for window object\n// window.setGlobalLogLevelFromString = setGlobalLogLevelFromString;\n// // @ts-expect-error creating a new property for window object\n// window.getGlobalLevel = getGlobalLogLevel;\n\nfunction localStorageProvider(): Map {\n const map = new Map(JSON.parse(localStorage.getItem(\"app-cache\") || \"[]\"));\n\n window.addEventListener(\"beforeunload\", () => {\n const appCache = JSON.stringify(Array.from(map.entries()));\n localStorage.setItem(\"app-cache\", appCache);\n });\n return map;\n}\n\nfunction getInitialBackendBaseURL(\n backendFromSettings: string | undefined,\n): string {\n const overrideUrl =\n typeof localStorage !== \"undefined\"\n ? localStorage.getItem(\"api-base-url\")\n : undefined;\n let result: string;\n\n if (!overrideUrl) {\n // normal path\n if (!backendFromSettings) {\n console.error(\n \"ERROR: backendBaseURL was overridden by a setting file and missing. Setting value to 'window.origin'\",\n );\n result = window.origin;\n } else {\n result = backendFromSettings;\n }\n } else {\n // testing/development path\n result = overrideUrl;\n }\n try {\n return canonicalizeBaseUrl(result);\n } catch (e) {\n // fall back\n return canonicalizeBaseUrl(window.origin);\n }\n}\n", "import { useRef, useMemo, useCallback, useDebugValue } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';\nimport { OBJECT, SWRConfig as SWRConfig$1, defaultConfig, withArgs, SWRGlobalState, serialize, createCacheHelper, isUndefined, getTimestamp, UNDEFINED, isFunction, internalMutate, useIsomorphicLayoutEffect, subscribeCallback, IS_SERVER, rAF, IS_REACT_LEGACY, mergeObjects, revalidateEvents } from 'swr/_internal';\nexport { mutate, preload, useSWRConfig } from 'swr/_internal';\n\nconst WITH_DEDUPE = {\n dedupe: true\n};\nconst useSWRHandler = (_key, fetcher, config)=>{\n const { cache , compare , suspense , fallbackData , revalidateOnMount , revalidateIfStale , refreshInterval , refreshWhenHidden , refreshWhenOffline , keepPreviousData } = config;\n const [EVENT_REVALIDATORS, MUTATION, FETCH] = SWRGlobalState.get(cache);\n // `key` is the identifier of the SWR `data` state, `keyInfo` holds extra\n // states such as `error` and `isValidating` inside,\n // all of them are derived from `_key`.\n // `fnArg` is the argument/arguments parsed from the key, which will be passed\n // to the fetcher.\n const [key, fnArg] = serialize(_key);\n // If it's the initial render of this hook.\n const initialMountedRef = useRef(false);\n // If the hook is unmounted already. This will be used to prevent some effects\n // to be called after unmounting.\n const unmountedRef = useRef(false);\n // Refs to keep the key and config.\n const keyRef = useRef(key);\n const fetcherRef = useRef(fetcher);\n const configRef = useRef(config);\n const getConfig = ()=>configRef.current;\n const isActive = ()=>getConfig().isVisible() && getConfig().isOnline();\n const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache, key);\n const stateDependencies = useRef({}).current;\n const fallback = isUndefined(fallbackData) ? config.fallback[key] : fallbackData;\n const isEqual = (prev, current)=>{\n let equal = true;\n for(const _ in stateDependencies){\n const t = _;\n if (t === 'data') {\n if (!compare(current[t], prev[t])) {\n if (isUndefined(prev[t])) {\n if (!compare(current[t], returnedData)) {\n equal = false;\n }\n } else {\n equal = false;\n }\n }\n } else {\n if (current[t] !== prev[t]) {\n equal = false;\n }\n }\n }\n return equal;\n };\n const getSnapshot = useMemo(()=>{\n const shouldStartRequest = (()=>{\n if (!key) return false;\n if (!fetcher) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (!isUndefined(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n if (suspense) return false;\n if (!isUndefined(revalidateIfStale)) return revalidateIfStale;\n return true;\n })();\n // Get the cache and merge it with expected states.\n const getSelectedCache = (state)=>{\n // We only select the needed fields from the state.\n const snapshot = mergeObjects(state);\n delete snapshot._k;\n if (!shouldStartRequest) {\n return snapshot;\n }\n return {\n isValidating: true,\n isLoading: true,\n ...snapshot\n };\n };\n // To make sure that we are returning the same object reference to avoid\n // unnecessary re-renders, we keep the previous snapshot and use deep\n // comparison to check if we need to return a new one.\n let memorizedSnapshot = getSelectedCache(getCache());\n const memorizedInitialSnapshot = getSelectedCache(getInitialCache());\n return [\n ()=>{\n const newSnapshot = getSelectedCache(getCache());\n return isEqual(newSnapshot, memorizedSnapshot) ? memorizedSnapshot : memorizedSnapshot = newSnapshot;\n },\n ()=>memorizedInitialSnapshot\n ];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n cache,\n key\n ]);\n // Get the current state that SWR should return.\n const cached = useSyncExternalStore(useCallback((callback)=>subscribeCache(key, (current, prev)=>{\n if (!isEqual(prev, current)) callback();\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n cache,\n key\n ]), getSnapshot[0], getSnapshot[1]);\n const isInitialMount = !initialMountedRef.current;\n const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;\n const cachedData = cached.data;\n const data = isUndefined(cachedData) ? fallback : cachedData;\n const error = cached.error;\n // Use a ref to store previously returned data. Use the initial data as its initial value.\n const laggyDataRef = useRef(data);\n const returnedData = keepPreviousData ? isUndefined(cachedData) ? laggyDataRef.current : cachedData : data;\n // - Suspense mode and there's stale data for the initial render.\n // - Not suspense mode and there is no fallback data and `revalidateIfStale` is enabled.\n // - `revalidateIfStale` is enabled but `data` is not defined.\n const shouldDoInitialRevalidation = (()=>{\n // if a key already has revalidators and also has error, we should not trigger revalidation\n if (hasRevalidator && !isUndefined(error)) return false;\n // If `revalidateOnMount` is set, we take the value directly.\n if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused()) return false;\n // Under suspense mode, it will always fetch on render if there is no\n // stale data so no need to revalidate immediately mount it again.\n // If data exists, only revalidate if `revalidateIfStale` is true.\n if (suspense) return isUndefined(data) ? false : revalidateIfStale;\n // If there is no stale data, we need to revalidate when mount;\n // If `revalidateIfStale` is set to true, we will always revalidate.\n return isUndefined(data) || revalidateIfStale;\n })();\n // Resolve the default validating state:\n // If it's able to validate, and it should revalidate when mount, this will be true.\n const defaultValidatingState = !!(key && fetcher && isInitialMount && shouldDoInitialRevalidation);\n const isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating;\n const isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading;\n // The revalidation function is a carefully crafted wrapper of the original\n // `fetcher`, to correctly handle the many edge cases.\n const revalidate = useCallback(async (revalidateOpts)=>{\n const currentFetcher = fetcherRef.current;\n if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) {\n return false;\n }\n let newData;\n let startAt;\n let loading = true;\n const opts = revalidateOpts || {};\n // If there is no ongoing concurrent request, or `dedupe` is not set, a\n // new request should be initiated.\n const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;\n /*\n For React 17\n Do unmount check for calls:\n If key has changed during the revalidation, or the component has been\n unmounted, old dispatch and old event callbacks should not take any\n effect\n\n For React 18\n only check if key has changed\n https://github.com/reactwg/react-18/discussions/82\n */ const callbackSafeguard = ()=>{\n if (IS_REACT_LEGACY) {\n return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;\n }\n return key === keyRef.current;\n };\n // The final state object when the request finishes.\n const finalState = {\n isValidating: false,\n isLoading: false\n };\n const finishRequestAndUpdateState = ()=>{\n setCache(finalState);\n };\n const cleanupState = ()=>{\n // Check if it's still the same request before deleting it.\n const requestInfo = FETCH[key];\n if (requestInfo && requestInfo[1] === startAt) {\n delete FETCH[key];\n }\n };\n // Start fetching. Change the `isValidating` state, update the cache.\n const initialState = {\n isValidating: true\n };\n // It is in the `isLoading` state, if and only if there is no cached data.\n // This bypasses fallback data and laggy data.\n if (isUndefined(getCache().data)) {\n initialState.isLoading = true;\n }\n try {\n if (shouldStartNewRequest) {\n setCache(initialState);\n // If no cache is being rendered currently (it shows a blank page),\n // we trigger the loading slow event.\n if (config.loadingTimeout && isUndefined(getCache().data)) {\n setTimeout(()=>{\n if (loading && callbackSafeguard()) {\n getConfig().onLoadingSlow(key, config);\n }\n }, config.loadingTimeout);\n }\n // Start the request and save the timestamp.\n // Key must be truthy if entering here.\n FETCH[key] = [\n currentFetcher(fnArg),\n getTimestamp()\n ];\n }\n [newData, startAt] = FETCH[key];\n newData = await newData;\n if (shouldStartNewRequest) {\n // If the request isn't interrupted, clean it up after the\n // deduplication interval.\n setTimeout(cleanupState, config.dedupingInterval);\n }\n // If there're other ongoing request(s), started after the current one,\n // we need to ignore the current one to avoid possible race conditions:\n // req1------------------>res1 (current one)\n // req2---------------->res2\n // the request that fired later will always be kept.\n // The timestamp maybe be `undefined` or a number\n if (!FETCH[key] || FETCH[key][1] !== startAt) {\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Clear error.\n finalState.error = UNDEFINED;\n // If there're other mutations(s), that overlapped with the current revalidation:\n // case 1:\n // req------------------>res\n // mutate------>end\n // case 2:\n // req------------>res\n // mutate------>end\n // case 3:\n // req------------------>res\n // mutate-------...---------->\n // we have to ignore the revalidation result (res) because it's no longer fresh.\n // meanwhile, a new revalidation should be triggered when the mutation ends.\n const mutationInfo = MUTATION[key];\n if (!isUndefined(mutationInfo) && // case 1\n (startAt <= mutationInfo[0] || // case 2\n startAt <= mutationInfo[1] || // case 3\n mutationInfo[1] === 0)) {\n finishRequestAndUpdateState();\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onDiscarded(key);\n }\n }\n return false;\n }\n // Deep compare with the latest state to avoid extra re-renders.\n // For local state, compare and assign.\n const cacheData = getCache().data;\n // Since the compare fn could be custom fn\n // cacheData might be different from newData even when compare fn returns True\n finalState.data = compare(cacheData, newData) ? cacheData : newData;\n // Trigger the successful callback if it's the original request.\n if (shouldStartNewRequest) {\n if (callbackSafeguard()) {\n getConfig().onSuccess(newData, key, config);\n }\n }\n } catch (err) {\n cleanupState();\n const currentConfig = getConfig();\n const { shouldRetryOnError } = currentConfig;\n // Not paused, we continue handling the error. Otherwise, discard it.\n if (!currentConfig.isPaused()) {\n // Get a new error, don't use deep comparison for errors.\n finalState.error = err;\n // Error event and retry logic. Only for the actual request, not\n // deduped ones.\n if (shouldStartNewRequest && callbackSafeguard()) {\n currentConfig.onError(err, key, currentConfig);\n if (shouldRetryOnError === true || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) {\n if (isActive()) {\n // If it's inactive, stop. It will auto-revalidate when\n // refocusing or reconnecting.\n // When retrying, deduplication is always enabled.\n currentConfig.onErrorRetry(err, key, currentConfig, revalidate, {\n retryCount: (opts.retryCount || 0) + 1,\n dedupe: true\n });\n }\n }\n }\n }\n }\n // Mark loading as stopped.\n loading = false;\n // Update the current hook's state.\n finishRequestAndUpdateState();\n return true;\n }, // `setState` is immutable, and `eventsCallback`, `fnArg`, and\n // `keyValidating` are depending on `key`, so we can exclude them from\n // the deps array.\n //\n // FIXME:\n // `fn` and `config` might be changed during the lifecycle,\n // but they might be changed every render like this.\n // `useSWR('key', () => fetch('/api/'), { suspense: true })`\n // So we omit the values from the deps array\n // even though it might cause unexpected behaviors.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n key,\n cache\n ]);\n // Similar to the global mutate but bound to the current cache and key.\n // `cache` isn't allowed to change during the lifecycle.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const boundMutate = useCallback(// Use callback to make sure `keyRef.current` returns latest result every time\n (...args)=>{\n return internalMutate(cache, keyRef.current, ...args);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n // The logic for updating refs.\n useIsomorphicLayoutEffect(()=>{\n fetcherRef.current = fetcher;\n configRef.current = config;\n // Handle laggy data updates. If there's cached data of the current key,\n // it'll be the correct reference.\n if (!isUndefined(cachedData)) {\n laggyDataRef.current = cachedData;\n }\n });\n // After mounted or key changed.\n useIsomorphicLayoutEffect(()=>{\n if (!key) return;\n const softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);\n // Expose revalidators to global event listeners. So we can trigger\n // revalidation from the outside.\n let nextFocusRevalidatedAt = 0;\n const onRevalidate = (type)=>{\n if (type == revalidateEvents.FOCUS_EVENT) {\n const now = Date.now();\n if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {\n nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;\n softRevalidate();\n }\n } else if (type == revalidateEvents.RECONNECT_EVENT) {\n if (getConfig().revalidateOnReconnect && isActive()) {\n softRevalidate();\n }\n } else if (type == revalidateEvents.MUTATE_EVENT) {\n return revalidate();\n }\n return;\n };\n const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);\n // Mark the component as mounted and update corresponding refs.\n unmountedRef.current = false;\n keyRef.current = key;\n initialMountedRef.current = true;\n // Keep the original key in the cache.\n setCache({\n _k: fnArg\n });\n // Trigger a revalidation.\n if (shouldDoInitialRevalidation) {\n if (isUndefined(data) || IS_SERVER) {\n // Revalidate immediately.\n softRevalidate();\n } else {\n // Delay the revalidate if we have data to return so we won't block\n // rendering.\n rAF(softRevalidate);\n }\n }\n return ()=>{\n // Mark it as unmounted.\n unmountedRef.current = true;\n unsubEvents();\n };\n }, [\n key\n ]);\n // Polling\n useIsomorphicLayoutEffect(()=>{\n let timer;\n function next() {\n // Use the passed interval\n // ...or invoke the function with the updated data to get the interval\n const interval = isFunction(refreshInterval) ? refreshInterval(data) : refreshInterval;\n // We only start the next interval if `refreshInterval` is not 0, and:\n // - `force` is true, which is the start of polling\n // - or `timer` is not 0, which means the effect wasn't canceled\n if (interval && timer !== -1) {\n timer = setTimeout(execute, interval);\n }\n }\n function execute() {\n // Check if it's OK to execute:\n // Only revalidate when the page is visible, online, and not errored.\n if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {\n revalidate(WITH_DEDUPE).then(next);\n } else {\n // Schedule the next interval to check again.\n next();\n }\n }\n next();\n return ()=>{\n if (timer) {\n clearTimeout(timer);\n timer = -1;\n }\n };\n }, [\n refreshInterval,\n refreshWhenHidden,\n refreshWhenOffline,\n key\n ]);\n // Display debug info in React DevTools.\n useDebugValue(returnedData);\n // In Suspense mode, we can't return the empty `data` state.\n // If there is an `error`, the `error` needs to be thrown to the error boundary.\n // If there is no `error`, the `revalidation` promise needs to be thrown to\n // the suspense boundary.\n if (suspense && isUndefined(data) && key) {\n // SWR should throw when trying to use Suspense on the server with React 18,\n // without providing any initial data. See:\n // https://github.com/vercel/swr/issues/1832\n if (!IS_REACT_LEGACY && IS_SERVER) {\n throw new Error('Fallback data is required when using suspense in SSR.');\n }\n // Always update fetcher and config refs even with the Suspense mode.\n fetcherRef.current = fetcher;\n configRef.current = config;\n unmountedRef.current = false;\n throw isUndefined(error) ? revalidate(WITH_DEDUPE) : error;\n }\n return {\n mutate: boundMutate,\n get data () {\n stateDependencies.data = true;\n return returnedData;\n },\n get error () {\n stateDependencies.error = true;\n return error;\n },\n get isValidating () {\n stateDependencies.isValidating = true;\n return isValidating;\n },\n get isLoading () {\n stateDependencies.isLoading = true;\n return isLoading;\n }\n };\n};\nconst SWRConfig = OBJECT.defineProperty(SWRConfig$1, 'defaultValue', {\n value: defaultConfig\n});\nconst unstable_serialize = (key)=>serialize(key)[0];\n/**\n * A hook to fetch data.\n *\n * @link https://swr.vercel.app\n * @example\n * ```jsx\n * import useSWR from 'swr'\n * function Profile() {\n * const { data, error } = useSWR('/api/user', fetcher)\n * if (error) return
    failed to load
    \n * if (!data) return
    loading...
    \n * return
    hello {data.name}!
    \n * }\n * ```\n */ var useSWR = withArgs(useSWRHandler);\n\n// useSWR\n\nexport { SWRConfig, useSWR as default, unstable_serialize };\n", "import React, { useEffect, useLayoutEffect, createContext, useContext, useMemo, useState, createElement, useRef, useCallback } from 'react';\n\n// Global state used to deduplicate requests and store listeners\nconst SWRGlobalState = new WeakMap();\n\nconst EMPTY_CACHE = {};\nconst INITIAL_CACHE = {};\nconst noop = ()=>{};\n// Using noop() as the undefined value as undefined can be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nconst UNDEFINED = /*#__NOINLINE__*/ noop();\nconst OBJECT = Object;\nconst isUndefined = (v)=>v === UNDEFINED;\nconst isFunction = (v)=>typeof v == 'function';\nconst mergeObjects = (a, b)=>({\n ...a,\n ...b\n });\nconst STR_UNDEFINED = 'undefined';\n// NOTE: Use the function to guarantee it's re-evaluated between jsdom and node runtime for tests.\nconst isWindowDefined = typeof window != STR_UNDEFINED;\nconst isDocumentDefined = typeof document != STR_UNDEFINED;\nconst hasRequestAnimationFrame = ()=>isWindowDefined && typeof window['requestAnimationFrame'] != STR_UNDEFINED;\nconst createCacheHelper = (cache, key)=>{\n const state = SWRGlobalState.get(cache);\n return [\n // Getter\n ()=>cache.get(key) || EMPTY_CACHE,\n // Setter\n (info)=>{\n if (!isUndefined(key)) {\n const prev = cache.get(key);\n // Before writing to the store, we keep the value in the initial cache\n // if it's not there yet.\n if (!(key in INITIAL_CACHE)) {\n INITIAL_CACHE[key] = prev;\n }\n state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);\n }\n },\n // Subscriber\n state[6],\n // Get server cache snapshot\n ()=>{\n if (!isUndefined(key)) {\n // If the cache was updated on the client, we return the stored initial value.\n if (key in INITIAL_CACHE) return INITIAL_CACHE[key];\n }\n // If we haven't done any client-side updates, we return the current value.\n return cache.get(key) || EMPTY_CACHE;\n }\n ];\n};\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nconst table = new WeakMap();\n// counter of the key\nlet counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsable.\nconst stableHash = (arg)=>{\n const type = typeof arg;\n const constructor = arg && arg.constructor;\n const isDate = constructor == Date;\n let result;\n let index;\n if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result) return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (constructor == Array) {\n // Array.\n result = '@';\n for(index = 0; index < arg.length; index++){\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (constructor == OBJECT) {\n // Object, sort keys.\n result = '#';\n const keys = OBJECT.keys(arg).sort();\n while(!isUndefined(index = keys.pop())){\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n } else {\n result = isDate ? arg.toJSON() : type == 'symbol' ? arg.toString() : type == 'string' ? JSON.stringify(arg) : '' + arg;\n }\n return result;\n};\n\n/**\n * Due to the bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,\n * it's not reliable to detect if the browser is currently online or offline\n * based on `navigator.onLine`.\n * As a workaround, we always assume it's online on the first load, and change\n * the status upon `online` or `offline` events.\n */ let online = true;\nconst isOnline = ()=>online;\n// For node and React Native, `add/removeEventListener` doesn't exist on window.\nconst [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [\n window.addEventListener.bind(window),\n window.removeEventListener.bind(window)\n] : [\n noop,\n noop\n];\nconst isVisible = ()=>{\n const visibilityState = isDocumentDefined && document.visibilityState;\n return isUndefined(visibilityState) || visibilityState !== 'hidden';\n};\nconst initFocus = (callback)=>{\n // focus revalidate\n if (isDocumentDefined) {\n document.addEventListener('visibilitychange', callback);\n }\n onWindowEvent('focus', callback);\n return ()=>{\n if (isDocumentDefined) {\n document.removeEventListener('visibilitychange', callback);\n }\n offWindowEvent('focus', callback);\n };\n};\nconst initReconnect = (callback)=>{\n // revalidate on reconnected\n const onOnline = ()=>{\n online = true;\n callback();\n };\n // nothing to revalidate, just update the status\n const onOffline = ()=>{\n online = false;\n };\n onWindowEvent('online', onOnline);\n onWindowEvent('offline', onOffline);\n return ()=>{\n offWindowEvent('online', onOnline);\n offWindowEvent('offline', onOffline);\n };\n};\nconst preset = {\n isOnline,\n isVisible\n};\nconst defaultConfigOptions = {\n initFocus,\n initReconnect\n};\n\nconst IS_REACT_LEGACY = !React.useId;\nconst IS_SERVER = !isWindowDefined || 'Deno' in window;\n// Polyfill requestAnimationFrame\nconst rAF = (f)=>hasRequestAnimationFrame() ? window['requestAnimationFrame'](f) : setTimeout(f, 1);\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nconst useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;\n// This assignment is to extend the Navigator type to use effectiveType.\nconst navigatorConnection = typeof navigator !== 'undefined' && navigator.connection;\n// Adjust the config based on slow connection status (<= 70Kbps).\nconst slowConnection = !IS_SERVER && navigatorConnection && ([\n 'slow-2g',\n '2g'\n].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);\n\nconst serialize = (key)=>{\n if (isFunction(key)) {\n try {\n key = key();\n } catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n // Use the original key as the argument of fetcher. This can be a string or an\n // array of values.\n const args = key;\n // If key is not falsy, or not an empty array, hash it.\n key = typeof key == 'string' ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : '';\n return [\n key,\n args\n ];\n};\n\n// Global timestamp.\nlet __timestamp = 0;\nconst getTimestamp = ()=>++__timestamp;\n\nconst FOCUS_EVENT = 0;\nconst RECONNECT_EVENT = 1;\nconst MUTATE_EVENT = 2;\n\nvar constants = {\n __proto__: null,\n FOCUS_EVENT: FOCUS_EVENT,\n RECONNECT_EVENT: RECONNECT_EVENT,\n MUTATE_EVENT: MUTATE_EVENT\n};\n\nasync function internalMutate(...args) {\n const [cache, _key, _data, _opts] = args;\n // When passing as a boolean, it's explicitly used to disable/enable\n // revalidation.\n const options = mergeObjects({\n populateCache: true,\n throwOnError: true\n }, typeof _opts === 'boolean' ? {\n revalidate: _opts\n } : _opts || {});\n let populateCache = options.populateCache;\n const rollbackOnErrorOption = options.rollbackOnError;\n let optimisticData = options.optimisticData;\n const revalidate = options.revalidate !== false;\n const rollbackOnError = (error)=>{\n return typeof rollbackOnErrorOption === 'function' ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;\n };\n const throwOnError = options.throwOnError;\n // If the second argument is a key filter, return the mutation results for all\n // filtered keys.\n if (isFunction(_key)) {\n const keyFilter = _key;\n const matchedKeys = [];\n const it = cache.keys();\n for(let keyIt = it.next(); !keyIt.done; keyIt = it.next()){\n const key = keyIt.value;\n if (// Skip the special useSWRInfinite keys.\n !key.startsWith('$inf$') && keyFilter(cache.get(key)._k)) {\n matchedKeys.push(key);\n }\n }\n return Promise.all(matchedKeys.map(mutateByKey));\n }\n return mutateByKey(_key);\n async function mutateByKey(_k) {\n // Serialize key\n const [key] = serialize(_k);\n if (!key) return;\n const [get, set] = createCacheHelper(cache, key);\n const [EVENT_REVALIDATORS, MUTATION, FETCH] = SWRGlobalState.get(cache);\n const revalidators = EVENT_REVALIDATORS[key];\n const startRevalidate = ()=>{\n if (revalidate) {\n // Invalidate the key by deleting the concurrent request markers so new\n // requests will not be deduped.\n delete FETCH[key];\n if (revalidators && revalidators[0]) {\n return revalidators[0](MUTATE_EVENT).then(()=>get().data);\n }\n }\n return get().data;\n };\n // If there is no new data provided, revalidate the key with current state.\n if (args.length < 3) {\n // Revalidate and broadcast state.\n return startRevalidate();\n }\n let data = _data;\n let error;\n // Update global timestamps.\n const beforeMutationTs = getTimestamp();\n MUTATION[key] = [\n beforeMutationTs,\n 0\n ];\n const hasOptimisticData = !isUndefined(optimisticData);\n const state = get();\n // `displayedData` is the current value on screen. It could be the optimistic value\n // that is going to be overridden by a `committedData`, or get reverted back.\n // `committedData` is the validated value that comes from a fetch or mutation.\n const displayedData = state.data;\n const currentData = state._c;\n const committedData = isUndefined(currentData) ? displayedData : currentData;\n // Do optimistic data update.\n if (hasOptimisticData) {\n optimisticData = isFunction(optimisticData) ? optimisticData(committedData) : optimisticData;\n // When we set optimistic data, backup the current committedData data in `_c`.\n set({\n data: optimisticData,\n _c: committedData\n });\n }\n if (isFunction(data)) {\n // `data` is a function, call it passing current cache value.\n try {\n data = data(committedData);\n } catch (err) {\n // If it throws an error synchronously, we shouldn't update the cache.\n error = err;\n }\n }\n // `data` is a promise/thenable, resolve the final data first.\n if (data && isFunction(data.then)) {\n // This means that the mutation is async, we need to check timestamps to\n // avoid race conditions.\n data = await data.catch((err)=>{\n error = err;\n });\n // Check if other mutations have occurred since we've started this mutation.\n // If there's a race we don't update cache or broadcast the change,\n // just return the data.\n if (beforeMutationTs !== MUTATION[key][0]) {\n if (error) throw error;\n return data;\n } else if (error && hasOptimisticData && rollbackOnError(error)) {\n // Rollback. Always populate the cache in this case but without\n // transforming the data.\n populateCache = true;\n data = committedData;\n // Reset data to be the latest committed data, and clear the `_c` value.\n set({\n data,\n _c: UNDEFINED\n });\n }\n }\n // If we should write back the cache after request.\n if (populateCache) {\n if (!error) {\n // Transform the result into data.\n if (isFunction(populateCache)) {\n data = populateCache(data, committedData);\n }\n // Only update cached data if there's no error. Data can be `undefined` here.\n set({\n data,\n _c: UNDEFINED\n });\n }\n }\n // Reset the timestamp to mark the mutation has ended.\n MUTATION[key][1] = getTimestamp();\n // Update existing SWR Hooks' internal states:\n const res = await startRevalidate();\n // The mutation and revalidation are ended, we can clear it since the data is\n // not an optimistic value anymore.\n set({\n _c: UNDEFINED\n });\n // Throw error or return data\n if (error) {\n if (throwOnError) throw error;\n return;\n }\n return populateCache ? res : data;\n }\n}\n\nconst revalidateAllKeys = (revalidators, type)=>{\n for(const key in revalidators){\n if (revalidators[key][0]) revalidators[key][0](type);\n }\n};\nconst initCache = (provider, options)=>{\n // The global state for a specific provider will be used to deduplicate\n // requests and store listeners. As well as a mutate function that is bound to\n // the cache.\n // The provider's global state might be already initialized. Let's try to get the\n // global state associated with the provider first.\n if (!SWRGlobalState.has(provider)) {\n const opts = mergeObjects(defaultConfigOptions, options);\n // If there's no global state bound to the provider, create a new one with the\n // new mutate function.\n const EVENT_REVALIDATORS = {};\n const mutate = internalMutate.bind(UNDEFINED, provider);\n let unmount = noop;\n const subscriptions = {};\n const subscribe = (key, callback)=>{\n const subs = subscriptions[key] || [];\n subscriptions[key] = subs;\n subs.push(callback);\n return ()=>subs.splice(subs.indexOf(callback), 1);\n };\n const setter = (key, value, prev)=>{\n provider.set(key, value);\n const subs = subscriptions[key];\n if (subs) {\n for(let i = subs.length; i--;){\n subs[i](value, prev);\n }\n }\n };\n const initProvider = ()=>{\n if (!SWRGlobalState.has(provider)) {\n // Update the state if it's new, or if the provider has been extended.\n SWRGlobalState.set(provider, [\n EVENT_REVALIDATORS,\n {},\n {},\n {},\n mutate,\n setter,\n subscribe\n ]);\n if (!IS_SERVER) {\n // When listening to the native events for auto revalidations,\n // we intentionally put a delay (setTimeout) here to make sure they are\n // fired after immediate JavaScript executions, which can be\n // React's state updates.\n // This avoids some unnecessary revalidations such as\n // https://github.com/vercel/swr/issues/1680.\n const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));\n const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));\n unmount = ()=>{\n releaseFocus && releaseFocus();\n releaseReconnect && releaseReconnect();\n // When un-mounting, we need to remove the cache provider from the state\n // storage too because it's a side-effect. Otherwise, when re-mounting we\n // will not re-register those event listeners.\n SWRGlobalState.delete(provider);\n };\n }\n }\n };\n initProvider();\n // This is a new provider, we need to initialize it and setup DOM events\n // listeners for `focus` and `reconnect` actions.\n // We might want to inject an extra layer on top of `provider` in the future,\n // such as key serialization, auto GC, etc.\n // For now, it's just a `Map` interface without any modifications.\n return [\n provider,\n mutate,\n initProvider,\n unmount\n ];\n }\n return [\n provider,\n SWRGlobalState.get(provider)[4]\n ];\n};\n\n// error retry\nconst onErrorRetry = (_, __, config, revalidate, opts)=>{\n const maxRetryCount = config.errorRetryCount;\n const currentRetryCount = opts.retryCount;\n // Exponential backoff\n const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;\n if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {\n return;\n }\n setTimeout(revalidate, timeout, opts);\n};\nconst compare = (currentData, newData)=>stableHash(currentData) == stableHash(newData);\n// Default cache provider\nconst [cache, mutate] = initCache(new Map());\n// Default config\nconst defaultConfig = mergeObjects({\n // events\n onLoadingSlow: noop,\n onSuccess: noop,\n onError: noop,\n onErrorRetry,\n onDiscarded: noop,\n // switches\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n revalidateIfStale: true,\n shouldRetryOnError: true,\n // timeouts\n errorRetryInterval: slowConnection ? 10000 : 5000,\n focusThrottleInterval: 5 * 1000,\n dedupingInterval: 2 * 1000,\n loadingTimeout: slowConnection ? 5000 : 3000,\n // providers\n compare,\n isPaused: ()=>false,\n cache,\n mutate,\n fallback: {}\n}, // use web preset by default\npreset);\n\nconst mergeConfigs = (a, b)=>{\n // Need to create a new object to avoid mutating the original here.\n const v = mergeObjects(a, b);\n // If two configs are provided, merge their `use` and `fallback` options.\n if (b) {\n const { use: u1 , fallback: f1 } = a;\n const { use: u2 , fallback: f2 } = b;\n if (u1 && u2) {\n v.use = u1.concat(u2);\n }\n if (f1 && f2) {\n v.fallback = mergeObjects(f1, f2);\n }\n }\n return v;\n};\n\nconst SWRConfigContext = createContext({});\nconst SWRConfig = (props)=>{\n const { value } = props;\n const parentConfig = useContext(SWRConfigContext);\n const isFunctionalConfig = isFunction(value);\n const config = useMemo(()=>isFunctionalConfig ? value(parentConfig) : value, [\n isFunctionalConfig,\n parentConfig,\n value\n ]);\n // Extend parent context values and middleware.\n const extendedConfig = useMemo(()=>isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [\n isFunctionalConfig,\n parentConfig,\n config\n ]);\n // Should not use the inherited provider.\n const provider = config && config.provider;\n // Use a lazy initialized state to create the cache on first access.\n const [cacheContext] = useState(()=>provider ? initCache(provider(extendedConfig.cache || cache), config) : UNDEFINED);\n // Override the cache if a new provider is given.\n if (cacheContext) {\n extendedConfig.cache = cacheContext[0];\n extendedConfig.mutate = cacheContext[1];\n }\n // Unsubscribe events.\n useIsomorphicLayoutEffect(()=>{\n if (cacheContext) {\n cacheContext[2] && cacheContext[2]();\n return cacheContext[3];\n }\n }, []);\n return createElement(SWRConfigContext.Provider, mergeObjects(props, {\n value: extendedConfig\n }));\n};\n\n// @ts-expect-error\nconst enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;\nconst use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];\nconst setupDevTools = ()=>{\n if (enableDevtools) {\n // @ts-expect-error\n window.__SWR_DEVTOOLS_REACT__ = React;\n }\n};\n\nconst normalize = (args)=>{\n return isFunction(args[1]) ? [\n args[0],\n args[1],\n args[2] || {}\n ] : [\n args[0],\n null,\n (args[1] === null ? args[2] : args[1]) || {}\n ];\n};\n\nconst useSWRConfig = ()=>{\n return mergeObjects(defaultConfig, useContext(SWRConfigContext));\n};\n\nconst preload = (key_, fetcher)=>{\n const key = serialize(key_)[0];\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n // Prevent preload to be called multiple times before used.\n if (PRELOAD[key]) return PRELOAD[key];\n const req = fetcher(key_);\n PRELOAD[key] = req;\n return req;\n};\nconst middleware = (useSWRNext)=>(key_, fetcher_, config)=>{\n // fetcher might be a sync function, so this should not be an async function\n const fetcher = fetcher_ && ((...args)=>{\n const key = serialize(key_)[0];\n const [, , , PRELOAD] = SWRGlobalState.get(cache);\n const req = PRELOAD[key];\n if (req) {\n delete PRELOAD[key];\n return req;\n }\n return fetcher_(...args);\n });\n return useSWRNext(key_, fetcher, config);\n };\n\nconst BUILT_IN_MIDDLEWARE = use.concat(middleware);\n\n// It's tricky to pass generic types as parameters, so we just directly override\n// the types here.\nconst withArgs = (hook)=>{\n return function useSWRArgs(...args) {\n // Get the default and inherited configuration.\n const fallbackConfig = useSWRConfig();\n // Normalize arguments.\n const [key, fn, _config] = normalize(args);\n // Merge configurations.\n const config = mergeConfigs(fallbackConfig, _config);\n // Apply middleware\n let next = hook;\n const { use } = config;\n const middleware = (use || []).concat(BUILT_IN_MIDDLEWARE);\n for(let i = middleware.length; i--;){\n next = middleware[i](next);\n }\n return next(key, fn || config.fetcher || null, config);\n };\n};\n\n/**\n * An implementation of state with dependency-tracking.\n */ const useStateWithDeps = (state)=>{\n const rerender = useState({})[1];\n const unmountedRef = useRef(false);\n const stateRef = useRef(state);\n // If a state property (data, error, or isValidating) is accessed by the render\n // function, we mark the property as a dependency so if it is updated again\n // in the future, we trigger a rerender.\n // This is also known as dependency-tracking.\n const stateDependenciesRef = useRef({\n data: false,\n error: false,\n isValidating: false\n });\n /**\n * @param payload To change stateRef, pass the values explicitly to setState:\n * @example\n * ```js\n * setState({\n * isValidating: false\n * data: newData // set data to newData\n * error: undefined // set error to undefined\n * })\n *\n * setState({\n * isValidating: false\n * data: undefined // set data to undefined\n * error: err // set error to err\n * })\n * ```\n */ const setState = useCallback((payload)=>{\n let shouldRerender = false;\n const currentState = stateRef.current;\n for(const _ in payload){\n const k = _;\n // If the property has changed, update the state and mark rerender as\n // needed.\n if (currentState[k] !== payload[k]) {\n currentState[k] = payload[k];\n // If the property is accessed by the component, a rerender should be\n // triggered.\n if (stateDependenciesRef.current[k]) {\n shouldRerender = true;\n }\n }\n }\n if (shouldRerender && !unmountedRef.current) {\n if (IS_REACT_LEGACY) {\n rerender({});\n } else {\n React.startTransition(()=>rerender({}));\n }\n }\n }, // config.suspense isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n useIsomorphicLayoutEffect(()=>{\n unmountedRef.current = false;\n return ()=>{\n unmountedRef.current = true;\n };\n });\n return [\n stateRef,\n stateDependenciesRef.current,\n setState\n ];\n};\n\n// Add a callback function to a list of keyed callback functions and return\n// the unsubscribe function.\nconst subscribeCallback = (key, callbacks, callback)=>{\n const keyedRevalidators = callbacks[key] || (callbacks[key] = []);\n keyedRevalidators.push(callback);\n return ()=>{\n const index = keyedRevalidators.indexOf(callback);\n if (index >= 0) {\n // O(1): faster than splice\n keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];\n keyedRevalidators.pop();\n }\n };\n};\n\n// Create a custom hook with a middleware\nconst withMiddleware = (useSWR, middleware)=>{\n return (...args)=>{\n const [key, fn, config] = normalize(args);\n const uses = (config.use || []).concat(middleware);\n return useSWR(key, fn, {\n ...config,\n use: uses\n });\n };\n};\n\nsetupDevTools();\n\nexport { IS_REACT_LEGACY, IS_SERVER, OBJECT, SWRConfig, SWRGlobalState, UNDEFINED, cache, compare, createCacheHelper, defaultConfig, defaultConfigOptions, getTimestamp, hasRequestAnimationFrame, initCache, internalMutate, isDocumentDefined, isFunction, isUndefined, isWindowDefined, mergeConfigs, mergeObjects, mutate, noop, normalize, preload, preset, rAF, constants as revalidateEvents, serialize, slowConnection, stableHash, subscribeCallback, useIsomorphicLayoutEffect, useSWRConfig, useStateWithDeps, withArgs, withMiddleware };\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport {\n urlPattern,\n useCurrentLocation,\n useNavigationContext,\n useTranslationContext,\n} from \"@gnu-taler/web-util/browser\";\nimport { ComponentChildren, Fragment, VNode, h } from \"preact\";\n\nimport { AccessToken } from \"@gnu-taler/taler-util\";\nimport { useEffect } from \"preact/hooks\";\nimport { Home } from \"./Home.js\";\nimport { assertUnreachable } from \"./utils.js\";\n\nfunction AppFrame({ children }: { children: ComponentChildren }) {\n return (\n
    \n
    \n \n
    \n\n
    {children}
    \n
    \n );\n}\n\nexport function Routing(): VNode {\n return (\n \n {}} />\n \n );\n}\n\nconst publicPages = {\n home: urlPattern(/\\/home/, () => \"#/home\"),\n};\n\nfunction PublicRounting({\n onLoggedUser,\n}: {\n onLoggedUser: (username: string, token: AccessToken) => void;\n}): VNode {\n const { i18n } = useTranslationContext();\n const location = useCurrentLocation(publicPages);\n const { navigateTo } = useNavigationContext();\n\n useEffect(() => {\n if (location === undefined) {\n navigateTo(publicPages.home.url({}));\n }\n }, [location]);\n\n if (location === undefined) {\n return ;\n }\n\n switch (location.name) {\n case undefined:\n case \"home\": {\n return ;\n }\n\n default:\n assertUnreachable(location);\n }\n}\n", "import { VNode, h } from \"preact\";\nimport { Histogram, Normalized } from \"./Histogram.js\";\n\nexport function Home() {\n return (\n
    \n
    \n \n \n
    \n\n
    \n
    \n
    \n

    \n Crecimiento de la deuda\n

    \n

    \n Descripcion del grafico\n

    \n
    \n\n \n
    \n
    \n
    \n
    \n
    \n

    \n Asignacion presupuestaria\n

    \n

    \n Descripcion del grafico\n

    \n
    \n\n \n
    \n
    \n
    \n );\n}\n\nfunction EnConstruccion(): VNode {\n return (\n
    \n
    \n
    \n \n \n \n
    \n
    \n

    \n Sitio en construcci\u00F3n\n

    \n
    \n

    Los datos no son reales.

    \n
    \n
    \n
    \n
    \n );\n}\n\nfunction Deuda(): VNode {\n // poblacion 43.000.000\n return (\n
    \n
    \n
    \n Deuda Nacional\n
    \n
    \n US $ 370.673.000.000,00\n
    \n
    \n
    \n
    \n Deuda por persona\n
    \n
    \n US $ 8.620,30\n
    \n
    \n
    \n
    \n Producto bruto interno\n
    \n
    \n US $ 640.591.000.000,00\n
    \n
    \n
    \n
    \n Produccion por persona\n
    \n
    \n US $ 14.897,46\n
    \n
    \n
    \n );\n}\n", "export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n", "import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can\u2019t do this\n // for a comparator (except for specific, known comparators) because we can\u2019t\n // tell if the comparator is symmetric, and an asymmetric comparator can\u2019t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n", "export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n", "import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n", "export default function count(values, valueof) {\n let count = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count;\n }\n }\n }\n return count;\n}\n", "function length(array) {\n return array.length | 0;\n}\n\nfunction empty(length) {\n return !(length > 0);\n}\n\nfunction arrayify(values) {\n return typeof values !== \"object\" || \"length\" in values ? values : Array.from(values);\n}\n\nfunction reducer(reduce) {\n return values => reduce(...values);\n}\n\nexport default function cross(...values) {\n const reduce = typeof values[values.length - 1] === \"function\" && reducer(values.pop());\n values = values.map(arrayify);\n const lengths = values.map(length);\n const j = values.length - 1;\n const index = new Array(j + 1).fill(0);\n const product = [];\n if (j < 0 || lengths.some(empty)) return product;\n while (true) {\n product.push(index.map((j, i) => values[i][j]));\n let i = j;\n while (++index[i] === lengths[i]) {\n if (i === 0) return reduce ? product.map(reduce) : product;\n index[i--] = 0;\n }\n }\n}\n", "export default function cumsum(values, valueof) {\n var sum = 0, index = 0;\n return Float64Array.from(values, valueof === undefined\n ? v => (sum += +v || 0)\n : v => (sum += +valueof(v, index++, values) || 0));\n}", "export default function variance(values, valueof) {\n let count = 0;\n let delta;\n let mean = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n delta = value - mean;\n mean += delta / ++count;\n sum += delta * (value - mean);\n }\n }\n }\n if (count > 1) return sum / (count - 1);\n}\n", "import variance from \"./variance.js\";\n\nexport default function deviation(values, valueof) {\n const v = variance(values, valueof);\n return v ? Math.sqrt(v) : v;\n}\n", "export default function extent(values, valueof) {\n let min;\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n }\n }\n return [min, max];\n}\n", "// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport class Adder {\n constructor() {\n this._partials = new Float64Array(32);\n this._n = 0;\n }\n add(x) {\n const p = this._partials;\n let i = 0;\n for (let j = 0; j < this._n && j < 32; j++) {\n const y = p[j],\n hi = x + y,\n lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n if (lo) p[i++] = lo;\n x = hi;\n }\n p[i] = x;\n this._n = i + 1;\n return this;\n }\n valueOf() {\n const p = this._partials;\n let n = this._n, x, y, lo, hi = 0;\n if (n > 0) {\n hi = p[--n];\n while (n > 0) {\n x = hi;\n y = p[--n];\n hi = x + y;\n lo = y - (hi - x);\n if (lo) break;\n }\n if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {\n y = lo * 2;\n x = hi + y;\n if (y == x - hi) hi = x;\n }\n }\n return hi;\n }\n}\n\nexport function fsum(values, valueof) {\n const adder = new Adder();\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n adder.add(value);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n adder.add(value);\n }\n }\n }\n return +adder;\n}\n\nexport function fcumsum(values, valueof) {\n const adder = new Adder();\n let index = -1;\n return Float64Array.from(values, valueof === undefined\n ? v => adder.add(+v || 0)\n : v => adder.add(+valueof(v, ++index, values) || 0)\n );\n}\n", "export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n", "export default function identity(x) {\n return x;\n}\n", "import {InternMap} from \"internmap\";\nimport identity from \"./identity.js\";\n\nexport default function group(values, ...keys) {\n return nest(values, identity, identity, keys);\n}\n\nexport function groups(values, ...keys) {\n return nest(values, Array.from, identity, keys);\n}\n\nfunction flatten(groups, keys) {\n for (let i = 1, n = keys.length; i < n; ++i) {\n groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));\n }\n return groups;\n}\n\nexport function flatGroup(values, ...keys) {\n return flatten(groups(values, ...keys), keys);\n}\n\nexport function flatRollup(values, reduce, ...keys) {\n return flatten(rollups(values, reduce, ...keys), keys);\n}\n\nexport function rollup(values, reduce, ...keys) {\n return nest(values, identity, reduce, keys);\n}\n\nexport function rollups(values, reduce, ...keys) {\n return nest(values, Array.from, reduce, keys);\n}\n\nexport function index(values, ...keys) {\n return nest(values, identity, unique, keys);\n}\n\nexport function indexes(values, ...keys) {\n return nest(values, Array.from, unique, keys);\n}\n\nfunction unique(values) {\n if (values.length !== 1) throw new Error(\"duplicate key\");\n return values[0];\n}\n\nfunction nest(values, map, reduce, keys) {\n return (function regroup(values, i) {\n if (i >= keys.length) return reduce(values);\n const groups = new InternMap();\n const keyof = keys[i++];\n let index = -1;\n for (const value of values) {\n const key = keyof(value, ++index, values);\n const group = groups.get(key);\n if (group) group.push(value);\n else groups.set(key, [value]);\n }\n for (const [key, values] of groups) {\n groups.set(key, regroup(values, i));\n }\n return map(groups);\n })(values, 0);\n}\n", "export default function permute(source, keys) {\n return Array.from(keys, key => source[key]);\n}\n", "import ascending from \"./ascending.js\";\nimport permute from \"./permute.js\";\n\nexport default function sort(values, ...F) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n values = Array.from(values);\n let [f] = F;\n if ((f && f.length !== 2) || F.length > 1) {\n const index = Uint32Array.from(values, (d, i) => i);\n if (F.length > 1) {\n F = F.map(f => values.map(f));\n index.sort((i, j) => {\n for (const f of F) {\n const c = ascendingDefined(f[i], f[j]);\n if (c) return c;\n }\n });\n } else {\n f = values.map(f);\n index.sort((i, j) => ascendingDefined(f[i], f[j]));\n }\n return permute(values, index);\n }\n return values.sort(compareDefined(f));\n}\n\nexport function compareDefined(compare = ascending) {\n if (compare === ascending) return ascendingDefined;\n if (typeof compare !== \"function\") throw new TypeError(\"compare is not a function\");\n return (a, b) => {\n const x = compare(a, b);\n if (x || x === 0) return x;\n return (compare(b, b) === 0) - (compare(a, a) === 0);\n };\n}\n\nexport function ascendingDefined(a, b) {\n return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);\n}\n", "import ascending from \"./ascending.js\";\nimport group, {rollup} from \"./group.js\";\nimport sort from \"./sort.js\";\n\nexport default function groupSort(values, reduce, key) {\n return (reduce.length !== 2\n ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)))\n : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))))\n .map(([key]) => key);\n}\n", "const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n", "import count from \"../count.js\";\n\nexport default function thresholdSturges(values) {\n return Math.max(1, Math.ceil(Math.log(count(values)) / Math.LN2) + 1);\n}\n", "export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n", "export default function maxIndex(values, valueof) {\n let max;\n let maxIndex = -1;\n let index = -1;\n if (valueof === undefined) {\n for (const value of values) {\n ++index;\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value, maxIndex = index;\n }\n }\n } else {\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value, maxIndex = index;\n }\n }\n }\n return maxIndex;\n}\n", "export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n", "export default function minIndex(values, valueof) {\n let min;\n let minIndex = -1;\n let index = -1;\n if (valueof === undefined) {\n for (const value of values) {\n ++index;\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value, minIndex = index;\n }\n }\n } else {\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value, minIndex = index;\n }\n }\n }\n return minIndex;\n}\n", "import {ascendingDefined, compareDefined} from \"./sort.js\";\n\n// Based on https://github.com/mourner/quickselect\n// ISC license, Copyright 2018 Vladimir Agafonkin.\nexport default function quickselect(array, k, left = 0, right = Infinity, compare) {\n k = Math.floor(k);\n left = Math.floor(Math.max(0, left));\n right = Math.floor(Math.min(array.length - 1, right));\n\n if (!(left <= k && k <= right)) return array;\n\n compare = compare === undefined ? ascendingDefined : compareDefined(compare);\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(array, k, newLeft, newRight, compare);\n }\n\n const t = array[k];\n let i = left;\n let j = right;\n\n swap(array, left, k);\n if (compare(array[right], t) > 0) swap(array, left, right);\n\n while (i < j) {\n swap(array, i, j), ++i, --j;\n while (compare(array[i], t) < 0) ++i;\n while (compare(array[j], t) > 0) --j;\n }\n\n if (compare(array[left], t) === 0) swap(array, left, j);\n else ++j, swap(array, j, right);\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n\n return array;\n}\n\nfunction swap(array, i, j) {\n const t = array[i];\n array[i] = array[j];\n array[j] = t;\n}\n", "import ascending from \"./ascending.js\";\n\nexport default function greatest(values, compare = ascending) {\n let max;\n let defined = false;\n if (compare.length === 1) {\n let maxValue;\n for (const element of values) {\n const value = compare(element);\n if (defined\n ? ascending(value, maxValue) > 0\n : ascending(value, value) === 0) {\n max = element;\n maxValue = value;\n defined = true;\n }\n }\n } else {\n for (const value of values) {\n if (defined\n ? compare(value, max) > 0\n : compare(value, value) === 0) {\n max = value;\n defined = true;\n }\n }\n }\n return max;\n}\n", "import max from \"./max.js\";\nimport maxIndex from \"./maxIndex.js\";\nimport min from \"./min.js\";\nimport minIndex from \"./minIndex.js\";\nimport quickselect from \"./quickselect.js\";\nimport number, {numbers} from \"./number.js\";\nimport {ascendingDefined} from \"./sort.js\";\nimport greatest from \"./greatest.js\";\n\nexport default function quantile(values, p, valueof) {\n values = Float64Array.from(numbers(values, valueof));\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return min(values);\n if (p >= 1) return max(values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),\n value1 = min(values.subarray(i0 + 1));\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileSorted(values, p, valueof = number) {\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileIndex(values, p, valueof = number) {\n if (isNaN(p = +p)) return;\n numbers = Float64Array.from(values, (_, i) => number(valueof(values[i], i, values)));\n if (p <= 0) return minIndex(numbers);\n if (p >= 1) return maxIndex(numbers);\n var numbers,\n index = Uint32Array.from(values, (_, i) => i),\n j = numbers.length - 1,\n i = Math.floor(j * p);\n quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));\n i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);\n return i >= 0 ? i : -1;\n}\n", "import count from \"../count.js\";\nimport quantile from \"../quantile.js\";\n\nexport default function thresholdFreedmanDiaconis(values, min, max) {\n const c = count(values), d = quantile(values, 0.75) - quantile(values, 0.25);\n return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1;\n}\n", "import count from \"../count.js\";\nimport deviation from \"../deviation.js\";\n\nexport default function thresholdScott(values, min, max) {\n const c = count(values), d = deviation(values);\n return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1;\n}\n", "export default function mean(values, valueof) {\n let count = 0;\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n }\n }\n if (count) return sum / count;\n}\n", "import quantile, {quantileIndex} from \"./quantile.js\";\n\nexport default function median(values, valueof) {\n return quantile(values, 0.5, valueof);\n}\n\nexport function medianIndex(values, valueof) {\n return quantileIndex(values, 0.5, valueof);\n}\n", "function* flatten(arrays) {\n for (const array of arrays) {\n yield* array;\n }\n}\n\nexport default function merge(arrays) {\n return Array.from(flatten(arrays));\n}\n", "import {InternMap} from \"internmap\";\n\nexport default function mode(values, valueof) {\n const counts = new InternMap();\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && value >= value) {\n counts.set(value, (counts.get(value) || 0) + 1);\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && value >= value) {\n counts.set(value, (counts.get(value) || 0) + 1);\n }\n }\n }\n let modeValue;\n let modeCount = 0;\n for (const [value, count] of counts) {\n if (count > modeCount) {\n modeCount = count;\n modeValue = value;\n }\n }\n return modeValue;\n}\n", "export default function pairs(values, pairof = pair) {\n const pairs = [];\n let previous;\n let first = false;\n for (const value of values) {\n if (first) pairs.push(pairof(previous, value));\n previous = value;\n first = true;\n }\n return pairs;\n}\n\nexport function pair(a, b) {\n return [a, b];\n}\n", "export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n", "export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n", "export default function reverse(values) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n return Array.from(values).reverse();\n}\n", "export default function(x) {\n return x;\n}\n", "import identity from \"./identity.js\";\n\nvar top = 1,\n right = 2,\n bottom = 3,\n left = 4,\n epsilon = 1e-6;\n\nfunction translateX(x) {\n return \"translate(\" + x + \",0)\";\n}\n\nfunction translateY(y) {\n return \"translate(0,\" + y + \")\";\n}\n\nfunction number(scale) {\n return d => +scale(d);\n}\n\nfunction center(scale, offset) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n if (scale.round()) offset = Math.round(offset);\n return d => +scale(d) + offset;\n}\n\nfunction entering() {\n return !this.__axis;\n}\n\nfunction axis(orient, scale) {\n var tickArguments = [],\n tickValues = null,\n tickFormat = null,\n tickSizeInner = 6,\n tickSizeOuter = 6,\n tickPadding = 3,\n offset = typeof window !== \"undefined\" && window.devicePixelRatio > 1 ? 0 : 0.5,\n k = orient === top || orient === left ? -1 : 1,\n x = orient === left || orient === right ? \"x\" : \"y\",\n transform = orient === top || orient === bottom ? translateX : translateY;\n\n function axis(context) {\n var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,\n format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity) : tickFormat,\n spacing = Math.max(tickSizeInner, 0) + tickPadding,\n range = scale.range(),\n range0 = +range[0] + offset,\n range1 = +range[range.length - 1] + offset,\n position = (scale.bandwidth ? center : number)(scale.copy(), offset),\n selection = context.selection ? context.selection() : context,\n path = selection.selectAll(\".domain\").data([null]),\n tick = selection.selectAll(\".tick\").data(values, scale).order(),\n tickExit = tick.exit(),\n tickEnter = tick.enter().append(\"g\").attr(\"class\", \"tick\"),\n line = tick.select(\"line\"),\n text = tick.select(\"text\");\n\n path = path.merge(path.enter().insert(\"path\", \".tick\")\n .attr(\"class\", \"domain\")\n .attr(\"stroke\", \"currentColor\"));\n\n tick = tick.merge(tickEnter);\n\n line = line.merge(tickEnter.append(\"line\")\n .attr(\"stroke\", \"currentColor\")\n .attr(x + \"2\", k * tickSizeInner));\n\n text = text.merge(tickEnter.append(\"text\")\n .attr(\"fill\", \"currentColor\")\n .attr(x, k * spacing)\n .attr(\"dy\", orient === top ? \"0em\" : orient === bottom ? \"0.71em\" : \"0.32em\"));\n\n if (context !== selection) {\n path = path.transition(context);\n tick = tick.transition(context);\n line = line.transition(context);\n text = text.transition(context);\n\n tickExit = tickExit.transition(context)\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute(\"transform\"); });\n\n tickEnter\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });\n }\n\n tickExit.remove();\n\n path\n .attr(\"d\", orient === left || orient === right\n ? (tickSizeOuter ? \"M\" + k * tickSizeOuter + \",\" + range0 + \"H\" + offset + \"V\" + range1 + \"H\" + k * tickSizeOuter : \"M\" + offset + \",\" + range0 + \"V\" + range1)\n : (tickSizeOuter ? \"M\" + range0 + \",\" + k * tickSizeOuter + \"V\" + offset + \"H\" + range1 + \"V\" + k * tickSizeOuter : \"M\" + range0 + \",\" + offset + \"H\" + range1));\n\n tick\n .attr(\"opacity\", 1)\n .attr(\"transform\", function(d) { return transform(position(d) + offset); });\n\n line\n .attr(x + \"2\", k * tickSizeInner);\n\n text\n .attr(x, k * spacing)\n .text(format);\n\n selection.filter(entering)\n .attr(\"fill\", \"none\")\n .attr(\"font-size\", 10)\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"text-anchor\", orient === right ? \"start\" : orient === left ? \"end\" : \"middle\");\n\n selection\n .each(function() { this.__axis = position; });\n }\n\n axis.scale = function(_) {\n return arguments.length ? (scale = _, axis) : scale;\n };\n\n axis.ticks = function() {\n return tickArguments = Array.from(arguments), axis;\n };\n\n axis.tickArguments = function(_) {\n return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();\n };\n\n axis.tickValues = function(_) {\n return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();\n };\n\n axis.tickFormat = function(_) {\n return arguments.length ? (tickFormat = _, axis) : tickFormat;\n };\n\n axis.tickSize = function(_) {\n return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeInner = function(_) {\n return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeOuter = function(_) {\n return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;\n };\n\n axis.tickPadding = function(_) {\n return arguments.length ? (tickPadding = +_, axis) : tickPadding;\n };\n\n axis.offset = function(_) {\n return arguments.length ? (offset = +_, axis) : offset;\n };\n\n return axis;\n}\n\nexport function axisTop(scale) {\n return axis(top, scale);\n}\n\nexport function axisRight(scale) {\n return axis(right, scale);\n}\n\nexport function axisBottom(scale) {\n return axis(bottom, scale);\n}\n\nexport function axisLeft(scale) {\n return axis(left, scale);\n}\n", "var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n", "export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n", "import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n", "import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n", "function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don\u2019t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n", "function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n", "export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n", "import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "export default function(update) {\n return new Array(update.length);\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n", "export default function(x) {\n return function() {\n return x;\n };\n}\n", "import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don\u2019t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn\u2019t worried about \u201Clive\u201D collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don\u2019t; we\u2019d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n", "export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n", "export default function() {\n return Array.from(this);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n", "export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n", "export default function() {\n return !this.node();\n}\n", "export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n", "import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n", "export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n", "import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n", "function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n", "function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n", "function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n", "function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n", "function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n", "function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n", "import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n", "import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n", "function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n", "function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n", "export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n", "function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n", "import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n", "export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n", "import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n", "import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n", "export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n", "import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n", "export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n", "import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n", "export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n", "import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n", "import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n", "export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "export default x => () => x;\n", "import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n", "import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n", "export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n", "import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n", "export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n", "import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n", "import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n", "import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n", "var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n", "import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n", "import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n", "import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n", "import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n", "import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n", "import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n", "import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n", "export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n", "var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we\u2019ve set an alarm, if we haven\u2019t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n", "import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n", "import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n", "import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n", "import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n", "import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n", "import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n", "import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n", "import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n", "import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n", "import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n", "import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n", "import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n", "function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n", "import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n", "import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n", "import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n", "function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n", "import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n", "function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n", "import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n", "import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n", "import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n", "export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n", "import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n", "import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name \u201C__brush\u201D rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n", "const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We\u2019re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n", "var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"] || \\\"\\\"\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nfunction pad(value, width) {\n var s = value + \"\", length = s.length;\n return length < width ? new Array(width - length + 1).join(0) + s : s;\n}\n\nfunction formatYear(year) {\n return year < 0 ? \"-\" + pad(-year, 6)\n : year > 9999 ? \"+\" + pad(year, 6)\n : pad(year, 4);\n}\n\nfunction formatDate(date) {\n var hours = date.getUTCHours(),\n minutes = date.getUTCMinutes(),\n seconds = date.getUTCSeconds(),\n milliseconds = date.getUTCMilliseconds();\n return isNaN(date) ? \"Invalid Date\"\n : formatYear(date.getUTCFullYear(), 4) + \"-\" + pad(date.getUTCMonth() + 1, 2) + \"-\" + pad(date.getUTCDate(), 2)\n + (milliseconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \".\" + pad(milliseconds, 3) + \"Z\"\n : seconds ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \":\" + pad(seconds, 2) + \"Z\"\n : minutes || hours ? \"T\" + pad(hours, 2) + \":\" + pad(minutes, 2) + \"Z\"\n : \"\");\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function preformatBody(rows, columns) {\n return rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n });\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(\"\\n\");\n }\n\n function formatBody(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return preformatBody(rows, columns).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(value) {\n return value == null ? \"\"\n : value instanceof Date ? formatDate(value)\n : reFormat.test(value += \"\") ? \"\\\"\" + value.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : value;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatBody: formatBody,\n formatRows: formatRows,\n formatRow: formatRow,\n formatValue: formatValue\n };\n}\n", "import dsv from \"./dsv.js\";\n\nvar csv = dsv(\",\");\n\nexport var csvParse = csv.parse;\nexport var csvParseRows = csv.parseRows;\nexport var csvFormat = csv.format;\nexport var csvFormatBody = csv.formatBody;\nexport var csvFormatRows = csv.formatRows;\nexport var csvFormatRow = csv.formatRow;\nexport var csvFormatValue = csv.formatValue;\n", "import dsv from \"./dsv.js\";\n\nvar tsv = dsv(\"\\t\");\n\nexport var tsvParse = tsv.parse;\nexport var tsvParseRows = tsv.parseRows;\nexport var tsvFormat = tsv.format;\nexport var tsvFormatBody = tsv.formatBody;\nexport var tsvFormatRows = tsv.formatRows;\nexport var tsvFormatRow = tsv.formatRow;\nexport var tsvFormatValue = tsv.formatValue;\n", "export default function autoType(object) {\n for (var key in object) {\n var value = object[key].trim(), number, m;\n if (!value) value = null;\n else if (value === \"true\") value = true;\n else if (value === \"false\") value = false;\n else if (value === \"NaN\") value = NaN;\n else if (!isNaN(number = +value)) value = number;\n else if (m = value.match(/^([-+]\\d{2})?\\d{4}(-\\d{2}(-\\d{2})?)?(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{3})?)?(Z|[-+]\\d{2}:\\d{2})?)?$/)) {\n if (fixtz && !!m[4] && !m[7]) value = value.replace(/-/g, \"/\").replace(/T/, \" \");\n value = new Date(value);\n }\n else continue;\n object[key] = value;\n }\n return object;\n}\n\n// https://github.com/d3/d3-dsv/issues/45\nconst fixtz = new Date(\"2019-01-01T00:00\").getHours() || new Date(\"2019-07-01T00:00\").getHours();", "function responseText(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.text();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseText);\n}\n", "import {csvParse, dsvFormat, tsvParse} from \"d3-dsv\";\nimport text from \"./text.js\";\n\nfunction dsvParse(parse) {\n return function(input, init, row) {\n if (arguments.length === 2 && typeof init === \"function\") row = init, init = undefined;\n return text(input, init).then(function(response) {\n return parse(response, row);\n });\n };\n}\n\nexport default function dsv(delimiter, input, init, row) {\n if (arguments.length === 3 && typeof init === \"function\") row = init, init = undefined;\n var format = dsvFormat(delimiter);\n return text(input, init).then(function(response) {\n return format.parse(response, row);\n });\n}\n\nexport var csv = dsvParse(csvParse);\nexport var tsv = dsvParse(tsvParse);\n", "export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, \u00B1Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n", "export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n", "export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n", "// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n", "// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n", "import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n", "export default function(x) {\n return x;\n}\n", "import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"\u00B5\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"\u2212\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer \u201Cvalue\u201D part that can be\n // grouped, and fractional or exponential \u201Csuffix\u201D part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n", "export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\n\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function haversin(x) {\n return (x = sin(x / 2)) * x;\n}\n", "export default function noop() {}\n", "function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function(object, stream) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) streamGeometry(features[i].geometry, stream);\n }\n};\n\nvar streamGeometryType = {\n Sphere: function(object, stream) {\n stream.sphere();\n },\n Point: function(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n },\n LineString: function(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamLine(coordinates[i], stream, 0);\n },\n Polygon: function(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function(object, stream) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) streamPolygon(coordinates[i], stream);\n },\n GeometryCollection: function(object, stream) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) streamGeometry(geometries[i], stream);\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n stream.lineStart();\n while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1, n = coordinates.length;\n stream.polygonStart();\n while (++i < n) streamLine(coordinates[i], stream, 1);\n stream.polygonEnd();\n}\n\nexport default function(object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n}\n", "import {asin, atan2, cos, sin, sqrt} from \"./math.js\";\n\nexport function spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\n\nexport function cartesian(spherical) {\n var lambda = spherical[0], phi = spherical[1], cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n}\n\nexport function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nexport function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n}\n\n// TODO return a\nexport function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\n\nexport function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n}\n\n// TODO return d\nexport function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}\n", "export default function(a, b) {\n\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n\n return compose;\n}\n", "import compose from \"./compose.js\";\nimport {abs, asin, atan2, cos, degrees, pi, radians, sin, tau} from \"./math.js\";\n\nfunction rotationIdentity(lambda, phi) {\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\n\nexport function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))\n : rotationLambda(deltaLambda))\n : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)\n : rotationIdentity);\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function(lambda, phi) {\n lambda += deltaLambda;\n if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;\n return [lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi),\n sinDeltaPhi = sin(deltaPhi),\n cosDeltaGamma = cos(deltaGamma),\n sinDeltaGamma = sin(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [\n atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n asin(k * cosDeltaGamma + y * sinDeltaGamma)\n ];\n }\n\n rotation.invert = function(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [\n atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n asin(k * cosDeltaPhi - x * sinDeltaPhi)\n ];\n };\n\n return rotation;\n}\n\nexport default function(rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n }\n\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n };\n\n return forward;\n}\n", "import {cartesian, cartesianNormalizeInPlace, spherical} from \"./cartesian.js\";\nimport constant from \"./constant.js\";\nimport {acos, cos, degrees, epsilon, radians, sin, tau} from \"./math.js\";\nimport {rotateRadians} from \"./rotation.js\";\n\n// Generates a circle centered at [0\u00B0, 0\u00B0], with a given radius and precision.\nexport function circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos(radius),\n sinRadius = sin(radius),\n step = direction * delta;\n if (t0 == null) {\n t0 = radius + direction * tau;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;\n }\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n}\n\n// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n}\n\nexport default function() {\n var center = constant([0, 0]),\n radius = constant(90),\n precision = constant(2),\n ring,\n rotate,\n stream = {point: point};\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees, x[1] *= degrees;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {type: \"Polygon\", coordinates: [ring]};\n ring = rotate = null;\n return c;\n }\n\n circle.center = function(_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function(_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle) : radius;\n };\n\n circle.precision = function(_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle) : precision;\n };\n\n return circle;\n}\n", "import noop from \"../noop.js\";\n\nexport default function() {\n var lines = [],\n line;\n return {\n point: function(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n}\n", "import {abs, epsilon} from \"./math.js\";\n\nexport default function(a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}\n", "import pointEqual from \"../pointEqual.js\";\nimport {epsilon} from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n this.e = entry; // is an entry?\n this.v = false; // visited\n this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nexport default function(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}\n\nfunction link(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n}\n", "import {Adder} from \"d3-array\";\nimport {cartesian, cartesianCross, cartesianNormalizeInPlace} from \"./cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, epsilon2, halfPi, pi, quarterPi, sign, sin, tau} from \"./math.js\";\n\nfunction longitude(point) {\n return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n}\n\nexport default function(polygon, point) {\n var lambda = longitude(point),\n phi = point[1],\n sinPhi = sin(phi),\n normal = [sin(lambda), -cos(lambda), 0],\n angle = 0,\n winding = 0;\n\n var sum = new Adder();\n\n if (sinPhi === 1) phi = halfPi + epsilon;\n else if (sinPhi === -1) phi = -halfPi - epsilon;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = longitude(point0),\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin(phi0),\n cosPhi0 = cos(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = longitude(point1),\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin(phi1),\n cosPhi1 = cos(phi1),\n delta = lambda1 - lambda0,\n sign = delta >= 0 ? 1 : -1,\n absDelta = sign * delta,\n antimeridian = absDelta > pi,\n k = sinPhi0 * sinPhi1;\n\n sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));\n angle += antimeridian ? delta + sign * tau : delta;\n\n // Are the longitudes either side of the point\u2019s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n }\n\n // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n return (angle < -epsilon || angle < epsilon && sum < -epsilon2) ^ (winding & 1);\n}\n", "import clipBuffer from \"./buffer.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {epsilon, halfPi} from \"../math.js\";\nimport polygonContains from \"../polygonContains.js\";\nimport {merge} from \"d3-array\";\n\nexport default function(pointVisible, clipLine, interpolate, start) {\n return function(sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i, n = ringSegments.length, m,\n segment,\n point;\n\n ring.pop();\n polygon.push(ring);\n ring = null;\n\n if (!n) return;\n\n // No intersections.\n if (clean & 1) {\n segment = ringSegments[0];\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);\n sink.lineEnd();\n }\n return;\n }\n\n // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n}\n\nfunction validSegment(segment) {\n return segment.length > 1;\n}\n\n// Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1])\n - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n}\n", "import clip from \"./index.js\";\nimport {abs, atan, cos, epsilon, halfPi, pi, sin} from \"../math.js\";\n\nexport default clip(\n function() { return true; },\n clipAntimeridianLine,\n clipAntimeridianInterpolate,\n [-pi, -halfPi]\n);\n\n// Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n clean; // no intersections\n\n return {\n lineStart: function() {\n stream.lineStart();\n clean = 1;\n },\n point: function(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi : -pi,\n delta = abs(lambda1 - lambda0);\n if (abs(delta - pi) < epsilon) { // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies\n if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n clean = 0;\n }\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function() {\n return 2 - clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon\n ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1)\n - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0))\n / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))\n : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}\n", "import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from \"../cartesian.js\";\nimport {circleStream} from \"../circle.js\";\nimport {abs, cos, epsilon, pi, radians, sqrt} from \"../math.js\";\nimport pointEqual from \"../pointEqual.js\";\nimport clip from \"./index.js\";\n\nexport default function(radius) {\n var cr = cos(radius),\n delta = 2 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n }\n\n // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n clean; // no intersections\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius\n ? v ? 0 : code(lambda, phi)\n : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))\n point1[2] = 1;\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function() {\n return clean | ((v00 && v0) << 1);\n }\n };\n }\n\n // Intersects the great circle between a and b with the clip circle.\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b);\n\n // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 \u2A2F n2).\n var n1 = [1, 0, 0], // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0], // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2;\n\n // Two polar points.\n if (!determinant) return !two && a;\n\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B);\n\n // Solve |p(t)|^2 = 1.\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n\n if (t2 < 0) return;\n\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n\n if (!two) return q;\n\n // Two intersection points.\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi) < epsilon,\n meridian = polar || delta < epsilon;\n\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;\n\n // Check that the first point is between a and b.\n if (meridian\n ? polar\n ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1)\n : phi0 <= q[1] && q[1] <= phi1\n : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n }\n\n // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n}\n", "export default function(a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n}\n", "import {abs, epsilon} from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {merge} from \"d3-array\";\n\nvar clipMax = 1e9, clipMin = -clipMax;\n\n// TODO Use d3-polygon\u2019s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0, a1 = 0;\n if (from == null\n || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n || comparePoint(from, to) < 0 ^ direction > 0) {\n do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3\n : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1\n : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0\n : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb\n : ca === 0 ? b[1] - a[1]\n : ca === 1 ? a[0] - b[0]\n : ca === 2 ? a[1] - b[1]\n : b[0] - a[0];\n }\n\n return function(stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__, y__, v__, // first point\n x_, y_, v_, // previous point\n first,\n clean;\n\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n }\n }\n\n return winding;\n }\n\n // Buffer geometry within a polygon and then clip it en masse.\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n if (cleanInside || visible) {\n stream.polygonStart();\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n stream.polygonEnd();\n }\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n\n // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);\n else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}\n", "export default x => x;\n", "import {Adder} from \"d3-array\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = new Adder(),\n areaRingSum = new Adder(),\n x00,\n y00,\n x0,\n y0;\n\nvar areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function() {\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function() {\n areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n areaSum.add(abs(areaRingSum));\n areaRingSum = new Adder();\n },\n result: function() {\n var area = areaSum / 2;\n areaSum = new Adder();\n return area;\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n areaStream.point = areaPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n areaRingSum.add(y0 * x - x0 * y);\n x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n areaPoint(x00, y00);\n}\n\nexport default areaStream;\n", "import noop from \"../noop.js\";\n\nvar x0 = Infinity,\n y0 = x0,\n x1 = -x0,\n y1 = x1;\n\nvar boundsStream = {\n point: boundsPoint,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function() {\n var bounds = [[x0, y0], [x1, y1]];\n x1 = y1 = -(y0 = x0 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint(x, y) {\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n}\n\nexport default boundsStream;\n", "import {sqrt} from \"../math.js\";\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n Y0 = 0,\n Z0 = 0,\n X1 = 0,\n Y1 = 0,\n Z1 = 0,\n X2 = 0,\n Y2 = 0,\n Z2 = 0,\n x00,\n y00,\n x0,\n y0;\n\nvar centroidStream = {\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function() {\n centroidStream.point = centroidPoint;\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n },\n result: function() {\n var centroid = Z2 ? [X2 / Z2, Y2 / Z2]\n : Z1 ? [X1 / Z1, Y1 / Z1]\n : Z0 ? [X0 / Z0, Y0 / Z0]\n : [NaN, NaN];\n X0 = Y0 = Z0 =\n X1 = Y1 = Z1 =\n X2 = Y2 = Z2 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint(x, y) {\n X0 += x;\n Y0 += y;\n ++Z0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream.point = centroidPointLine;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream.point = centroidPointRing;\n centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n\n z = y0 * x - x0 * y;\n X2 += z * (x0 + x);\n Y2 += z * (y0 + y);\n Z2 += z * 3;\n centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;\n", "import {tau} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nexport default function PathContext(context) {\n this._context = context;\n}\n\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function(_) {\n return this._radius = _, this;\n },\n polygonStart: function() {\n this._line = 0;\n },\n polygonEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function(x, y) {\n switch (this._point) {\n case 0: {\n this._context.moveTo(x, y);\n this._point = 1;\n break;\n }\n case 1: {\n this._context.lineTo(x, y);\n break;\n }\n default: {\n this._context.moveTo(x + this._radius, y);\n this._context.arc(x, y, this._radius, 0, tau);\n break;\n }\n }\n },\n result: noop\n};\n", "import {Adder} from \"d3-array\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = new Adder(),\n lengthRing,\n x00,\n y00,\n x0,\n y0;\n\nvar lengthStream = {\n point: noop,\n lineStart: function() {\n lengthStream.point = lengthPointFirst;\n },\n lineEnd: function() {\n if (lengthRing) lengthPoint(x00, y00);\n lengthStream.point = noop;\n },\n polygonStart: function() {\n lengthRing = true;\n },\n polygonEnd: function() {\n lengthRing = null;\n },\n result: function() {\n var length = +lengthSum;\n lengthSum = new Adder();\n return length;\n }\n};\n\nfunction lengthPointFirst(x, y) {\n lengthStream.point = lengthPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n x0 -= x, y0 -= y;\n lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n x0 = x, y0 = y;\n}\n\nexport default lengthStream;\n", "// Simple caching for constant-radius points.\nlet cacheDigits, cacheAppend, cacheRadius, cacheCircle;\n\nexport default class PathString {\n constructor(digits) {\n this._append = digits == null ? append : appendRound(digits);\n this._radius = 4.5;\n this._ = \"\";\n }\n pointRadius(_) {\n this._radius = +_;\n return this;\n }\n polygonStart() {\n this._line = 0;\n }\n polygonEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line === 0) this._ += \"Z\";\n this._point = NaN;\n }\n point(x, y) {\n switch (this._point) {\n case 0: {\n this._append`M${x},${y}`;\n this._point = 1;\n break;\n }\n case 1: {\n this._append`L${x},${y}`;\n break;\n }\n default: {\n this._append`M${x},${y}`;\n if (this._radius !== cacheRadius || this._append !== cacheAppend) {\n const r = this._radius;\n const s = this._;\n this._ = \"\"; // stash the old string so we can cache the circle path fragment\n this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;\n cacheRadius = r;\n cacheAppend = this._append;\n cacheCircle = this._;\n this._ = s;\n }\n this._ += cacheCircle;\n break;\n }\n }\n }\n result() {\n const result = this._;\n this._ = \"\";\n return result.length ? result : null;\n }\n}\n\nfunction append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n const d = Math.floor(digits);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);\n if (d > 15) return append;\n if (d !== cacheDigits) {\n const k = 10 ** d;\n cacheDigits = d;\n cacheAppend = function append(strings) {\n let i = 1;\n this._ += strings[0];\n for (const j = strings.length; i < j; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n }\n return cacheAppend;\n}\n", "import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\n\nexport default function(projection, context) {\n let digits = 3,\n pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n stream(object, projectionStream(contextStream));\n }\n return contextStream.result();\n }\n\n path.area = function(object) {\n stream(object, projectionStream(pathArea));\n return pathArea.result();\n };\n\n path.measure = function(object) {\n stream(object, projectionStream(pathMeasure));\n return pathMeasure.result();\n };\n\n path.bounds = function(object) {\n stream(object, projectionStream(pathBounds));\n return pathBounds.result();\n };\n\n path.centroid = function(object) {\n stream(object, projectionStream(pathCentroid));\n return pathCentroid.result();\n };\n\n path.projection = function(_) {\n if (!arguments.length) return projection;\n projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream;\n return path;\n };\n\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n path.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) digits = null;\n else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n if (context === null) contextStream = new PathString(digits);\n return path;\n };\n\n return path.projection(projection).digits(digits).context(context);\n}\n", "export default function(methods) {\n return {\n stream: transformer(methods)\n };\n}\n\nexport function transformer(methods) {\n return function(stream) {\n var s = new TransformStream;\n for (var key in methods) s[key] = methods[key];\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function(x, y) { this.stream.point(x, y); },\n sphere: function() { this.stream.sphere(); },\n lineStart: function() { this.stream.lineStart(); },\n lineEnd: function() { this.stream.lineEnd(); },\n polygonStart: function() { this.stream.polygonStart(); },\n polygonEnd: function() { this.stream.polygonEnd(); }\n};\n", "import {default as geoStream} from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n var clip = projection.clipExtent && projection.clipExtent();\n projection.scale(150).translate([0, 0]);\n if (clip != null) projection.clipExtent(null);\n geoStream(object, projection.stream(boundsStream));\n fitBounds(boundsStream.result());\n if (clip != null) projection.clipExtent(clip);\n return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n return fit(projection, function(b) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\n\nexport function fitWidth(projection, width, object) {\n return fit(projection, function(b) {\n var w = +width,\n k = w / (b[1][0] - b[0][0]),\n x = (w - k * (b[1][0] + b[0][0])) / 2,\n y = -k * b[0][1];\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n\nexport function fitHeight(projection, height, object) {\n return fit(projection, function(b) {\n var h = +height,\n k = h / (b[1][1] - b[0][1]),\n x = -k * b[0][0],\n y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\n", "import {cartesian} from \"../cartesian.js\";\nimport {abs, asin, atan2, cos, epsilon, radians, sqrt} from \"../math.js\";\nimport {transformer} from \"../transform.js\";\n\nvar maxDepth = 16, // maximum depth of subdivision\n cosMinDistance = cos(30 * radians); // cos(minimum angular distance)\n\nexport default function(project, delta2) {\n return +delta2 ? resample(project, delta2) : resampleNone(project);\n}\n\nfunction resampleNone(project) {\n return transformer({\n point: function(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample(project, delta2) {\n\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n return function(stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },\n polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]), p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}\n", "import clipAntimeridian from \"../clip/antimeridian.js\";\nimport clipCircle from \"../clip/circle.js\";\nimport clipRectangle from \"../clip/rectangle.js\";\nimport compose from \"../compose.js\";\nimport identity from \"../identity.js\";\nimport {cos, degrees, radians, sin, sqrt} from \"../math.js\";\nimport {rotateRadians} from \"../rotation.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport resample from \"./resample.js\";\n\nvar transformRadians = transformer({\n point: function(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction scaleTranslate(k, dx, dy, sx, sy) {\n function transform(x, y) {\n x *= sx; y *= sy;\n return [dx + k * x, dy - k * y];\n }\n transform.invert = function(x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n return transform;\n}\n\nfunction scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);\n var cosAlpha = cos(alpha),\n sinAlpha = sin(alpha),\n a = cosAlpha * k,\n b = sinAlpha * k,\n ai = cosAlpha / k,\n bi = sinAlpha / k,\n ci = (sinAlpha * dy - cosAlpha * dx) / k,\n fi = (sinAlpha * dx + cosAlpha * dy) / k;\n function transform(x, y) {\n x *= sx; y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n transform.invert = function(x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n return transform;\n}\n\nexport default function projection(project) {\n return projectionMutator(function() { return project; })();\n}\n\nexport function projectionMutator(projectAt) {\n var project,\n k = 150, // scale\n x = 480, y = 250, // translate\n lambda = 0, phi = 0, // center\n deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate\n alpha = 0, // post-rotate angle\n sx = 1, // reflectX\n sy = 1, // reflectX\n theta = null, preclip = clipAntimeridian, // pre-clip angle\n x0 = null, y0, x1, y1, postclip = identity, // post-clip extent\n delta2 = 0.5, // precision\n projectResample,\n projectTransform,\n projectRotateTransform,\n cache,\n cacheStream;\n\n function projection(point) {\n return projectRotateTransform(point[0] * radians, point[1] * radians);\n }\n\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees, point[1] * degrees];\n }\n\n projection.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function(_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function(_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function(_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;\n };\n\n projection.clipExtent = function(_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function(_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function(_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function(_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];\n };\n\n projection.rotate = function(_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];\n };\n\n projection.angle = function(_) {\n return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;\n };\n\n projection.reflectX = function(_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n\n projection.reflectY = function(_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n\n projection.precision = function(_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function(extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function(size, object) {\n return fitSize(projection, size, object);\n };\n\n projection.fitWidth = function(width, object) {\n return fitWidth(projection, width, object);\n };\n\n projection.fitHeight = function(height, object) {\n return fitHeight(projection, height, object);\n };\n\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),\n transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}\n", "import {degrees, pi, radians} from \"../math.js\";\nimport {projectionMutator} from \"./index.js\";\n\nexport function conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function(_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];\n };\n\n return p;\n}\n", "import {asin, cos, sin} from \"../math.js\";\n\nexport function cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n\n forward.invert = function(x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}\n", "import {abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {cylindricalEqualAreaRaw} from \"./cylindricalEqualArea.js\";\n\nexport function conicEqualAreaRaw(y0, y1) {\n var sy0 = sin(y0), n = (sy0 + sin(y1)) / 2;\n\n // Are the parallels symmetrical around the Equator?\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);\n\n var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n\n project.invert = function(x, y) {\n var r0y = r0 - y,\n l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0)\n l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEqualAreaRaw)\n .scale(155.424)\n .center([0, 33.6442]);\n}\n", "import conicEqualArea from \"./conicEqualArea.js\";\n\nexport default function() {\n return conicEqualArea()\n .parallels([29.5, 45.5])\n .scale(1070)\n .translate([480, 250])\n .rotate([96, 0])\n .center([-0.6, 38.7]);\n}\n", "import {epsilon} from \"../math.js\";\nimport albers from \"./albers.js\";\nimport conicEqualArea from \"./conicEqualArea.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\n\n// The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },\n sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },\n lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },\n lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },\n polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },\n polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }\n };\n}\n\n// A composite projection for the United States, configured by default for\n// 960\u00D7500. The projection also works quite well at 960\u00D7600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\nexport default function() {\n var cache,\n cacheStream,\n lower48 = albers(), lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007\n point, pointStream = {point: function(x, y) { point = [x, y]; }};\n\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n return point = null,\n (lower48Point.point(x, y), point)\n || (alaskaPoint.point(x, y), point)\n || (hawaiiPoint.point(x, y), point);\n }\n\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska\n : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii\n : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function(stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n\n lower48Point = lower48\n .translate(_)\n .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])\n .stream(pointStream);\n\n alaskaPoint = alaska\n .translate([x - 0.307 * k, y + 0.201 * k])\n .clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n hawaiiPoint = hawaii\n .translate([x - 0.205 * k, y + 0.212 * k])\n .clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]])\n .stream(pointStream);\n\n return reset();\n };\n\n albersUsa.fitExtent = function(extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function(size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n albersUsa.fitWidth = function(width, object) {\n return fitWidth(albersUsa, width, object);\n };\n\n albersUsa.fitHeight = function(height, object) {\n return fitHeight(albersUsa, height, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n}\n", "import {asin, atan2, cos, sin, sqrt} from \"../math.js\";\n\nexport function azimuthalRaw(scale) {\n return function(x, y) {\n var cx = cos(x),\n cy = cos(y),\n k = scale(cx * cy);\n if (k === Infinity) return [2, 0];\n return [\n k * cy * sin(x),\n k * sin(y)\n ];\n }\n}\n\nexport function azimuthalInvert(angle) {\n return function(x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin(c),\n cc = cos(c);\n return [\n atan2(x * sc, z * cc),\n asin(z && y * sc / z)\n ];\n }\n}\n", "import {asin, sqrt} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\n\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {\n return 2 * asin(z / 2);\n});\n\nexport default function() {\n return projection(azimuthalEqualAreaRaw)\n .scale(124.75)\n .clipAngle(180 - 1e-3);\n}\n", "import {acos, sin} from \"../math.js\";\nimport {azimuthalRaw, azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport var azimuthalEquidistantRaw = azimuthalRaw(function(c) {\n return (c = acos(c)) && c / sin(c);\n});\n\nazimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {\n return z;\n});\n\nexport default function() {\n return projection(azimuthalEquidistantRaw)\n .scale(79.4188)\n .clipAngle(180 - 1e-3);\n}\n", "import {atan, exp, halfPi, log, pi, tan, tau} from \"../math.js\";\nimport rotation from \"../rotation.js\";\nimport projection from \"./index.js\";\n\nexport function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n}\n\nmercatorRaw.invert = function(x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n};\n\nexport default function() {\n return mercatorProjection(mercatorRaw)\n .scale(961 / tau);\n}\n\nexport function mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null, y0, x1, y1; // clip extent\n\n m.scale = function(_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function(_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function(_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function(_) {\n return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null\n ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw\n ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]\n : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}\n", "import {abs, atan, atan2, cos, epsilon, halfPi, log, pi, pow, sign, sin, sqrt, tan} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {mercatorRaw} from \"./mercator.js\";\n\nfunction tany(y) {\n return tan((halfPi + y) / 2);\n}\n\nexport function conicConformalRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)),\n f = cy0 * pow(tany(y0), n) / n;\n\n if (!n) return mercatorRaw;\n\n function project(x, y) {\n if (f > 0) { if (y < -halfPi + epsilon) y = -halfPi + epsilon; }\n else { if (y > halfPi - epsilon) y = halfPi - epsilon; }\n var r = f / pow(tany(y), n);\n return [r * sin(n * x), f - r * cos(n * x)];\n }\n\n project.invert = function(x, y) {\n var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy),\n l = atan2(x, abs(fy)) * sign(fy);\n if (fy * n < 0)\n l -= pi * sign(x) * sign(fy);\n return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicConformalRaw)\n .scale(109.5)\n .parallels([30, 30]);\n}\n", "import projection from \"./index.js\";\n\nexport function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\n\nequirectangularRaw.invert = equirectangularRaw;\n\nexport default function() {\n return projection(equirectangularRaw)\n .scale(152.63);\n}\n", "import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from \"../math.js\";\nimport {conicProjection} from \"./conic.js\";\nimport {equirectangularRaw} from \"./equirectangular.js\";\n\nexport function conicEquidistantRaw(y0, y1) {\n var cy0 = cos(y0),\n n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0),\n g = cy0 / n + y0;\n\n if (abs(n) < epsilon) return equirectangularRaw;\n\n function project(x, y) {\n var gy = g - y, nx = n * x;\n return [gy * sin(nx), g - gy * cos(nx)];\n }\n\n project.invert = function(x, y) {\n var gy = g - y,\n l = atan2(x, abs(gy)) * sign(gy);\n if (gy * n < 0)\n l -= pi * sign(x) * sign(gy);\n return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];\n };\n\n return project;\n}\n\nexport default function() {\n return conicProjection(conicEquidistantRaw)\n .scale(131.154)\n .center([0, 13.9389]);\n}\n", "import projection from \"./index.js\";\nimport {abs, asin, cos, epsilon2, sin, sqrt} from \"../math.js\";\n\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = sqrt(3) / 2,\n iterations = 12;\n\nexport function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;\n return [\n lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),\n l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))\n ];\n}\n\nequalEarthRaw.invert = function(x, y) {\n var l = y, l2 = l * l, l6 = l2 * l2 * l2;\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon2) break;\n }\n return [\n M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l),\n asin(sin(l) / M)\n ];\n};\n\nexport default function() {\n return projection(equalEarthRaw)\n .scale(177.158);\n}\n", "import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function gnomonicRaw(x, y) {\n var cy = cos(y), k = cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\ngnomonicRaw.invert = azimuthalInvert(atan);\n\nexport default function() {\n return projection(gnomonicRaw)\n .scale(144.049)\n .clipAngle(60);\n}\n", "import {asin, cos, epsilon, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n}\n\northographicRaw.invert = azimuthalInvert(asin);\n\nexport default function() {\n return projection(orthographicRaw)\n .scale(249.5)\n .clipAngle(90 + epsilon);\n}\n", "import {atan, cos, sin} from \"../math.js\";\nimport {azimuthalInvert} from \"./azimuthal.js\";\nimport projection from \"./index.js\";\n\nexport function stereographicRaw(x, y) {\n var cy = cos(y), k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\n\nstereographicRaw.invert = azimuthalInvert(function(z) {\n return 2 * atan(z);\n});\n\nexport default function() {\n return projection(stereographicRaw)\n .scale(250)\n .clipAngle(142);\n}\n", "import {atan, exp, halfPi, log, tan} from \"../math.js\";\nimport {mercatorProjection} from \"./mercator.js\";\n\nexport function transverseMercatorRaw(lambda, phi) {\n return [log(tan((halfPi + phi) / 2)), -lambda];\n}\n\ntransverseMercatorRaw.invert = function(x, y) {\n return [-y, 2 * atan(exp(x)) - halfPi];\n};\n\nexport default function() {\n var m = mercatorProjection(transverseMercatorRaw),\n center = m.center,\n rotate = m.rotate;\n\n m.center = function(_) {\n return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);\n };\n\n m.rotate = function(_) {\n return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);\n };\n\n return rotate([0, 0, 90])\n .scale(159.155);\n}\n", "export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n", "import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n", "import {range as sequence} from \"d3-array\";\nimport {initRange} from \"./init.js\";\nimport ordinal from \"./ordinal.js\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n r0 = 0,\n r1 = 1,\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = r1 < r0,\n start = reverse ? r1 : r0,\n stop = reverse ? r0 : r1;\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];\n };\n\n scale.rangeRound = function(_) {\n return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band(domain(), [r0, r1])\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return initRange.apply(rescale(), arguments);\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band.apply(null, arguments).paddingInner(1));\n}\n", "export default function constants(x) {\n return function() {\n return x;\n };\n}\n", "export default function number(x) {\n return +x;\n}\n", "import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n", "import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n", "import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n", "import {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nexport default function identity(domain) {\n var unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return identity(domain).unknown(unknown);\n };\n\n domain = arguments.length ? Array.from(domain, number) : [0, 1];\n\n return linearish(scale);\n}\n", "export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n", "import {ticks} from \"d3-array\";\nimport {format, formatSpecifier} from \"d3-format\";\nimport nice from \"./nice.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformLog(x) {\n return Math.log(x);\n}\n\nfunction transformExp(x) {\n return Math.exp(x);\n}\n\nfunction transformLogn(x) {\n return -Math.log(-x);\n}\n\nfunction transformExpn(x) {\n return -Math.exp(-x);\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : x => Math.pow(base, x);\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), x => Math.log(x) / base);\n}\n\nfunction reflect(f) {\n return (x, k) => -f(-x, k);\n}\n\nexport function loggish(transform) {\n const scale = transform(transformLog, transformExp);\n const domain = scale.domain;\n let base = 10;\n let logs;\n let pows;\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) {\n logs = reflect(logs), pows = reflect(pows);\n transform(transformLogn, transformExpn);\n } else {\n transform(transformLog, transformExp);\n }\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = count => {\n const d = domain();\n let u = d[0];\n let v = d[d.length - 1];\n const r = v < u;\n\n if (r) ([u, v] = [v, u]);\n\n let i = logs(u);\n let j = logs(v);\n let k;\n let t;\n const n = count == null ? 10 : +count;\n let z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.floor(i), j = Math.ceil(j);\n if (u > 0) for (; i <= j; ++i) {\n for (k = 1; k < base; ++k) {\n t = i < 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i <= j; ++i) {\n for (k = base - 1; k >= 1; --k) {\n t = i > 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n if (z.length * 2 < n) z = ticks(u, v, n);\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = (count, specifier) => {\n if (count == null) count = 10;\n if (specifier == null) specifier = base === 10 ? \"s\" : \",\";\n if (typeof specifier !== \"function\") {\n if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;\n specifier = format(specifier);\n }\n if (count === Infinity) return specifier;\n const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return d => {\n let i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = () => {\n return domain(nice(domain(), {\n floor: x => pows(Math.floor(logs(x))),\n ceil: x => pows(Math.ceil(logs(x)))\n }));\n };\n\n return scale;\n}\n\nexport default function log() {\n const scale = loggish(transformer()).domain([1, 10]);\n scale.copy = () => copy(scale, log()).base(scale.base());\n initRange.apply(scale, arguments);\n return scale;\n}\n", "import {linearish} from \"./linear.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformSymlog(c) {\n return function(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / c));\n };\n}\n\nfunction transformSymexp(c) {\n return function(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * c;\n };\n}\n\nexport function symlogish(transform) {\n var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));\n\n scale.constant = function(_) {\n return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;\n };\n\n return linearish(scale);\n}\n\nexport default function symlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, symlog()).constant(scale.constant());\n };\n\n return initRange.apply(scale, arguments);\n}\n", "import {linearish} from \"./linear.js\";\nimport {copy, identity, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformPow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction transformSqrt(x) {\n return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);\n}\n\nfunction transformSquare(x) {\n return x < 0 ? -x * x : x * x;\n}\n\nexport function powish(transform) {\n var scale = transform(identity, identity),\n exponent = 1;\n\n function rescale() {\n return exponent === 1 ? transform(identity, identity)\n : exponent === 0.5 ? transform(transformSqrt, transformSquare)\n : transform(transformPow(exponent), transformPow(1 / exponent));\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, rescale()) : exponent;\n };\n\n return linearish(scale);\n}\n\nexport default function pow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, pow()).exponent(scale.exponent());\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n\nexport function sqrt() {\n return pow.apply(null, arguments).exponent(0.5);\n}\n", "import {ascending, bisect, quantileSorted as threshold} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [],\n unknown;\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n", "import {bisect} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n unknown,\n n = 1;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n", "const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n", "import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n", "export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n", "import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n", "import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n", "import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n", "import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n", "import {interpolate, interpolateRound} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 1,\n t0,\n t1,\n k10,\n transform,\n interpolator = identity,\n clamp = false,\n unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1;\n return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);\n return scale;\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .interpolator(source.interpolator())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport default function sequential() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, sequential());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialLog() {\n var scale = loggish(transformer()).domain([1, 10]);\n\n scale.copy = function() {\n return copy(scale, sequentialLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSqrt() {\n return sequentialPow.apply(null, arguments).exponent(0.5);\n}\n", "import {interpolate, interpolateRound, piecewise} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {copy} from \"./sequential.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 0.5,\n x2 = 1,\n s = 1,\n t0,\n t1,\n t2,\n k10,\n k21,\n interpolator = identity,\n transform,\n clamp = false,\n unknown;\n\n function scale(x) {\n return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1, r2;\n return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;\n return scale;\n };\n}\n\nexport default function diverging() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, diverging());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingLog() {\n var scale = loggish(transformer()).domain([0.1, 1, 10]);\n\n scale.copy = function() {\n return copy(scale, divergingLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSqrt() {\n return divergingPow.apply(null, arguments).exponent(0.5);\n}\n", "export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n", "import colors from \"../colors.js\";\n\nexport default colors(\"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f\");\n", "import colors from \"../colors.js\";\n\nexport default colors(\"4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab\");\n", "import {interpolateRgbBasis} from \"d3-interpolate\";\n\nexport default scheme => interpolateRgbBasis(scheme[scheme.length - 1]);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"d8b365f5f5f55ab4ac\",\n \"a6611adfc27d80cdc1018571\",\n \"a6611adfc27df5f5f580cdc1018571\",\n \"8c510ad8b365f6e8c3c7eae55ab4ac01665e\",\n \"8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e\",\n \"8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e\",\n \"8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e\",\n \"5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30\",\n \"5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"af8dc3f7f7f77fbf7b\",\n \"7b3294c2a5cfa6dba0008837\",\n \"7b3294c2a5cff7f7f7a6dba0008837\",\n \"762a83af8dc3e7d4e8d9f0d37fbf7b1b7837\",\n \"762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837\",\n \"762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837\",\n \"762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837\",\n \"40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b\",\n \"40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e9a3c9f7f7f7a1d76a\",\n \"d01c8bf1b6dab8e1864dac26\",\n \"d01c8bf1b6daf7f7f7b8e1864dac26\",\n \"c51b7de9a3c9fde0efe6f5d0a1d76a4d9221\",\n \"c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221\",\n \"c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221\",\n \"c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221\",\n \"8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419\",\n \"8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"998ec3f7f7f7f1a340\",\n \"5e3c99b2abd2fdb863e66101\",\n \"5e3c99b2abd2f7f7f7fdb863e66101\",\n \"542788998ec3d8daebfee0b6f1a340b35806\",\n \"542788998ec3d8daebf7f7f7fee0b6f1a340b35806\",\n \"5427888073acb2abd2d8daebfee0b6fdb863e08214b35806\",\n \"5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806\",\n \"2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08\",\n \"2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ef8a62f7f7f767a9cf\",\n \"ca0020f4a58292c5de0571b0\",\n \"ca0020f4a582f7f7f792c5de0571b0\",\n \"b2182bef8a62fddbc7d1e5f067a9cf2166ac\",\n \"b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac\",\n \"b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac\",\n \"b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac\",\n \"67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061\",\n \"67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ef8a62ffffff999999\",\n \"ca0020f4a582bababa404040\",\n \"ca0020f4a582ffffffbababa404040\",\n \"b2182bef8a62fddbc7e0e0e09999994d4d4d\",\n \"b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d\",\n \"b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d\",\n \"b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d\",\n \"67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a\",\n \"67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf91bfdb\",\n \"d7191cfdae61abd9e92c7bb6\",\n \"d7191cfdae61ffffbfabd9e92c7bb6\",\n \"d73027fc8d59fee090e0f3f891bfdb4575b4\",\n \"d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4\",\n \"d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4\",\n \"d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4\",\n \"a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695\",\n \"a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf91cf60\",\n \"d7191cfdae61a6d96a1a9641\",\n \"d7191cfdae61ffffbfa6d96a1a9641\",\n \"d73027fc8d59fee08bd9ef8b91cf601a9850\",\n \"d73027fc8d59fee08bffffbfd9ef8b91cf601a9850\",\n \"d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850\",\n \"d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850\",\n \"a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837\",\n \"a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fc8d59ffffbf99d594\",\n \"d7191cfdae61abdda42b83ba\",\n \"d7191cfdae61ffffbfabdda42b83ba\",\n \"d53e4ffc8d59fee08be6f59899d5943288bd\",\n \"d53e4ffc8d59fee08bffffbfe6f59899d5943288bd\",\n \"d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd\",\n \"d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd\",\n \"9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2\",\n \"9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e5f5f999d8c92ca25f\",\n \"edf8fbb2e2e266c2a4238b45\",\n \"edf8fbb2e2e266c2a42ca25f006d2c\",\n \"edf8fbccece699d8c966c2a42ca25f006d2c\",\n \"edf8fbccece699d8c966c2a441ae76238b45005824\",\n \"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824\",\n \"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e0ecf49ebcda8856a7\",\n \"edf8fbb3cde38c96c688419d\",\n \"edf8fbb3cde38c96c68856a7810f7c\",\n \"edf8fbbfd3e69ebcda8c96c68856a7810f7c\",\n \"edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b\",\n \"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b\",\n \"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e0f3dba8ddb543a2ca\",\n \"f0f9e8bae4bc7bccc42b8cbe\",\n \"f0f9e8bae4bc7bccc443a2ca0868ac\",\n \"f0f9e8ccebc5a8ddb57bccc443a2ca0868ac\",\n \"f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e\",\n \"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e\",\n \"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee8c8fdbb84e34a33\",\n \"fef0d9fdcc8afc8d59d7301f\",\n \"fef0d9fdcc8afc8d59e34a33b30000\",\n \"fef0d9fdd49efdbb84fc8d59e34a33b30000\",\n \"fef0d9fdd49efdbb84fc8d59ef6548d7301f990000\",\n \"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000\",\n \"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ece2f0a6bddb1c9099\",\n \"f6eff7bdc9e167a9cf02818a\",\n \"f6eff7bdc9e167a9cf1c9099016c59\",\n \"f6eff7d0d1e6a6bddb67a9cf1c9099016c59\",\n \"f6eff7d0d1e6a6bddb67a9cf3690c002818a016450\",\n \"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450\",\n \"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ece7f2a6bddb2b8cbe\",\n \"f1eef6bdc9e174a9cf0570b0\",\n \"f1eef6bdc9e174a9cf2b8cbe045a8d\",\n \"f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d\",\n \"f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b\",\n \"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b\",\n \"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e7e1efc994c7dd1c77\",\n \"f1eef6d7b5d8df65b0ce1256\",\n \"f1eef6d7b5d8df65b0dd1c77980043\",\n \"f1eef6d4b9dac994c7df65b0dd1c77980043\",\n \"f1eef6d4b9dac994c7df65b0e7298ace125691003f\",\n \"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f\",\n \"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fde0ddfa9fb5c51b8a\",\n \"feebe2fbb4b9f768a1ae017e\",\n \"feebe2fbb4b9f768a1c51b8a7a0177\",\n \"feebe2fcc5c0fa9fb5f768a1c51b8a7a0177\",\n \"feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177\",\n \"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177\",\n \"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"edf8b17fcdbb2c7fb8\",\n \"ffffcca1dab441b6c4225ea8\",\n \"ffffcca1dab441b6c42c7fb8253494\",\n \"ffffccc7e9b47fcdbb41b6c42c7fb8253494\",\n \"ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84\",\n \"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84\",\n \"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"f7fcb9addd8e31a354\",\n \"ffffccc2e69978c679238443\",\n \"ffffccc2e69978c67931a354006837\",\n \"ffffccd9f0a3addd8e78c67931a354006837\",\n \"ffffccd9f0a3addd8e78c67941ab5d238443005a32\",\n \"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32\",\n \"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fff7bcfec44fd95f0e\",\n \"ffffd4fed98efe9929cc4c02\",\n \"ffffd4fed98efe9929d95f0e993404\",\n \"ffffd4fee391fec44ffe9929d95f0e993404\",\n \"ffffd4fee391fec44ffe9929ec7014cc4c028c2d04\",\n \"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04\",\n \"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"ffeda0feb24cf03b20\",\n \"ffffb2fecc5cfd8d3ce31a1c\",\n \"ffffb2fecc5cfd8d3cf03b20bd0026\",\n \"ffffb2fed976feb24cfd8d3cf03b20bd0026\",\n \"ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026\",\n \"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026\",\n \"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"deebf79ecae13182bd\",\n \"eff3ffbdd7e76baed62171b5\",\n \"eff3ffbdd7e76baed63182bd08519c\",\n \"eff3ffc6dbef9ecae16baed63182bd08519c\",\n \"eff3ffc6dbef9ecae16baed64292c62171b5084594\",\n \"f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594\",\n \"f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"e5f5e0a1d99b31a354\",\n \"edf8e9bae4b374c476238b45\",\n \"edf8e9bae4b374c47631a354006d2c\",\n \"edf8e9c7e9c0a1d99b74c47631a354006d2c\",\n \"edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32\",\n \"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32\",\n \"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"f0f0f0bdbdbd636363\",\n \"f7f7f7cccccc969696525252\",\n \"f7f7f7cccccc969696636363252525\",\n \"f7f7f7d9d9d9bdbdbd969696636363252525\",\n \"f7f7f7d9d9d9bdbdbd969696737373525252252525\",\n \"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525\",\n \"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"efedf5bcbddc756bb1\",\n \"f2f0f7cbc9e29e9ac86a51a3\",\n \"f2f0f7cbc9e29e9ac8756bb154278f\",\n \"f2f0f7dadaebbcbddc9e9ac8756bb154278f\",\n \"f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486\",\n \"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486\",\n \"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee0d2fc9272de2d26\",\n \"fee5d9fcae91fb6a4acb181d\",\n \"fee5d9fcae91fb6a4ade2d26a50f15\",\n \"fee5d9fcbba1fc9272fb6a4ade2d26a50f15\",\n \"fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d\",\n \"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d\",\n \"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d\"\n).map(colors);\n\nexport default ramp(scheme);\n", "import colors from \"../colors.js\";\nimport ramp from \"../ramp.js\";\n\nexport var scheme = new Array(3).concat(\n \"fee6cefdae6be6550d\",\n \"feeddefdbe85fd8d3cd94701\",\n \"feeddefdbe85fd8d3ce6550da63603\",\n \"feeddefdd0a2fdae6bfd8d3ce6550da63603\",\n \"feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04\",\n \"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04\",\n \"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704\"\n).map(colors);\n\nexport default ramp(scheme);\n", "export default function(t) {\n t = Math.max(0, Math.min(1, t));\n return \"rgb(\"\n + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67)))))))\n + \")\";\n}\n", "import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n", "import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nexport var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar c = cubehelix();\n\nexport default function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n c.h = 360 * t - 100;\n c.s = 1.5 - 1.5 * ts;\n c.l = 0.8 - 0.9 * ts;\n return c + \"\";\n}\n", "import {rgb} from \"d3-color\";\n\nvar c = rgb(),\n pi_1_3 = Math.PI / 3,\n pi_2_3 = Math.PI * 2 / 3;\n\nexport default function(t) {\n var x;\n t = (0.5 - t) * Math.PI;\n c.r = 255 * (x = Math.sin(t)) * x;\n c.g = 255 * (x = Math.sin(t + pi_1_3)) * x;\n c.b = 255 * (x = Math.sin(t + pi_2_3)) * x;\n return c + \"\";\n}\n", "export default function(t) {\n t = Math.max(0, Math.min(1, t));\n return \"rgb(\"\n + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + \", \"\n + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))\n + \")\";\n}\n", "import colors from \"../colors.js\";\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nexport default ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nexport var magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nexport var inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nexport var plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n", "export default function(x) {\n return function constant() {\n return x;\n };\n}\n", "export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n", "import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n", "export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n", "function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n", "export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n", "import pointRadial from \"../pointRadial.js\";\n\nclass Bump {\n constructor(context, x) {\n this._context = context;\n this._x = x;\n }\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n }\n point(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: {\n this._point = 1;\n if (this._line) this._context.lineTo(x, y);\n else this._context.moveTo(x, y);\n break;\n }\n case 1: this._point = 2; // falls through\n default: {\n if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);\n else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);\n break;\n }\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nclass BumpRadial {\n constructor(context) {\n this._context = context;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {}\n point(x, y) {\n x = +x, y = +y;\n if (this._point === 0) {\n this._point = 1;\n } else {\n const p0 = pointRadial(this._x0, this._y0);\n const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);\n const p2 = pointRadial(x, this._y0);\n const p3 = pointRadial(x, y);\n this._context.moveTo(...p0);\n this._context.bezierCurveTo(...p1, ...p2, ...p3);\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nexport function bumpX(context) {\n return new Bump(context, true);\n}\n\nexport function bumpY(context) {\n return new Bump(context, false);\n}\n\nexport function bumpRadial(context) {\n return new BumpRadial(context);\n}\n", "import {min, sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;\n const t = r / 2;\n const u = t * sqrt3;\n context.moveTo(0, r);\n context.lineTo(0, -r);\n context.moveTo(-u, -t);\n context.lineTo(u, t);\n context.moveTo(-u, t);\n context.lineTo(u, -t);\n }\n};\n", "import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.62625;\n context.moveTo(0, -r);\n context.lineTo(r, 0);\n context.lineTo(0, r);\n context.lineTo(-r, 0);\n context.closePath();\n }\n};\n", "import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 7, 2)) * 0.87559;\n context.moveTo(-r, 0);\n context.lineTo(r, 0);\n context.moveTo(0, r);\n context.lineTo(0, -r);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const w = sqrt(size);\n const x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.4431;\n context.moveTo(r, r);\n context.lineTo(r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, r);\n context.closePath();\n }\n};\n", "import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const s = sqrt(size) * 0.6824;\n const t = s / 2;\n const u = (s * sqrt3) / 2; // cos(Math.PI / 6)\n context.moveTo(0, -s);\n context.lineTo(u, t);\n context.lineTo(-u, t);\n context.closePath();\n }\n};\n", "import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n", "import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 6, 1.7)) * 0.6189;\n context.moveTo(-r, -r);\n context.lineTo(r, r);\n context.moveTo(-r, r);\n context.lineTo(r, -r);\n }\n};\n", "import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n", "export default function() {}\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n", "import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n", "import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n", "import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n", "function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic B\u00E9zier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n", "function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n", "function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n", "export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n", "import {ascending, descending} from \"d3\";\n\nexport function defined(x) {\n return x != null && !Number.isNaN(x);\n}\n\nexport function ascendingDefined(a, b) {\n return +defined(b) - +defined(a) || ascending(a, b);\n}\n\nexport function descendingDefined(a, b) {\n return +defined(b) - +defined(a) || descending(a, b);\n}\n\nexport function nonempty(x) {\n return x != null && `${x}` !== \"\";\n}\n\nexport function finite(x) {\n return isFinite(x) ? x : NaN;\n}\n\nexport function positive(x) {\n return x > 0 && isFinite(x) ? x : NaN;\n}\n\nexport function negative(x) {\n return x < 0 && isFinite(x) ? x : NaN;\n}\n", "export default function format(date, fallback) {\n if (!(date instanceof Date)) date = new Date(+date);\n if (isNaN(date)) return typeof fallback === \"function\" ? fallback(date) : fallback;\n const hours = date.getUTCHours();\n const minutes = date.getUTCMinutes();\n const seconds = date.getUTCSeconds();\n const milliseconds = date.getUTCMilliseconds();\n return `${formatYear(date.getUTCFullYear(), 4)}-${pad(date.getUTCMonth() + 1, 2)}-${pad(date.getUTCDate(), 2)}${\n hours || minutes || seconds || milliseconds ? `T${pad(hours, 2)}:${pad(minutes, 2)}${\n seconds || milliseconds ? `:${pad(seconds, 2)}${\n milliseconds ? `.${pad(milliseconds, 3)}` : ``\n }` : ``\n }Z` : ``\n }`;\n}\n\nfunction formatYear(year) {\n return year < 0 ? `-${pad(-year, 6)}`\n : year > 9999 ? `+${pad(year, 6)}`\n : pad(year, 4);\n}\n\nfunction pad(value, width) {\n return `${value}`.padStart(width, \"0\");\n}\n", "const re = /^(?:[-+]\\d{2})?\\d{4}(?:-\\d{2}(?:-\\d{2})?)?(?:T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{3})?)?(?:Z|[-+]\\d{2}:?\\d{2})?)?$/;\n\nexport default function parse(string, fallback) {\n if (!re.test(string += \"\")) return typeof fallback === \"function\" ? fallback(string) : fallback;\n return new Date(string);\n}\n", "import {descending} from \"d3\";\n\n// Like a sort comparator, returns a positive value if the given array of values\n// is in ascending order, a negative value if the values are in descending\n// order. Assumes monotonicity; only tests the first and last values.\nexport function orderof(values) {\n if (values == null) return;\n const first = values[0];\n const last = values[values.length - 1];\n return descending(first, last);\n}\n", "import {bisector, max, pairs, timeFormat, utcFormat} from \"d3\";\nimport {utcSecond, utcMinute, utcHour, unixDay, utcWeek, utcMonth, utcYear} from \"d3\";\nimport {utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSunday} from \"d3\";\nimport {timeSecond, timeMinute, timeHour, timeDay, timeWeek, timeMonth, timeYear} from \"d3\";\nimport {timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSunday} from \"d3\";\nimport {orderof} from \"./order.js\";\n\nconst durationSecond = 1000;\nconst durationMinute = durationSecond * 60;\nconst durationHour = durationMinute * 60;\nconst durationDay = durationHour * 24;\nconst durationWeek = durationDay * 7;\nconst durationMonth = durationDay * 30;\nconst durationYear = durationDay * 365;\n\n// See https://github.com/d3/d3-time/blob/9e8dc940f38f78d7588aad68a54a25b1f0c2d97b/src/ticks.js#L14-L33\nconst tickIntervals = [\n [\"millisecond\", 1],\n [\"2 milliseconds\", 2],\n [\"5 milliseconds\", 5],\n [\"10 milliseconds\", 10],\n [\"20 milliseconds\", 20],\n [\"50 milliseconds\", 50],\n [\"100 milliseconds\", 100],\n [\"200 milliseconds\", 200],\n [\"500 milliseconds\", 500],\n [\"second\", durationSecond],\n [\"5 seconds\", 5 * durationSecond],\n [\"15 seconds\", 15 * durationSecond],\n [\"30 seconds\", 30 * durationSecond],\n [\"minute\", durationMinute],\n [\"5 minutes\", 5 * durationMinute],\n [\"15 minutes\", 15 * durationMinute],\n [\"30 minutes\", 30 * durationMinute],\n [\"hour\", durationHour],\n [\"3 hours\", 3 * durationHour],\n [\"6 hours\", 6 * durationHour],\n [\"12 hours\", 12 * durationHour],\n [\"day\", durationDay],\n [\"2 days\", 2 * durationDay],\n [\"week\", durationWeek],\n [\"2 weeks\", 2 * durationWeek], // https://github.com/d3/d3-time/issues/46\n [\"month\", durationMonth],\n [\"3 months\", 3 * durationMonth],\n [\"6 months\", 6 * durationMonth], // https://github.com/d3/d3-time/issues/46\n [\"year\", durationYear],\n [\"2 years\", 2 * durationYear],\n [\"5 years\", 5 * durationYear],\n [\"10 years\", 10 * durationYear],\n [\"20 years\", 20 * durationYear],\n [\"50 years\", 50 * durationYear],\n [\"100 years\", 100 * durationYear] // TODO generalize to longer time scales\n];\n\nconst durations = new Map([\n [\"second\", durationSecond],\n [\"minute\", durationMinute],\n [\"hour\", durationHour],\n [\"day\", durationDay],\n [\"monday\", durationWeek],\n [\"tuesday\", durationWeek],\n [\"wednesday\", durationWeek],\n [\"thursday\", durationWeek],\n [\"friday\", durationWeek],\n [\"saturday\", durationWeek],\n [\"sunday\", durationWeek],\n [\"week\", durationWeek],\n [\"month\", durationMonth],\n [\"year\", durationYear]\n]);\n\nconst timeIntervals = new Map([\n [\"second\", timeSecond],\n [\"minute\", timeMinute],\n [\"hour\", timeHour],\n [\"day\", timeDay], // https://github.com/d3/d3-time/issues/62\n [\"monday\", timeMonday],\n [\"tuesday\", timeTuesday],\n [\"wednesday\", timeWednesday],\n [\"thursday\", timeThursday],\n [\"friday\", timeFriday],\n [\"saturday\", timeSaturday],\n [\"sunday\", timeSunday],\n [\"week\", timeWeek],\n [\"month\", timeMonth],\n [\"year\", timeYear]\n]);\n\nconst utcIntervals = new Map([\n [\"second\", utcSecond],\n [\"minute\", utcMinute],\n [\"hour\", utcHour],\n [\"day\", unixDay],\n [\"monday\", utcMonday],\n [\"tuesday\", utcTuesday],\n [\"wednesday\", utcWednesday],\n [\"thursday\", utcThursday],\n [\"friday\", utcFriday],\n [\"saturday\", utcSaturday],\n [\"sunday\", utcSunday],\n [\"week\", utcWeek],\n [\"month\", utcMonth],\n [\"year\", utcYear]\n]);\n\n// These hidden fields describe standard intervals so that we can, for example,\n// generalize a scale\u2019s time interval to a larger ticks time interval to reduce\n// the number of displayed ticks. TODO We could instead allow the interval\n// implementation to expose a \u201Cgeneralize\u201D method that returns a larger, aligned\n// interval; that would allow us to move this logic to D3, and allow\n// generalization even when a custom interval is provided.\nexport const intervalDuration = Symbol(\"intervalDuration\");\nexport const intervalType = Symbol(\"intervalType\");\n\n// We greedily mutate D3\u2019s standard intervals on load so that the hidden fields\n// are available even if specified as e.g. d3.utcMonth instead of \"month\".\nfor (const [name, interval] of timeIntervals) {\n interval[intervalDuration] = durations.get(name);\n interval[intervalType] = \"time\";\n}\nfor (const [name, interval] of utcIntervals) {\n interval[intervalDuration] = durations.get(name);\n interval[intervalType] = \"utc\";\n}\n\nconst utcFormatIntervals = [\n [\"year\", utcYear, \"utc\"],\n [\"month\", utcMonth, \"utc\"],\n [\"day\", unixDay, \"utc\", 6 * durationMonth],\n [\"hour\", utcHour, \"utc\", 3 * durationDay],\n [\"minute\", utcMinute, \"utc\", 6 * durationHour],\n [\"second\", utcSecond, \"utc\", 30 * durationMinute]\n];\n\nconst timeFormatIntervals = [\n [\"year\", timeYear, \"time\"],\n [\"month\", timeMonth, \"time\"],\n [\"day\", timeDay, \"time\", 6 * durationMonth],\n [\"hour\", timeHour, \"time\", 3 * durationDay],\n [\"minute\", timeMinute, \"time\", 6 * durationHour],\n [\"second\", timeSecond, \"time\", 30 * durationMinute]\n];\n\n// An interleaved array of UTC and local time intervals, in descending order\n// from largest to smallest, used to determine the most specific standard time\n// format for a given array of dates. This is a subset of the tick intervals\n// listed above; we only need the breakpoints where the format changes.\nconst formatIntervals = [\n utcFormatIntervals[0],\n timeFormatIntervals[0],\n utcFormatIntervals[1],\n timeFormatIntervals[1],\n utcFormatIntervals[2],\n timeFormatIntervals[2],\n // Below day, local time typically has an hourly offset from UTC and hence the\n // two are aligned and indistinguishable; therefore, we only consider UTC, and\n // we don\u2019t consider these if the domain only has a single value.\n ...utcFormatIntervals.slice(3)\n];\n\nexport function parseTimeInterval(input) {\n let name = `${input}`.toLowerCase();\n if (name.endsWith(\"s\")) name = name.slice(0, -1); // drop plural\n let period = 1;\n const match = /^(?:(\\d+)\\s+)/.exec(name);\n if (match) {\n name = name.slice(match[0].length);\n period = +match[1];\n }\n switch (name) {\n case \"quarter\":\n name = \"month\";\n period *= 3;\n break;\n case \"half\":\n name = \"month\";\n period *= 6;\n break;\n }\n let interval = utcIntervals.get(name);\n if (!interval) throw new Error(`unknown interval: ${input}`);\n if (period > 1 && !interval.every) throw new Error(`non-periodic interval: ${name}`);\n return [name, period];\n}\n\nexport function maybeTimeInterval(input) {\n return asInterval(parseTimeInterval(input), \"time\");\n}\n\nexport function maybeUtcInterval(input) {\n return asInterval(parseTimeInterval(input), \"utc\");\n}\n\nfunction asInterval([name, period], type) {\n let interval = (type === \"time\" ? timeIntervals : utcIntervals).get(name);\n if (period > 1) {\n interval = interval.every(period);\n interval[intervalDuration] = durations.get(name) * period;\n interval[intervalType] = type;\n }\n return interval;\n}\n\n// If the given interval is a standard time interval, we may be able to promote\n// it a larger aligned time interval, rather than showing every nth tick.\nexport function generalizeTimeInterval(interval, n) {\n if (!(n > 1)) return; // no need to generalize\n const duration = interval[intervalDuration];\n if (!tickIntervals.some(([, d]) => d === duration)) return; // nonstandard or unknown interval\n if (duration % durationDay === 0 && durationDay < duration && duration < durationMonth) return; // not generalizable\n const [i] = tickIntervals[bisector(([, step]) => Math.log(step)).center(tickIntervals, Math.log(duration * n))];\n return (interval[intervalType] === \"time\" ? maybeTimeInterval : maybeUtcInterval)(i);\n}\n\nfunction formatTimeInterval(name, type, anchor) {\n const format = type === \"time\" ? timeFormat : utcFormat;\n // For tips and legends, use a format that doesn\u2019t require context.\n if (anchor == null) {\n return format(\n name === \"year\"\n ? \"%Y\"\n : name === \"month\"\n ? \"%Y-%m\"\n : name === \"day\"\n ? \"%Y-%m-%d\"\n : name === \"hour\" || name === \"minute\"\n ? \"%Y-%m-%dT%H:%M\"\n : name === \"second\"\n ? \"%Y-%m-%dT%H:%M:%S\"\n : \"%Y-%m-%dT%H:%M:%S.%L\"\n );\n }\n // Otherwise, assume that this is for axis ticks.\n const template = getTimeTemplate(anchor);\n switch (name) {\n case \"millisecond\":\n return formatConditional(format(\".%L\"), format(\":%M:%S\"), template);\n case \"second\":\n return formatConditional(format(\":%S\"), format(\"%-I:%M\"), template);\n case \"minute\":\n return formatConditional(format(\"%-I:%M\"), format(\"%p\"), template);\n case \"hour\":\n return formatConditional(format(\"%-I %p\"), format(\"%b %-d\"), template);\n case \"day\":\n return formatConditional(format(\"%-d\"), format(\"%b\"), template);\n case \"month\":\n return formatConditional(format(\"%b\"), format(\"%Y\"), template);\n case \"year\":\n return format(\"%Y\");\n }\n throw new Error(\"unable to format time ticks\");\n}\n\nfunction getTimeTemplate(anchor) {\n return anchor === \"left\" || anchor === \"right\"\n ? (f1, f2) => `\\n${f1}\\n${f2}` // extra newline to keep f1 centered\n : anchor === \"top\"\n ? (f1, f2) => `${f2}\\n${f1}`\n : (f1, f2) => `${f1}\\n${f2}`;\n}\n\nfunction getFormatIntervals(type) {\n return type === \"time\" ? timeFormatIntervals : type === \"utc\" ? utcFormatIntervals : formatIntervals;\n}\n\n// Given an array of dates, returns the largest compatible standard time\n// interval. If no standard interval is compatible (other than milliseconds,\n// which is universally compatible), returns undefined.\nexport function inferTimeFormat(type, dates, anchor) {\n const step = max(pairs(dates, (a, b) => Math.abs(b - a))); // maybe undefined!\n if (step < 1000) return formatTimeInterval(\"millisecond\", \"utc\", anchor);\n for (const [name, interval, intervalType, maxStep] of getFormatIntervals(type)) {\n if (step > maxStep) break; // e.g., 52 weeks\n if (name === \"hour\" && !step) break; // e.g., domain with a single date\n if (dates.every((d) => interval.floor(d) >= d)) return formatTimeInterval(name, intervalType, anchor);\n }\n}\n\nfunction formatConditional(format1, format2, template) {\n return (x, i, X) => {\n const f1 = format1(x, i); // always shown\n const f2 = format2(x, i); // only shown if different\n const j = i - orderof(X); // detect reversed domains\n return i !== j && X[j] !== undefined && f2 === format2(X[j], j) ? f1 : template(f1, f2);\n };\n}\n", "import {quantile, range as rangei} from \"d3\";\nimport {parse as isoParse} from \"isoformat\";\nimport {defined} from \"./defined.js\";\nimport {maybeTimeInterval, maybeUtcInterval} from \"./time.js\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray\nexport const TypedArray = Object.getPrototypeOf(Uint8Array);\nconst objectToString = Object.prototype.toString;\n\n// If a reindex is attached to the data, channel values expressed as arrays will\n// be reindexed when the channels are instantiated. See exclusiveFacets.\nexport const reindex = Symbol(\"reindex\");\n\nexport function valueof(data, value, type) {\n const valueType = typeof value;\n return valueType === \"string\"\n ? maybeTypedMap(data, field(value), type)\n : valueType === \"function\"\n ? maybeTypedMap(data, value, type)\n : valueType === \"number\" || value instanceof Date || valueType === \"boolean\"\n ? map(data, constant(value), type)\n : typeof value?.transform === \"function\"\n ? maybeTypedArrayify(value.transform(data), type)\n : maybeTake(maybeTypedArrayify(value, type), data?.[reindex]);\n}\n\nfunction maybeTake(values, index) {\n return index ? take(values, index) : values;\n}\n\nfunction maybeTypedMap(data, f, type) {\n return map(data, type?.prototype instanceof TypedArray ? floater(f) : f, type);\n}\n\nfunction maybeTypedArrayify(data, type) {\n return type === undefined\n ? arrayify(data) // preserve undefined type\n : data instanceof type\n ? data\n : type.prototype instanceof TypedArray && !(data instanceof TypedArray)\n ? type.from(data, coerceNumber)\n : type.from(data);\n}\n\nfunction floater(f) {\n return (d, i) => coerceNumber(f(d, i));\n}\n\nexport const singleton = [null]; // for data-less decoration marks, e.g. frame\nexport const field = (name) => (d) => d[name];\nexport const indexOf = {transform: range};\nexport const identity = {transform: (d) => d};\nexport const zero = () => 0;\nexport const one = () => 1;\nexport const yes = () => true;\nexport const string = (x) => (x == null ? x : `${x}`);\nexport const number = (x) => (x == null ? x : +x);\nexport const boolean = (x) => (x == null ? x : !!x);\nexport const first = (x) => (x ? x[0] : undefined);\nexport const second = (x) => (x ? x[1] : undefined);\nexport const third = (x) => (x ? x[2] : undefined);\nexport const constant = (x) => () => x;\n\n// Converts a string like \u201Cp25\u201D into a function that takes an index I and an\n// accessor function f, returning the corresponding percentile value.\nexport function percentile(reduce) {\n const p = +`${reduce}`.slice(1) / 100;\n return (I, f) => quantile(I, p, f);\n}\n\n// If the values are specified as a typed array, no coercion is required.\nexport function coerceNumbers(values) {\n return values instanceof TypedArray ? values : map(values, coerceNumber, Float64Array);\n}\n\n// Unlike Mark\u2019s number, here we want to convert null and undefined to NaN since\n// the result will be stored in a Float64Array and we don\u2019t want null to be\n// coerced to zero. We use Number instead of unary + to allow BigInt coercion.\nfunction coerceNumber(x) {\n return x == null ? NaN : Number(x);\n}\n\nexport function coerceDates(values) {\n return map(values, coerceDate);\n}\n\n// When coercing strings to dates, we only want to allow the ISO 8601 format\n// since the built-in string parsing of the Date constructor varies across\n// browsers. (In the future, this could be made more liberal if desired, though\n// it is still generally preferable to do date parsing yourself explicitly,\n// rather than rely on Plot.) Any non-string values are coerced to number first\n// and treated as milliseconds since UNIX epoch.\nexport function coerceDate(x) {\n return x instanceof Date && !isNaN(x)\n ? x\n : typeof x === \"string\"\n ? isoParse(x)\n : x == null || isNaN((x = +x))\n ? undefined\n : new Date(x);\n}\n\n// Some channels may allow a string constant to be specified; to differentiate\n// string constants (e.g., \"red\") from named fields (e.g., \"date\"), this\n// function tests whether the given value is a CSS color string and returns a\n// tuple [channel, constant] where one of the two is undefined, and the other is\n// the given value. If you wish to reference a named field that is also a valid\n// CSS color, use an accessor (d => d.red) instead.\nexport function maybeColorChannel(value, defaultValue) {\n if (value === undefined) value = defaultValue;\n return value === null ? [undefined, \"none\"] : isColor(value) ? [undefined, value] : [value, undefined];\n}\n\n// Similar to maybeColorChannel, this tests whether the given value is a number\n// indicating a constant, and otherwise assumes that it\u2019s a channel value.\nexport function maybeNumberChannel(value, defaultValue) {\n if (value === undefined) value = defaultValue;\n return value === null || typeof value === \"number\" ? [undefined, value] : [value, undefined];\n}\n\n// Validates the specified optional string against the allowed list of keywords.\nexport function maybeKeyword(input, name, allowed) {\n if (input != null) return keyword(input, name, allowed);\n}\n\n// Validates the specified required string against the allowed list of keywords.\nexport function keyword(input, name, allowed) {\n const i = `${input}`.toLowerCase();\n if (!allowed.includes(i)) throw new Error(`invalid ${name}: ${input}`);\n return i;\n}\n\n// Promotes the specified data to an array as needed.\nexport function arrayify(data) {\n return data == null || data instanceof Array || data instanceof TypedArray ? data : Array.from(data);\n}\n\n// An optimization of type.from(values, f): if the given values are already an\n// instanceof the desired array type, the faster values.map method is used.\nexport function map(values, f, type = Array) {\n return values == null ? values : values instanceof type ? values.map(f) : type.from(values, f);\n}\n\n// An optimization of type.from(values): if the given values are already an\n// instanceof the desired array type, the faster values.slice method is used.\nexport function slice(values, type = Array) {\n return values instanceof type ? values.slice() : type.from(values);\n}\n\n// Returns true if any of x, x1, or x2 is not (strictly) undefined.\nexport function hasX({x, x1, x2}) {\n return x !== undefined || x1 !== undefined || x2 !== undefined;\n}\n\n// Returns true if any of y, y1, or y2 is not (strictly) undefined.\nexport function hasY({y, y1, y2}) {\n return y !== undefined || y1 !== undefined || y2 !== undefined;\n}\n\n// Returns true if has x or y, or if interval is not (strictly) undefined.\nexport function hasXY(options) {\n return hasX(options) || hasY(options) || options.interval !== undefined;\n}\n\n// Disambiguates an options object (e.g., {y: \"x2\"}) from a primitive value.\nexport function isObject(option) {\n return option?.toString === objectToString;\n}\n\n// Disambiguates a scale options object (e.g., {color: {type: \"linear\"}}) from\n// some other option (e.g., {color: \"red\"}). When creating standalone legends,\n// this is used to test whether a scale is defined; this should be consistent\n// with inferScaleType when there are no channels associated with the scale, and\n// if this returns true, then normalizeScale must return non-null.\nexport function isScaleOptions(option) {\n return isObject(option) && (option.type !== undefined || option.domain !== undefined);\n}\n\n// Disambiguates an options object (e.g., {y: \"x2\"}) from a channel value\n// definition expressed as a channel transform (e.g., {transform: \u2026}).\n// TODO Check typeof option[Symbol.iterator] !== \"function\"?\nexport function isOptions(option) {\n return isObject(option) && typeof option.transform !== \"function\";\n}\n\n// Disambiguates a sort transform (e.g., {sort: \"date\"}) from a channel domain\n// sort definition (e.g., {sort: {y: \"x\"}}).\nexport function isDomainSort(sort) {\n return isOptions(sort) && sort.value === undefined && sort.channel === undefined;\n}\n\n// For marks specified either as [0, x] or [x1, x2], such as areas and bars.\nexport function maybeZero(x, x1, x2, x3 = identity) {\n if (x1 === undefined && x2 === undefined) {\n // {x} or {}\n (x1 = 0), (x2 = x === undefined ? x3 : x);\n } else if (x1 === undefined) {\n // {x, x2} or {x2}\n x1 = x === undefined ? 0 : x;\n } else if (x2 === undefined) {\n // {x, x1} or {x1}\n x2 = x === undefined ? 0 : x;\n }\n return [x1, x2];\n}\n\n// For marks that have x and y channels (e.g., cell, dot, line, text).\nexport function maybeTuple(x, y) {\n return x === undefined && y === undefined ? [first, second] : [x, y];\n}\n\n// A helper for extracting the z channel, if it is variable. Used by transforms\n// that require series, such as moving average and normalize.\nexport function maybeZ({z, fill, stroke} = {}) {\n if (z === undefined) [z] = maybeColorChannel(fill);\n if (z === undefined) [z] = maybeColorChannel(stroke);\n return z;\n}\n\n// Returns a Uint32Array with elements [0, 1, 2, \u2026 data.length - 1].\nexport function range(data) {\n const n = data.length;\n const r = new Uint32Array(n);\n for (let i = 0; i < n; ++i) r[i] = i;\n return r;\n}\n\n// Returns a filtered range of data given the test function.\nexport function where(data, test) {\n return range(data).filter((i) => test(data[i], i, data));\n}\n\n// Returns an array [values[index[0]], values[index[1]], \u2026].\nexport function take(values, index) {\n return map(index, (i) => values[i], values.constructor);\n}\n\n// If f does not take exactly one argument, wraps it in a function that uses take.\nexport function taker(f) {\n return f.length === 1 ? (index, values) => f(take(values, index)) : f;\n}\n\n// Uses subarray if available, and otherwise slice.\nexport function subarray(I, i, j) {\n return I.subarray ? I.subarray(i, j) : I.slice(i, j);\n}\n\n// Based on InternMap (d3.group).\nexport function keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n\nexport function maybeInput(key, options) {\n if (options[key] !== undefined) return options[key];\n switch (key) {\n case \"x1\":\n case \"x2\":\n key = \"x\";\n break;\n case \"y1\":\n case \"y2\":\n key = \"y\";\n break;\n }\n return options[key];\n}\n\nexport function column(source) {\n // Defines a column whose values are lazily populated by calling the returned\n // setter. If the given source is labeled, the label is propagated to the\n // returned column definition.\n let value;\n return [\n {\n transform: () => value,\n label: labelof(source)\n },\n (v) => (value = v)\n ];\n}\n\n// Like column, but allows the source to be null.\nexport function maybeColumn(source) {\n return source == null ? [source] : column(source);\n}\n\nexport function labelof(value, defaultValue) {\n return typeof value === \"string\" ? value : value && value.label !== undefined ? value.label : defaultValue;\n}\n\n// Assuming that both x1 and x2 and lazy columns (per above), this derives a new\n// a column that\u2019s the average of the two, and which inherits the column label\n// (if any). Both input columns are assumed to be quantitative. If either column\n// is temporal, the returned column is also temporal.\nexport function mid(x1, x2) {\n return {\n transform(data) {\n const X1 = x1.transform(data);\n const X2 = x2.transform(data);\n return isTemporal(X1) || isTemporal(X2)\n ? map(X1, (_, i) => new Date((+X1[i] + +X2[i]) / 2))\n : map(X1, (_, i) => (+X1[i] + +X2[i]) / 2, Float64Array);\n },\n label: x1.label\n };\n}\n\n// If the scale options declare an interval, applies it to the values V.\nexport function maybeApplyInterval(V, scale) {\n const t = maybeIntervalTransform(scale?.interval, scale?.type);\n return t ? map(V, t) : V;\n}\n\n// Returns the equivalent scale transform for the specified interval option.\nexport function maybeIntervalTransform(interval, type) {\n const i = maybeInterval(interval, type);\n return i && ((v) => (defined(v) ? i.floor(v) : v));\n}\n\n// If interval is not nullish, converts interval shorthand such as a number (for\n// multiples) or a time interval name (such as \u201Cday\u201D) to a {floor, offset,\n// range} object similar to a D3 time interval.\nexport function maybeInterval(interval, type) {\n if (interval == null) return;\n if (typeof interval === \"number\") {\n if (0 < interval && interval < 1 && Number.isInteger(1 / interval)) interval = -1 / interval;\n const n = Math.abs(interval);\n return interval < 0\n ? {\n floor: (d) => Math.floor(d * n) / n,\n offset: (d) => (d * n + 1) / n, // note: no optional step for simplicity\n range: (lo, hi) => rangei(Math.ceil(lo * n), hi * n).map((x) => x / n)\n }\n : {\n floor: (d) => Math.floor(d / n) * n,\n offset: (d) => d + n, // note: no optional step for simplicity\n range: (lo, hi) => rangei(Math.ceil(lo / n), hi / n).map((x) => x * n)\n };\n }\n if (typeof interval === \"string\") return (type === \"time\" ? maybeTimeInterval : maybeUtcInterval)(interval);\n if (typeof interval.floor !== \"function\") throw new Error(\"invalid interval; missing floor method\");\n if (typeof interval.offset !== \"function\") throw new Error(\"invalid interval; missing offset method\");\n return interval;\n}\n\n// Like maybeInterval, but requires a range method too.\nexport function maybeRangeInterval(interval, type) {\n interval = maybeInterval(interval, type);\n if (interval && typeof interval.range !== \"function\") throw new Error(\"invalid interval: missing range method\");\n return interval;\n}\n\n// Like maybeRangeInterval, but requires a ceil method too.\nexport function maybeNiceInterval(interval, type) {\n interval = maybeRangeInterval(interval, type);\n if (interval && typeof interval.ceil !== \"function\") throw new Error(\"invalid interval: missing ceil method\");\n return interval;\n}\n\nexport function isTimeInterval(t) {\n return isInterval(t) && typeof t?.floor === \"function\" && t.floor() instanceof Date;\n}\n\nexport function isInterval(t) {\n return typeof t?.range === \"function\";\n}\n\n// This distinguishes between per-dimension options and a standalone value.\nexport function maybeValue(value) {\n return value === undefined || isOptions(value) ? value : {value};\n}\n\n// Coerces the given channel values (if any) to numbers. This is useful when\n// values will be interpolated into other code, such as an SVG transform, and\n// where we don\u2019t wish to allow unexpected behavior for weird input.\nexport function numberChannel(source) {\n return source == null\n ? null\n : {\n transform: (data) => valueof(data, source, Float64Array),\n label: labelof(source)\n };\n}\n\nexport function isTuples(data) {\n if (!isIterable(data)) return false;\n for (const d of data) {\n if (d == null) continue;\n return typeof d === \"object\" && \"0\" in d && \"1\" in d;\n }\n}\n\nexport function isIterable(value) {\n return value && typeof value[Symbol.iterator] === \"function\";\n}\n\nexport function isTextual(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value !== \"object\" || value instanceof Date;\n }\n}\n\nexport function isOrdinal(values) {\n for (const value of values) {\n if (value == null) continue;\n const type = typeof value;\n return type === \"string\" || type === \"boolean\";\n }\n}\n\nexport function isTemporal(values) {\n for (const value of values) {\n if (value == null) continue;\n return value instanceof Date;\n }\n}\n\n// Are these strings that might represent dates? This is stricter than ISO 8601\n// because we want to ignore false positives on numbers; for example, the string\n// \"1192\" is more likely to represent a number than a date even though it is\n// valid ISO 8601 representing 1192-01-01.\nexport function isTemporalString(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value === \"string\" && isNaN(value) && isoParse(value);\n }\n}\n\n// Are these strings that might represent numbers? This is stricter than\n// coercion because we want to ignore false positives on e.g. empty strings.\nexport function isNumericString(values) {\n for (const value of values) {\n if (value == null) continue;\n if (typeof value !== \"string\") return false;\n if (!value.trim()) continue;\n return !isNaN(value);\n }\n}\n\nexport function isNumeric(values) {\n for (const value of values) {\n if (value == null) continue;\n return typeof value === \"number\";\n }\n}\n\n// Returns true if every non-null value in the specified iterable of values\n// passes the specified predicate, and there is at least one non-null value;\n// returns false if at least one non-null value does not pass the specified\n// predicate; otherwise returns undefined (as if all values are null).\nexport function isEvery(values, is) {\n let every;\n for (const value of values) {\n if (value == null) continue;\n if (!is(value)) return false;\n every = true;\n }\n return every;\n}\n\nconst namedColors = new Set(\"none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow\".split(\",\")); // prettier-ignore\n\n// Returns true if value is a valid CSS color string. This is intentionally lax\n// because the CSS color spec keeps growing, and we don\u2019t need to parse these\n// colors\u2014we just need to disambiguate them from column names.\n// https://www.w3.org/TR/SVG11/painting.html#SpecifyingPaint\n// https://www.w3.org/TR/css-color-5/\nexport function isColor(value) {\n if (typeof value !== \"string\") return false;\n value = value.toLowerCase().trim();\n return (\n /^#[0-9a-f]{3,8}$/.test(value) || // hex rgb, rgba, rrggbb, rrggbbaa\n /^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\\(.*\\)$/.test(value) || // , CSS variable, color, etc.\n namedColors.has(value) // currentColor, red, etc.\n );\n}\n\nexport function isOpacity(value) {\n return typeof value === \"number\" && ((0 <= value && value <= 1) || isNaN(value));\n}\n\nexport function isNoneish(value) {\n return value == null || isNone(value);\n}\n\nexport function isNone(value) {\n return /^\\s*none\\s*$/i.test(value);\n}\n\nexport function isRound(value) {\n return /^\\s*round\\s*$/i.test(value);\n}\n\nexport function maybeAnchor(value, name) {\n return maybeKeyword(value, name, [\n \"middle\",\n \"top-left\",\n \"top\",\n \"top-right\",\n \"right\",\n \"bottom-right\",\n \"bottom\",\n \"bottom-left\",\n \"left\"\n ]);\n}\n\nexport function maybeFrameAnchor(value = \"middle\") {\n return maybeAnchor(value, \"frameAnchor\");\n}\n\n// Unlike {...defaults, ...options}, this ensures that any undefined (but\n// present) properties in options inherit the given default value.\nexport function inherit(options = {}, ...rest) {\n let o = options;\n for (const defaults of rest) {\n for (const key in defaults) {\n if (o[key] === undefined) {\n const value = defaults[key];\n if (o === options) o = {...o, [key]: value};\n else o[key] = value;\n }\n }\n }\n return o;\n}\n\n// Given an iterable of named things (objects with a name property), returns a\n// corresponding object with properties associated with the given name.\nexport function named(things) {\n console.warn(\"named iterables are deprecated; please use an object instead\");\n const names = new Set();\n return Object.fromEntries(\n Array.from(things, (thing) => {\n const {name} = thing;\n if (name == null) throw new Error(\"missing name\");\n const key = `${name}`;\n if (key === \"__proto__\") throw new Error(`illegal name: ${key}`);\n if (names.has(key)) throw new Error(`duplicate name: ${key}`);\n names.add(key);\n return [name, thing];\n })\n );\n}\n\nexport function maybeNamed(things) {\n return isIterable(things) ? named(things) : things;\n}\n\n// TODO Accept other types of clips (paths, urls, x, y, other marks\u2026)?\n// https://github.com/observablehq/plot/issues/181\nexport function maybeClip(clip) {\n if (clip === true) clip = \"frame\";\n else if (clip === false) clip = null;\n else if (clip != null) clip = keyword(clip, \"clip\", [\"frame\", \"sphere\"]);\n return clip;\n}\n", "// Positional scales have associated axes, and for ordinal data, a point or band\n// scale is used instead of an ordinal scale.\nexport const position = Symbol(\"position\");\n\n// Color scales default to the turbo interpolator for quantitative data, and to\n// the Tableau10 scheme for ordinal data. Color scales may also have an\n// associated legend.\nexport const color = Symbol(\"color\");\n\n// Radius scales default to the sqrt type, have a default range of [0, 3], and a\n// default domain from 0 to the median first quartile of associated channels.\nexport const radius = Symbol(\"radius\");\n\n// Length scales default to the linear type, have a default range of [0, 12],\n// and a default domain from 0 to the median median of associated channels.\nexport const length = Symbol(\"length\");\n\n// Opacity scales have a default range of [0, 1], and a default domain from 0 to\n// the maximum value of associated channels.\nexport const opacity = Symbol(\"opacity\");\n\n// Symbol scales have a default range of categorical symbols.\nexport const symbol = Symbol(\"symbol\");\n\n// There isn\u2019t really a projection scale; this represents x and y for geometry.\n// This is used to denote channels that should be projected.\nexport const projection = Symbol(\"projection\");\n\n// TODO Rather than hard-coding the list of known scale names, collect the names\n// and categories for each plot specification, so that custom marks can register\n// custom scales.\nexport const registry = new Map([\n [\"x\", position],\n [\"y\", position],\n [\"fx\", position],\n [\"fy\", position],\n [\"r\", radius],\n [\"color\", color],\n [\"opacity\", opacity],\n [\"symbol\", symbol],\n [\"length\", length],\n [\"projection\", projection]\n]);\n\nexport function isPosition(kind) {\n return kind === position || kind === projection;\n}\n\nexport function hasNumericRange(kind) {\n return kind === position || kind === radius || kind === length || kind === opacity;\n}\n", "import {symbolAsterisk, symbolDiamond2, symbolPlus, symbolSquare2, symbolTriangle2, symbolTimes} from \"d3\";\nimport {symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye} from \"d3\";\n\nexport const sqrt3 = Math.sqrt(3);\nexport const sqrt4_3 = 2 / sqrt3;\n\nconst symbolHexagon = {\n draw(context, size) {\n const rx = Math.sqrt(size / Math.PI),\n ry = rx * sqrt4_3,\n hy = ry / 2;\n context.moveTo(0, ry);\n context.lineTo(rx, hy);\n context.lineTo(rx, -hy);\n context.lineTo(0, -ry);\n context.lineTo(-rx, -hy);\n context.lineTo(-rx, hy);\n context.closePath();\n }\n};\n\nconst symbols = new Map([\n [\"asterisk\", symbolAsterisk],\n [\"circle\", symbolCircle],\n [\"cross\", symbolCross],\n [\"diamond\", symbolDiamond],\n [\"diamond2\", symbolDiamond2],\n [\"hexagon\", symbolHexagon],\n [\"plus\", symbolPlus],\n [\"square\", symbolSquare],\n [\"square2\", symbolSquare2],\n [\"star\", symbolStar],\n [\"times\", symbolTimes],\n [\"triangle\", symbolTriangle],\n [\"triangle2\", symbolTriangle2],\n [\"wye\", symbolWye]\n]);\n\nfunction isSymbolObject(value) {\n return value && typeof value.draw === \"function\";\n}\n\nexport function isSymbol(value) {\n if (isSymbolObject(value)) return true;\n if (typeof value !== \"string\") return false;\n return symbols.has(value.toLowerCase());\n}\n\nexport function maybeSymbol(symbol) {\n if (symbol == null || isSymbolObject(symbol)) return symbol;\n const value = symbols.get(`${symbol}`.toLowerCase());\n if (value) return value;\n throw new Error(`invalid symbol: ${symbol}`);\n}\n\nexport function maybeSymbolChannel(symbol) {\n if (symbol == null || isSymbolObject(symbol)) return [undefined, symbol];\n if (typeof symbol === \"string\") {\n const value = symbols.get(`${symbol}`.toLowerCase());\n if (value) return [undefined, value];\n }\n return [symbol, undefined];\n}\n", "import {randomLcg} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"../defined.js\";\nimport {arrayify, isDomainSort, isOptions, maybeValue, valueof} from \"../options.js\";\n\nexport function basic({filter: f1, sort: s1, reverse: r1, transform: t1, initializer: i1, ...options} = {}, transform) {\n // If both t1 and t2 are defined, returns a composite transform that first\n // applies t1 and then applies t2.\n if (t1 === undefined) {\n // explicit transform overrides filter, sort, and reverse\n if (f1 != null) t1 = filterTransform(f1);\n if (s1 != null && !isDomainSort(s1)) t1 = composeTransform(t1, sortTransform(s1));\n if (r1) t1 = composeTransform(t1, reverseTransform);\n }\n if (transform != null && i1 != null) throw new Error(\"transforms cannot be applied after initializers\");\n return {\n ...options,\n ...((s1 === null || isDomainSort(s1)) && {sort: s1}),\n transform: composeTransform(t1, transform)\n };\n}\n\nexport function initializer({filter: f1, sort: s1, reverse: r1, initializer: i1, ...options} = {}, initializer) {\n // If both i1 and i2 are defined, returns a composite initializer that first\n // applies i1 and then applies i2.\n if (i1 === undefined) {\n // explicit initializer overrides filter, sort, and reverse\n if (f1 != null) i1 = filterTransform(f1);\n if (s1 != null && !isDomainSort(s1)) i1 = composeInitializer(i1, sortTransform(s1));\n if (r1) i1 = composeInitializer(i1, reverseTransform);\n }\n return {\n ...options,\n ...((s1 === null || isDomainSort(s1)) && {sort: s1}),\n initializer: composeInitializer(i1, initializer)\n };\n}\n\nfunction composeTransform(t1, t2) {\n if (t1 == null) return t2 === null ? undefined : t2;\n if (t2 == null) return t1 === null ? undefined : t1;\n return function (data, facets, plotOptions) {\n ({data, facets} = t1.call(this, data, facets, plotOptions));\n return t2.call(this, arrayify(data), facets, plotOptions);\n };\n}\n\nfunction composeInitializer(i1, i2) {\n if (i1 == null) return i2 === null ? undefined : i2;\n if (i2 == null) return i1 === null ? undefined : i1;\n return function (data, facets, channels, ...args) {\n let c1, d1, f1, c2, d2, f2;\n ({data: d1 = data, facets: f1 = facets, channels: c1} = i1.call(this, data, facets, channels, ...args));\n ({data: d2 = d1, facets: f2 = f1, channels: c2} = i2.call(this, d1, f1, {...channels, ...c1}, ...args));\n return {data: d2, facets: f2, channels: {...c1, ...c2}};\n };\n}\n\nfunction apply(options, t) {\n return (options.initializer != null ? initializer : basic)(options, t);\n}\n\nexport function filter(test, options) {\n return apply(options, filterTransform(test));\n}\n\nfunction filterTransform(value) {\n return (data, facets) => {\n const V = valueof(data, value);\n return {data, facets: facets.map((I) => I.filter((i) => V[i]))};\n };\n}\n\nexport function reverse({sort, ...options} = {}) {\n return {\n ...apply(options, reverseTransform),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nfunction reverseTransform(data, facets) {\n return {data, facets: facets.map((I) => I.slice().reverse())};\n}\n\nexport function shuffle({seed, sort, ...options} = {}) {\n return {\n ...apply(options, sortValue(seed == null ? Math.random : randomLcg(seed))),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nexport function sort(order, {sort, ...options} = {}) {\n return {\n ...(isOptions(order) && order.channel !== undefined ? initializer : apply)(options, sortTransform(order)),\n sort: isDomainSort(sort) ? sort : null\n };\n}\n\nfunction sortTransform(value) {\n return (typeof value === \"function\" && value.length !== 1 ? sortData : sortValue)(value);\n}\n\nfunction sortData(compare) {\n return (data, facets) => {\n const compareData = (i, j) => compare(data[i], data[j]);\n return {data, facets: facets.map((I) => I.slice().sort(compareData))};\n };\n}\n\nfunction sortValue(value) {\n let channel, order;\n ({channel, value, order} = {...maybeValue(value)});\n const negate = channel?.startsWith(\"-\");\n if (negate) channel = channel.slice(1);\n if (order === undefined) order = negate ? descendingDefined : ascendingDefined;\n if (typeof order !== \"function\") {\n switch (`${order}`.toLowerCase()) {\n case \"ascending\":\n order = ascendingDefined;\n break;\n case \"descending\":\n order = descendingDefined;\n break;\n default:\n throw new Error(`invalid order: ${order}`);\n }\n }\n return (data, facets, channels) => {\n let V;\n if (channel === undefined) {\n V = valueof(data, value);\n } else {\n if (channels === undefined) throw new Error(\"channel sort requires an initializer\");\n V = channels[channel];\n if (!V) return {}; // ignore missing channel\n V = V.value;\n }\n const compareValue = (i, j) => order(V[i], V[j]);\n return {data, facets: facets.map((I) => I.slice().sort(compareValue))};\n };\n}\n", "import {\n InternSet,\n deviation,\n group as grouper,\n max,\n maxIndex,\n mean,\n median,\n min,\n minIndex,\n mode,\n rollup,\n sort,\n sum,\n variance\n} from \"d3\";\nimport {ascendingDefined} from \"../defined.js\";\nimport {\n column,\n identity,\n isObject,\n isTemporal,\n labelof,\n maybeApplyInterval,\n maybeColorChannel,\n maybeColumn,\n maybeInput,\n maybeTuple,\n percentile,\n range,\n second,\n take,\n valueof\n} from \"../options.js\";\nimport {basic} from \"./basic.js\";\n\n// Group on {z, fill, stroke}.\nexport function groupZ(outputs, options) {\n return groupn(null, null, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on x.\nexport function groupX(outputs = {y: \"count\"}, options = {}) {\n const {x = identity} = options;\n if (x == null) throw new Error(\"missing channel: x\");\n return groupn(x, null, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on y.\nexport function groupY(outputs = {x: \"count\"}, options = {}) {\n const {y = identity} = options;\n if (y == null) throw new Error(\"missing channel: y\");\n return groupn(null, y, outputs, options);\n}\n\n// Group on {z, fill, stroke}, then on x and y.\nexport function group(outputs = {fill: \"count\"}, options = {}) {\n let {x, y} = options;\n [x, y] = maybeTuple(x, y);\n if (x == null) throw new Error(\"missing channel: x\");\n if (y == null) throw new Error(\"missing channel: y\");\n return groupn(x, y, outputs, options);\n}\n\nfunction groupn(\n x, // optionally group on x\n y, // optionally group on y\n {\n data: reduceData = reduceIdentity,\n filter,\n sort,\n reverse,\n ...outputs // output channel definitions\n } = {},\n inputs = {} // input channels and options\n) {\n // Compute the outputs.\n outputs = maybeGroupOutputs(outputs, inputs);\n reduceData = maybeGroupReduce(reduceData, identity);\n sort = sort == null ? undefined : maybeGroupOutput(\"sort\", sort, inputs);\n filter = filter == null ? undefined : maybeGroupEvaluator(\"filter\", filter, inputs);\n\n // Produce x and y output channels as appropriate.\n const [GX, setGX] = maybeColumn(x);\n const [GY, setGY] = maybeColumn(y);\n\n // Greedily materialize the z, fill, and stroke channels (if channels and not\n // constants) so that we can reference them for subdividing groups without\n // computing them more than once.\n const {\n z,\n fill,\n stroke,\n x1,\n x2, // consumed if x is an output\n y1,\n y2, // consumed if y is an output\n ...options\n } = inputs;\n const [GZ, setGZ] = maybeColumn(z);\n const [vfill] = maybeColorChannel(fill);\n const [vstroke] = maybeColorChannel(stroke);\n const [GF, setGF] = maybeColumn(vfill);\n const [GS, setGS] = maybeColumn(vstroke);\n\n return {\n ...(\"z\" in inputs && {z: GZ || z}),\n ...(\"fill\" in inputs && {fill: GF || fill}),\n ...(\"stroke\" in inputs && {stroke: GS || stroke}),\n ...basic(options, (data, facets, plotOptions) => {\n const X = maybeApplyInterval(valueof(data, x), plotOptions?.x);\n const Y = maybeApplyInterval(valueof(data, y), plotOptions?.y);\n const Z = valueof(data, z);\n const F = valueof(data, vfill);\n const S = valueof(data, vstroke);\n const G = maybeSubgroup(outputs, {z: Z, fill: F, stroke: S});\n const groupFacets = [];\n const groupData = [];\n const GX = X && setGX([]);\n const GY = Y && setGY([]);\n const GZ = Z && setGZ([]);\n const GF = F && setGF([]);\n const GS = S && setGS([]);\n let i = 0;\n for (const o of outputs) o.initialize(data);\n if (sort) sort.initialize(data);\n if (filter) filter.initialize(data);\n for (const facet of facets) {\n const groupFacet = [];\n for (const o of outputs) o.scope(\"facet\", facet);\n if (sort) sort.scope(\"facet\", facet);\n if (filter) filter.scope(\"facet\", facet);\n for (const [f, I] of maybeGroup(facet, G)) {\n for (const [y, gg] of maybeGroup(I, Y)) {\n for (const [x, g] of maybeGroup(gg, X)) {\n const extent = {data};\n if (X) extent.x = x;\n if (Y) extent.y = y;\n if (G) extent.z = f;\n if (filter && !filter.reduce(g, extent)) continue;\n groupFacet.push(i++);\n groupData.push(reduceData.reduceIndex(g, data, extent));\n if (X) GX.push(x);\n if (Y) GY.push(y);\n if (Z) GZ.push(G === Z ? f : Z[g[0]]);\n if (F) GF.push(G === F ? f : F[g[0]]);\n if (S) GS.push(G === S ? f : S[g[0]]);\n for (const o of outputs) o.reduce(g, extent);\n if (sort) sort.reduce(g, extent);\n }\n }\n }\n groupFacets.push(groupFacet);\n }\n maybeSort(groupFacets, sort, reverse);\n return {data: groupData, facets: groupFacets};\n }),\n ...(!hasOutput(outputs, \"x\") && (GX ? {x: GX} : {x1, x2})),\n ...(!hasOutput(outputs, \"y\") && (GY ? {y: GY} : {y1, y2})),\n ...Object.fromEntries(outputs.map(({name, output}) => [name, output]))\n };\n}\n\nexport function hasOutput(outputs, ...names) {\n for (const {name} of outputs) {\n if (names.includes(name)) {\n return true;\n }\n }\n return false;\n}\n\nexport function maybeOutputs(outputs, inputs, asOutput = maybeOutput) {\n const entries = Object.entries(outputs);\n // Propagate standard mark channels by default.\n if (inputs.title != null && outputs.title === undefined) entries.push([\"title\", reduceTitle]);\n if (inputs.href != null && outputs.href === undefined) entries.push([\"href\", reduceFirst]);\n return entries\n .filter(([, reduce]) => reduce !== undefined)\n .map(([name, reduce]) => (reduce === null ? nullOutput(name) : asOutput(name, reduce, inputs)));\n}\n\nexport function maybeOutput(name, reduce, inputs, asEvaluator = maybeEvaluator) {\n let scale; // optional per-channel scale override\n if (isObject(reduce) && \"reduce\" in reduce) (scale = reduce.scale), (reduce = reduce.reduce); // N.B. array.reduce\n const evaluator = asEvaluator(name, reduce, inputs);\n const [output, setOutput] = column(evaluator.label);\n let O;\n return {\n name,\n output: scale === undefined ? output : {value: output, scale},\n initialize(data) {\n evaluator.initialize(data);\n O = setOutput([]);\n },\n scope(scope, I) {\n evaluator.scope(scope, I);\n },\n reduce(I, extent) {\n O.push(evaluator.reduce(I, extent));\n }\n };\n}\n\nfunction nullOutput(name) {\n return {name, initialize() {}, scope() {}, reduce() {}};\n}\n\nexport function maybeEvaluator(name, reduce, inputs, asReduce = maybeReduce) {\n const input = maybeInput(name, inputs);\n const reducer = asReduce(reduce, input);\n let V, context;\n return {\n label: labelof(reducer === reduceCount ? null : input, reducer.label),\n initialize(data) {\n V = input === undefined ? data : valueof(data, input);\n if (reducer.scope === \"data\") {\n context = reducer.reduceIndex(range(data), V);\n }\n },\n scope(scope, I) {\n if (reducer.scope === scope) {\n context = reducer.reduceIndex(I, V);\n }\n },\n reduce(I, extent) {\n return reducer.scope == null ? reducer.reduceIndex(I, V, extent) : reducer.reduceIndex(I, V, context, extent);\n }\n };\n}\n\nexport function maybeGroup(I, X) {\n return X ? grouper(I, (i) => X[i]) : [[, I]];\n}\n\nexport function maybeReduce(reduce, value, fallback = invalidReduce) {\n if (reduce == null) return fallback(reduce);\n if (typeof reduce.reduceIndex === \"function\") return reduce;\n if (typeof reduce.reduce === \"function\" && isObject(reduce)) return reduceReduce(reduce); // N.B. array.reduce\n if (typeof reduce === \"function\") return reduceFunction(reduce);\n if (/^p\\d{2}$/i.test(reduce)) return reduceAccessor(percentile(reduce));\n switch (`${reduce}`.toLowerCase()) {\n case \"first\":\n return reduceFirst;\n case \"last\":\n return reduceLast;\n case \"identity\":\n return reduceIdentity;\n case \"count\":\n return reduceCount;\n case \"distinct\":\n return reduceDistinct;\n case \"sum\":\n return value == null ? reduceCount : reduceSum;\n case \"proportion\":\n return reduceProportion(value, \"data\");\n case \"proportion-facet\":\n return reduceProportion(value, \"facet\");\n case \"deviation\":\n return reduceAccessor(deviation);\n case \"min\":\n return reduceAccessor(min);\n case \"min-index\":\n return reduceAccessor(minIndex);\n case \"max\":\n return reduceAccessor(max);\n case \"max-index\":\n return reduceAccessor(maxIndex);\n case \"mean\":\n return reduceMaybeTemporalAccessor(mean);\n case \"median\":\n return reduceMaybeTemporalAccessor(median);\n case \"variance\":\n return reduceAccessor(variance);\n case \"mode\":\n return reduceAccessor(mode);\n }\n return fallback(reduce);\n}\n\nfunction invalidReduce(reduce) {\n throw new Error(`invalid reduce: ${reduce}`);\n}\n\nexport function maybeGroupOutputs(outputs, inputs) {\n return maybeOutputs(outputs, inputs, maybeGroupOutput);\n}\n\nfunction maybeGroupOutput(name, reduce, inputs) {\n return maybeOutput(name, reduce, inputs, maybeGroupEvaluator);\n}\n\nfunction maybeGroupEvaluator(name, reduce, inputs) {\n return maybeEvaluator(name, reduce, inputs, maybeGroupReduce);\n}\n\nfunction maybeGroupReduce(reduce, value) {\n return maybeReduce(reduce, value, maybeGroupReduceFallback);\n}\n\nfunction maybeGroupReduceFallback(reduce) {\n switch (`${reduce}`.toLowerCase()) {\n case \"x\":\n return reduceX;\n case \"y\":\n return reduceY;\n case \"z\":\n return reduceZ;\n }\n throw new Error(`invalid group reduce: ${reduce}`);\n}\n\nexport function maybeSubgroup(outputs, inputs) {\n for (const name in inputs) {\n const value = inputs[name];\n if (value !== undefined && !outputs.some((o) => o.name === name)) {\n return value;\n }\n }\n}\n\nexport function maybeSort(facets, sort, reverse) {\n if (sort) {\n const S = sort.output.transform();\n const compare = (i, j) => ascendingDefined(S[i], S[j]);\n facets.forEach((f) => f.sort(compare));\n }\n if (reverse) {\n facets.forEach((f) => f.reverse());\n }\n}\n\nfunction reduceReduce(reduce) {\n console.warn(\"deprecated reduce interface; implement reduceIndex instead.\");\n return {...reduce, reduceIndex: reduce.reduce.bind(reduce)};\n}\n\nfunction reduceFunction(f) {\n return {\n reduceIndex(I, X, extent) {\n return f(take(X, I), extent);\n }\n };\n}\n\nfunction reduceAccessor(f) {\n return {\n reduceIndex(I, X) {\n return f(I, (i) => X[i]);\n }\n };\n}\n\nfunction reduceMaybeTemporalAccessor(f) {\n return {\n reduceIndex(I, X) {\n const x = f(I, (i) => X[i]);\n return isTemporal(X) ? new Date(x) : x;\n }\n };\n}\n\nexport const reduceIdentity = {\n reduceIndex(I, X) {\n return take(X, I);\n }\n};\n\nexport const reduceFirst = {\n reduceIndex(I, X) {\n return X[I[0]];\n }\n};\n\nconst reduceTitle = {\n reduceIndex(I, X) {\n const n = 5;\n const groups = sort(\n rollup(\n I,\n (V) => V.length,\n (i) => X[i]\n ),\n second\n );\n const top = groups.slice(-n).reverse();\n if (top.length < groups.length) {\n const bottom = groups.slice(0, 1 - n);\n top[n - 1] = [`\u2026 ${bottom.length.toLocaleString(\"en-US\")} more`, sum(bottom, second)];\n }\n return top.map(([key, value]) => `${key} (${value.toLocaleString(\"en-US\")})`).join(\"\\n\");\n }\n};\n\nconst reduceLast = {\n reduceIndex(I, X) {\n return X[I[I.length - 1]];\n }\n};\n\nexport const reduceCount = {\n label: \"Frequency\",\n reduceIndex(I) {\n return I.length;\n }\n};\n\nconst reduceDistinct = {\n label: \"Distinct\",\n reduceIndex(I, X) {\n const s = new InternSet();\n for (const i of I) s.add(X[i]);\n return s.size;\n }\n};\n\nconst reduceSum = reduceAccessor(sum);\n\nfunction reduceProportion(value, scope) {\n return value == null\n ? {scope, label: \"Frequency\", reduceIndex: (I, V, basis = 1) => I.length / basis}\n : {scope, reduceIndex: (I, V, basis = 1) => sum(I, (i) => V[i]) / basis};\n}\n\nconst reduceX = {\n reduceIndex(I, X, {x}) {\n return x;\n }\n};\n\nconst reduceY = {\n reduceIndex(I, X, {y}) {\n return y;\n }\n};\n\nexport const reduceZ = {\n reduceIndex(I, X, {z}) {\n return z;\n }\n};\n\nexport function find(test) {\n if (typeof test !== \"function\") throw new Error(`invalid test function: ${test}`);\n return {\n reduceIndex(I, V, {data}) {\n return V[I.find((i) => test(data[i], i, data))];\n }\n };\n}\n", "import {InternSet, rollups} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"./defined.js\";\nimport {first, isColor, isEvery, isIterable, isOpacity, labelof, map, maybeValue, range, valueof} from \"./options.js\";\nimport {registry} from \"./scales/index.js\";\nimport {isSymbol, maybeSymbol} from \"./symbol.js\";\nimport {maybeReduce} from \"./transforms/group.js\";\n\nexport function createChannel(data, {scale, type, value, filter, hint, label = labelof(value)}, name) {\n if (hint === undefined && typeof value?.transform === \"function\") hint = value.hint;\n return inferChannelScale(name, {\n scale,\n type,\n value: valueof(data, value),\n label,\n filter,\n hint\n });\n}\n\nexport function createChannels(channels, data) {\n return Object.fromEntries(\n Object.entries(channels).map(([name, channel]) => [name, createChannel(data, channel, name)])\n );\n}\n\n// TODO Use Float64Array for scales with numeric ranges, e.g. position?\nexport function valueObject(channels, scales) {\n const values = Object.fromEntries(\n Object.entries(channels).map(([name, {scale: scaleName, value}]) => {\n const scale = scaleName == null ? null : scales[scaleName];\n return [name, scale == null ? value : map(value, scale)];\n })\n );\n values.channels = channels; // expose channel state for advanced usage\n return values;\n}\n\n// If the channel uses the \"auto\" scale (or equivalently true), infer the scale\n// from the channel name and the provided values. For color and symbol channels,\n// no scale is applied if the values are literal; however for symbols, we must\n// promote symbol names (e.g., \"plus\") to symbol implementations (symbolPlus).\n// Note: mutates channel!\nexport function inferChannelScale(name, channel) {\n const {scale, value} = channel;\n if (scale === true || scale === \"auto\") {\n switch (name) {\n case \"fill\":\n case \"stroke\":\n case \"color\":\n channel.scale = scale !== true && isEvery(value, isColor) ? null : \"color\";\n break;\n case \"fillOpacity\":\n case \"strokeOpacity\":\n case \"opacity\":\n channel.scale = scale !== true && isEvery(value, isOpacity) ? null : \"opacity\";\n break;\n case \"symbol\":\n if (scale !== true && isEvery(value, isSymbol)) {\n channel.scale = null;\n channel.value = map(value, maybeSymbol);\n } else {\n channel.scale = \"symbol\";\n }\n break;\n default:\n channel.scale = registry.has(name) ? name : null;\n break;\n }\n } else if (scale === false) {\n channel.scale = null;\n } else if (scale != null && !registry.has(scale)) {\n throw new Error(`unknown scale: ${scale}`);\n }\n return channel;\n}\n\n// Note: mutates channel.domain! This is set to a function so that it is lazily\n// computed; i.e., if the scale\u2019s domain is set explicitly, that takes priority\n// over the sort option, and we don\u2019t need to do additional work.\nexport function channelDomain(data, facets, channels, facetChannels, options) {\n const {order: defaultOrder, reverse: defaultReverse, reduce: defaultReduce = true, limit: defaultLimit} = options;\n for (const x in options) {\n if (!registry.has(x)) continue; // ignore unknown scale keys (including generic options)\n let {value: y, order = defaultOrder, reverse = defaultReverse, reduce = defaultReduce, limit = defaultLimit} = maybeValue(options[x]); // prettier-ignore\n const negate = y?.startsWith(\"-\");\n if (negate) y = y.slice(1);\n order = order === undefined ? negate !== (y === \"width\" || y === \"height\") ? descendingGroup : ascendingGroup : maybeOrder(order); // prettier-ignore\n if (reduce == null || reduce === false) continue; // disabled reducer\n const X = x === \"fx\" || x === \"fy\" ? reindexFacetChannel(facets, facetChannels[x]) : findScaleChannel(channels, x);\n if (!X) throw new Error(`missing channel for scale: ${x}`);\n const XV = X.value;\n const [lo = 0, hi = Infinity] = isIterable(limit) ? limit : limit < 0 ? [limit] : [0, limit];\n if (y == null) {\n X.domain = () => {\n let domain = Array.from(new InternSet(XV)); // remove any duplicates\n if (reverse) domain = domain.reverse();\n if (lo !== 0 || hi !== Infinity) domain = domain.slice(lo, hi);\n return domain;\n };\n } else {\n const YV =\n y === \"data\"\n ? data\n : y === \"height\"\n ? difference(channels, \"y1\", \"y2\")\n : y === \"width\"\n ? difference(channels, \"x1\", \"x2\")\n : values(channels, y, y === \"y\" ? \"y2\" : y === \"x\" ? \"x2\" : undefined);\n const reducer = maybeReduce(reduce === true ? \"max\" : reduce, YV);\n X.domain = () => {\n let domain = rollups(\n range(XV),\n (I) => reducer.reduceIndex(I, YV),\n (i) => XV[i]\n );\n if (order) domain.sort(order);\n if (reverse) domain.reverse();\n if (lo !== 0 || hi !== Infinity) domain = domain.slice(lo, hi);\n return domain.map(first);\n };\n }\n }\n}\n\nfunction findScaleChannel(channels, scale) {\n for (const name in channels) {\n const channel = channels[name];\n if (channel.scale === scale) return channel;\n }\n}\n\n// Facet channels are not affected by transforms; so, to compute the domain of a\n// facet scale, we must first re-index the facet channel according to the\n// transformed mark index. Note: mutates channel, but that should be safe here?\nfunction reindexFacetChannel(facets, channel) {\n const originalFacets = facets.original;\n if (originalFacets === facets) return channel; // not transformed\n const V1 = channel.value;\n const V2 = (channel.value = []); // mutates channel!\n for (let i = 0; i < originalFacets.length; ++i) {\n const vi = V1[originalFacets[i][0]];\n for (const j of facets[i]) V2[j] = vi;\n }\n return channel;\n}\n\nfunction difference(channels, k1, k2) {\n const X1 = values(channels, k1);\n const X2 = values(channels, k2);\n return map(X2, (x2, i) => Math.abs(x2 - X1[i]), Float64Array);\n}\n\nfunction values(channels, name, alias) {\n let channel = channels[name];\n if (!channel && alias !== undefined) channel = channels[alias];\n if (channel) return channel.value;\n throw new Error(`missing channel: ${name}`);\n}\n\nfunction maybeOrder(order) {\n if (order == null || typeof order === \"function\") return order;\n switch (`${order}`.toLowerCase()) {\n case \"ascending\":\n return ascendingGroup;\n case \"descending\":\n return descendingGroup;\n }\n throw new Error(`invalid order: ${order}`);\n}\n\nfunction ascendingGroup([ak, av], [bk, bv]) {\n return ascendingDefined(av, bv) || ascendingDefined(ak, bk);\n}\n\nfunction descendingGroup([ak, av], [bk, bv]) {\n return descendingDefined(av, bv) || ascendingDefined(ak, bk);\n}\n\nexport function getSource(channels, key) {\n let channel = channels[key];\n if (!channel) return;\n while (channel.source) channel = channel.source;\n return channel.source === null ? null : channel;\n}\n", "import {creator, select} from \"d3\";\nimport {maybeClip} from \"./options.js\";\n\nexport function createContext(options = {}) {\n const {document = typeof window !== \"undefined\" ? window.document : undefined, clip} = options;\n return {document, clip: maybeClip(clip)};\n}\n\nexport function create(name, {document}) {\n return select(creator(name).call(document.documentElement));\n}\n", "let warnings = 0;\nlet lastMessage;\n\nexport function consumeWarnings() {\n const w = warnings;\n warnings = 0;\n lastMessage = undefined;\n return w;\n}\n\nexport function warn(message) {\n if (message === lastMessage) return;\n lastMessage = message;\n console.warn(message);\n ++warnings;\n}\n", "import {\n geoAlbers,\n geoAlbersUsa,\n geoAzimuthalEqualArea,\n geoAzimuthalEquidistant,\n geoClipRectangle,\n geoConicConformal,\n geoConicEqualArea,\n geoConicEquidistant,\n geoEqualEarth,\n geoEquirectangular,\n geoGnomonic,\n geoMercator,\n geoOrthographic,\n geoPath,\n geoStereographic,\n geoStream,\n geoTransform,\n geoTransverseMercator\n} from \"d3\";\nimport {valueObject} from \"./channel.js\";\nimport {coerceNumbers, constant, isObject} from \"./options.js\";\nimport {warn} from \"./warnings.js\";\n\nconst pi = Math.PI;\nconst tau = 2 * pi;\nconst defaultAspectRatio = 0.618;\n\nexport function createProjection(\n {\n projection,\n inset: globalInset = 0,\n insetTop = globalInset,\n insetRight = globalInset,\n insetBottom = globalInset,\n insetLeft = globalInset\n } = {},\n dimensions\n) {\n if (projection == null) return;\n if (typeof projection.stream === \"function\") return projection; // d3 projection\n let options;\n let domain;\n let clip = \"frame\";\n\n // If the projection was specified as an object with additional options,\n // extract those. The order of precedence for insetTop (and other insets) is:\n // projection.insetTop, projection.inset, (global) insetTop, (global) inset.\n // Any other options on this object will be passed through to the initializer.\n if (isObject(projection)) {\n let inset;\n ({\n type: projection,\n domain,\n inset,\n insetTop = inset !== undefined ? inset : insetTop,\n insetRight = inset !== undefined ? inset : insetRight,\n insetBottom = inset !== undefined ? inset : insetBottom,\n insetLeft = inset !== undefined ? inset : insetLeft,\n clip = clip,\n ...options\n } = projection);\n if (projection == null) return;\n }\n\n // For named projections, retrieve the corresponding projection initializer.\n if (typeof projection !== \"function\") ({type: projection} = namedProjection(projection));\n\n // Compute the frame dimensions and invoke the projection initializer.\n const {width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions;\n const dx = width - marginLeft - marginRight - insetLeft - insetRight;\n const dy = height - marginTop - marginBottom - insetTop - insetBottom;\n projection = projection?.({width: dx, height: dy, clip, ...options});\n\n // The projection initializer might decide to not use a projection.\n if (projection == null) return;\n clip = maybePostClip(clip, marginLeft, marginTop, width - marginRight, height - marginBottom);\n\n // Translate the origin to the top-left corner, respecting margins and insets.\n let tx = marginLeft + insetLeft;\n let ty = marginTop + insetTop;\n let transform;\n\n // If a domain is specified, fit the projection to the frame.\n if (domain != null) {\n const [[x0, y0], [x1, y1]] = geoPath(projection).bounds(domain);\n const k = Math.min(dx / (x1 - x0), dy / (y1 - y0));\n if (k > 0) {\n tx -= (k * (x0 + x1) - dx) / 2;\n ty -= (k * (y0 + y1) - dy) / 2;\n transform = geoTransform({\n point(x, y) {\n this.stream.point(x * k + tx, y * k + ty);\n }\n });\n } else {\n warn(`Warning: the projection could not be fit to the specified domain; using the default scale.`);\n }\n }\n\n transform ??=\n tx === 0 && ty === 0\n ? identity()\n : geoTransform({\n point(x, y) {\n this.stream.point(x + tx, y + ty);\n }\n });\n\n return {stream: (s) => projection.stream(transform.stream(clip(s)))};\n}\n\nfunction namedProjection(projection) {\n switch (`${projection}`.toLowerCase()) {\n case \"albers-usa\":\n return scaleProjection(geoAlbersUsa, 0.7463, 0.4673);\n case \"albers\":\n return conicProjection(geoAlbers, 0.7463, 0.4673);\n case \"azimuthal-equal-area\":\n return scaleProjection(geoAzimuthalEqualArea, 4, 4);\n case \"azimuthal-equidistant\":\n return scaleProjection(geoAzimuthalEquidistant, tau, tau);\n case \"conic-conformal\":\n return conicProjection(geoConicConformal, tau, tau);\n case \"conic-equal-area\":\n return conicProjection(geoConicEqualArea, 6.1702, 2.9781);\n case \"conic-equidistant\":\n return conicProjection(geoConicEquidistant, 7.312, 3.6282);\n case \"equal-earth\":\n return scaleProjection(geoEqualEarth, 5.4133, 2.6347);\n case \"equirectangular\":\n return scaleProjection(geoEquirectangular, tau, pi);\n case \"gnomonic\":\n return scaleProjection(geoGnomonic, 3.4641, 3.4641);\n case \"identity\":\n return {type: identity};\n case \"reflect-y\":\n return {type: reflectY};\n case \"mercator\":\n return scaleProjection(geoMercator, tau, tau);\n case \"orthographic\":\n return scaleProjection(geoOrthographic, 2, 2);\n case \"stereographic\":\n return scaleProjection(geoStereographic, 2, 2);\n case \"transverse-mercator\":\n return scaleProjection(geoTransverseMercator, tau, tau);\n default:\n throw new Error(`unknown projection type: ${projection}`);\n }\n}\n\nfunction maybePostClip(clip, x1, y1, x2, y2) {\n if (clip === false || clip == null || typeof clip === \"number\") return (s) => s;\n if (clip === true) clip = \"frame\";\n switch (`${clip}`.toLowerCase()) {\n case \"frame\":\n return geoClipRectangle(x1, y1, x2, y2);\n default:\n throw new Error(`unknown projection clip type: ${clip}`);\n }\n}\n\nfunction scaleProjection(createProjection, kx, ky) {\n return {\n type: ({width, height, rotate, precision = 0.15, clip}) => {\n const projection = createProjection();\n if (precision != null) projection.precision?.(precision);\n if (rotate != null) projection.rotate?.(rotate);\n if (typeof clip === \"number\") projection.clipAngle?.(clip);\n projection.scale(Math.min(width / kx, height / ky));\n projection.translate([width / 2, height / 2]);\n return projection;\n },\n aspectRatio: ky / kx\n };\n}\n\nfunction conicProjection(createProjection, kx, ky) {\n const {type, aspectRatio} = scaleProjection(createProjection, kx, ky);\n return {\n type: (options) => {\n const {parallels, domain, width, height} = options;\n const projection = type(options);\n if (parallels != null) {\n projection.parallels(parallels);\n if (domain === undefined) {\n projection.fitSize([width, height], {type: \"Sphere\"});\n }\n }\n return projection;\n },\n aspectRatio\n };\n}\n\nconst identity = constant({stream: (stream) => stream});\n\nconst reflectY = constant(\n geoTransform({\n point(x, y) {\n this.stream.point(x, -y);\n }\n })\n);\n\n// Applies a point-wise projection to the given paired x and y channels.\n// Note: mutates values!\nexport function project(cx, cy, values, projection) {\n const x = values[cx];\n const y = values[cy];\n const n = x.length;\n const X = (values[cx] = new Float64Array(n).fill(NaN));\n const Y = (values[cy] = new Float64Array(n).fill(NaN));\n let i;\n const stream = projection.stream({\n point(x, y) {\n X[i] = x;\n Y[i] = y;\n }\n });\n for (i = 0; i < n; ++i) {\n stream.point(x[i], y[i]);\n }\n}\n\n// Returns true if a projection was specified. This should match the logic of\n// createProjection above, and is called before we construct the projection.\n// (Though note that we ignore the edge case where the projection initializer\n// may return null.)\nexport function hasProjection({projection} = {}) {\n if (projection == null) return false;\n if (typeof projection.stream === \"function\") return true;\n if (isObject(projection)) projection = projection.type;\n return projection != null;\n}\n\n// When a named projection is specified, we can use its natural aspect ratio to\n// determine a good value for the projection\u2019s height based on the desired\n// width. When we don\u2019t have a way to know, the golden ratio is our best guess.\n// Due to a circular dependency (we need to know the height before we can\n// construct the projection), we have to test the raw projection option rather\n// than the materialized projection; therefore we must be extremely careful that\n// the logic of this function exactly matches createProjection above!\nexport function projectionAspectRatio(projection) {\n if (typeof projection?.stream === \"function\") return defaultAspectRatio;\n if (isObject(projection)) projection = projection.type;\n if (projection == null) return;\n if (typeof projection !== \"function\") {\n const {aspectRatio} = namedProjection(projection);\n if (aspectRatio) return aspectRatio;\n }\n return defaultAspectRatio;\n}\n\n// Extract the (possibly) scaled values for the x and y channels, and apply the\n// projection if any.\nexport function applyPosition(channels, scales, {projection}) {\n const {x, y} = channels;\n let position = {};\n if (x) position.x = x;\n if (y) position.y = y;\n position = valueObject(position, scales);\n if (projection && x?.scale === \"x\" && y?.scale === \"y\") project(\"x\", \"y\", position, projection);\n if (x) position.x = coerceNumbers(position.x);\n if (y) position.y = coerceNumbers(position.y);\n return position;\n}\n\nexport function getGeometryChannels(channel) {\n const X = [];\n const Y = [];\n const x = {scale: \"x\", value: X};\n const y = {scale: \"y\", value: Y};\n const sink = {\n point(x, y) {\n X.push(x);\n Y.push(y);\n },\n lineStart() {},\n lineEnd() {},\n polygonStart() {},\n polygonEnd() {},\n sphere() {}\n };\n for (const object of channel.value) geoStream(object, sink);\n return [x, y];\n}\n", "import {\n interpolateBlues,\n interpolateBrBG,\n interpolateBuGn,\n interpolateBuPu,\n interpolateGnBu,\n interpolateGreens,\n interpolateGreys,\n interpolateOranges,\n interpolateOrRd,\n interpolatePiYG,\n interpolatePRGn,\n interpolatePuBu,\n interpolatePuBuGn,\n interpolatePuOr,\n interpolatePuRd,\n interpolatePurples,\n interpolateRdBu,\n interpolateRdGy,\n interpolateRdPu,\n interpolateRdYlBu,\n interpolateRdYlGn,\n interpolateReds,\n interpolateSpectral,\n interpolateYlGn,\n interpolateYlGnBu,\n interpolateYlOrBr,\n interpolateYlOrRd,\n interpolateTurbo,\n interpolateViridis,\n interpolateMagma,\n interpolateInferno,\n interpolatePlasma,\n interpolateCividis,\n interpolateCubehelixDefault,\n interpolateWarm,\n interpolateCool,\n interpolateRainbow,\n interpolateSinebow,\n quantize,\n schemeAccent,\n schemeBlues,\n schemeBrBG,\n schemeBuGn,\n schemeBuPu,\n schemeCategory10,\n schemeDark2,\n schemeGnBu,\n schemeGreens,\n schemeGreys,\n schemeObservable10,\n schemeOranges,\n schemeOrRd,\n schemePaired,\n schemePastel1,\n schemePastel2,\n schemePiYG,\n schemePRGn,\n schemePuBu,\n schemePuBuGn,\n schemePuOr,\n schemePuRd,\n schemePurples,\n schemeRdBu,\n schemeRdGy,\n schemeRdPu,\n schemeRdYlBu,\n schemeRdYlGn,\n schemeReds,\n schemeSet1,\n schemeSet2,\n schemeSet3,\n schemeSpectral,\n schemeTableau10,\n schemeYlGn,\n schemeYlGnBu,\n schemeYlOrBr,\n schemeYlOrRd\n} from \"d3\";\n\nconst categoricalSchemes = new Map([\n [\"accent\", schemeAccent],\n [\"category10\", schemeCategory10],\n [\"dark2\", schemeDark2],\n [\"observable10\", schemeObservable10],\n [\"paired\", schemePaired],\n [\"pastel1\", schemePastel1],\n [\"pastel2\", schemePastel2],\n [\"set1\", schemeSet1],\n [\"set2\", schemeSet2],\n [\"set3\", schemeSet3],\n [\"tableau10\", schemeTableau10]\n]);\n\nexport function isCategoricalScheme(scheme) {\n return scheme != null && categoricalSchemes.has(`${scheme}`.toLowerCase());\n}\n\nconst ordinalSchemes = new Map([\n ...categoricalSchemes,\n\n // diverging\n [\"brbg\", scheme11(schemeBrBG, interpolateBrBG)],\n [\"prgn\", scheme11(schemePRGn, interpolatePRGn)],\n [\"piyg\", scheme11(schemePiYG, interpolatePiYG)],\n [\"puor\", scheme11(schemePuOr, interpolatePuOr)],\n [\"rdbu\", scheme11(schemeRdBu, interpolateRdBu)],\n [\"rdgy\", scheme11(schemeRdGy, interpolateRdGy)],\n [\"rdylbu\", scheme11(schemeRdYlBu, interpolateRdYlBu)],\n [\"rdylgn\", scheme11(schemeRdYlGn, interpolateRdYlGn)],\n [\"spectral\", scheme11(schemeSpectral, interpolateSpectral)],\n\n // reversed diverging (for temperature data)\n [\"burd\", scheme11r(schemeRdBu, interpolateRdBu)],\n [\"buylrd\", scheme11r(schemeRdYlBu, interpolateRdYlBu)],\n\n // sequential (single-hue)\n [\"blues\", scheme9(schemeBlues, interpolateBlues)],\n [\"greens\", scheme9(schemeGreens, interpolateGreens)],\n [\"greys\", scheme9(schemeGreys, interpolateGreys)],\n [\"oranges\", scheme9(schemeOranges, interpolateOranges)],\n [\"purples\", scheme9(schemePurples, interpolatePurples)],\n [\"reds\", scheme9(schemeReds, interpolateReds)],\n\n // sequential (multi-hue)\n [\"turbo\", schemei(interpolateTurbo)],\n [\"viridis\", schemei(interpolateViridis)],\n [\"magma\", schemei(interpolateMagma)],\n [\"inferno\", schemei(interpolateInferno)],\n [\"plasma\", schemei(interpolatePlasma)],\n [\"cividis\", schemei(interpolateCividis)],\n [\"cubehelix\", schemei(interpolateCubehelixDefault)],\n [\"warm\", schemei(interpolateWarm)],\n [\"cool\", schemei(interpolateCool)],\n [\"bugn\", scheme9(schemeBuGn, interpolateBuGn)],\n [\"bupu\", scheme9(schemeBuPu, interpolateBuPu)],\n [\"gnbu\", scheme9(schemeGnBu, interpolateGnBu)],\n [\"orrd\", scheme9(schemeOrRd, interpolateOrRd)],\n [\"pubu\", scheme9(schemePuBu, interpolatePuBu)],\n [\"pubugn\", scheme9(schemePuBuGn, interpolatePuBuGn)],\n [\"purd\", scheme9(schemePuRd, interpolatePuRd)],\n [\"rdpu\", scheme9(schemeRdPu, interpolateRdPu)],\n [\"ylgn\", scheme9(schemeYlGn, interpolateYlGn)],\n [\"ylgnbu\", scheme9(schemeYlGnBu, interpolateYlGnBu)],\n [\"ylorbr\", scheme9(schemeYlOrBr, interpolateYlOrBr)],\n [\"ylorrd\", scheme9(schemeYlOrRd, interpolateYlOrRd)],\n\n // cyclical\n [\"rainbow\", schemeicyclical(interpolateRainbow)],\n [\"sinebow\", schemeicyclical(interpolateSinebow)]\n]);\n\nfunction scheme9(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 1) return [scheme[3][1]]; // favor midpoint\n if (n === 2) return [scheme[3][1], scheme[3][2]]; // favor darker\n n = Math.max(3, Math.floor(n));\n return n > 9 ? quantize(interpolate, n) : scheme[n];\n };\n}\n\nfunction scheme11(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 2) return [scheme[3][0], scheme[3][2]]; // favor diverging extrema\n n = Math.max(3, Math.floor(n));\n return n > 11 ? quantize(interpolate, n) : scheme[n];\n };\n}\n\nfunction scheme11r(scheme, interpolate) {\n return ({length: n}) => {\n if (n === 2) return [scheme[3][2], scheme[3][0]]; // favor diverging extrema\n n = Math.max(3, Math.floor(n));\n return n > 11 ? quantize((t) => interpolate(1 - t), n) : scheme[n].slice().reverse();\n };\n}\n\nfunction schemei(interpolate) {\n return ({length: n}) => quantize(interpolate, Math.max(2, Math.floor(n)));\n}\n\nfunction schemeicyclical(interpolate) {\n return ({length: n}) => quantize(interpolate, Math.floor(n) + 1).slice(0, -1);\n}\n\nexport function ordinalScheme(scheme) {\n const s = `${scheme}`.toLowerCase();\n if (!ordinalSchemes.has(s)) throw new Error(`unknown ordinal scheme: ${s}`);\n return ordinalSchemes.get(s);\n}\n\nexport function ordinalRange(scheme, length) {\n const s = ordinalScheme(scheme);\n const r = typeof s === \"function\" ? s({length}) : s;\n return r.length !== length ? r.slice(0, length) : r;\n}\n\n// If the specified domain contains only booleans (ignoring null and undefined),\n// returns a corresponding range where false is mapped to the low color and true\n// is mapped to the high color of the specified scheme.\nexport function maybeBooleanRange(domain, scheme = \"greys\") {\n const range = new Set();\n const [f, t] = ordinalRange(scheme, 2);\n for (const value of domain) {\n if (value == null) continue;\n if (value === true) range.add(t);\n else if (value === false) range.add(f);\n else return;\n }\n return [...range];\n}\n\nconst quantitativeSchemes = new Map([\n // diverging\n [\"brbg\", interpolateBrBG],\n [\"prgn\", interpolatePRGn],\n [\"piyg\", interpolatePiYG],\n [\"puor\", interpolatePuOr],\n [\"rdbu\", interpolateRdBu],\n [\"rdgy\", interpolateRdGy],\n [\"rdylbu\", interpolateRdYlBu],\n [\"rdylgn\", interpolateRdYlGn],\n [\"spectral\", interpolateSpectral],\n\n // reversed diverging (for temperature data)\n [\"burd\", (t) => interpolateRdBu(1 - t)],\n [\"buylrd\", (t) => interpolateRdYlBu(1 - t)],\n\n // sequential (single-hue)\n [\"blues\", interpolateBlues],\n [\"greens\", interpolateGreens],\n [\"greys\", interpolateGreys],\n [\"purples\", interpolatePurples],\n [\"reds\", interpolateReds],\n [\"oranges\", interpolateOranges],\n\n // sequential (multi-hue)\n [\"turbo\", interpolateTurbo],\n [\"viridis\", interpolateViridis],\n [\"magma\", interpolateMagma],\n [\"inferno\", interpolateInferno],\n [\"plasma\", interpolatePlasma],\n [\"cividis\", interpolateCividis],\n [\"cubehelix\", interpolateCubehelixDefault],\n [\"warm\", interpolateWarm],\n [\"cool\", interpolateCool],\n [\"bugn\", interpolateBuGn],\n [\"bupu\", interpolateBuPu],\n [\"gnbu\", interpolateGnBu],\n [\"orrd\", interpolateOrRd],\n [\"pubugn\", interpolatePuBuGn],\n [\"pubu\", interpolatePuBu],\n [\"purd\", interpolatePuRd],\n [\"rdpu\", interpolateRdPu],\n [\"ylgnbu\", interpolateYlGnBu],\n [\"ylgn\", interpolateYlGn],\n [\"ylorbr\", interpolateYlOrBr],\n [\"ylorrd\", interpolateYlOrRd],\n\n // cyclical\n [\"rainbow\", interpolateRainbow],\n [\"sinebow\", interpolateSinebow]\n]);\n\nexport function quantitativeScheme(scheme) {\n const s = `${scheme}`.toLowerCase();\n if (!quantitativeSchemes.has(s)) throw new Error(`unknown quantitative scheme: ${s}`);\n return quantitativeSchemes.get(s);\n}\n\nconst divergingSchemes = new Set([\n \"brbg\",\n \"prgn\",\n \"piyg\",\n \"puor\",\n \"rdbu\",\n \"rdgy\",\n \"rdylbu\",\n \"rdylgn\",\n \"spectral\",\n \"burd\",\n \"buylrd\"\n]);\n\nexport function isDivergingScheme(scheme) {\n return scheme != null && divergingSchemes.has(`${scheme}`.toLowerCase());\n}\n", "import {\n descending,\n extent,\n interpolateHcl,\n interpolateHsl,\n interpolateLab,\n interpolateNumber,\n interpolateRgb,\n interpolateRound,\n max,\n median,\n min,\n piecewise,\n quantile,\n quantize,\n reverse as reverseof,\n scaleIdentity,\n scaleLinear,\n scaleLog,\n scalePow,\n scaleQuantile,\n scaleSymlog,\n scaleThreshold,\n ticks\n} from \"d3\";\nimport {finite, negative, positive} from \"../defined.js\";\nimport {arrayify, constant, maybeNiceInterval, maybeRangeInterval, slice} from \"../options.js\";\nimport {orderof} from \"../order.js\";\nimport {color, length, opacity, radius, registry, hasNumericRange} from \"./index.js\";\nimport {ordinalRange, quantitativeScheme} from \"./schemes.js\";\n\nexport const flip = (i) => (t) => i(1 - t);\nconst unit = [0, 1];\n\nconst interpolators = new Map([\n // numbers\n [\"number\", interpolateNumber],\n\n // color spaces\n [\"rgb\", interpolateRgb],\n [\"hsl\", interpolateHsl],\n [\"hcl\", interpolateHcl],\n [\"lab\", interpolateLab]\n]);\n\nexport function maybeInterpolator(interpolate) {\n const i = `${interpolate}`.toLowerCase();\n if (!interpolators.has(i)) throw new Error(`unknown interpolator: ${i}`);\n return interpolators.get(i);\n}\n\nexport function createScaleQ(\n key,\n scale,\n channels,\n {\n type,\n nice,\n clamp,\n zero,\n domain = inferAutoDomain(key, channels),\n unknown,\n round,\n scheme,\n interval,\n range = registry.get(key) === radius\n ? inferRadialRange(channels, domain)\n : registry.get(key) === length\n ? inferLengthRange(channels, domain)\n : registry.get(key) === opacity\n ? unit\n : undefined,\n interpolate = registry.get(key) === color\n ? scheme == null && range !== undefined\n ? interpolateRgb\n : quantitativeScheme(scheme !== undefined ? scheme : type === \"cyclical\" ? \"rainbow\" : \"turbo\")\n : round\n ? interpolateRound\n : interpolateNumber,\n reverse\n }\n) {\n interval = maybeRangeInterval(interval, type);\n if (type === \"cyclical\" || type === \"sequential\") type = \"linear\"; // shorthand for color schemes\n if (typeof interpolate !== \"function\") interpolate = maybeInterpolator(interpolate); // named interpolator\n reverse = !!reverse;\n\n // If an explicit range is specified, and it has a different length than the\n // domain, then redistribute the range using a piecewise interpolator.\n if (range !== undefined) {\n const n = (domain = arrayify(domain)).length;\n const m = (range = arrayify(range)).length;\n if (n !== m) {\n if (interpolate.length === 1) throw new Error(\"invalid piecewise interpolator\"); // e.g., turbo\n interpolate = piecewise(interpolate, range);\n range = undefined;\n }\n }\n\n // Disambiguate between a two-argument interpolator that is used in\n // conjunction with the range, and a one-argument \u201Cfixed\u201D interpolator on the\n // [0, 1] interval as with the RdBu color scheme.\n if (interpolate.length === 1) {\n if (reverse) {\n interpolate = flip(interpolate);\n reverse = false;\n }\n if (range === undefined) {\n range = Float64Array.from(domain, (_, i) => i / (domain.length - 1));\n if (range.length === 2) range = unit; // optimize common case of [0, 1]\n }\n scale.interpolate((range === unit ? constant : interpolatePiecewise)(interpolate));\n } else {\n scale.interpolate(interpolate);\n }\n\n // If a zero option is specified, we assume that the domain is numeric, and we\n // want to ensure that the domain crosses zero. However, note that the domain\n // may be reversed (descending) so we shouldn\u2019t assume that the first value is\n // smaller than the last; and also it\u2019s possible that the domain has more than\n // two values for a \u201Cpoly\u201D scale. And lastly be careful not to mutate input!\n if (zero) {\n const [min, max] = extent(domain);\n if (min > 0 || max < 0) {\n domain = slice(domain);\n if (orderof(domain) !== Math.sign(min)) domain[domain.length - 1] = 0; // [2, 1] or [-2, -1]\n else domain[0] = 0; // [1, 2] or [-1, -2]\n }\n }\n\n if (reverse) domain = reverseof(domain);\n scale.domain(domain).unknown(unknown);\n if (nice) scale.nice(maybeNice(nice, type)), (domain = scale.domain());\n if (range !== undefined) scale.range(range);\n if (clamp) scale.clamp(clamp);\n return {type, domain, range, scale, interpolate, interval};\n}\n\nfunction maybeNice(nice, type) {\n return nice === true ? undefined : typeof nice === \"number\" ? nice : maybeNiceInterval(nice, type);\n}\n\nexport function createScaleLinear(key, channels, options) {\n return createScaleQ(key, scaleLinear(), channels, options);\n}\n\nexport function createScaleSqrt(key, channels, options) {\n return createScalePow(key, channels, {...options, exponent: 0.5});\n}\n\nexport function createScalePow(key, channels, {exponent = 1, ...options}) {\n return createScaleQ(key, scalePow().exponent(exponent), channels, {...options, type: \"pow\"});\n}\n\nexport function createScaleLog(key, channels, {base = 10, domain = inferLogDomain(channels), ...options}) {\n return createScaleQ(key, scaleLog().base(base), channels, {...options, domain});\n}\n\nexport function createScaleSymlog(key, channels, {constant = 1, ...options}) {\n return createScaleQ(key, scaleSymlog().constant(constant), channels, options);\n}\n\nexport function createScaleQuantile(\n key,\n channels,\n {\n range,\n quantiles = range === undefined ? 5 : (range = [...range]).length, // deprecated; use n instead\n n = quantiles,\n scheme = \"rdylbu\",\n domain = inferQuantileDomain(channels),\n unknown,\n interpolate,\n reverse\n }\n) {\n if (range === undefined) {\n range =\n interpolate !== undefined\n ? quantize(interpolate, n)\n : registry.get(key) === color\n ? ordinalRange(scheme, n)\n : undefined;\n }\n if (domain.length > 0) {\n domain = scaleQuantile(domain, range === undefined ? {length: n} : range).quantiles();\n }\n return createScaleThreshold(key, channels, {domain, range, reverse, unknown});\n}\n\nexport function createScaleQuantize(\n key,\n channels,\n {\n range,\n n = range === undefined ? 5 : (range = [...range]).length,\n scheme = \"rdylbu\",\n domain = inferAutoDomain(key, channels),\n unknown,\n interpolate,\n reverse\n }\n) {\n const [min, max] = extent(domain);\n let thresholds;\n if (range === undefined) {\n thresholds = ticks(min, max, n); // approximate number of nice, round thresholds\n if (thresholds[0] <= min) thresholds.splice(0, 1); // drop exact lower bound\n if (thresholds[thresholds.length - 1] >= max) thresholds.pop(); // drop exact upper bound\n n = thresholds.length + 1;\n range =\n interpolate !== undefined\n ? quantize(interpolate, n)\n : registry.get(key) === color\n ? ordinalRange(scheme, n)\n : undefined;\n } else {\n thresholds = quantize(interpolateNumber(min, max), n + 1).slice(1, -1); // exactly n - 1 thresholds to match range\n if (min instanceof Date) thresholds = thresholds.map((x) => new Date(x)); // preserve date types\n }\n if (orderof(arrayify(domain)) < 0) thresholds.reverse(); // preserve descending domain\n return createScaleThreshold(key, channels, {domain: thresholds, range, reverse, unknown});\n}\n\nexport function createScaleThreshold(\n key,\n channels,\n {\n domain = [0], // explicit thresholds in ascending order\n unknown,\n scheme = \"rdylbu\",\n interpolate,\n range = interpolate !== undefined\n ? quantize(interpolate, domain.length + 1)\n : registry.get(key) === color\n ? ordinalRange(scheme, domain.length + 1)\n : undefined,\n reverse\n }\n) {\n domain = arrayify(domain);\n const sign = orderof(domain); // preserve descending domain\n if (!isNaN(sign) && !isOrdered(domain, sign)) throw new Error(`the ${key} scale has a non-monotonic domain`);\n if (reverse) range = reverseof(range); // domain ascending, so reverse range\n return {\n type: \"threshold\",\n scale: scaleThreshold(sign < 0 ? reverseof(domain) : domain, range === undefined ? [] : range).unknown(unknown),\n domain,\n range\n };\n}\n\nfunction isOrdered(domain, sign) {\n for (let i = 1, n = domain.length, d = domain[0]; i < n; ++i) {\n const s = descending(d, (d = domain[i]));\n if (s !== 0 && s !== sign) return false;\n }\n return true;\n}\n\n// For non-numeric identity scales such as color and symbol, we can\u2019t use D3\u2019s\n// identity scale because it coerces to number; and we can\u2019t compute the domain\n// (and equivalently range) since we can\u2019t know whether the values are\n// continuous or discrete.\nexport function createScaleIdentity(key) {\n return {type: \"identity\", scale: hasNumericRange(registry.get(key)) ? scaleIdentity() : (d) => d};\n}\n\nexport function inferDomain(channels, f = finite) {\n return channels.length\n ? [\n min(channels, ({value}) => (value === undefined ? value : min(value, f))),\n max(channels, ({value}) => (value === undefined ? value : max(value, f)))\n ]\n : [0, 1];\n}\n\nfunction inferAutoDomain(key, channels) {\n const type = registry.get(key);\n return (type === radius || type === opacity || type === length ? inferZeroDomain : inferDomain)(channels);\n}\n\nfunction inferZeroDomain(channels) {\n return [0, channels.length ? max(channels, ({value}) => (value === undefined ? value : max(value, finite))) : 1];\n}\n\n// We don\u2019t want the upper bound of the radial domain to be zero, as this would\n// be degenerate, so we ignore nonpositive values. We also don\u2019t want the\n// maximum default radius to exceed 30px.\nfunction inferRadialRange(channels, domain) {\n const hint = channels.find(({radius}) => radius !== undefined);\n if (hint !== undefined) return [0, hint.radius]; // a natural maximum radius, e.g. hexbins\n const h25 = quantile(channels, 0.5, ({value}) => (value === undefined ? NaN : quantile(value, 0.25, positive)));\n const range = domain.map((d) => 3 * Math.sqrt(d / h25));\n const k = 30 / max(range);\n return k < 1 ? range.map((r) => r * k) : range;\n}\n\n// We want a length scale\u2019s domain to go from zero to a positive value, and to\n// treat negative lengths if any as inverted vectors of equivalent magnitude. We\n// also don\u2019t want the maximum default length to exceed 60px.\nfunction inferLengthRange(channels, domain) {\n const h50 = median(channels, ({value}) => (value === undefined ? NaN : median(value, Math.abs)));\n const range = domain.map((d) => (12 * d) / h50);\n const k = 60 / max(range);\n return k < 1 ? range.map((r) => r * k) : range;\n}\n\nfunction inferLogDomain(channels) {\n for (const {value} of channels) {\n if (value !== undefined) {\n for (let v of value) {\n if (v > 0) return inferDomain(channels, positive);\n if (v < 0) return inferDomain(channels, negative);\n }\n }\n }\n return [1, 10];\n}\n\nfunction inferQuantileDomain(channels) {\n const domain = [];\n for (const {value} of channels) {\n if (value === undefined) continue;\n for (const v of value) domain.push(v);\n }\n return domain;\n}\n\nexport function interpolatePiecewise(interpolate) {\n return (i, j) => (t) => interpolate(i + t * (j - i));\n}\n", "import {\n descending,\n interpolateNumber,\n interpolateRgb,\n piecewise,\n scaleDiverging,\n scaleDivergingLog,\n scaleDivergingPow,\n scaleDivergingSymlog\n} from \"d3\";\nimport {negative, positive} from \"../defined.js\";\nimport {arrayify} from \"../options.js\";\nimport {warn} from \"../warnings.js\";\nimport {color, registry} from \"./index.js\";\nimport {flip, inferDomain, interpolatePiecewise, maybeInterpolator} from \"./quantitative.js\";\nimport {quantitativeScheme} from \"./schemes.js\";\n\nfunction createScaleD(\n key,\n scale,\n transform,\n channels,\n {\n type,\n nice,\n clamp,\n domain = inferDomain(channels),\n unknown,\n pivot = 0,\n scheme,\n range,\n symmetric = true,\n interpolate = registry.get(key) === color\n ? scheme == null && range !== undefined\n ? interpolateRgb\n : quantitativeScheme(scheme !== undefined ? scheme : \"rdbu\")\n : interpolateNumber,\n reverse\n }\n) {\n pivot = +pivot;\n domain = arrayify(domain);\n let [min, max] = domain;\n if (domain.length > 2) warn(`Warning: the diverging ${key} scale domain contains extra elements.`);\n\n if (descending(min, max) < 0) ([min, max] = [max, min]), (reverse = !reverse);\n min = Math.min(min, pivot);\n max = Math.max(max, pivot);\n\n // Sometimes interpolate is a named interpolator, such as \"lab\" for Lab color\n // space. Other times interpolate is a function that takes two arguments and\n // is used in conjunction with the range. And other times the interpolate\n // function is a \u201Cfixed\u201D interpolator on the [0, 1] interval, as when a\n // color scheme such as interpolateRdBu is used.\n if (typeof interpolate !== \"function\") {\n interpolate = maybeInterpolator(interpolate);\n }\n\n // If an explicit range is specified, promote it to a piecewise interpolator.\n if (range !== undefined) {\n interpolate =\n interpolate.length === 1 ? interpolatePiecewise(interpolate)(...range) : piecewise(interpolate, range);\n }\n\n // Reverse before normalization.\n if (reverse) interpolate = flip(interpolate);\n\n // Normalize the interpolator for symmetric difference around the pivot.\n if (symmetric) {\n const mid = transform.apply(pivot);\n const mindelta = mid - transform.apply(min);\n const maxdelta = transform.apply(max) - mid;\n if (mindelta < maxdelta) min = transform.invert(mid - maxdelta);\n else if (mindelta > maxdelta) max = transform.invert(mid + mindelta);\n }\n\n scale.domain([min, pivot, max]).unknown(unknown).interpolator(interpolate);\n if (clamp) scale.clamp(clamp);\n if (nice) scale.nice(nice);\n return {type, domain: [min, max], pivot, interpolate, scale};\n}\n\nexport function createScaleDiverging(key, channels, options) {\n return createScaleD(key, scaleDiverging(), transformIdentity, channels, options);\n}\n\nexport function createScaleDivergingSqrt(key, channels, options) {\n return createScaleDivergingPow(key, channels, {...options, exponent: 0.5});\n}\n\nexport function createScaleDivergingPow(key, channels, {exponent = 1, ...options}) {\n return createScaleD(key, scaleDivergingPow().exponent((exponent = +exponent)), transformPow(exponent), channels, {\n ...options,\n type: \"diverging-pow\"\n });\n}\n\nexport function createScaleDivergingLog(\n key,\n channels,\n {base = 10, pivot = 1, domain = inferDomain(channels, pivot < 0 ? negative : positive), ...options}\n) {\n return createScaleD(key, scaleDivergingLog().base((base = +base)), transformLog, channels, {\n domain,\n pivot,\n ...options\n });\n}\n\nexport function createScaleDivergingSymlog(key, channels, {constant = 1, ...options}) {\n return createScaleD(\n key,\n scaleDivergingSymlog().constant((constant = +constant)),\n transformSymlog(constant),\n channels,\n options\n );\n}\n\nconst transformIdentity = {\n apply(x) {\n return x;\n },\n invert(x) {\n return x;\n }\n};\n\nconst transformLog = {\n apply: Math.log,\n invert: Math.exp\n};\n\nconst transformSqrt = {\n apply(x) {\n return Math.sign(x) * Math.sqrt(Math.abs(x));\n },\n invert(x) {\n return Math.sign(x) * (x * x);\n }\n};\n\nfunction transformPow(exponent) {\n return exponent === 0.5\n ? transformSqrt\n : {\n apply(x) {\n return Math.sign(x) * Math.pow(Math.abs(x), exponent);\n },\n invert(x) {\n return Math.sign(x) * Math.pow(Math.abs(x), 1 / exponent);\n }\n };\n}\n\nfunction transformSymlog(constant) {\n return {\n apply(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / constant));\n },\n invert(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * constant;\n }\n };\n}\n", "import {scaleTime, scaleUtc} from \"d3\";\nimport {createScaleQ} from \"./quantitative.js\";\n\nfunction createScaleT(key, scale, channels, options) {\n return createScaleQ(key, scale, channels, options);\n}\n\nexport function createScaleTime(key, channels, options) {\n return createScaleT(key, scaleTime(), channels, options);\n}\n\nexport function createScaleUtc(key, channels, options) {\n return createScaleT(key, scaleUtc(), channels, options);\n}\n", "import {InternSet, extent, quantize, reverse as reverseof, sort, symbolsFill, symbolsStroke} from \"d3\";\nimport {scaleBand, scaleOrdinal, scalePoint, scaleImplicit} from \"d3\";\nimport {ascendingDefined} from \"../defined.js\";\nimport {isNoneish, map, maybeRangeInterval} from \"../options.js\";\nimport {maybeSymbol} from \"../symbol.js\";\nimport {registry, color, position, symbol} from \"./index.js\";\nimport {maybeBooleanRange, ordinalScheme, quantitativeScheme} from \"./schemes.js\";\n\n// This denotes an implicitly ordinal color scale: the scale type was not set,\n// but the associated values are strings or booleans. If the associated defined\n// values are entirely boolean, the range will default to greys. You can opt out\n// of this by setting the type explicitly.\nexport const ordinalImplicit = Symbol(\"ordinal\");\n\nfunction createScaleO(key, scale, channels, {type, interval, domain, range, reverse, hint}) {\n interval = maybeRangeInterval(interval, type);\n if (domain === undefined) domain = inferDomain(channels, interval, key);\n if (type === \"categorical\" || type === ordinalImplicit) type = \"ordinal\"; // shorthand for color schemes\n if (reverse) domain = reverseof(domain);\n domain = scale.domain(domain).domain(); // deduplicate\n if (range !== undefined) {\n // If the range is specified as a function, pass it the domain.\n if (typeof range === \"function\") range = range(domain);\n scale.range(range);\n }\n return {type, domain, range, scale, hint, interval};\n}\n\nexport function createScaleOrdinal(key, channels, {type, interval, domain, range, scheme, unknown, ...options}) {\n interval = maybeRangeInterval(interval, type);\n if (domain === undefined) domain = inferDomain(channels, interval, key);\n let hint;\n if (registry.get(key) === symbol) {\n hint = inferSymbolHint(channels);\n range = range === undefined ? inferSymbolRange(hint) : map(range, maybeSymbol);\n } else if (registry.get(key) === color) {\n if (range === undefined && (type === \"ordinal\" || type === ordinalImplicit)) {\n range = maybeBooleanRange(domain, scheme);\n if (range !== undefined) scheme = undefined; // Don\u2019t re-apply scheme.\n }\n if (scheme === undefined && range === undefined) {\n scheme = type === \"ordinal\" ? \"turbo\" : \"observable10\";\n }\n if (scheme !== undefined) {\n if (range !== undefined) {\n const interpolate = quantitativeScheme(scheme);\n const t0 = range[0],\n d = range[1] - range[0];\n range = ({length: n}) => quantize((t) => interpolate(t0 + d * t), n);\n } else {\n range = ordinalScheme(scheme);\n }\n }\n }\n if (unknown === scaleImplicit) {\n throw new Error(`implicit unknown on ${key} scale is not supported`);\n }\n return createScaleO(key, scaleOrdinal().unknown(unknown), channels, {...options, type, domain, range, hint});\n}\n\nexport function createScalePoint(key, channels, {align = 0.5, padding = 0.5, ...options}) {\n return maybeRound(scalePoint().align(align).padding(padding), channels, options, key);\n}\n\nexport function createScaleBand(\n key,\n channels,\n {\n align = 0.5,\n padding = 0.1,\n paddingInner = padding,\n paddingOuter = key === \"fx\" || key === \"fy\" ? 0 : padding,\n ...options\n }\n) {\n return maybeRound(\n scaleBand().align(align).paddingInner(paddingInner).paddingOuter(paddingOuter),\n channels,\n options,\n key\n );\n}\n\nfunction maybeRound(scale, channels, options, key) {\n let {round} = options;\n if (round !== undefined) scale.round((round = !!round));\n scale = createScaleO(key, scale, channels, options);\n scale.round = round; // preserve for autoScaleRound\n return scale;\n}\n\nfunction inferDomain(channels, interval, key) {\n const values = new InternSet();\n for (const {value, domain} of channels) {\n if (domain !== undefined) return domain(); // see channelDomain\n if (value === undefined) continue;\n for (const v of value) values.add(v);\n }\n if (interval !== undefined) {\n const [min, max] = extent(values).map(interval.floor, interval);\n return interval.range(min, interval.offset(max));\n }\n if (values.size > 10e3 && registry.get(key) === position) {\n throw new Error(`implicit ordinal domain of ${key} scale has more than 10,000 values`);\n }\n return sort(values, ascendingDefined);\n}\n\n// If all channels provide a consistent hint, propagate it to the scale.\nfunction inferHint(channels, key) {\n let value;\n for (const {hint} of channels) {\n const candidate = hint?.[key];\n if (candidate === undefined) continue; // no hint here\n if (value === undefined) value = candidate; // first hint\n else if (value !== candidate) return; // inconsistent hint\n }\n return value;\n}\n\nfunction inferSymbolHint(channels) {\n return {\n fill: inferHint(channels, \"fill\"),\n stroke: inferHint(channels, \"stroke\")\n };\n}\n\nfunction inferSymbolRange(hint) {\n return isNoneish(hint.fill) ? symbolsStroke : symbolsFill;\n}\n", "import {\n isOrdinal,\n isTemporal,\n isTemporalString,\n isNumericString,\n isScaleOptions,\n map,\n slice,\n coerceNumbers,\n coerceDates\n} from \"./options.js\";\nimport {orderof} from \"./order.js\";\nimport {registry, color, position, radius, opacity, symbol, length} from \"./scales/index.js\";\nimport {\n createScaleLinear,\n createScaleSqrt,\n createScalePow,\n createScaleLog,\n createScaleSymlog,\n createScaleQuantile,\n createScaleQuantize,\n createScaleThreshold,\n createScaleIdentity\n} from \"./scales/quantitative.js\";\nimport {\n createScaleDiverging,\n createScaleDivergingSqrt,\n createScaleDivergingPow,\n createScaleDivergingLog,\n createScaleDivergingSymlog\n} from \"./scales/diverging.js\";\nimport {isCategoricalScheme, isDivergingScheme} from \"./scales/schemes.js\";\nimport {createScaleTime, createScaleUtc} from \"./scales/temporal.js\";\nimport {createScaleOrdinal, createScalePoint, createScaleBand, ordinalImplicit} from \"./scales/ordinal.js\";\nimport {maybeSymbol} from \"./symbol.js\";\nimport {warn} from \"./warnings.js\";\n\nexport function createScales(\n channelsByScale,\n {\n label: globalLabel,\n inset: globalInset = 0,\n insetTop: globalInsetTop = globalInset,\n insetRight: globalInsetRight = globalInset,\n insetBottom: globalInsetBottom = globalInset,\n insetLeft: globalInsetLeft = globalInset,\n round,\n nice,\n clamp,\n zero,\n align,\n padding,\n projection,\n facet: {label: facetLabel = globalLabel} = {},\n ...options\n } = {}\n) {\n const scales = {};\n for (const [key, channels] of channelsByScale) {\n const scaleOptions = options[key];\n const scale = createScale(key, channels, {\n round: registry.get(key) === position ? round : undefined, // only for position\n nice,\n clamp,\n zero,\n align,\n padding,\n projection,\n ...scaleOptions\n });\n if (scale) {\n // populate generic scale options (percent, transform, insets)\n let {\n label = key === \"fx\" || key === \"fy\" ? facetLabel : globalLabel,\n percent,\n transform,\n inset,\n insetTop = inset !== undefined ? inset : key === \"y\" ? globalInsetTop : 0, // not fy\n insetRight = inset !== undefined ? inset : key === \"x\" ? globalInsetRight : 0, // not fx\n insetBottom = inset !== undefined ? inset : key === \"y\" ? globalInsetBottom : 0, // not fy\n insetLeft = inset !== undefined ? inset : key === \"x\" ? globalInsetLeft : 0 // not fx\n } = scaleOptions || {};\n if (transform == null) transform = undefined;\n else if (typeof transform !== \"function\") throw new Error(\"invalid scale transform; not a function\");\n scale.percent = !!percent;\n scale.label = label === undefined ? inferScaleLabel(channels, scale) : label;\n scale.transform = transform;\n if (key === \"x\" || key === \"fx\") {\n scale.insetLeft = +insetLeft;\n scale.insetRight = +insetRight;\n } else if (key === \"y\" || key === \"fy\") {\n scale.insetTop = +insetTop;\n scale.insetBottom = +insetBottom;\n }\n scales[key] = scale;\n }\n }\n return scales;\n}\n\nexport function createScaleFunctions(descriptors) {\n const scales = {};\n const scaleFunctions = {scales};\n for (const [key, descriptor] of Object.entries(descriptors)) {\n const {scale, type, interval, label} = descriptor;\n scales[key] = exposeScale(descriptor);\n scaleFunctions[key] = scale;\n // TODO: pass these properties, which are needed for axes, in the descriptor.\n scale.type = type;\n if (interval != null) scale.interval = interval;\n if (label != null) scale.label = label;\n }\n return scaleFunctions;\n}\n\n// Mutates scale.range!\nexport function autoScaleRange(scales, dimensions) {\n const {x, y, fx, fy} = scales;\n const superdimensions = fx || fy ? outerDimensions(dimensions) : dimensions;\n if (fx) autoScaleRangeX(fx, superdimensions);\n if (fy) autoScaleRangeY(fy, superdimensions);\n const subdimensions = fx || fy ? innerDimensions(scales, dimensions) : dimensions;\n if (x) autoScaleRangeX(x, subdimensions);\n if (y) autoScaleRangeY(y, subdimensions);\n}\n\n// Channels can have labels; if all the channels for a given scale are\n// consistently labeled (i.e., have the same value if not undefined), and the\n// corresponding scale doesn\u2019t already have an explicit label, then the\n// channels\u2019 label is promoted to the scale. This inferred label should have an\n// orientation-appropriate arrow added when used as an axis, but we don\u2019t want\n// to add the arrow when the label is set explicitly as an option; so, the\n// inferred label is distinguished as an object with an \u201Cinferred\u201D property.\nfunction inferScaleLabel(channels = [], scale) {\n let label;\n for (const {label: l} of channels) {\n if (l === undefined) continue;\n if (label === undefined) label = l;\n else if (label !== l) return;\n }\n if (label === undefined) return;\n if (!isOrdinalScale(scale) && scale.percent) label = `${label} (%)`;\n return {inferred: true, toString: () => label};\n}\n\n// Determines whether the scale points in the \u201Cpositive\u201D (right or down) or\n// \u201Cnegative\u201D (left or up) direction; if the scale order cannot be determined,\n// returns NaN; used to assign an appropriate label arrow.\nexport function inferScaleOrder(scale) {\n return Math.sign(orderof(scale.domain())) * Math.sign(orderof(scale.range()));\n}\n\n// Returns the dimensions of the outer frame; this is subdivided into facets\n// with the margins of each facet collapsing into the outer margins.\nexport function outerDimensions(dimensions) {\n const {\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n width,\n height,\n facet: {\n marginTop: facetMarginTop,\n marginRight: facetMarginRight,\n marginBottom: facetMarginBottom,\n marginLeft: facetMarginLeft\n }\n } = dimensions;\n return {\n marginTop: Math.max(marginTop, facetMarginTop),\n marginRight: Math.max(marginRight, facetMarginRight),\n marginBottom: Math.max(marginBottom, facetMarginBottom),\n marginLeft: Math.max(marginLeft, facetMarginLeft),\n width,\n height\n };\n}\n\n// Returns the dimensions of each facet.\nexport function innerDimensions({fx, fy}, dimensions) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = outerDimensions(dimensions);\n return {\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n width: fx ? fx.scale.bandwidth() + marginLeft + marginRight : width,\n height: fy ? fy.scale.bandwidth() + marginTop + marginBottom : height,\n facet: {width, height}\n };\n}\n\nfunction autoScaleRangeX(scale, dimensions) {\n if (scale.range === undefined) {\n const {insetLeft, insetRight} = scale;\n const {width, marginLeft = 0, marginRight = 0} = dimensions;\n const left = marginLeft + insetLeft;\n const right = width - marginRight - insetRight;\n scale.range = [left, Math.max(left, right)];\n if (!isOrdinalScale(scale)) scale.range = piecewiseRange(scale);\n scale.scale.range(scale.range);\n }\n autoScaleRound(scale);\n}\n\nfunction autoScaleRangeY(scale, dimensions) {\n if (scale.range === undefined) {\n const {insetTop, insetBottom} = scale;\n const {height, marginTop = 0, marginBottom = 0} = dimensions;\n const top = marginTop + insetTop;\n const bottom = height - marginBottom - insetBottom;\n scale.range = [Math.max(top, bottom), top];\n if (!isOrdinalScale(scale)) scale.range = piecewiseRange(scale);\n else scale.range.reverse();\n scale.scale.range(scale.range);\n }\n autoScaleRound(scale);\n}\n\nfunction autoScaleRound(scale) {\n if (scale.round === undefined && isBandScale(scale) && roundError(scale) <= 30) {\n scale.scale.round(true);\n }\n}\n\n// If we were to turn on rounding for this band or point scale, how much wasted\n// space would it introduce (on both ends of the range)? This must match\n// d3.scaleBand\u2019s rounding behavior:\n// https://github.com/d3/d3-scale/blob/83555bd759c7314420bd4240642beda5e258db9e/src/band.js#L20-L32\nfunction roundError({scale}) {\n const n = scale.domain().length;\n const [start, stop] = scale.range();\n const paddingInner = scale.paddingInner ? scale.paddingInner() : 1;\n const paddingOuter = scale.paddingOuter ? scale.paddingOuter() : scale.padding();\n const m = n - paddingInner;\n const step = Math.abs(stop - start) / Math.max(1, m + paddingOuter * 2);\n return (step - Math.floor(step)) * m;\n}\n\nfunction piecewiseRange(scale) {\n const length = scale.scale.domain().length + isThresholdScale(scale);\n if (!(length > 2)) return scale.range;\n const [start, end] = scale.range;\n return Array.from({length}, (_, i) => start + (i / (length - 1)) * (end - start));\n}\n\nexport function normalizeScale(key, scale, hint) {\n return createScale(key, hint === undefined ? undefined : [{hint}], {...scale});\n}\n\nfunction createScale(key, channels = [], options = {}) {\n const type = inferScaleType(key, channels, options);\n\n // Warn for common misuses of implicit ordinal scales. We disable this test if\n // you specify a scale interval or if you set the domain or range explicitly,\n // since setting the domain or range (typically with a cardinality of more than\n // two) is another indication that you intended for the scale to be ordinal; we\n // also disable it for facet scales since these are always band scales.\n if (\n options.type === undefined &&\n options.domain === undefined &&\n options.range === undefined &&\n options.interval == null &&\n key !== \"fx\" &&\n key !== \"fy\" &&\n isOrdinalScale({type})\n ) {\n const values = channels.map(({value}) => value).filter((value) => value !== undefined);\n if (values.some(isTemporal))\n warn(\n `Warning: some data associated with the ${key} scale are dates. Dates are typically associated with a \"utc\" or \"time\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n else if (values.some(isTemporalString))\n warn(\n `Warning: some data associated with the ${key} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a \"utc\" or \"time\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n else if (values.some(isNumericString))\n warn(\n `Warning: some data associated with the ${key} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a \"linear\" scale rather than a \"${formatScaleType(\n type\n )}\" scale. If you want to treat this data as ordinal, you can specify the interval of the ${key} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${key} scale to \"${formatScaleType(\n type\n )}\".`\n );\n }\n\n options.type = type; // Mutates input!\n\n // Once the scale type is known, coerce the associated channel values and any\n // explicitly-specified domain to the expected type.\n switch (type) {\n case \"diverging\":\n case \"diverging-sqrt\":\n case \"diverging-pow\":\n case \"diverging-log\":\n case \"diverging-symlog\":\n case \"cyclical\":\n case \"sequential\":\n case \"linear\":\n case \"sqrt\":\n case \"threshold\":\n case \"quantile\":\n case \"pow\":\n case \"log\":\n case \"symlog\":\n options = coerceType(channels, options, coerceNumbers);\n break;\n case \"identity\":\n switch (registry.get(key)) {\n case position:\n options = coerceType(channels, options, coerceNumbers);\n break;\n case symbol:\n options = coerceType(channels, options, coerceSymbols);\n break;\n }\n break;\n case \"utc\":\n case \"time\":\n options = coerceType(channels, options, coerceDates);\n break;\n }\n\n switch (type) {\n case \"diverging\":\n return createScaleDiverging(key, channels, options);\n case \"diverging-sqrt\":\n return createScaleDivergingSqrt(key, channels, options);\n case \"diverging-pow\":\n return createScaleDivergingPow(key, channels, options);\n case \"diverging-log\":\n return createScaleDivergingLog(key, channels, options);\n case \"diverging-symlog\":\n return createScaleDivergingSymlog(key, channels, options);\n case \"categorical\":\n case \"ordinal\":\n case ordinalImplicit:\n return createScaleOrdinal(key, channels, options);\n case \"cyclical\":\n case \"sequential\":\n case \"linear\":\n return createScaleLinear(key, channels, options);\n case \"sqrt\":\n return createScaleSqrt(key, channels, options);\n case \"threshold\":\n return createScaleThreshold(key, channels, options);\n case \"quantile\":\n return createScaleQuantile(key, channels, options);\n case \"quantize\":\n return createScaleQuantize(key, channels, options);\n case \"pow\":\n return createScalePow(key, channels, options);\n case \"log\":\n return createScaleLog(key, channels, options);\n case \"symlog\":\n return createScaleSymlog(key, channels, options);\n case \"utc\":\n return createScaleUtc(key, channels, options);\n case \"time\":\n return createScaleTime(key, channels, options);\n case \"point\":\n return createScalePoint(key, channels, options);\n case \"band\":\n return createScaleBand(key, channels, options);\n case \"identity\":\n return createScaleIdentity(key);\n case undefined:\n return;\n default:\n throw new Error(`unknown scale type: ${type}`);\n }\n}\n\nfunction formatScaleType(type) {\n return typeof type === \"symbol\" ? type.description : type;\n}\n\nfunction maybeScaleType(type) {\n return typeof type === \"string\" ? `${type}`.toLowerCase() : type;\n}\n\n// A special type symbol when the x and y scales are replaced with a projection.\nconst typeProjection = {toString: () => \"projection\"};\n\nfunction inferScaleType(key, channels, {type, domain, range, scheme, pivot, projection}) {\n type = maybeScaleType(type);\n\n // The facet scales are always band scales; this cannot be changed.\n if (key === \"fx\" || key === \"fy\") return \"band\";\n\n // If a projection is specified, the x- and y-scales are disabled; these\n // channels will be projected rather than scaled. (But still check that none\n // of the associated channels are incompatible with a projection.)\n if ((key === \"x\" || key === \"y\") && projection != null) type = typeProjection;\n\n // If a channel dictates a scale type, make sure that it is consistent with\n // the user-specified scale type (if any) and all other channels. For example,\n // barY requires x to be a band scale and disallows any other scale type.\n for (const channel of channels) {\n const t = maybeScaleType(channel.type);\n if (t === undefined) continue;\n else if (type === undefined) type = t;\n else if (type !== t) throw new Error(`scale incompatible with channel: ${type} !== ${t}`);\n }\n\n // If the scale, a channel, or user specified a (consistent) type, return it.\n if (type === typeProjection) return;\n if (type !== undefined) return type;\n\n // If there\u2019s no data (and no type) associated with this scale, don\u2019t create a scale.\n if (domain === undefined && !channels.some(({value}) => value !== undefined)) return;\n\n // Some scales have default types.\n const kind = registry.get(key);\n if (kind === radius) return \"sqrt\";\n if (kind === opacity || kind === length) return \"linear\";\n if (kind === symbol) return \"ordinal\";\n\n // If the domain or range has more than two values, assume it\u2019s ordinal. You\n // can still use a \u201Cpiecewise\u201D (or \u201Cpolylinear\u201D) scale, but you must set the\n // type explicitly.\n if ((domain || range || []).length > 2) return asOrdinalType(kind);\n\n // Otherwise, infer the scale type from the data! Prefer the domain, if\n // present, over channels. (The domain and channels should be consistently\n // typed, and the domain is more explicit and typically much smaller.) We only\n // check the first defined value for expedience and simplicity; we expect\n // that the types are consistent.\n if (domain !== undefined) {\n if (isOrdinal(domain)) return asOrdinalType(kind);\n if (isTemporal(domain)) return \"utc\";\n } else {\n const values = channels.map(({value}) => value).filter((value) => value !== undefined);\n if (values.some(isOrdinal)) return asOrdinalType(kind);\n if (values.some(isTemporal)) return \"utc\";\n }\n\n // For color scales, take a hint from the color scheme and pivot option.\n if (kind === color) {\n if (pivot != null || isDivergingScheme(scheme)) return \"diverging\";\n if (isCategoricalScheme(scheme)) return \"categorical\";\n }\n\n return \"linear\";\n}\n\n// Positional scales default to a point scale instead of an ordinal scale.\nfunction asOrdinalType(kind) {\n switch (kind) {\n case position:\n return \"point\";\n case color:\n return ordinalImplicit;\n default:\n return \"ordinal\";\n }\n}\n\nexport function isTemporalScale({type}) {\n return type === \"time\" || type === \"utc\";\n}\n\nexport function isOrdinalScale({type}) {\n return type === \"ordinal\" || type === \"point\" || type === \"band\" || type === ordinalImplicit;\n}\n\nexport function isThresholdScale({type}) {\n return type === \"threshold\";\n}\n\nfunction isBandScale({type}) {\n return type === \"point\" || type === \"band\";\n}\n\nexport function isDivergingScale({type}) {\n return /^diverging($|-)/.test(type);\n}\n\n// Certain marks have special behavior if a scale is collapsed, i.e. if the\n// domain is degenerate and represents only a single value such as [3, 3]; for\n// example, a rect will span the full extent of the chart along a collapsed\n// dimension (whereas a dot will simply be drawn in the center).\nexport function isCollapsed(scale) {\n if (scale === undefined) return true; // treat missing scale as collapsed\n const domain = scale.domain();\n const value = scale(domain[0]);\n for (let i = 1, n = domain.length; i < n; ++i) {\n if (scale(domain[i]) - value) {\n return false;\n }\n }\n return true;\n}\n\n// Mutates channel.value!\nfunction coerceType(channels, {domain, ...options}, coerceValues) {\n for (const c of channels) {\n if (c.value !== undefined) {\n if (domain === undefined) domain = c.value?.domain; // promote channel domain\n c.value = coerceValues(c.value);\n }\n }\n return {\n domain: domain === undefined ? domain : coerceValues(domain),\n ...options\n };\n}\n\nfunction coerceSymbols(values) {\n return map(values, maybeSymbol);\n}\n\nexport function scale(options = {}) {\n let scale;\n for (const key in options) {\n if (!registry.has(key)) continue; // ignore unknown properties\n if (!isScaleOptions(options[key])) continue; // e.g., ignore {color: \"red\"}\n if (scale !== undefined) throw new Error(\"ambiguous scale definition; multiple scales found\");\n scale = exposeScale(normalizeScale(key, options[key]));\n }\n if (scale === undefined) throw new Error(\"invalid scale definition; no scale found\");\n return scale;\n}\n\nexport function exposeScales(scales) {\n return (key) => {\n if (!registry.has((key = `${key}`))) throw new Error(`unknown scale: ${key}`);\n return scales[key];\n };\n}\n\n// Note: axis- and legend-related properties (such as label, ticks and\n// tickFormat) are not included here as they do not affect the scale\u2019s behavior.\nfunction exposeScale({scale, type, domain, range, interpolate, interval, transform, percent, pivot}) {\n if (type === \"identity\") return {type: \"identity\", apply: (d) => d, invert: (d) => d};\n const unknown = scale.unknown ? scale.unknown() : undefined;\n return {\n type,\n domain: slice(domain), // defensive copy\n ...(range !== undefined && {range: slice(range)}), // defensive copy\n ...(transform !== undefined && {transform}),\n ...(percent && {percent}), // only exposed if truthy\n ...(unknown !== undefined && {unknown}),\n ...(interval !== undefined && {interval}),\n\n // quantitative\n ...(interpolate !== undefined && {interpolate}),\n ...(scale.clamp && {clamp: scale.clamp()}),\n\n // diverging (always asymmetric; we never want to apply the symmetric transform twice)\n ...(pivot !== undefined && {pivot, symmetric: false}),\n\n // log, diverging-log\n ...(scale.base && {base: scale.base()}),\n\n // pow, diverging-pow\n ...(scale.exponent && {exponent: scale.exponent()}),\n\n // symlog, diverging-symlog\n ...(scale.constant && {constant: scale.constant()}),\n\n // band, point\n ...(scale.align && {align: scale.align(), round: scale.round()}),\n ...(scale.padding &&\n (scale.paddingInner\n ? {paddingInner: scale.paddingInner(), paddingOuter: scale.paddingOuter()}\n : {padding: scale.padding()})),\n ...(scale.bandwidth && {bandwidth: scale.bandwidth(), step: scale.step()}),\n\n // utilities\n apply: (t) => scale(t),\n ...(scale.invert && {invert: (t) => scale.invert(t)})\n };\n}\n", "export function memoize1(compute) {\n let cacheValue, cacheKeys;\n return (...keys) => {\n if (cacheKeys?.length !== keys.length || cacheKeys.some((k, i) => k !== keys[i])) {\n cacheKeys = keys;\n cacheValue = compute(...keys);\n }\n return cacheValue;\n };\n}\n", "import {format as isoFormat} from \"isoformat\";\nimport {string} from \"./options.js\";\nimport {memoize1} from \"./memoize.js\";\n\nconst numberFormat = memoize1((locale) => {\n return new Intl.NumberFormat(locale);\n});\n\nconst monthFormat = memoize1((locale, month) => {\n return new Intl.DateTimeFormat(locale, {timeZone: \"UTC\", ...(month && {month})});\n});\n\nconst weekdayFormat = memoize1((locale, weekday) => {\n return new Intl.DateTimeFormat(locale, {timeZone: \"UTC\", ...(weekday && {weekday})});\n});\n\nexport function formatNumber(locale = \"en-US\") {\n const format = numberFormat(locale);\n return (i) => (i != null && !isNaN(i) ? format.format(i) : undefined);\n}\n\nexport function formatMonth(locale = \"en-US\", format = \"short\") {\n const fmt = monthFormat(locale, format);\n return (i) => (i != null && !isNaN((i = +new Date(Date.UTC(2000, +i)))) ? fmt.format(i) : undefined);\n}\n\nexport function formatWeekday(locale = \"en-US\", format = \"short\") {\n const fmt = weekdayFormat(locale, format);\n return (i) => (i != null && !isNaN((i = +new Date(Date.UTC(2001, 0, +i)))) ? fmt.format(i) : undefined);\n}\n\nexport function formatIsoDate(date) {\n return isoFormat(date, \"Invalid Date\");\n}\n\nexport function formatAuto(locale = \"en-US\") {\n const number = formatNumber(locale);\n return (v) => (v instanceof Date ? formatIsoDate : typeof v === \"number\" ? number : string)(v);\n}\n\n// TODO When Plot supports a top-level locale option, this should be removed\n// because it lacks context to know which locale to use; formatAuto should be\n// used instead whenever possible.\nexport const formatDefault = formatAuto();\n", "import {geoPath, group, namespaces} from \"d3\";\nimport {create} from \"./context.js\";\nimport {defined, nonempty} from \"./defined.js\";\nimport {formatDefault} from \"./format.js\";\nimport {isNone, isNoneish, isRound, maybeColorChannel, maybeNumberChannel} from \"./options.js\";\nimport {keyof, number, string} from \"./options.js\";\nimport {warn} from \"./warnings.js\";\n\nexport const offset = (typeof window !== \"undefined\" ? window.devicePixelRatio > 1 : typeof it === \"undefined\") ? 0 : 0.5; // prettier-ignore\n\nlet nextClipId = 0;\n\nexport function getClipId() {\n return `plot-clip-${++nextClipId}`;\n}\n\nexport function styles(\n mark,\n {\n title,\n href,\n ariaLabel: variaLabel,\n ariaDescription,\n ariaHidden,\n target,\n fill,\n fillOpacity,\n stroke,\n strokeWidth,\n strokeOpacity,\n strokeLinejoin,\n strokeLinecap,\n strokeMiterlimit,\n strokeDasharray,\n strokeDashoffset,\n opacity,\n mixBlendMode,\n imageFilter,\n paintOrder,\n pointerEvents,\n shapeRendering,\n channels\n },\n {\n ariaLabel: cariaLabel,\n fill: defaultFill = \"currentColor\",\n fillOpacity: defaultFillOpacity,\n stroke: defaultStroke = \"none\",\n strokeOpacity: defaultStrokeOpacity,\n strokeWidth: defaultStrokeWidth,\n strokeLinecap: defaultStrokeLinecap,\n strokeLinejoin: defaultStrokeLinejoin,\n strokeMiterlimit: defaultStrokeMiterlimit,\n paintOrder: defaultPaintOrder\n }\n) {\n // Some marks don\u2019t support fill (e.g., tick and rule).\n if (defaultFill === null) {\n fill = null;\n fillOpacity = null;\n }\n\n // Some marks don\u2019t support stroke (e.g., image).\n if (defaultStroke === null) {\n stroke = null;\n strokeOpacity = null;\n }\n\n // Some marks default to fill with no stroke, while others default to stroke\n // with no fill. For example, bar and area default to fill, while dot and line\n // default to stroke. For marks that fill by default, the default fill only\n // applies if the stroke is (constant) none; if you set a stroke, then the\n // default fill becomes none. Similarly for marks that stroke by stroke, the\n // default stroke only applies if the fill is (constant) none.\n if (isNoneish(defaultFill)) {\n if (!isNoneish(defaultStroke) && (!isNoneish(fill) || channels?.fill)) defaultStroke = \"none\";\n } else {\n if (isNoneish(defaultStroke) && (!isNoneish(stroke) || channels?.stroke)) defaultFill = \"none\";\n }\n\n const [vfill, cfill] = maybeColorChannel(fill, defaultFill);\n const [vfillOpacity, cfillOpacity] = maybeNumberChannel(fillOpacity, defaultFillOpacity);\n const [vstroke, cstroke] = maybeColorChannel(stroke, defaultStroke);\n const [vstrokeOpacity, cstrokeOpacity] = maybeNumberChannel(strokeOpacity, defaultStrokeOpacity);\n const [vopacity, copacity] = maybeNumberChannel(opacity);\n\n // For styles that have no effect if there is no stroke, only apply the\n // defaults if the stroke is not the constant none. (If stroke is a channel,\n // then cstroke will be undefined, but there\u2019s still a stroke; hence we don\u2019t\n // use isNoneish here.)\n if (!isNone(cstroke)) {\n if (strokeWidth === undefined) strokeWidth = defaultStrokeWidth;\n if (strokeLinecap === undefined) strokeLinecap = defaultStrokeLinecap;\n if (strokeLinejoin === undefined) strokeLinejoin = defaultStrokeLinejoin;\n\n // The default stroke miterlimit need not be applied if the current stroke\n // is the constant round; this only has effect on miter joins.\n if (strokeMiterlimit === undefined && !isRound(strokeLinejoin)) strokeMiterlimit = defaultStrokeMiterlimit;\n\n // The paint order only takes effect if there is both a fill and a stroke\n // (at least if we ignore markers, which no built-in marks currently use).\n if (!isNone(cfill) && paintOrder === undefined) paintOrder = defaultPaintOrder;\n }\n\n const [vstrokeWidth, cstrokeWidth] = maybeNumberChannel(strokeWidth);\n\n // Some marks don\u2019t support fill (e.g., tick and rule).\n if (defaultFill !== null) {\n mark.fill = impliedString(cfill, \"currentColor\");\n mark.fillOpacity = impliedNumber(cfillOpacity, 1);\n }\n\n // Some marks don\u2019t support stroke (e.g., image).\n if (defaultStroke !== null) {\n mark.stroke = impliedString(cstroke, \"none\");\n mark.strokeWidth = impliedNumber(cstrokeWidth, 1);\n mark.strokeOpacity = impliedNumber(cstrokeOpacity, 1);\n mark.strokeLinejoin = impliedString(strokeLinejoin, \"miter\");\n mark.strokeLinecap = impliedString(strokeLinecap, \"butt\");\n mark.strokeMiterlimit = impliedNumber(strokeMiterlimit, 4);\n mark.strokeDasharray = impliedString(strokeDasharray, \"none\");\n mark.strokeDashoffset = impliedString(strokeDashoffset, \"0\");\n }\n\n mark.target = string(target);\n mark.ariaLabel = string(cariaLabel);\n mark.ariaDescription = string(ariaDescription);\n mark.ariaHidden = string(ariaHidden);\n mark.opacity = impliedNumber(copacity, 1);\n mark.mixBlendMode = impliedString(mixBlendMode, \"normal\");\n mark.imageFilter = impliedString(imageFilter, \"none\");\n mark.paintOrder = impliedString(paintOrder, \"normal\");\n mark.pointerEvents = impliedString(pointerEvents, \"auto\");\n mark.shapeRendering = impliedString(shapeRendering, \"auto\");\n\n return {\n title: {value: title, optional: true, filter: null},\n href: {value: href, optional: true, filter: null},\n ariaLabel: {value: variaLabel, optional: true, filter: null},\n fill: {value: vfill, scale: \"auto\", optional: true},\n fillOpacity: {value: vfillOpacity, scale: \"auto\", optional: true},\n stroke: {value: vstroke, scale: \"auto\", optional: true},\n strokeOpacity: {value: vstrokeOpacity, scale: \"auto\", optional: true},\n strokeWidth: {value: vstrokeWidth, optional: true},\n opacity: {value: vopacity, scale: \"auto\", optional: true}\n };\n}\n\n// Applies the specified titles via selection.call.\nexport function applyTitle(selection, L) {\n if (L)\n selection\n .filter((i) => nonempty(L[i]))\n .append(\"title\")\n .call(applyText, L);\n}\n\n// Like applyTitle, but for grouped data (lines, areas).\nexport function applyTitleGroup(selection, L) {\n if (L)\n selection\n .filter(([i]) => nonempty(L[i]))\n .append(\"title\")\n .call(applyTextGroup, L);\n}\n\nexport function applyText(selection, T) {\n if (T) selection.text((i) => formatDefault(T[i]));\n}\n\nexport function applyTextGroup(selection, T) {\n if (T) selection.text(([i]) => formatDefault(T[i]));\n}\n\nexport function applyChannelStyles(\n selection,\n {target, tip},\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n }\n) {\n if (AL) applyAttr(selection, \"aria-label\", (i) => AL[i]);\n if (F) applyAttr(selection, \"fill\", (i) => F[i]);\n if (FO) applyAttr(selection, \"fill-opacity\", (i) => FO[i]);\n if (S) applyAttr(selection, \"stroke\", (i) => S[i]);\n if (SO) applyAttr(selection, \"stroke-opacity\", (i) => SO[i]);\n if (SW) applyAttr(selection, \"stroke-width\", (i) => SW[i]);\n if (O) applyAttr(selection, \"opacity\", (i) => O[i]);\n if (H) applyHref(selection, (i) => H[i], target);\n if (!tip) applyTitle(selection, T);\n}\n\nexport function applyGroupedChannelStyles(\n selection,\n {target, tip},\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n }\n) {\n if (AL) applyAttr(selection, \"aria-label\", ([i]) => AL[i]);\n if (F) applyAttr(selection, \"fill\", ([i]) => F[i]);\n if (FO) applyAttr(selection, \"fill-opacity\", ([i]) => FO[i]);\n if (S) applyAttr(selection, \"stroke\", ([i]) => S[i]);\n if (SO) applyAttr(selection, \"stroke-opacity\", ([i]) => SO[i]);\n if (SW) applyAttr(selection, \"stroke-width\", ([i]) => SW[i]);\n if (O) applyAttr(selection, \"opacity\", ([i]) => O[i]);\n if (H) applyHref(selection, ([i]) => H[i], target);\n if (!tip) applyTitleGroup(selection, T);\n}\n\nfunction groupAesthetics(\n {\n ariaLabel: AL,\n title: T,\n fill: F,\n fillOpacity: FO,\n stroke: S,\n strokeOpacity: SO,\n strokeWidth: SW,\n opacity: O,\n href: H\n },\n {tip}\n) {\n return [AL, tip ? undefined : T, F, FO, S, SO, SW, O, H].filter((c) => c !== undefined);\n}\n\nexport function groupZ(I, Z, z) {\n const G = group(I, (i) => Z[i]);\n if (z === undefined && G.size > (1 + I.length) >> 1) {\n warn(\n `Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null.`\n );\n }\n return G.values();\n}\n\nexport function* groupIndex(I, position, mark, channels) {\n const {z} = mark;\n const {z: Z} = channels; // group channel\n const A = groupAesthetics(channels, mark); // aesthetic channels\n const C = [...position, ...A]; // all channels\n\n // Group the current index by Z (if any).\n for (const G of Z ? groupZ(I, Z, z) : [I]) {\n let Ag; // the A-values (aesthetics) of the current group, if any\n let Gg; // the current group index (a subset of G, and I), if any\n out: for (const i of G) {\n // If any channel has an undefined value for this index, skip it.\n for (const c of C) {\n if (!defined(c[i])) {\n if (Gg) Gg.push(-1);\n continue out;\n }\n }\n\n // Otherwise, if this is a new group, record the aesthetics for this\n // group. Yield the current group and start a new one.\n if (Ag === undefined) {\n if (Gg) yield Gg;\n (Ag = A.map((c) => keyof(c[i]))), (Gg = [i]);\n continue;\n }\n\n // Otherwise, add the current index to the current group. Then, if any of\n // the aesthetics don\u2019t match the current group, yield the current group\n // and start a new group of the current index.\n Gg.push(i);\n for (let j = 0; j < A.length; ++j) {\n const k = keyof(A[j][i]);\n if (k !== Ag[j]) {\n yield Gg;\n (Ag = A.map((c) => keyof(c[i]))), (Gg = [i]);\n continue out;\n }\n }\n }\n\n // Yield the current group, if any.\n if (Gg) yield Gg;\n }\n}\n\n// Note: may mutate selection.node!\nfunction applyClip(selection, mark, dimensions, context) {\n let clipUrl;\n const {clip = context.clip} = mark;\n switch (clip) {\n case \"frame\": {\n const {width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions;\n const id = getClipId();\n clipUrl = `url(#${id})`;\n selection = create(\"svg:g\", context)\n .call((g) =>\n g\n .append(\"svg:clipPath\")\n .attr(\"id\", id)\n .append(\"rect\")\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop)\n .attr(\"width\", width - marginRight - marginLeft)\n .attr(\"height\", height - marginTop - marginBottom)\n )\n .each(function () {\n this.appendChild(selection.node());\n selection.node = () => this; // Note: mutation!\n });\n break;\n }\n case \"sphere\": {\n const {projection} = context;\n if (!projection) throw new Error(`the \"sphere\" clip option requires a projection`);\n const id = getClipId();\n clipUrl = `url(#${id})`;\n selection\n .append(\"clipPath\")\n .attr(\"id\", id)\n .append(\"path\")\n .attr(\"d\", geoPath(projection)({type: \"Sphere\"}));\n break;\n }\n }\n // Here we\u2019re careful to apply the ARIA attributes to the outer G element when\n // clipping is applied, and to apply the ARIA attributes before any other\n // attributes (for readability).\n applyAttr(selection, \"aria-label\", mark.ariaLabel);\n applyAttr(selection, \"aria-description\", mark.ariaDescription);\n applyAttr(selection, \"aria-hidden\", mark.ariaHidden);\n applyAttr(selection, \"clip-path\", clipUrl);\n}\n\n// Note: may mutate selection.node!\nexport function applyIndirectStyles(selection, mark, dimensions, context) {\n applyClip(selection, mark, dimensions, context);\n applyAttr(selection, \"fill\", mark.fill);\n applyAttr(selection, \"fill-opacity\", mark.fillOpacity);\n applyAttr(selection, \"stroke\", mark.stroke);\n applyAttr(selection, \"stroke-width\", mark.strokeWidth);\n applyAttr(selection, \"stroke-opacity\", mark.strokeOpacity);\n applyAttr(selection, \"stroke-linejoin\", mark.strokeLinejoin);\n applyAttr(selection, \"stroke-linecap\", mark.strokeLinecap);\n applyAttr(selection, \"stroke-miterlimit\", mark.strokeMiterlimit);\n applyAttr(selection, \"stroke-dasharray\", mark.strokeDasharray);\n applyAttr(selection, \"stroke-dashoffset\", mark.strokeDashoffset);\n applyAttr(selection, \"shape-rendering\", mark.shapeRendering);\n applyAttr(selection, \"filter\", mark.imageFilter);\n applyAttr(selection, \"paint-order\", mark.paintOrder);\n const {pointerEvents = context.pointerSticky === false ? \"none\" : undefined} = mark;\n applyAttr(selection, \"pointer-events\", pointerEvents);\n}\n\nexport function applyDirectStyles(selection, mark) {\n applyStyle(selection, \"mix-blend-mode\", mark.mixBlendMode);\n applyAttr(selection, \"opacity\", mark.opacity);\n}\n\nfunction applyHref(selection, href, target) {\n selection.each(function (i) {\n const h = href(i);\n if (h != null) {\n const a = this.ownerDocument.createElementNS(namespaces.svg, \"a\");\n a.setAttribute(\"fill\", \"inherit\");\n a.setAttributeNS(namespaces.xlink, \"href\", h);\n if (target != null) a.setAttribute(\"target\", target);\n this.parentNode.insertBefore(a, this).appendChild(this);\n }\n });\n}\n\nexport function applyAttr(selection, name, value) {\n if (value != null) selection.attr(name, value);\n}\n\nexport function applyStyle(selection, name, value) {\n if (value != null) selection.style(name, value);\n}\n\nexport function applyTransform(selection, mark, {x, y}, tx = offset, ty = offset) {\n tx += mark.dx;\n ty += mark.dy;\n if (x?.bandwidth) tx += x.bandwidth() / 2;\n if (y?.bandwidth) ty += y.bandwidth() / 2;\n if (tx || ty) selection.attr(\"transform\", `translate(${tx},${ty})`);\n}\n\nexport function impliedString(value, impliedValue) {\n if ((value = string(value)) !== impliedValue) return value;\n}\n\nexport function impliedNumber(value, impliedValue) {\n if ((value = number(value)) !== impliedValue) return value;\n}\n\n// https://www.w3.org/TR/CSS21/grammar.html\nconst validClassName =\n /^-?([_a-z]|[\\240-\\377]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\240-\\377]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*$/i;\n\nexport function maybeClassName(name) {\n // The default should be changed whenever the default styles are changed, so\n // as to avoid conflict when multiple versions of Plot are on the page.\n if (name === undefined) return \"plot-d6a7b5\";\n name = `${name}`;\n if (!validClassName.test(name)) throw new Error(`invalid class name: ${name}`);\n return name;\n}\n\nexport function applyInlineStyles(selection, style) {\n if (typeof style === \"string\") {\n selection.property(\"style\", style);\n } else if (style != null) {\n for (const element of selection) {\n Object.assign(element.style, style);\n }\n }\n}\n\nexport function applyFrameAnchor({frameAnchor}, {width, height, marginTop, marginRight, marginBottom, marginLeft}) {\n return [\n /left$/.test(frameAnchor)\n ? marginLeft\n : /right$/.test(frameAnchor)\n ? width - marginRight\n : (marginLeft + width - marginRight) / 2,\n /^top/.test(frameAnchor)\n ? marginTop\n : /^bottom/.test(frameAnchor)\n ? height - marginBottom\n : (marginTop + height - marginBottom) / 2\n ];\n}\n", "import {extent} from \"d3\";\nimport {projectionAspectRatio} from \"./projection.js\";\nimport {isOrdinalScale} from \"./scales.js\";\nimport {offset} from \"./style.js\";\n\nexport function createDimensions(scales, marks, options = {}) {\n // Compute the default margins: the maximum of the marks\u2019 margins. While not\n // always used, they may be needed to compute the default height of the plot.\n let marginTopDefault = 0.5 - offset,\n marginRightDefault = 0.5 + offset,\n marginBottomDefault = 0.5 + offset,\n marginLeftDefault = 0.5 - offset;\n\n for (const {marginTop, marginRight, marginBottom, marginLeft} of marks) {\n if (marginTop > marginTopDefault) marginTopDefault = marginTop;\n if (marginRight > marginRightDefault) marginRightDefault = marginRight;\n if (marginBottom > marginBottomDefault) marginBottomDefault = marginBottom;\n if (marginLeft > marginLeftDefault) marginLeftDefault = marginLeft;\n }\n\n // Compute the actual margins. The order of precedence is: the side-specific\n // margin options, then the global margin option, then the defaults.\n let {\n margin,\n marginTop = margin !== undefined ? margin : marginTopDefault,\n marginRight = margin !== undefined ? margin : marginRightDefault,\n marginBottom = margin !== undefined ? margin : marginBottomDefault,\n marginLeft = margin !== undefined ? margin : marginLeftDefault\n } = options;\n\n // Coerce the margin options to numbers.\n marginTop = +marginTop;\n marginRight = +marginRight;\n marginBottom = +marginBottom;\n marginLeft = +marginLeft;\n\n // Compute the outer dimensions of the plot. If the top and bottom margins are\n // specified explicitly, adjust the automatic height accordingly.\n let {\n width = 640,\n height = autoHeight(scales, options, {\n width,\n marginTopDefault,\n marginRightDefault,\n marginBottomDefault,\n marginLeftDefault\n }) + Math.max(0, marginTop - marginTopDefault + marginBottom - marginBottomDefault)\n } = options;\n\n // Coerce the width and height.\n width = +width;\n height = +height;\n\n const dimensions = {\n width,\n height,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft\n };\n\n // Compute the facet margins.\n if (scales.fx || scales.fy) {\n let {\n margin: facetMargin,\n marginTop: facetMarginTop = facetMargin !== undefined ? facetMargin : marginTop,\n marginRight: facetMarginRight = facetMargin !== undefined ? facetMargin : marginRight,\n marginBottom: facetMarginBottom = facetMargin !== undefined ? facetMargin : marginBottom,\n marginLeft: facetMarginLeft = facetMargin !== undefined ? facetMargin : marginLeft\n } = options.facet ?? {};\n\n // Coerce the facet margin options to numbers.\n facetMarginTop = +facetMarginTop;\n facetMarginRight = +facetMarginRight;\n facetMarginBottom = +facetMarginBottom;\n facetMarginLeft = +facetMarginLeft;\n\n dimensions.facet = {\n marginTop: facetMarginTop,\n marginRight: facetMarginRight,\n marginBottom: facetMarginBottom,\n marginLeft: facetMarginLeft\n };\n }\n\n return dimensions;\n}\n\nfunction autoHeight(\n {x, y, fy, fx},\n {projection, aspectRatio},\n {width, marginTopDefault, marginRightDefault, marginBottomDefault, marginLeftDefault}\n) {\n const nfy = fy ? fy.scale.domain().length : 1;\n\n // If a projection is specified, use its natural aspect ratio (if known).\n const ar = projectionAspectRatio(projection);\n if (ar) {\n const nfx = fx ? fx.scale.domain().length : 1;\n const far = ((1.1 * nfy - 0.1) / (1.1 * nfx - 0.1)) * ar; // 0.1 is default facet padding\n const lar = Math.max(0.1, Math.min(10, far)); // clamp the aspect ratio to a \u201Creasonable\u201D value\n return Math.round((width - marginLeftDefault - marginRightDefault) * lar + marginTopDefault + marginBottomDefault);\n }\n\n const ny = y ? (isOrdinalScale(y) ? y.scale.domain().length : Math.max(7, 17 / nfy)) : 1;\n\n // If a desired aspect ratio is given, compute a default height to match.\n if (aspectRatio != null) {\n aspectRatio = +aspectRatio;\n if (!(isFinite(aspectRatio) && aspectRatio > 0)) throw new Error(`invalid aspectRatio: ${aspectRatio}`);\n const ratio = aspectRatioLength(\"y\", y) / (aspectRatioLength(\"x\", x) * aspectRatio);\n const fxb = fx ? fx.scale.bandwidth() : 1;\n const fyb = fy ? fy.scale.bandwidth() : 1;\n const w = fxb * (width - marginLeftDefault - marginRightDefault) - x.insetLeft - x.insetRight;\n return (ratio * w + y.insetTop + y.insetBottom) / fyb + marginTopDefault + marginBottomDefault;\n }\n\n return !!(y || fy) * Math.max(1, Math.min(60, ny * nfy)) * 20 + !!fx * 30 + 60;\n}\n\nfunction aspectRatioLength(k, scale) {\n if (!scale) throw new Error(`aspectRatio requires ${k} scale`);\n const {type, domain} = scale;\n let transform;\n switch (type) {\n case \"linear\":\n case \"utc\":\n case \"time\":\n transform = Number;\n break;\n case \"pow\": {\n const exponent = scale.scale.exponent();\n transform = (x) => Math.pow(x, exponent);\n break;\n }\n case \"log\":\n transform = Math.log;\n break;\n case \"point\":\n case \"band\":\n return domain.length;\n default:\n throw new Error(`unsupported ${k} scale for aspectRatio: ${type}`);\n }\n const [min, max] = extent(domain);\n return Math.abs(transform(max) - transform(min));\n}\n", "import {InternMap, cross, rollup, sum} from \"d3\";\nimport {keyof, map, range} from \"./options.js\";\nimport {createScales} from \"./scales.js\";\n\n// Returns an array of {x?, y?, i} objects representing the facet domain.\nexport function createFacets(channelsByScale, options) {\n const {fx, fy} = createScales(channelsByScale, options);\n const fxDomain = fx?.scale.domain();\n const fyDomain = fy?.scale.domain();\n return fxDomain && fyDomain\n ? cross(fxDomain, fyDomain).map(([x, y], i) => ({x, y, i}))\n : fxDomain\n ? fxDomain.map((x, i) => ({x, i}))\n : fyDomain\n ? fyDomain.map((y, i) => ({y, i}))\n : undefined;\n}\n\nexport function recreateFacets(facets, {x: X, y: Y}) {\n X &&= facetIndex(X);\n Y &&= facetIndex(Y);\n return facets\n .filter(\n X && Y // remove any facets no longer present in the domain\n ? (f) => X.has(f.x) && Y.has(f.y)\n : X\n ? (f) => X.has(f.x)\n : (f) => Y.has(f.y)\n )\n .sort(\n X && Y // reorder facets to match the new scale domains\n ? (a, b) => X.get(a.x) - X.get(b.x) || Y.get(a.y) - Y.get(b.y)\n : X\n ? (a, b) => X.get(a.x) - X.get(b.x)\n : (a, b) => Y.get(a.y) - Y.get(b.y)\n );\n}\n\n// Returns a (possibly nested) Map of [[key1, index1], [key2, index2], \u2026]\n// representing the data indexes associated with each facet.\nexport function facetGroups(data, {fx, fy}) {\n const I = range(data);\n const FX = fx?.value;\n const FY = fy?.value;\n return fx && fy\n ? rollup(\n I,\n (G) => ((G.fx = FX[G[0]]), (G.fy = FY[G[0]]), G),\n (i) => FX[i],\n (i) => FY[i]\n )\n : fx\n ? rollup(\n I,\n (G) => ((G.fx = FX[G[0]]), G),\n (i) => FX[i]\n )\n : rollup(\n I,\n (G) => ((G.fy = FY[G[0]]), G),\n (i) => FY[i]\n );\n}\n\nexport function facetTranslator(fx, fy, {marginTop, marginLeft}) {\n return fx && fy\n ? ({x, y}) => `translate(${fx(x) - marginLeft},${fy(y) - marginTop})`\n : fx\n ? ({x}) => `translate(${fx(x) - marginLeft},0)`\n : ({y}) => `translate(0,${fy(y) - marginTop})`;\n}\n\n// Returns an index that for each facet lists all the elements present in other\n// facets in the original index. TODO Memoize to avoid repeated work?\nexport function facetExclude(index) {\n const ex = [];\n const e = new Uint32Array(sum(index, (d) => d.length));\n for (const i of index) {\n let n = 0;\n for (const j of index) {\n if (i === j) continue;\n e.set(j, n);\n n += j.length;\n }\n ex.push(e.slice(0, n));\n }\n return ex;\n}\n\nconst facetAnchors = new Map([\n [\"top\", facetAnchorTop],\n [\"right\", facetAnchorRight],\n [\"bottom\", facetAnchorBottom],\n [\"left\", facetAnchorLeft],\n [\"top-left\", and(facetAnchorTop, facetAnchorLeft)],\n [\"top-right\", and(facetAnchorTop, facetAnchorRight)],\n [\"bottom-left\", and(facetAnchorBottom, facetAnchorLeft)],\n [\"bottom-right\", and(facetAnchorBottom, facetAnchorRight)],\n [\"top-empty\", facetAnchorTopEmpty],\n [\"right-empty\", facetAnchorRightEmpty],\n [\"bottom-empty\", facetAnchorBottomEmpty],\n [\"left-empty\", facetAnchorLeftEmpty],\n [\"empty\", facetAnchorEmpty]\n]);\n\nexport function maybeFacetAnchor(facetAnchor) {\n if (facetAnchor == null) return null;\n const anchor = facetAnchors.get(`${facetAnchor}`.toLowerCase());\n if (anchor) return anchor;\n throw new Error(`invalid facet anchor: ${facetAnchor}`);\n}\n\nconst indexCache = new WeakMap();\n\nfunction facetIndex(V) {\n let I = indexCache.get(V);\n if (!I) indexCache.set(V, (I = new InternMap(map(V, (v, i) => [v, i]))));\n return I;\n}\n\n// Like V.indexOf(v), but with the same semantics as InternMap.\nfunction facetIndexOf(V, v) {\n return facetIndex(V).get(v);\n}\n\n// Like facets.find, but with the same semantics as InternMap.\nfunction facetFind(facets, x, y) {\n x = keyof(x);\n y = keyof(y);\n return facets.find((f) => Object.is(keyof(f.x), x) && Object.is(keyof(f.y), y));\n}\n\nfunction facetEmpty(facets, x, y) {\n return facetFind(facets, x, y)?.empty;\n}\n\nfunction facetAnchorTop(facets, {y: Y}, {y}) {\n return Y ? facetIndexOf(Y, y) === 0 : true;\n}\n\nfunction facetAnchorBottom(facets, {y: Y}, {y}) {\n return Y ? facetIndexOf(Y, y) === Y.length - 1 : true;\n}\n\nfunction facetAnchorLeft(facets, {x: X}, {x}) {\n return X ? facetIndexOf(X, x) === 0 : true;\n}\n\nfunction facetAnchorRight(facets, {x: X}, {x}) {\n return X ? facetIndexOf(X, x) === X.length - 1 : true;\n}\n\nfunction facetAnchorTopEmpty(facets, {y: Y}, {x, y, empty}) {\n if (empty) return false;\n if (!Y) return;\n const i = facetIndexOf(Y, y);\n if (i > 0) return facetEmpty(facets, x, Y[i - 1]);\n}\n\nfunction facetAnchorBottomEmpty(facets, {y: Y}, {x, y, empty}) {\n if (empty) return false;\n if (!Y) return;\n const i = facetIndexOf(Y, y);\n if (i < Y.length - 1) return facetEmpty(facets, x, Y[i + 1]);\n}\n\nfunction facetAnchorLeftEmpty(facets, {x: X}, {x, y, empty}) {\n if (empty) return false;\n if (!X) return;\n const i = facetIndexOf(X, x);\n if (i > 0) return facetEmpty(facets, X[i - 1], y);\n}\n\nfunction facetAnchorRightEmpty(facets, {x: X}, {x, y, empty}) {\n if (empty) return false;\n if (!X) return;\n const i = facetIndexOf(X, x);\n if (i < X.length - 1) return facetEmpty(facets, X[i + 1], y);\n}\n\nfunction facetAnchorEmpty(facets, channels, {empty}) {\n return empty;\n}\n\nfunction and(a, b) {\n return function () {\n return a.apply(null, arguments) && b.apply(null, arguments);\n };\n}\n\n// Facet filter, by mark; for now only the \"eq\" filter is provided.\nexport function facetFilter(facets, {channels: {fx, fy}, groups}) {\n return fx && fy\n ? facets.map(({x, y}) => groups.get(x)?.get(y) ?? [])\n : fx\n ? facets.map(({x}) => groups.get(x) ?? [])\n : facets.map(({y}) => groups.get(y) ?? []);\n}\n", "import {channelDomain, createChannels, valueObject} from \"./channel.js\";\nimport {defined} from \"./defined.js\";\nimport {maybeFacetAnchor} from \"./facet.js\";\nimport {maybeClip, maybeNamed, maybeValue} from \"./options.js\";\nimport {arrayify, isDomainSort, isObject, isOptions, keyword, range, singleton} from \"./options.js\";\nimport {project} from \"./projection.js\";\nimport {styles} from \"./style.js\";\nimport {basic, initializer} from \"./transforms/basic.js\";\n\nexport class Mark {\n constructor(data, channels = {}, options = {}, defaults) {\n const {\n facet = \"auto\",\n facetAnchor,\n fx,\n fy,\n sort,\n dx = 0,\n dy = 0,\n margin = 0,\n marginTop = margin,\n marginRight = margin,\n marginBottom = margin,\n marginLeft = margin,\n clip = defaults?.clip,\n channels: extraChannels,\n tip,\n render\n } = options;\n this.data = data;\n this.sort = isDomainSort(sort) ? sort : null;\n this.initializer = initializer(options).initializer;\n this.transform = this.initializer ? options.transform : basic(options).transform;\n if (facet === null || facet === false) {\n this.facet = null;\n } else {\n this.facet = keyword(facet === true ? \"include\" : facet, \"facet\", [\"auto\", \"include\", \"exclude\", \"super\"]);\n this.fx = data === singleton && typeof fx === \"string\" ? [fx] : fx;\n this.fy = data === singleton && typeof fy === \"string\" ? [fy] : fy;\n }\n this.facetAnchor = maybeFacetAnchor(facetAnchor);\n channels = maybeNamed(channels);\n if (extraChannels !== undefined) channels = {...maybeChannels(extraChannels), ...channels};\n if (defaults !== undefined) channels = {...styles(this, options, defaults), ...channels};\n this.channels = Object.fromEntries(\n Object.entries(channels)\n .map(([name, channel]) => {\n if (isOptions(channel.value)) {\n // apply scale and label overrides\n const {value, label = channel.label, scale = channel.scale} = channel.value;\n channel = {...channel, label, scale, value};\n }\n if (data === singleton && typeof channel.value === \"string\") {\n // convert field names to singleton values for decoration marks (e.g., frame)\n const {value} = channel;\n channel = {...channel, value: [value]};\n }\n return [name, channel];\n })\n .filter(([name, {value, optional}]) => {\n if (value != null) return true;\n if (optional) return false;\n throw new Error(`missing channel value: ${name}`);\n })\n );\n this.dx = +dx;\n this.dy = +dy;\n this.marginTop = +marginTop;\n this.marginRight = +marginRight;\n this.marginBottom = +marginBottom;\n this.marginLeft = +marginLeft;\n this.clip = maybeClip(clip);\n this.tip = maybeTip(tip);\n // Super-faceting currently disallow position channels; in the future, we\n // could allow position to be specified in fx and fy in addition to (or\n // instead of) x and y.\n if (this.facet === \"super\") {\n if (fx || fy) throw new Error(`super-faceting cannot use fx or fy`);\n for (const name in this.channels) {\n const {scale} = channels[name];\n if (scale !== \"x\" && scale !== \"y\") continue;\n throw new Error(`super-faceting cannot use x or y`);\n }\n }\n if (render != null) {\n this.render = composeRender(render, this.render);\n }\n }\n initialize(facets, facetChannels, plotOptions) {\n let data = arrayify(this.data);\n if (facets === undefined && data != null) facets = [range(data)];\n const originalFacets = facets;\n if (this.transform != null) ({facets, data} = this.transform(data, facets, plotOptions)), (data = arrayify(data));\n if (facets !== undefined) facets.original = originalFacets; // needed to read facetChannels\n const channels = createChannels(this.channels, data);\n if (this.sort != null) channelDomain(data, facets, channels, facetChannels, this.sort); // mutates facetChannels!\n return {data, facets, channels};\n }\n filter(index, channels, values) {\n for (const name in channels) {\n const {filter = defined} = channels[name];\n if (filter !== null) {\n const value = values[name];\n index = index.filter((i) => filter(value[i]));\n }\n }\n return index;\n }\n // If there is a projection, and there are paired x and y channels associated\n // with the x and y scale respectively (and not already in screen coordinates\n // as with an initializer), then apply the projection, replacing the x and y\n // values. Note that the x and y scales themselves don\u2019t exist if there is a\n // projection, but whether the channels are associated with scales still\n // determines whether the projection should apply; think of the projection as\n // a combination xy-scale.\n project(channels, values, context) {\n for (const cx in channels) {\n if (channels[cx].scale === \"x\" && /^x|x$/.test(cx)) {\n const cy = cx.replace(/^x|x$/, \"y\");\n if (cy in channels && channels[cy].scale === \"y\") {\n project(cx, cy, values, context.projection);\n }\n }\n }\n }\n scale(channels, scales, context) {\n const values = valueObject(channels, scales);\n if (context.projection) this.project(channels, values, context);\n return values;\n }\n}\n\nexport function marks(...marks) {\n marks.plot = Mark.prototype.plot; // Note: depends on side-effect in plot!\n return marks;\n}\n\nexport function composeRender(r1, r2) {\n if (r1 == null) return r2 === null ? undefined : r2;\n if (r2 == null) return r1 === null ? undefined : r1;\n if (typeof r1 !== \"function\") throw new TypeError(`invalid render transform: ${r1}`);\n if (typeof r2 !== \"function\") throw new TypeError(`invalid render transform: ${r2}`);\n return function (i, s, v, d, c, next) {\n return r1.call(this, i, s, v, d, c, (i, s, v, d, c) => {\n return r2.call(this, i, s, v, d, c, next); // preserve this\n });\n };\n}\n\nfunction maybeChannels(channels) {\n return Object.fromEntries(\n Object.entries(maybeNamed(channels)).map(([name, channel]) => {\n channel = typeof channel === \"string\" ? {value: channel, label: name} : maybeValue(channel); // for shorthand extra channels, use name as label\n if (channel.filter === undefined && channel.scale == null) channel = {...channel, filter: null};\n return [name, channel];\n })\n );\n}\n\nfunction maybeTip(tip) {\n return tip === true\n ? \"xy\"\n : tip === false || tip == null\n ? null\n : typeof tip === \"string\"\n ? keyword(tip, \"tip\", [\"x\", \"y\", \"xy\"])\n : tip; // tip options object\n}\n\nexport function withTip(options, pointer) {\n return options?.tip === true\n ? {...options, tip: pointer}\n : isObject(options?.tip) && options.tip.pointer === undefined\n ? {...options, tip: {...options.tip, pointer}}\n : options;\n}\n", "import {pointer as pointof} from \"d3\";\nimport {composeRender} from \"../mark.js\";\nimport {applyFrameAnchor} from \"../style.js\";\n\nconst states = new WeakMap();\n\nfunction pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...options} = {}) {\n maxRadius = +maxRadius;\n // When px or py is used, register an extra channel that the pointer\n // interaction can use to control which point is focused; this allows pointing\n // to function independently of where the downstream mark (e.g., a tip) is\n // displayed. Also default x or y to null to disable maybeTuple etc.\n if (px != null) (x ??= null), (channels = {...channels, px: {value: px, scale: \"x\"}});\n if (py != null) (y ??= null), (channels = {...channels, py: {value: py, scale: \"y\"}});\n return {\n x,\n y,\n channels,\n ...options,\n // Unlike other composed transforms, the render transform must be the\n // outermost render function because it will re-render dynamically in\n // response to pointer events.\n render: composeRender(function (index, scales, values, dimensions, context, next) {\n context = {...context, pointerSticky: false};\n const svg = context.ownerSVGElement;\n const {data} = context.getMarkState(this);\n\n // Isolate state per-pointer, per-plot; if the pointer is reused by\n // multiple marks, they will share the same state (e.g., sticky modality).\n let state = states.get(svg);\n if (!state) states.set(svg, (state = {sticky: false, roots: [], renders: []}));\n\n // This serves as a unique identifier of the rendered mark per-plot; it is\n // used to record the currently-rendered elements (state.roots) so that we\n // can tell when a rendered element is clicked on.\n let renderIndex = state.renders.push(render) - 1;\n\n // For faceting, we want to compute the local coordinates of each point,\n // which means subtracting out the facet translation, if any. (It\u2019s\n // tempting to do this using the local coordinates in SVG, but that\u2019s\n // complicated by mark-specific transforms such as dx and dy.) Also, since\n // band scales return the upper bound of the band, we have to offset by\n // half the bandwidth.\n const {x, y, fx, fy} = scales;\n let tx = fx ? fx(index.fx) - dimensions.marginLeft : 0;\n let ty = fy ? fy(index.fy) - dimensions.marginTop : 0;\n if (x?.bandwidth) tx += x.bandwidth() / 2;\n if (y?.bandwidth) ty += y.bandwidth() / 2;\n\n // For faceting, we also need to record the closest point per facet per\n // mark (!), since each facet has its own pointer event listeners; we only\n // want the closest point across facets to be visible.\n const faceted = index.fi != null;\n let facetState;\n if (faceted) {\n let facetStates = state.facetStates;\n if (!facetStates) state.facetStates = facetStates = new Map();\n facetState = facetStates.get(this);\n if (!facetState) facetStates.set(this, (facetState = new Map()));\n }\n\n // The order of precedence for the pointer position is: px & py; the\n // middle of x1 & y1 and x2 & y2; or x1 & y1 (e.g., area); or lastly x &\n // y. If a dimension is unspecified, the frame anchor is used.\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n const {px: PX, py: PY} = values;\n const px = PX ? (i) => PX[i] : anchorX(values, cx);\n const py = PY ? (i) => PY[i] : anchorY(values, cy);\n\n let i; // currently focused index\n let g; // currently rendered mark\n let s; // currently rendered stickiness\n let f; // current animation frame\n\n // When faceting, if more than one pointer would be visible, only show\n // this one if it is the closest. We defer rendering using an animation\n // frame to allow all pointer events to be received before deciding which\n // mark to render; although when hiding, we render immediately.\n function update(ii, ri) {\n if (faceted) {\n if (f) f = cancelAnimationFrame(f);\n if (ii == null) facetState.delete(index.fi);\n else {\n facetState.set(index.fi, ri);\n f = requestAnimationFrame(() => {\n f = null;\n for (const [fi, r] of facetState) {\n if (r < ri || (r === ri && fi < index.fi)) {\n ii = null;\n break;\n }\n }\n render(ii);\n });\n return;\n }\n }\n render(ii);\n }\n\n function render(ii) {\n if (i === ii && s === state.sticky) return; // the tooltip hasn\u2019t moved\n i = ii;\n s = context.pointerSticky = state.sticky;\n const I = i == null ? [] : [i];\n if (faceted) (I.fx = index.fx), (I.fy = index.fy), (I.fi = index.fi);\n const r = next(I, scales, values, dimensions, context);\n if (g) {\n // When faceting, preserve swapped mark and facet transforms; also\n // remove ARIA attributes since these are promoted to the parent. This\n // is perhaps brittle in that it depends on how Plot renders facets,\n // but it produces a cleaner and more accessible SVG structure.\n if (faceted) {\n const p = g.parentNode;\n const ft = g.getAttribute(\"transform\");\n const mt = r.getAttribute(\"transform\");\n ft ? r.setAttribute(\"transform\", ft) : r.removeAttribute(\"transform\");\n mt ? p.setAttribute(\"transform\", mt) : p.removeAttribute(\"transform\");\n r.removeAttribute(\"aria-label\");\n r.removeAttribute(\"aria-description\");\n r.removeAttribute(\"aria-hidden\");\n }\n g.replaceWith(r);\n }\n state.roots[renderIndex] = g = r;\n\n // Dispatch the value. When simultaneously exiting this facet and\n // entering a new one, prioritize the entering facet.\n if (!(i == null && facetState?.size > 1)) context.dispatchValue(i == null ? null : data[i]);\n return r;\n }\n\n // Select the closest point to the mouse in the current facet; for\n // pointerX or pointerY, the orthogonal component of the distance is\n // squashed, selecting primarily on the dominant dimension. Across facets,\n // use unsquashed distance to determine the winner.\n function pointermove(event) {\n if (state.sticky || (event.pointerType === \"mouse\" && event.buttons === 1)) return; // dragging\n let [xp, yp] = pointof(event);\n (xp -= tx), (yp -= ty); // correct for facets and band scales\n const kpx = xp < dimensions.marginLeft || xp > dimensions.width - dimensions.marginRight ? 1 : kx;\n const kpy = yp < dimensions.marginTop || yp > dimensions.height - dimensions.marginBottom ? 1 : ky;\n let ii = null;\n let ri = maxRadius * maxRadius;\n for (const j of index) {\n const dx = kpx * (px(j) - xp);\n const dy = kpy * (py(j) - yp);\n const rj = dx * dx + dy * dy;\n if (rj <= ri) (ii = j), (ri = rj);\n }\n if (ii != null && (kx !== 1 || ky !== 1)) {\n const dx = px(ii) - xp;\n const dy = py(ii) - yp;\n ri = dx * dx + dy * dy;\n }\n update(ii, ri);\n }\n\n function pointerdown(event) {\n if (event.pointerType !== \"mouse\") return;\n if (i == null) return; // not pointing\n if (state.sticky && state.roots.some((r) => r?.contains(event.target))) return; // stay sticky\n if (state.sticky) (state.sticky = false), state.renders.forEach((r) => r(null)); // clear all pointers\n else (state.sticky = true), render(i);\n event.stopImmediatePropagation(); // suppress other pointers\n }\n\n function pointerleave(event) {\n if (event.pointerType !== \"mouse\") return;\n if (!state.sticky) update(null);\n }\n\n // We listen to the svg element; listening to the window instead would let\n // us receive pointer events from farther away, but would also make it\n // hard to know when to remove the listeners. (Using a mutation observer\n // to watch the entire document is likely too expensive.)\n svg.addEventListener(\"pointerenter\", pointermove);\n svg.addEventListener(\"pointermove\", pointermove);\n svg.addEventListener(\"pointerdown\", pointerdown);\n svg.addEventListener(\"pointerleave\", pointerleave);\n\n return render(null);\n }, render)\n };\n}\n\nexport function pointer(options) {\n return pointerK(1, 1, options);\n}\n\nexport function pointerX(options) {\n return pointerK(1, 0.01, options);\n}\n\nexport function pointerY(options) {\n return pointerK(0.01, 1, options);\n}\n\nexport function anchorX({x1: X1, x2: X2, x: X = X1}, cx) {\n return X1 && X2 ? (i) => (X1[i] + X2[i]) / 2 : X ? (i) => X[i] : () => cx;\n}\n\nexport function anchorY({y1: Y1, y2: Y2, y: Y = Y1}, cy) {\n return Y1 && Y2 ? (i) => (Y1[i] + Y2[i]) / 2 : Y ? (i) => Y[i] : () => cy;\n}\n", "import {isOrdinalScale} from \"./scales.js\";\n\nexport function inferFontVariant(scale) {\n return isOrdinalScale(scale) && scale.interval === undefined ? undefined : \"tabular-nums\";\n}\n", "import {quantize, interpolateNumber, piecewise, format, scaleBand, scaleLinear, axisBottom} from \"d3\";\nimport {inferFontVariant} from \"../axes.js\";\nimport {createContext, create} from \"../context.js\";\nimport {map, maybeNumberChannel} from \"../options.js\";\nimport {interpolatePiecewise} from \"../scales/quantitative.js\";\nimport {applyInlineStyles, impliedString, maybeClassName} from \"../style.js\";\n\nexport function legendRamp(color, options) {\n let {\n label = color.label,\n tickSize = 6,\n width = 240,\n height = 44 + tickSize,\n marginTop = 18,\n marginRight = 0,\n marginBottom = 16 + tickSize,\n marginLeft = 0,\n style,\n ticks = (width - marginLeft - marginRight) / 64,\n tickFormat,\n fontVariant = inferFontVariant(color),\n round = true,\n opacity,\n className\n } = options;\n const context = createContext(options);\n className = maybeClassName(className);\n opacity = maybeNumberChannel(opacity)[1];\n if (tickFormat === null) tickFormat = () => null;\n\n const svg = create(\"svg\", context)\n .attr(\"class\", `${className}-ramp`)\n .attr(\"font-family\", \"system-ui, sans-serif\")\n .attr(\"font-size\", 10)\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"viewBox\", `0 0 ${width} ${height}`)\n .call((svg) =>\n // Warning: if you edit this, change defaultClassName.\n svg.append(\"style\").text(\n `:where(.${className}-ramp) {\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n overflow: visible;\n}\n:where(.${className}-ramp text) {\n white-space: pre;\n}`\n )\n )\n .call(applyInlineStyles, style);\n\n let tickAdjust = (g) => g.selectAll(\".tick line\").attr(\"y1\", marginTop + marginBottom - height);\n\n let x;\n\n // Some D3 scales use scale.interpolate, some scale.interpolator, and some\n // scale.round; this normalizes the API so it works with all scale types.\n const applyRange = round ? (x, range) => x.rangeRound(range) : (x, range) => x.range(range);\n\n const {type, domain, range, interpolate, scale, pivot} = color;\n\n // Continuous\n if (interpolate) {\n // Often interpolate is a \u201Cfixed\u201D interpolator on the [0, 1] interval, as\n // with a built-in color scheme, but sometimes it is a function that takes\n // two arguments and is used in conjunction with the range.\n const interpolator =\n range === undefined\n ? interpolate\n : piecewise(interpolate.length === 1 ? interpolatePiecewise(interpolate) : interpolate, range);\n\n // Construct a D3 scale of the same type, but with a range that evenly\n // divides the horizontal extent of the legend. (In the common case, the\n // domain.length is two, and so the range is simply the extent.) For a\n // diverging scale, we need an extra point in the range for the pivot such\n // that the pivot is always drawn in the middle.\n x = applyRange(\n scale.copy(),\n quantize(\n interpolateNumber(marginLeft, width - marginRight),\n Math.min(domain.length + (pivot !== undefined), range === undefined ? Infinity : range.length)\n )\n );\n\n // Construct a 256\u00D71 canvas, filling each pixel using the interpolator.\n const n = 256;\n const canvas = context.document.createElement(\"canvas\");\n canvas.width = n;\n canvas.height = 1;\n const context2 = canvas.getContext(\"2d\");\n for (let i = 0, j = n - 1; i < n; ++i) {\n context2.fillStyle = interpolator(i / j);\n context2.fillRect(i, 0, 1, 1);\n }\n\n svg\n .append(\"image\")\n .attr(\"opacity\", opacity)\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop)\n .attr(\"width\", width - marginLeft - marginRight)\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"preserveAspectRatio\", \"none\")\n .attr(\"xlink:href\", canvas.toDataURL());\n }\n\n // Threshold\n else if (type === \"threshold\") {\n const thresholds = domain;\n\n const thresholdFormat =\n tickFormat === undefined ? (d) => d : typeof tickFormat === \"string\" ? format(tickFormat) : tickFormat;\n\n // Construct a linear scale with evenly-spaced ticks for each of the\n // thresholds; the domain extends one beyond the threshold extent.\n x = applyRange(scaleLinear().domain([-1, range.length - 1]), [marginLeft, width - marginRight]);\n\n svg\n .append(\"g\")\n .attr(\"fill-opacity\", opacity)\n .selectAll()\n .data(range)\n .enter()\n .append(\"rect\")\n .attr(\"x\", (d, i) => x(i - 1))\n .attr(\"y\", marginTop)\n .attr(\"width\", (d, i) => x(i) - x(i - 1))\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"fill\", (d) => d);\n\n ticks = map(thresholds, (_, i) => i);\n tickFormat = (i) => thresholdFormat(thresholds[i], i);\n }\n\n // Ordinal (hopefully!)\n else {\n x = applyRange(scaleBand().domain(domain), [marginLeft, width - marginRight]);\n\n svg\n .append(\"g\")\n .attr(\"fill-opacity\", opacity)\n .selectAll()\n .data(domain)\n .enter()\n .append(\"rect\")\n .attr(\"x\", x)\n .attr(\"y\", marginTop)\n .attr(\"width\", Math.max(0, x.bandwidth() - 1))\n .attr(\"height\", height - marginTop - marginBottom)\n .attr(\"fill\", scale);\n\n tickAdjust = () => {};\n }\n\n svg\n .append(\"g\")\n .attr(\"transform\", `translate(0,${height - marginBottom})`)\n .call(\n axisBottom(x)\n .ticks(Array.isArray(ticks) ? null : ticks, typeof tickFormat === \"string\" ? tickFormat : undefined)\n .tickFormat(typeof tickFormat === \"function\" ? tickFormat : undefined)\n .tickSize(tickSize)\n .tickValues(Array.isArray(ticks) ? ticks : null)\n )\n .attr(\"font-size\", null)\n .attr(\"font-family\", null)\n .attr(\"font-variant\", impliedString(fontVariant, \"normal\"))\n .call(tickAdjust)\n .call((g) => g.select(\".domain\").remove());\n\n if (label !== undefined) {\n svg\n .append(\"text\")\n .attr(\"x\", marginLeft)\n .attr(\"y\", marginTop - 6)\n .attr(\"fill\", \"currentColor\") // TODO move to stylesheet?\n .attr(\"font-weight\", \"bold\")\n .text(label);\n }\n\n return svg.node();\n}\n", "export const radians = Math.PI / 180;\n", "import {create} from \"./context.js\";\n\nexport function markers(mark, {marker, markerStart = marker, markerMid = marker, markerEnd = marker} = {}) {\n mark.markerStart = maybeMarker(markerStart);\n mark.markerMid = maybeMarker(markerMid);\n mark.markerEnd = maybeMarker(markerEnd);\n}\n\nfunction maybeMarker(marker) {\n if (marker == null || marker === false) return null;\n if (marker === true) return markerCircleFill;\n if (typeof marker === \"function\") return marker;\n switch (`${marker}`.toLowerCase()) {\n case \"none\":\n return null;\n case \"arrow\":\n return markerArrow(\"auto\");\n case \"arrow-reverse\":\n return markerArrow(\"auto-start-reverse\");\n case \"dot\":\n return markerDot;\n case \"circle\":\n case \"circle-fill\":\n return markerCircleFill;\n case \"circle-stroke\":\n return markerCircleStroke;\n case \"tick\":\n return markerTick(\"auto\");\n case \"tick-x\":\n return markerTick(90);\n case \"tick-y\":\n return markerTick(0);\n }\n throw new Error(`invalid marker: ${marker}`);\n}\n\nfunction markerArrow(orient) {\n return (color, context) =>\n create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"orient\", orient)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", 1.5)\n .attr(\"stroke-linecap\", \"round\")\n .attr(\"stroke-linejoin\", \"round\")\n .call((marker) => marker.append(\"path\").attr(\"d\", \"M-1.5,-3l3,3l-3,3\"))\n .node();\n}\n\nfunction markerDot(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", color)\n .attr(\"stroke\", \"none\")\n .call((marker) => marker.append(\"circle\").attr(\"r\", 2.5))\n .node();\n}\n\nfunction markerCircleFill(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", color)\n .attr(\"stroke\", \"var(--plot-background)\")\n .attr(\"stroke-width\", 1.5)\n .call((marker) => marker.append(\"circle\").attr(\"r\", 3))\n .node();\n}\n\nfunction markerCircleStroke(color, context) {\n return create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-5 -5 10 10\")\n .attr(\"markerWidth\", 6.67)\n .attr(\"markerHeight\", 6.67)\n .attr(\"fill\", \"var(--plot-background)\")\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", 1.5)\n .call((marker) => marker.append(\"circle\").attr(\"r\", 3))\n .node();\n}\n\nfunction markerTick(orient) {\n return (color, context) =>\n create(\"svg:marker\", context)\n .attr(\"viewBox\", \"-3 -3 6 6\")\n .attr(\"markerWidth\", 6)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", orient)\n .attr(\"stroke\", color)\n .call((marker) => marker.append(\"path\").attr(\"d\", \"M0,-3v6\"))\n .node();\n}\n\nlet nextMarkerId = 0;\n\nexport function applyMarkers(path, mark, {stroke: S}, context) {\n return applyMarkersColor(path, mark, S && ((i) => S[i]), context);\n}\n\nexport function applyGroupedMarkers(path, mark, {stroke: S}, context) {\n return applyMarkersColor(path, mark, S && (([i]) => S[i]), context);\n}\n\nfunction applyMarkersColor(path, {markerStart, markerMid, markerEnd, stroke}, strokeof = () => stroke, context) {\n const iriByMarkerColor = new Map();\n\n function applyMarker(marker) {\n return function (i) {\n const color = strokeof(i);\n let iriByColor = iriByMarkerColor.get(marker);\n if (!iriByColor) iriByMarkerColor.set(marker, (iriByColor = new Map()));\n let iri = iriByColor.get(color);\n if (!iri) {\n const node = this.parentNode.insertBefore(marker(color, context), this);\n const id = `plot-marker-${++nextMarkerId}`;\n node.setAttribute(\"id\", id);\n iriByColor.set(color, (iri = `url(#${id})`));\n }\n return iri;\n };\n }\n\n if (markerStart) path.attr(\"marker-start\", applyMarker(markerStart));\n if (markerMid) path.attr(\"marker-mid\", applyMarker(markerMid));\n if (markerEnd) path.attr(\"marker-end\", applyMarker(markerEnd));\n}\n", "import {offset} from \"../style.js\";\n\nexport function maybeInsetX({inset, insetLeft, insetRight, ...options} = {}) {\n [insetLeft, insetRight] = maybeInset(inset, insetLeft, insetRight);\n return {inset, insetLeft, insetRight, ...options};\n}\n\nexport function maybeInsetY({inset, insetTop, insetBottom, ...options} = {}) {\n [insetTop, insetBottom] = maybeInset(inset, insetTop, insetBottom);\n return {inset, insetTop, insetBottom, ...options};\n}\n\nfunction maybeInset(inset, inset1, inset2) {\n return inset === undefined && inset1 === undefined && inset2 === undefined\n ? offset\n ? [1, 0]\n : [0.5, 0.5]\n : [inset1, inset2];\n}\n", "import {isTemporal, labelof, map, maybeInterval, maybeValue, valueof} from \"../options.js\";\nimport {maybeInsetX, maybeInsetY} from \"./inset.js\";\n\n// The interval may be specified either as x: {value, interval} or as {x,\n// interval}. The former can be used to specify separate intervals for x and y,\n// for example with Plot.rect.\nfunction maybeIntervalValue(value, {interval}) {\n value = {...maybeValue(value)};\n value.interval = maybeInterval(value.interval === undefined ? interval : value.interval);\n return value;\n}\n\nfunction maybeIntervalK(k, maybeInsetK, options, trivial) {\n const {[k]: v, [`${k}1`]: v1, [`${k}2`]: v2} = options;\n const {value, interval} = maybeIntervalValue(v, options);\n if (value == null || (interval == null && !trivial)) return options;\n const label = labelof(v);\n if (interval == null) {\n let V;\n const kv = {transform: (data) => V || (V = valueof(data, value)), label};\n return {\n ...options,\n [k]: undefined,\n [`${k}1`]: v1 === undefined ? kv : v1,\n [`${k}2`]: v2 === undefined && !(v1 === v2 && trivial) ? kv : v2\n };\n }\n let D1, V1;\n function transform(data) {\n if (V1 !== undefined && data === D1) return V1; // memoize\n return (V1 = map(valueof((D1 = data), value), (v) => interval.floor(v)));\n }\n return maybeInsetK({\n ...options,\n [k]: undefined,\n [`${k}1`]: v1 === undefined ? {transform, label} : v1,\n [`${k}2`]: v2 === undefined ? {transform: (data) => transform(data).map((v) => interval.offset(v)), label} : v2\n });\n}\n\nfunction maybeIntervalMidK(k, maybeInsetK, options) {\n const {[k]: v} = options;\n const {value, interval} = maybeIntervalValue(v, options);\n if (value == null || interval == null) return options;\n return maybeInsetK({\n ...options,\n [k]: {\n label: labelof(v),\n transform: (data) => {\n const V1 = map(valueof(data, value), (v) => interval.floor(v));\n const V2 = V1.map((v) => interval.offset(v));\n return V1.map(\n isTemporal(V1)\n ? (v1, v2) =>\n v1 == null || isNaN((v1 = +v1)) || ((v2 = V2[v2]), v2 == null) || isNaN((v2 = +v2))\n ? undefined\n : new Date((v1 + v2) / 2)\n : (v1, v2) => (v1 == null || ((v2 = V2[v2]), v2 == null) ? NaN : (+v1 + +v2) / 2)\n );\n }\n }\n });\n}\n\nexport function maybeTrivialIntervalX(options = {}) {\n return maybeIntervalK(\"x\", maybeInsetX, options, true);\n}\n\nexport function maybeTrivialIntervalY(options = {}) {\n return maybeIntervalK(\"y\", maybeInsetY, options, true);\n}\n\nexport function maybeIntervalX(options = {}) {\n return maybeIntervalK(\"x\", maybeInsetX, options);\n}\n\nexport function maybeIntervalY(options = {}) {\n return maybeIntervalK(\"y\", maybeInsetY, options);\n}\n\nexport function maybeIntervalMidX(options = {}) {\n return maybeIntervalMidK(\"x\", maybeInsetX, options);\n}\n\nexport function maybeIntervalMidY(options = {}) {\n return maybeIntervalMidK(\"y\", maybeInsetY, options);\n}\n", "import {create} from \"../context.js\";\nimport {Mark, withTip} from \"../mark.js\";\nimport {applyMarkers, markers} from \"../marker.js\";\nimport {identity, number} from \"../options.js\";\nimport {isCollapsed} from \"../scales.js\";\nimport {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, offset} from \"../style.js\";\nimport {maybeIntervalX, maybeIntervalY} from \"../transforms/interval.js\";\n\nconst defaults = {\n ariaLabel: \"rule\",\n fill: null,\n stroke: \"currentColor\"\n};\n\nexport class RuleX extends Mark {\n constructor(data, options = {}) {\n const {x, y1, y2, inset = 0, insetTop = inset, insetBottom = inset} = options;\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y1: {value: y1, scale: \"y\", optional: true},\n y2: {value: y2, scale: \"y\", optional: true}\n },\n withTip(options, \"x\"),\n defaults\n );\n this.insetTop = number(insetTop);\n this.insetBottom = number(insetBottom);\n markers(this, options);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y1: Y1, y2: Y2} = channels;\n const {width, height, marginTop, marginRight, marginLeft, marginBottom} = dimensions;\n const {insetTop, insetBottom} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {x: X && x}, offset, 0)\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"line\")\n .call(applyDirectStyles, this)\n .attr(\"x1\", X ? (i) => X[i] : (marginLeft + width - marginRight) / 2)\n .attr(\"x2\", X ? (i) => X[i] : (marginLeft + width - marginRight) / 2)\n .attr(\"y1\", Y1 && !isCollapsed(y) ? (i) => Y1[i] + insetTop : marginTop + insetTop)\n .attr(\n \"y2\",\n Y2 && !isCollapsed(y)\n ? y.bandwidth\n ? (i) => Y2[i] + y.bandwidth() - insetBottom\n : (i) => Y2[i] - insetBottom\n : height - marginBottom - insetBottom\n )\n .call(applyChannelStyles, this, channels)\n .call(applyMarkers, this, channels, context)\n )\n .node();\n }\n}\n\nexport class RuleY extends Mark {\n constructor(data, options = {}) {\n const {x1, x2, y, inset = 0, insetRight = inset, insetLeft = inset} = options;\n super(\n data,\n {\n y: {value: y, scale: \"y\", optional: true},\n x1: {value: x1, scale: \"x\", optional: true},\n x2: {value: x2, scale: \"x\", optional: true}\n },\n withTip(options, \"y\"),\n defaults\n );\n this.insetRight = number(insetRight);\n this.insetLeft = number(insetLeft);\n markers(this, options);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {y: Y, x1: X1, x2: X2} = channels;\n const {width, height, marginTop, marginRight, marginLeft, marginBottom} = dimensions;\n const {insetLeft, insetRight} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {y: Y && y}, 0, offset)\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"line\")\n .call(applyDirectStyles, this)\n .attr(\"x1\", X1 && !isCollapsed(x) ? (i) => X1[i] + insetLeft : marginLeft + insetLeft)\n .attr(\n \"x2\",\n X2 && !isCollapsed(x)\n ? x.bandwidth\n ? (i) => X2[i] + x.bandwidth() - insetRight\n : (i) => X2[i] - insetRight\n : width - marginRight - insetRight\n )\n .attr(\"y1\", Y ? (i) => Y[i] : (marginTop + height - marginBottom) / 2)\n .attr(\"y2\", Y ? (i) => Y[i] : (marginTop + height - marginBottom) / 2)\n .call(applyChannelStyles, this, channels)\n .call(applyMarkers, this, channels, context)\n )\n .node();\n }\n}\n\nexport function ruleX(data, options) {\n let {x = identity, y, y1, y2, ...rest} = maybeIntervalY(options);\n [y1, y2] = maybeOptionalZero(y, y1, y2);\n return new RuleX(data, {...rest, x, y1, y2});\n}\n\nexport function ruleY(data, options) {\n let {y = identity, x, x1, x2, ...rest} = maybeIntervalX(options);\n [x1, x2] = maybeOptionalZero(x, x1, x2);\n return new RuleY(data, {...rest, y, x1, x2});\n}\n\n// For marks specified either as [0, x] or [x1, x2], or nothing.\nfunction maybeOptionalZero(x, x1, x2) {\n if (x == null) {\n if (x1 === undefined) {\n if (x2 !== undefined) return [0, x2];\n } else {\n if (x2 === undefined) return [0, x1];\n }\n } else if (x1 === undefined) {\n return x2 === undefined ? [0, x] : [x, x2];\n } else if (x2 === undefined) {\n return [x, x1];\n }\n return [x1, x2];\n}\n", "export function template(strings, ...parts) {\n let n = parts.length;\n\n // If any of the interpolated parameters are strings rather than functions,\n // bake them into the template to optimize performance during render.\n for (let j = 0, copy = true; j < n; ++j) {\n if (typeof parts[j] !== \"function\") {\n if (copy) {\n strings = strings.slice(); // copy before mutate\n copy = false;\n }\n strings.splice(j, 2, strings[j] + parts[j] + strings[j + 1]);\n parts.splice(j, 1);\n --j, --n;\n }\n }\n\n return (i) => {\n let s = strings[0];\n for (let j = 0; j < n; ++j) {\n s += parts[j](i) + strings[j + 1];\n }\n return s;\n };\n}\n", "import {namespaces} from \"d3\";\nimport {create} from \"../context.js\";\nimport {nonempty} from \"../defined.js\";\nimport {formatDefault} from \"../format.js\";\nimport {Mark} from \"../mark.js\";\nimport {\n indexOf,\n identity,\n string,\n maybeNumberChannel,\n maybeTuple,\n numberChannel,\n isNumeric,\n isTemporal,\n keyword,\n maybeFrameAnchor,\n isTextual,\n isIterable\n} from \"../options.js\";\nimport {\n applyChannelStyles,\n applyDirectStyles,\n applyIndirectStyles,\n applyAttr,\n applyTransform,\n impliedString,\n applyFrameAnchor\n} from \"../style.js\";\nimport {template} from \"../template.js\";\nimport {maybeIntervalMidX, maybeIntervalMidY} from \"../transforms/interval.js\";\n\nconst defaults = {\n ariaLabel: \"text\",\n strokeLinejoin: \"round\",\n strokeWidth: 3,\n paintOrder: \"stroke\"\n};\n\nconst softHyphen = \"\\u00ad\";\n\nexport class Text extends Mark {\n constructor(data, options = {}) {\n const {\n x,\n y,\n text = isIterable(data) && isTextual(data) ? identity : indexOf,\n frameAnchor,\n textAnchor = /right$/i.test(frameAnchor) ? \"end\" : /left$/i.test(frameAnchor) ? \"start\" : \"middle\",\n lineAnchor = /^top/i.test(frameAnchor) ? \"top\" : /^bottom/i.test(frameAnchor) ? \"bottom\" : \"middle\",\n lineHeight = 1,\n lineWidth = Infinity,\n textOverflow,\n monospace,\n fontFamily = monospace ? \"ui-monospace, monospace\" : undefined,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n rotate\n } = options;\n const [vrotate, crotate] = maybeNumberChannel(rotate, 0);\n const [vfontSize, cfontSize] = maybeFontSizeChannel(fontSize);\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y: {value: y, scale: \"y\", optional: true},\n fontSize: {value: vfontSize, optional: true},\n rotate: {value: numberChannel(vrotate), optional: true},\n text: {value: text, filter: nonempty, optional: true}\n },\n options,\n defaults\n );\n this.rotate = crotate;\n this.textAnchor = impliedString(textAnchor, \"middle\");\n this.lineAnchor = keyword(lineAnchor, \"lineAnchor\", [\"top\", \"middle\", \"bottom\"]);\n this.lineHeight = +lineHeight;\n this.lineWidth = +lineWidth;\n this.textOverflow = maybeTextOverflow(textOverflow);\n this.monospace = !!monospace;\n this.fontFamily = string(fontFamily);\n this.fontSize = cfontSize;\n this.fontStyle = string(fontStyle);\n this.fontVariant = string(fontVariant);\n this.fontWeight = string(fontWeight);\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n if (!(this.lineWidth >= 0)) throw new Error(`invalid lineWidth: ${lineWidth}`);\n this.splitLines = splitter(this);\n this.clipLine = clipper(this);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y: Y, rotate: R, text: T, title: TL, fontSize: FS} = channels;\n const {rotate} = this;\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyIndirectTextStyles, this, T, dimensions)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"text\")\n .call(applyDirectStyles, this)\n .call(applyMultilineText, this, T, TL)\n .attr(\n \"transform\",\n template`translate(${X ? (i) => X[i] : cx},${Y ? (i) => Y[i] : cy})${\n R ? (i) => ` rotate(${R[i]})` : rotate ? ` rotate(${rotate})` : ``\n }`\n )\n .call(applyAttr, \"font-size\", FS && ((i) => FS[i]))\n .call(applyChannelStyles, this, channels)\n )\n .node();\n }\n}\n\nexport function maybeTextOverflow(textOverflow) {\n return textOverflow == null\n ? null\n : keyword(textOverflow, \"textOverflow\", [\n \"clip\", // shorthand for clip-end\n \"ellipsis\", // \u2026 ellipsis-end\n \"clip-start\",\n \"clip-end\",\n \"ellipsis-start\",\n \"ellipsis-middle\",\n \"ellipsis-end\"\n ]).replace(/^(clip|ellipsis)$/, \"$1-end\");\n}\n\nfunction applyMultilineText(selection, mark, T, TL) {\n if (!T) return;\n const {lineAnchor, lineHeight, textOverflow, splitLines, clipLine} = mark;\n selection.each(function (i) {\n const lines = splitLines(formatDefault(T[i]) ?? \"\").map(clipLine);\n const n = lines.length;\n const y = lineAnchor === \"top\" ? 0.71 : lineAnchor === \"bottom\" ? 1 - n : (164 - n * 100) / 200;\n if (n > 1) {\n let m = 0;\n for (let i = 0; i < n; ++i) {\n ++m;\n if (!lines[i]) continue;\n const tspan = this.ownerDocument.createElementNS(namespaces.svg, \"tspan\");\n tspan.setAttribute(\"x\", 0);\n if (i === m - 1) tspan.setAttribute(\"y\", `${(y + i) * lineHeight}em`);\n else tspan.setAttribute(\"dy\", `${m * lineHeight}em`);\n tspan.textContent = lines[i];\n this.appendChild(tspan);\n m = 0;\n }\n } else {\n if (y) this.setAttribute(\"y\", `${y * lineHeight}em`);\n this.textContent = lines[0];\n }\n if (textOverflow && !TL && lines[0] !== T[i]) {\n const title = this.ownerDocument.createElementNS(namespaces.svg, \"title\");\n title.textContent = T[i];\n this.appendChild(title);\n }\n });\n}\n\nexport function text(data, {x, y, ...options} = {}) {\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Text(data, {...options, x, y});\n}\n\nexport function textX(data, {x = identity, ...options} = {}) {\n return new Text(data, maybeIntervalMidY({...options, x}));\n}\n\nexport function textY(data, {y = identity, ...options} = {}) {\n return new Text(data, maybeIntervalMidX({...options, y}));\n}\n\nexport function applyIndirectTextStyles(selection, mark, T) {\n applyAttr(selection, \"text-anchor\", mark.textAnchor);\n applyAttr(selection, \"font-family\", mark.fontFamily);\n applyAttr(selection, \"font-size\", mark.fontSize);\n applyAttr(selection, \"font-style\", mark.fontStyle);\n applyAttr(selection, \"font-variant\", mark.fontVariant === undefined ? inferFontVariant(T) : mark.fontVariant);\n applyAttr(selection, \"font-weight\", mark.fontWeight);\n}\n\nfunction inferFontVariant(T) {\n return T && (isNumeric(T) || isTemporal(T)) ? \"tabular-nums\" : undefined;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/CSS/font-size\nconst fontSizes = new Set([\n // global keywords\n \"inherit\",\n \"initial\",\n \"revert\",\n \"unset\",\n // absolute keywords\n \"xx-small\",\n \"x-small\",\n \"small\",\n \"medium\",\n \"large\",\n \"x-large\",\n \"xx-large\",\n \"xxx-large\",\n // relative keywords\n \"larger\",\n \"smaller\"\n]);\n\n// The font size may be expressed as a constant in the following forms:\n// - number in pixels\n// - string keyword: see above\n// - string : e.g., \"12px\"\n// - string : e.g., \"80%\"\n// Anything else is assumed to be a channel definition.\nfunction maybeFontSizeChannel(fontSize) {\n if (fontSize == null || typeof fontSize === \"number\") return [undefined, fontSize];\n if (typeof fontSize !== \"string\") return [fontSize, undefined];\n fontSize = fontSize.trim().toLowerCase();\n return fontSizes.has(fontSize) || /^[+-]?\\d*\\.?\\d+(e[+-]?\\d+)?(\\w*|%)$/.test(fontSize)\n ? [undefined, fontSize]\n : [fontSize, undefined];\n}\n\n// This is a greedy algorithm for line wrapping. It would be better to use the\n// Knuth\u2013Plass line breaking algorithm (but that would be much more complex).\n// https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap\nfunction lineWrap(input, maxWidth, widthof) {\n const lines = [];\n let lineStart,\n lineEnd = 0;\n for (const [wordStart, wordEnd, required] of lineBreaks(input)) {\n // Record the start of a line. This isn\u2019t the same as the previous line\u2019s\n // end because we often skip spaces between lines.\n if (lineStart === undefined) lineStart = wordStart;\n\n // If the current line is not empty, and if adding the current word would\n // make the line longer than the allowed width, then break the line at the\n // previous word end.\n if (lineEnd > lineStart && widthof(input, lineStart, wordEnd) > maxWidth) {\n lines.push(input.slice(lineStart, lineEnd) + (input[lineEnd - 1] === softHyphen ? \"-\" : \"\"));\n lineStart = wordStart;\n }\n\n // If this is a required break (a newline), emit the line and reset.\n if (required) {\n lines.push(input.slice(lineStart, wordEnd));\n lineStart = undefined;\n continue;\n }\n\n // Extend the current line to include the new word.\n lineEnd = wordEnd;\n }\n return lines;\n}\n\n// This is a rudimentary (and U.S.-centric) algorithm for finding opportunities\n// to break lines between words. A better and far more comprehensive approach\n// would be to use the official Unicode Line Breaking Algorithm.\n// https://unicode.org/reports/tr14/\nfunction* lineBreaks(input) {\n let i = 0,\n j = 0;\n const n = input.length;\n while (j < n) {\n let k = 1;\n switch (input[j]) {\n case softHyphen:\n case \"-\": // hyphen\n ++j;\n yield [i, j, false];\n i = j;\n break;\n case \" \":\n yield [i, j, false];\n while (input[++j] === \" \"); // skip multiple spaces\n i = j;\n break;\n case \"\\r\":\n if (input[j + 1] === \"\\n\") ++k; // falls through\n case \"\\n\":\n yield [i, j, true];\n j += k;\n i = j;\n break;\n default:\n ++j;\n break;\n }\n }\n yield [i, j, true];\n}\n\n// Computed as round(measureText(text).width * 10) at 10px system-ui. For\n// characters that are not represented in this map, we\u2019d ideally want to use a\n// weighted average of what we expect to see. But since we don\u2019t really know\n// what that is, using \u201Ce\u201D seems reasonable.\nconst defaultWidthMap = {\n a: 56,\n b: 63,\n c: 57,\n d: 63,\n e: 58,\n f: 37,\n g: 62,\n h: 60,\n i: 26,\n j: 26,\n k: 55,\n l: 26,\n m: 88,\n n: 60,\n o: 60,\n p: 62,\n q: 62,\n r: 39,\n s: 54,\n t: 38,\n u: 60,\n v: 55,\n w: 79,\n x: 54,\n y: 55,\n z: 55,\n A: 69,\n B: 67,\n C: 73,\n D: 74,\n E: 61,\n F: 58,\n G: 76,\n H: 75,\n I: 28,\n J: 55,\n K: 67,\n L: 58,\n M: 89,\n N: 75,\n O: 78,\n P: 65,\n Q: 78,\n R: 67,\n S: 65,\n T: 65,\n U: 75,\n V: 69,\n W: 98,\n X: 69,\n Y: 67,\n Z: 67,\n 0: 64,\n 1: 48,\n 2: 62,\n 3: 64,\n 4: 66,\n 5: 63,\n 6: 65,\n 7: 58,\n 8: 65,\n 9: 65,\n \" \": 29,\n \"!\": 32,\n '\"': 49,\n \"'\": 31,\n \"(\": 39,\n \")\": 39,\n \",\": 31,\n \"-\": 48,\n \".\": 31,\n \"/\": 32,\n \":\": 31,\n \";\": 31,\n \"?\": 52,\n \"\u2018\": 31,\n \"\u2019\": 31,\n \"\u201C\": 47,\n \"\u201D\": 47,\n \"\u2026\": 82\n};\n\n// This is a rudimentary (and U.S.-centric) algorithm for measuring the width of\n// a string based on a technique of Gregor Aisch; it assumes that individual\n// characters are laid out independently and does not implement the Unicode\n// grapheme cluster breaking algorithm. It does understand code points, though,\n// and so treats things like emoji as having the width of a lowercase e (and\n// should be equivalent to using for-of to iterate over code points, while also\n// being fast). TODO Optimize this by noting that we often re-measure characters\n// that were previously measured?\n// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries\n// https://exploringjs.com/impatient-js/ch_strings.html#atoms-of-text\nexport function defaultWidth(text, start = 0, end = text.length) {\n let sum = 0;\n for (let i = start; i < end; i = readCharacter(text, i)) {\n sum += defaultWidthMap[text[i]] ?? (isPictographic(text, i) ? 120 : defaultWidthMap.e);\n }\n return sum;\n}\n\n// Even for monospaced text, we can\u2019t assume that the number of UTF-16 code\n// points (i.e., the length of a string) corresponds to the number of visible\n// characters; we still have to count graphemes. And note that pictographic\n// characters such as emojis are typically not monospaced!\nexport function monospaceWidth(text, start = 0, end = text.length) {\n let sum = 0;\n for (let i = start; i < end; i = readCharacter(text, i)) {\n sum += isPictographic(text, i) ? 126 : 63;\n }\n return sum;\n}\n\nexport function splitter({monospace, lineWidth, textOverflow}) {\n if (textOverflow != null || lineWidth == Infinity) return (text) => text.split(/\\r\\n?|\\n/g);\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const maxWidth = lineWidth * 100;\n return (text) => lineWrap(text, maxWidth, widthof);\n}\n\nexport function clipper({monospace, lineWidth, textOverflow}) {\n if (textOverflow == null || lineWidth == Infinity) return (text) => text;\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const maxWidth = lineWidth * 100;\n switch (textOverflow) {\n case \"clip-start\":\n return (text) => clipStart(text, maxWidth, widthof, \"\");\n case \"clip-end\":\n return (text) => clipEnd(text, maxWidth, widthof, \"\");\n case \"ellipsis-start\":\n return (text) => clipStart(text, maxWidth, widthof, ellipsis);\n case \"ellipsis-middle\":\n return (text) => clipMiddle(text, maxWidth, widthof, ellipsis);\n case \"ellipsis-end\":\n return (text) => clipEnd(text, maxWidth, widthof, ellipsis);\n }\n}\n\nexport const ellipsis = \"\u2026\";\n\n// Cuts the given text to the given width, using the specified widthof function;\n// the returned [index, error] guarantees text.slice(0, index) fits within the\n// specified width with the given error. If the text fits naturally within the\n// given width, returns [-1, 0]. If the text needs cutting, the given inset\n// specifies how much space (in the same units as width and widthof) to reserve\n// for a possible ellipsis character.\nexport function cut(text, width, widthof, inset) {\n const I = []; // indexes of read character boundaries\n let w = 0; // current line width\n for (let i = 0, j = 0, n = text.length; i < n; i = j) {\n j = readCharacter(text, i); // read the next character\n const l = widthof(text, i, j); // current character width\n if (w + l > width) {\n w += inset;\n while (w > width && i > 0) (j = i), (i = I.pop()), (w -= widthof(text, i, j)); // remove excess\n return [i, width - w];\n }\n w += l;\n I.push(i);\n }\n return [-1, 0];\n}\n\nexport function clipEnd(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const e = widthof(ellipsis);\n const [i] = cut(text, width, widthof, e);\n return i < 0 ? text : text.slice(0, i).trimEnd() + ellipsis;\n}\n\nexport function clipMiddle(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const w = widthof(text);\n if (w <= width) return text;\n const e = widthof(ellipsis) / 2;\n const [i, ei] = cut(text, width / 2, widthof, e);\n const [j] = cut(text, w - width / 2 - ei + e, widthof, -e); // TODO read spaces?\n return j < 0 ? ellipsis : text.slice(0, i).trimEnd() + ellipsis + text.slice(readCharacter(text, j)).trimStart();\n}\n\nexport function clipStart(text, width, widthof, ellipsis) {\n text = text.trim(); // ignore leading and trailing whitespace\n const w = widthof(text);\n if (w <= width) return text;\n const e = widthof(ellipsis);\n const [j] = cut(text, w - width + e, widthof, -e); // TODO read spaces?\n return j < 0 ? ellipsis : ellipsis + text.slice(readCharacter(text, j)).trimStart();\n}\n\nconst reCombiner = /[\\p{Combining_Mark}\\p{Emoji_Modifier}]+/uy;\nconst rePictographic = /\\p{Extended_Pictographic}/uy;\n\n// Reads a single \u201Ccharacter\u201D element from the given text starting at the given\n// index, returning the index after the read character. Ideally, this implements\n// the Unicode text segmentation algorithm and understands grapheme cluster\n// boundaries, etc., but in practice this is only smart enough to detect UTF-16\n// surrogate pairs, combining marks, and zero-width joiner (zwj) sequences such\n// as emoji skin color modifiers. https://unicode.org/reports/tr29/\nexport function readCharacter(text, i) {\n i += isSurrogatePair(text, i) ? 2 : 1;\n if (isCombiner(text, i)) i = reCombiner.lastIndex;\n if (isZeroWidthJoiner(text, i)) return readCharacter(text, i + 1);\n return i;\n}\n\n// We avoid more expensive regex tests involving Unicode property classes by\n// first checking for the common case of 7-bit ASCII characters.\nfunction isAscii(text, i) {\n return text.charCodeAt(i) < 0x80;\n}\n\nfunction isSurrogatePair(text, i) {\n const hi = text.charCodeAt(i);\n if (hi >= 0xd800 && hi < 0xdc00) {\n const lo = text.charCodeAt(i + 1);\n return lo >= 0xdc00 && lo < 0xe000;\n }\n return false;\n}\n\nfunction isZeroWidthJoiner(text, i) {\n return text.charCodeAt(i) === 0x200d;\n}\n\nfunction isCombiner(text, i) {\n return isAscii(text, i) ? false : ((reCombiner.lastIndex = i), reCombiner.test(text));\n}\n\nfunction isPictographic(text, i) {\n return isAscii(text, i) ? false : ((rePictographic.lastIndex = i), rePictographic.test(text));\n}\n", "import {pathRound as path} from \"d3\";\nimport {create} from \"../context.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeFrameAnchor, maybeNumberChannel, maybeTuple, keyword, identity} from \"../options.js\";\nimport {\n applyChannelStyles,\n applyDirectStyles,\n applyFrameAnchor,\n applyIndirectStyles,\n applyTransform\n} from \"../style.js\";\nimport {template} from \"../template.js\";\n\nconst defaults = {\n ariaLabel: \"vector\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 1.5,\n strokeLinejoin: \"round\",\n strokeLinecap: \"round\"\n};\n\nconst defaultRadius = 3.5;\n\n// The size of the arrowhead is proportional to its length, but we still allow\n// the relative size of the head to be controlled via the mark\u2019s width option;\n// doubling the default radius will produce an arrowhead that is twice as big.\n// That said, we\u2019ll probably want a arrow with a fixed head size, too.\nconst wingRatio = defaultRadius * 5;\n\nconst shapeArrow = {\n draw(context, l, r) {\n const wing = (l * r) / wingRatio;\n context.moveTo(0, 0);\n context.lineTo(0, -l);\n context.moveTo(-wing, wing - l);\n context.lineTo(0, -l);\n context.lineTo(wing, wing - l);\n }\n};\n\nconst shapeSpike = {\n draw(context, l, r) {\n context.moveTo(-r, 0);\n context.lineTo(0, -l);\n context.lineTo(r, 0);\n }\n};\n\nconst shapes = new Map([\n [\"arrow\", shapeArrow],\n [\"spike\", shapeSpike]\n]);\n\nfunction isShapeObject(value) {\n return value && typeof value.draw === \"function\";\n}\n\nfunction maybeShape(shape) {\n if (isShapeObject(shape)) return shape;\n const value = shapes.get(`${shape}`.toLowerCase());\n if (value) return value;\n throw new Error(`invalid shape: ${shape}`);\n}\n\nexport class Vector extends Mark {\n constructor(data, options = {}) {\n const {x, y, r = defaultRadius, length, rotate, shape = shapeArrow, anchor = \"middle\", frameAnchor} = options;\n const [vl, cl] = maybeNumberChannel(length, 12);\n const [vr, cr] = maybeNumberChannel(rotate, 0);\n super(\n data,\n {\n x: {value: x, scale: \"x\", optional: true},\n y: {value: y, scale: \"y\", optional: true},\n length: {value: vl, scale: \"length\", optional: true},\n rotate: {value: vr, optional: true}\n },\n options,\n defaults\n );\n this.r = +r;\n this.length = cl;\n this.rotate = cr;\n this.shape = maybeShape(shape);\n this.anchor = keyword(anchor, \"anchor\", [\"start\", \"middle\", \"end\"]);\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n }\n render(index, scales, channels, dimensions, context) {\n const {x, y} = scales;\n const {x: X, y: Y, length: L, rotate: A} = channels;\n const {length, rotate, anchor, shape, r} = this;\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .attr(\n \"transform\",\n template`translate(${X ? (i) => X[i] : cx},${Y ? (i) => Y[i] : cy})${\n A ? (i) => ` rotate(${A[i]})` : rotate ? ` rotate(${rotate})` : ``\n }${\n anchor === \"start\"\n ? ``\n : anchor === \"end\"\n ? L\n ? (i) => ` translate(0,${L[i]})`\n : ` translate(0,${length})`\n : L\n ? (i) => ` translate(0,${L[i] / 2})`\n : ` translate(0,${length / 2})`\n }`\n )\n .attr(\n \"d\",\n L\n ? (i) => {\n const p = path();\n shape.draw(p, L[i], r);\n return p;\n }\n : (() => {\n const p = path();\n shape.draw(p, length, r);\n return p;\n })()\n )\n .call(applyChannelStyles, this, channels)\n )\n .node();\n }\n}\n\nexport function vector(data, options = {}) {\n let {x, y, ...rest} = options;\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Vector(data, {...rest, x, y});\n}\n\nexport function vectorX(data, options = {}) {\n const {x = identity, ...rest} = options;\n return new Vector(data, {...rest, x});\n}\n\nexport function vectorY(data, options = {}) {\n const {y = identity, ...rest} = options;\n return new Vector(data, {...rest, y});\n}\n\nexport function spike(data, options = {}) {\n const {\n shape = shapeSpike,\n stroke = defaults.stroke,\n strokeWidth = 1,\n fill = stroke,\n fillOpacity = 0.3,\n anchor = \"start\",\n ...rest\n } = options;\n return vector(data, {...rest, shape, stroke, strokeWidth, fill, fillOpacity, anchor});\n}\n", "import {InternSet, extent, format, utcFormat} from \"d3\";\nimport {formatDefault} from \"../format.js\";\nimport {marks} from \"../mark.js\";\nimport {radians} from \"../math.js\";\nimport {arrayify, constant, identity, keyword, number, range, valueof} from \"../options.js\";\nimport {isIterable, isNoneish, isTemporal, isInterval} from \"../options.js\";\nimport {maybeColorChannel, maybeNumberChannel, maybeRangeInterval} from \"../options.js\";\nimport {inferScaleOrder} from \"../scales.js\";\nimport {offset} from \"../style.js\";\nimport {generalizeTimeInterval, inferTimeFormat, intervalDuration} from \"../time.js\";\nimport {initializer} from \"../transforms/basic.js\";\nimport {warn} from \"../warnings.js\";\nimport {ruleX, ruleY} from \"./rule.js\";\nimport {text, textX, textY} from \"./text.js\";\nimport {vectorX, vectorY} from \"./vector.js\";\n\nfunction maybeData(data, options) {\n if (arguments.length < 2 && !isIterable(data)) (options = data), (data = null);\n if (options === undefined) options = {};\n return [data, options];\n}\n\nfunction maybeAnchor({anchor} = {}, anchors) {\n return anchor === undefined ? anchors[0] : keyword(anchor, \"anchor\", anchors);\n}\n\nfunction anchorY(options) {\n return maybeAnchor(options, [\"left\", \"right\"]);\n}\n\nfunction anchorFy(options) {\n return maybeAnchor(options, [\"right\", \"left\"]);\n}\n\nfunction anchorX(options) {\n return maybeAnchor(options, [\"bottom\", \"top\"]);\n}\n\nfunction anchorFx(options) {\n return maybeAnchor(options, [\"top\", \"bottom\"]);\n}\n\nexport function axisY() {\n const [data, options] = maybeData(...arguments);\n return axisKy(\"y\", anchorY(options), data, options);\n}\n\nexport function axisFy() {\n const [data, options] = maybeData(...arguments);\n return axisKy(\"fy\", anchorFy(options), data, options);\n}\n\nexport function axisX() {\n const [data, options] = maybeData(...arguments);\n return axisKx(\"x\", anchorX(options), data, options);\n}\n\nexport function axisFx() {\n const [data, options] = maybeData(...arguments);\n return axisKx(\"fx\", anchorFx(options), data, options);\n}\n\nfunction axisKy(\n k,\n anchor,\n data,\n {\n color = \"currentColor\",\n opacity = 1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n fill = color,\n fillOpacity = opacity,\n textAnchor,\n textStroke,\n textStrokeOpacity,\n textStrokeWidth,\n tickSize = k === \"y\" ? 6 : 0,\n tickPadding,\n tickRotate,\n x,\n margin,\n marginTop = margin === undefined ? 20 : margin,\n marginRight = margin === undefined ? (anchor === \"right\" ? 40 : 0) : margin,\n marginBottom = margin === undefined ? 20 : margin,\n marginLeft = margin === undefined ? (anchor === \"left\" ? 40 : 0) : margin,\n label,\n labelAnchor,\n labelArrow,\n labelOffset,\n ...options\n }\n) {\n tickSize = number(tickSize);\n tickPadding = number(tickPadding);\n tickRotate = number(tickRotate);\n if (labelAnchor !== undefined) labelAnchor = keyword(labelAnchor, \"labelAnchor\", [\"center\", \"top\", \"bottom\"]);\n labelArrow = maybeLabelArrow(labelArrow);\n return marks(\n tickSize && !isNoneish(stroke)\n ? axisTickKy(k, anchor, data, {\n stroke,\n strokeOpacity,\n strokeWidth,\n tickSize,\n tickPadding,\n tickRotate,\n x,\n ...options\n })\n : null,\n !isNoneish(fill)\n ? axisTextKy(k, anchor, data, {\n fill,\n fillOpacity,\n stroke: textStroke,\n strokeOpacity: textStrokeOpacity,\n strokeWidth: textStrokeWidth,\n textAnchor,\n tickSize,\n tickPadding,\n tickRotate,\n x,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n ...options\n })\n : null,\n !isNoneish(fill) && label !== null\n ? text(\n [],\n labelOptions({fill, fillOpacity, ...options}, function (data, facets, channels, scales, dimensions) {\n const scale = scales[k];\n const {marginTop, marginRight, marginBottom, marginLeft} = (k === \"y\" && dimensions.inset) || dimensions;\n const cla = labelAnchor ?? (scale.bandwidth ? \"center\" : \"top\");\n const clo = labelOffset ?? (anchor === \"right\" ? marginRight : marginLeft) - 3;\n if (cla === \"center\") {\n this.textAnchor = undefined; // middle\n this.lineAnchor = anchor === \"right\" ? \"bottom\" : \"top\";\n this.frameAnchor = anchor;\n this.rotate = -90;\n } else {\n this.textAnchor = anchor === \"right\" ? \"end\" : \"start\";\n this.lineAnchor = cla;\n this.frameAnchor = `${cla}-${anchor}`;\n this.rotate = 0;\n }\n this.dy = cla === \"top\" ? 3 - marginTop : cla === \"bottom\" ? marginBottom - 3 : 0;\n this.dx = anchor === \"right\" ? clo : -clo;\n this.ariaLabel = `${k}-axis label`;\n return {\n facets: [[0]],\n channels: {text: {value: [formatAxisLabel(k, scale, {anchor, label, labelAnchor: cla, labelArrow})]}}\n };\n })\n )\n : null\n );\n}\n\nfunction axisKx(\n k,\n anchor,\n data,\n {\n color = \"currentColor\",\n opacity = 1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n fill = color,\n fillOpacity = opacity,\n textAnchor,\n textStroke,\n textStrokeOpacity,\n textStrokeWidth,\n tickSize = k === \"x\" ? 6 : 0,\n tickPadding,\n tickRotate,\n y,\n margin,\n marginTop = margin === undefined ? (anchor === \"top\" ? 30 : 0) : margin,\n marginRight = margin === undefined ? 20 : margin,\n marginBottom = margin === undefined ? (anchor === \"bottom\" ? 30 : 0) : margin,\n marginLeft = margin === undefined ? 20 : margin,\n label,\n labelAnchor,\n labelArrow,\n labelOffset,\n ...options\n }\n) {\n tickSize = number(tickSize);\n tickPadding = number(tickPadding);\n tickRotate = number(tickRotate);\n if (labelAnchor !== undefined) labelAnchor = keyword(labelAnchor, \"labelAnchor\", [\"center\", \"left\", \"right\"]);\n labelArrow = maybeLabelArrow(labelArrow);\n return marks(\n tickSize && !isNoneish(stroke)\n ? axisTickKx(k, anchor, data, {\n stroke,\n strokeOpacity,\n strokeWidth,\n tickSize,\n tickPadding,\n tickRotate,\n y,\n ...options\n })\n : null,\n !isNoneish(fill)\n ? axisTextKx(k, anchor, data, {\n fill,\n fillOpacity,\n stroke: textStroke,\n strokeOpacity: textStrokeOpacity,\n strokeWidth: textStrokeWidth,\n textAnchor,\n tickSize,\n tickPadding,\n tickRotate,\n y,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n ...options\n })\n : null,\n !isNoneish(fill) && label !== null\n ? text(\n [],\n labelOptions({fill, fillOpacity, ...options}, function (data, facets, channels, scales, dimensions) {\n const scale = scales[k];\n const {marginTop, marginRight, marginBottom, marginLeft} = (k === \"x\" && dimensions.inset) || dimensions;\n const cla = labelAnchor ?? (scale.bandwidth ? \"center\" : \"right\");\n const clo = labelOffset ?? (anchor === \"top\" ? marginTop : marginBottom) - 3;\n if (cla === \"center\") {\n this.frameAnchor = anchor;\n this.textAnchor = undefined; // middle\n } else {\n this.frameAnchor = `${anchor}-${cla}`;\n this.textAnchor = cla === \"right\" ? \"end\" : \"start\";\n }\n this.lineAnchor = anchor;\n this.dy = anchor === \"top\" ? -clo : clo;\n this.dx = cla === \"right\" ? marginRight - 3 : cla === \"left\" ? 3 - marginLeft : 0;\n this.ariaLabel = `${k}-axis label`;\n return {\n facets: [[0]],\n channels: {text: {value: [formatAxisLabel(k, scale, {anchor, label, labelAnchor: cla, labelArrow})]}}\n };\n })\n )\n : null\n );\n}\n\nfunction axisTickKy(\n k,\n anchor,\n data,\n {\n strokeWidth = 1,\n strokeLinecap = null,\n strokeLinejoin = null,\n facetAnchor = anchor + (k === \"y\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n inset = 0,\n insetLeft = inset,\n insetRight = inset,\n dx = 0,\n y = k === \"y\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n vectorY,\n k,\n data,\n {\n ariaLabel: `${k}-axis tick`,\n ariaHidden: true\n },\n {\n strokeWidth,\n strokeLinecap,\n strokeLinejoin,\n facetAnchor,\n frameAnchor,\n y,\n ...options,\n dx: anchor === \"left\" ? +dx - offset + +insetLeft : +dx + offset - insetRight,\n anchor: \"start\",\n length: tickSize,\n shape: anchor === \"left\" ? shapeTickLeft : shapeTickRight\n }\n );\n}\n\nfunction axisTickKx(\n k,\n anchor,\n data,\n {\n strokeWidth = 1,\n strokeLinecap = null,\n strokeLinejoin = null,\n facetAnchor = anchor + (k === \"x\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n inset = 0,\n insetTop = inset,\n insetBottom = inset,\n dy = 0,\n x = k === \"x\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n vectorX,\n k,\n data,\n {\n ariaLabel: `${k}-axis tick`,\n ariaHidden: true\n },\n {\n strokeWidth,\n strokeLinejoin,\n strokeLinecap,\n facetAnchor,\n frameAnchor,\n x,\n ...options,\n dy: anchor === \"bottom\" ? +dy - offset - insetBottom : +dy + offset + +insetTop,\n anchor: \"start\",\n length: tickSize,\n shape: anchor === \"bottom\" ? shapeTickBottom : shapeTickTop\n }\n );\n}\n\nfunction axisTextKy(\n k,\n anchor,\n data,\n {\n facetAnchor = anchor + (k === \"y\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n tickRotate = 0,\n tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) > 60 ? 4 * Math.cos(tickRotate * radians) : 0),\n text,\n textAnchor = Math.abs(tickRotate) > 60 ? \"middle\" : anchor === \"left\" ? \"end\" : \"start\",\n lineAnchor = tickRotate > 60 ? \"top\" : tickRotate < -60 ? \"bottom\" : \"middle\",\n fontVariant,\n inset = 0,\n insetLeft = inset,\n insetRight = inset,\n dx = 0,\n y = k === \"y\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n textY,\n k,\n data,\n {ariaLabel: `${k}-axis tick label`},\n {\n facetAnchor,\n frameAnchor,\n text,\n textAnchor,\n lineAnchor,\n fontVariant,\n rotate: tickRotate,\n y,\n ...options,\n dx: anchor === \"left\" ? +dx - tickSize - tickPadding + +insetLeft : +dx + +tickSize + +tickPadding - insetRight\n },\n function (scale, data, ticks, tickFormat, channels) {\n if (fontVariant === undefined) this.fontVariant = inferFontVariant(scale);\n if (text === undefined) channels.text = inferTextChannel(scale, data, ticks, tickFormat, anchor);\n }\n );\n}\n\nfunction axisTextKx(\n k,\n anchor,\n data,\n {\n facetAnchor = anchor + (k === \"x\" ? \"-empty\" : \"\"),\n frameAnchor = anchor,\n tickSize,\n tickRotate = 0,\n tickPadding = Math.max(3, 9 - tickSize) + (Math.abs(tickRotate) >= 10 ? 4 * Math.cos(tickRotate * radians) : 0),\n text,\n textAnchor = Math.abs(tickRotate) >= 10 ? ((tickRotate < 0) ^ (anchor === \"bottom\") ? \"start\" : \"end\") : \"middle\",\n lineAnchor = Math.abs(tickRotate) >= 10 ? \"middle\" : anchor === \"bottom\" ? \"top\" : \"bottom\",\n fontVariant,\n inset = 0,\n insetTop = inset,\n insetBottom = inset,\n dy = 0,\n x = k === \"x\" ? undefined : null,\n ...options\n }\n) {\n return axisMark(\n textX,\n k,\n data,\n {ariaLabel: `${k}-axis tick label`},\n {\n facetAnchor,\n frameAnchor,\n text: text === undefined ? null : text,\n textAnchor,\n lineAnchor,\n fontVariant,\n rotate: tickRotate,\n x,\n ...options,\n dy: anchor === \"bottom\" ? +dy + +tickSize + +tickPadding - insetBottom : +dy - tickSize - tickPadding + +insetTop\n },\n function (scale, data, ticks, tickFormat, channels) {\n if (fontVariant === undefined) this.fontVariant = inferFontVariant(scale);\n if (text === undefined) channels.text = inferTextChannel(scale, data, ticks, tickFormat, anchor);\n }\n );\n}\n\nexport function gridY() {\n const [data, options] = maybeData(...arguments);\n return gridKy(\"y\", anchorY(options), data, options);\n}\n\nexport function gridFy() {\n const [data, options] = maybeData(...arguments);\n return gridKy(\"fy\", anchorFy(options), data, options);\n}\n\nexport function gridX() {\n const [data, options] = maybeData(...arguments);\n return gridKx(\"x\", anchorX(options), data, options);\n}\n\nexport function gridFx() {\n const [data, options] = maybeData(...arguments);\n return gridKx(\"fx\", anchorFx(options), data, options);\n}\n\nfunction gridKy(\n k,\n anchor,\n data,\n {\n y = k === \"y\" ? undefined : null,\n x = null,\n x1 = anchor === \"left\" ? x : null,\n x2 = anchor === \"right\" ? x : null,\n ...options\n }\n) {\n return axisMark(ruleY, k, data, {ariaLabel: `${k}-grid`, ariaHidden: true}, {y, x1, x2, ...gridDefaults(options)});\n}\n\nfunction gridKx(\n k,\n anchor,\n data,\n {\n x = k === \"x\" ? undefined : null,\n y = null,\n y1 = anchor === \"top\" ? y : null,\n y2 = anchor === \"bottom\" ? y : null,\n ...options\n }\n) {\n return axisMark(ruleX, k, data, {ariaLabel: `${k}-grid`, ariaHidden: true}, {x, y1, y2, ...gridDefaults(options)});\n}\n\nfunction gridDefaults({\n color = \"currentColor\",\n opacity = 0.1,\n stroke = color,\n strokeOpacity = opacity,\n strokeWidth = 1,\n ...options\n}) {\n return {stroke, strokeOpacity, strokeWidth, ...options};\n}\n\nfunction labelOptions(\n {\n fill,\n fillOpacity,\n fontFamily,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n monospace,\n pointerEvents,\n shapeRendering,\n clip = false\n },\n initializer\n) {\n // Only propagate these options if constant.\n [, fill] = maybeColorChannel(fill);\n [, fillOpacity] = maybeNumberChannel(fillOpacity);\n return {\n facet: \"super\",\n x: null,\n y: null,\n fill,\n fillOpacity,\n fontFamily,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n monospace,\n pointerEvents,\n shapeRendering,\n clip,\n initializer\n };\n}\n\nfunction axisMark(mark, k, data, properties, options, initialize) {\n let channels;\n\n function axisInitializer(data, facets, _channels, scales, dimensions, context) {\n const initializeFacets = data == null && (k === \"fx\" || k === \"fy\");\n const {[k]: scale} = scales;\n if (!scale) throw new Error(`missing scale: ${k}`);\n const domain = scale.domain();\n let {interval, ticks, tickFormat, tickSpacing = k === \"x\" ? 80 : 35} = options;\n // For a scale with a temporal domain, also allow the ticks to be specified\n // as a string which is promoted to a time interval. In the case of ordinal\n // scales, the interval is interpreted as UTC.\n if (typeof ticks === \"string\" && hasTemporalDomain(scale)) (interval = ticks), (ticks = undefined);\n // The interval axis option is an alternative method of specifying ticks;\n // for example, for a numeric scale, ticks = 5 means \u201Cabout 5 ticks\u201D whereas\n // interval = 5 means \u201Cticks every 5 units\u201D. (This is not to be confused\n // with the interval scale option, which affects the scale\u2019s behavior!)\n // Lastly use the tickSpacing option to infer the desired tick count.\n if (ticks === undefined) ticks = maybeRangeInterval(interval, scale.type) ?? inferTickCount(scale, tickSpacing);\n if (data == null) {\n if (isIterable(ticks)) {\n // Use explicit ticks, if specified.\n data = arrayify(ticks);\n } else if (isInterval(ticks)) {\n // Use the tick interval, if specified.\n data = inclusiveRange(ticks, ...extent(domain));\n } else if (scale.interval) {\n // If the scale interval is a standard time interval such as \"day\", we\n // may be able to generalize the scale interval it to a larger aligned\n // time interval to create the desired number of ticks.\n let interval = scale.interval;\n if (scale.ticks) {\n const [min, max] = extent(domain);\n const n = (max - min) / interval[intervalDuration]; // current tick count\n // We don\u2019t explicitly check that given interval is a time interval;\n // in that case the generalized interval will be undefined, just like\n // a nonstandard interval. TODO Generalize integer intervals, too.\n interval = generalizeTimeInterval(interval, n / ticks) ?? interval;\n data = inclusiveRange(interval, min, max);\n } else {\n data = domain;\n const n = data.length; // current tick count\n interval = generalizeTimeInterval(interval, n / ticks) ?? interval;\n if (interval !== scale.interval) data = inclusiveRange(interval, ...extent(data));\n }\n if (interval === scale.interval) {\n // If we weren\u2019t able to generalize the scale\u2019s interval, compute the\n // positive number n such that taking every nth value from the scale\u2019s\n // domain produces as close as possible to the desired number of\n // ticks. For example, if the domain has 100 values and 5 ticks are\n // desired, n = 20.\n const n = Math.round(data.length / ticks);\n if (n > 1) data = data.filter((d, i) => i % n === 0);\n }\n } else if (scale.ticks) {\n data = scale.ticks(ticks);\n } else {\n // For ordinal scales, the domain will already be generated using the\n // scale\u2019s interval, if any.\n data = domain;\n }\n if (!scale.ticks && data.length && data !== domain) {\n // For ordinal scales, intersect the ticks with the scale domain since\n // the scale is only defined on its domain. If all of the ticks are\n // removed, then warn that the ticks and scale domain may be misaligned\n // (e.g., \"year\" ticks and \"4 weeks\" interval).\n const domainSet = new InternSet(domain);\n data = data.filter((d) => domainSet.has(d));\n if (!data.length) warn(`Warning: the ${k}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`); // prettier-ignore\n }\n if (k === \"y\" || k === \"x\") {\n facets = [range(data)];\n } else {\n channels[k] = {scale: k, value: identity};\n }\n }\n initialize?.call(this, scale, data, ticks, tickFormat, channels);\n const initializedChannels = Object.fromEntries(\n Object.entries(channels).map(([name, channel]) => {\n return [name, {...channel, value: valueof(data, channel.value)}];\n })\n );\n if (initializeFacets) facets = context.filterFacets(data, initializedChannels);\n return {data, facets, channels: initializedChannels};\n }\n\n // Apply any basic initializers after the axis initializer computes the ticks.\n const basicInitializer = initializer(options).initializer;\n const m = mark(data, initializer({...options, initializer: axisInitializer}, basicInitializer));\n if (data == null) {\n channels = m.channels;\n m.channels = {};\n } else {\n channels = {};\n }\n if (properties !== undefined) Object.assign(m, properties);\n if (m.clip === undefined) m.clip = false; // don\u2019t clip axes by default\n return m;\n}\n\nfunction inferTickCount(scale, tickSpacing) {\n const [min, max] = extent(scale.range());\n return (max - min) / tickSpacing;\n}\n\nfunction inferTextChannel(scale, data, ticks, tickFormat, anchor) {\n return {value: inferTickFormat(scale, data, ticks, tickFormat, anchor)};\n}\n\n// D3\u2019s ordinal scales simply use toString by default, but if the ordinal scale\n// domain (or ticks) are numbers or dates (say because we\u2019re applying a time\n// interval to the ordinal scale), we want Plot\u2019s default formatter. And for\n// time ticks, we want to use the multi-line time format (e.g., Jan 26) if\n// possible, or the default ISO format (2014-01-26). TODO We need a better way\n// to infer whether the ordinal scale is UTC or local time.\nexport function inferTickFormat(scale, data, ticks, tickFormat, anchor) {\n return typeof tickFormat === \"function\"\n ? tickFormat\n : tickFormat === undefined && data && isTemporal(data)\n ? inferTimeFormat(scale.type, data, anchor) ?? formatDefault\n : scale.tickFormat\n ? scale.tickFormat(typeof ticks === \"number\" ? ticks : null, tickFormat)\n : tickFormat === undefined\n ? formatDefault\n : typeof tickFormat === \"string\"\n ? (isTemporal(scale.domain()) ? utcFormat : format)(tickFormat)\n : constant(tickFormat);\n}\n\nfunction inclusiveRange(interval, min, max) {\n return interval.range(min, interval.offset(interval.floor(max)));\n}\n\nconst shapeTickBottom = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(0, l);\n }\n};\n\nconst shapeTickTop = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(0, -l);\n }\n};\n\nconst shapeTickLeft = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(-l, 0);\n }\n};\n\nconst shapeTickRight = {\n draw(context, l) {\n context.moveTo(0, 0);\n context.lineTo(l, 0);\n }\n};\n\n// TODO Unify this with the other inferFontVariant; here we only have a scale\n// function rather than a scale descriptor.\nfunction inferFontVariant(scale) {\n return scale.bandwidth && !scale.interval ? undefined : \"tabular-nums\";\n}\n\n// Takes the scale label, and if this is not an ordinal scale and the label was\n// inferred from an associated channel, adds an orientation-appropriate arrow.\nfunction formatAxisLabel(k, scale, {anchor, label = scale.label, labelAnchor, labelArrow} = {}) {\n if (label == null || (label.inferred && hasTemporalDomain(scale) && /^(date|time|year)$/i.test(label))) return;\n label = String(label); // coerce to a string after checking if inferred\n if (labelArrow === \"auto\") labelArrow = (!scale.bandwidth || scale.interval) && !/[\u2191\u2193\u2192\u2190]/.test(label);\n if (!labelArrow) return label;\n if (labelArrow === true) {\n const order = inferScaleOrder(scale);\n if (order)\n labelArrow =\n /x$/.test(k) || labelAnchor === \"center\"\n ? /x$/.test(k) === order < 0\n ? \"left\"\n : \"right\"\n : order < 0\n ? \"up\"\n : \"down\";\n }\n switch (labelArrow) {\n case \"left\":\n return `\u2190 ${label}`;\n case \"right\":\n return `${label} \u2192`;\n case \"up\":\n return anchor === \"right\" ? `${label} \u2191` : `\u2191 ${label}`;\n case \"down\":\n return anchor === \"right\" ? `${label} \u2193` : `\u2193 ${label}`;\n }\n return label;\n}\n\nfunction maybeLabelArrow(labelArrow = \"auto\") {\n return isNoneish(labelArrow)\n ? false\n : typeof labelArrow === \"boolean\"\n ? labelArrow\n : keyword(labelArrow, \"labelArrow\", [\"auto\", \"up\", \"right\", \"down\", \"left\"]);\n}\n\nfunction hasTemporalDomain(scale) {\n return isTemporal(scale.domain());\n}\n", "import {pathRound as path} from \"d3\";\nimport {inferFontVariant} from \"../axes.js\";\nimport {create, createContext} from \"../context.js\";\nimport {isNoneish, maybeColorChannel, maybeNumberChannel} from \"../options.js\";\nimport {isOrdinalScale, isThresholdScale} from \"../scales.js\";\nimport {applyInlineStyles, impliedString, maybeClassName} from \"../style.js\";\nimport {inferTickFormat} from \"../marks/axis.js\";\n\nfunction maybeScale(scale, key) {\n if (key == null) return key;\n const s = scale(key);\n if (!s) throw new Error(`scale not found: ${key}`);\n return s;\n}\n\nexport function legendSwatches(color, {opacity, ...options} = {}) {\n if (!isOrdinalScale(color) && !isThresholdScale(color))\n throw new Error(`swatches legend requires ordinal or threshold color scale (not ${color.type})`);\n return legendItems(color, options, (selection, scale, width, height) =>\n selection\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"fill\", scale.scale)\n .attr(\"fill-opacity\", maybeNumberChannel(opacity)[1])\n .append(\"rect\")\n .attr(\"width\", \"100%\")\n .attr(\"height\", \"100%\")\n );\n}\n\nexport function legendSymbols(\n symbol,\n {\n fill = symbol.hint?.fill !== undefined ? symbol.hint.fill : \"none\",\n fillOpacity = 1,\n stroke = symbol.hint?.stroke !== undefined ? symbol.hint.stroke : isNoneish(fill) ? \"currentColor\" : \"none\",\n strokeOpacity = 1,\n strokeWidth = 1.5,\n r = 4.5,\n ...options\n } = {},\n scale\n) {\n const [vf, cf] = maybeColorChannel(fill);\n const [vs, cs] = maybeColorChannel(stroke);\n const sf = maybeScale(scale, vf);\n const ss = maybeScale(scale, vs);\n const size = r * r * Math.PI;\n fillOpacity = maybeNumberChannel(fillOpacity)[1];\n strokeOpacity = maybeNumberChannel(strokeOpacity)[1];\n strokeWidth = maybeNumberChannel(strokeWidth)[1];\n return legendItems(symbol, options, (selection, scale, width, height) =>\n selection\n .append(\"svg\")\n .attr(\"viewBox\", \"-8 -8 16 16\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"fill\", vf === \"color\" ? (d) => sf.scale(d) : cf)\n .attr(\"fill-opacity\", fillOpacity)\n .attr(\"stroke\", vs === \"color\" ? (d) => ss.scale(d) : cs)\n .attr(\"stroke-opacity\", strokeOpacity)\n .attr(\"stroke-width\", strokeWidth)\n .append(\"path\")\n .attr(\"d\", (d) => {\n const p = path();\n symbol.scale(d).draw(p, size);\n return p;\n })\n );\n}\n\nfunction legendItems(scale, options = {}, swatch) {\n let {\n columns,\n tickFormat,\n fontVariant = inferFontVariant(scale),\n // TODO label,\n swatchSize = 15,\n swatchWidth = swatchSize,\n swatchHeight = swatchSize,\n marginLeft = 0,\n className,\n style,\n width\n } = options;\n const context = createContext(options);\n className = maybeClassName(className);\n tickFormat = inferTickFormat(scale.scale, scale.domain, undefined, tickFormat);\n\n const swatches = create(\"div\", context).attr(\n \"class\",\n `${className}-swatches ${className}-swatches-${columns != null ? \"columns\" : \"wrap\"}`\n );\n\n let extraStyle;\n\n if (columns != null) {\n extraStyle = `:where(.${className}-swatches-columns .${className}-swatch) {\n display: flex;\n align-items: center;\n break-inside: avoid;\n padding-bottom: 1px;\n}\n:where(.${className}-swatches-columns .${className}-swatch::before) {\n flex-shrink: 0;\n}\n:where(.${className}-swatches-columns .${className}-swatch-label) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}`;\n\n swatches\n .style(\"columns\", columns)\n .selectAll()\n .data(scale.domain)\n .enter()\n .append(\"div\")\n .attr(\"class\", `${className}-swatch`)\n .call(swatch, scale, swatchWidth, swatchHeight)\n .call((item) =>\n item.append(\"div\").attr(\"class\", `${className}-swatch-label`).attr(\"title\", tickFormat).text(tickFormat)\n );\n } else {\n extraStyle = `:where(.${className}-swatches-wrap) {\n display: flex;\n align-items: center;\n min-height: 33px;\n flex-wrap: wrap;\n}\n:where(.${className}-swatches-wrap .${className}-swatch) {\n display: inline-flex;\n align-items: center;\n margin-right: 1em;\n}`;\n\n swatches\n .selectAll()\n .data(scale.domain)\n .enter()\n .append(\"span\")\n .attr(\"class\", `${className}-swatch`)\n .call(swatch, scale, swatchWidth, swatchHeight)\n .append(function () {\n return this.ownerDocument.createTextNode(tickFormat.apply(this, arguments));\n });\n }\n\n return swatches\n .call((div) =>\n div.insert(\"style\", \"*\").text(\n `:where(.${className}-swatches) {\n font-family: system-ui, sans-serif;\n font-size: 10px;\n margin-bottom: 0.5em;\n}\n:where(.${className}-swatch > svg) {\n margin-right: 0.5em;\n overflow: visible;\n}\n${extraStyle}`\n )\n )\n .style(\"margin-left\", marginLeft ? `${+marginLeft}px` : null)\n .style(\"width\", width === undefined ? null : `${+width}px`)\n .style(\"font-variant\", impliedString(fontVariant, \"normal\"))\n .call(applyInlineStyles, style)\n .node();\n}\n", "import {rgb} from \"d3\";\nimport {createContext} from \"./context.js\";\nimport {legendRamp} from \"./legends/ramp.js\";\nimport {legendSwatches, legendSymbols} from \"./legends/swatches.js\";\nimport {inherit, isScaleOptions} from \"./options.js\";\nimport {normalizeScale} from \"./scales.js\";\n\nconst legendRegistry = new Map([\n [\"symbol\", legendSymbols],\n [\"color\", legendColor],\n [\"opacity\", legendOpacity]\n]);\n\nexport function legend(options = {}) {\n for (const [key, value] of legendRegistry) {\n const scale = options[key];\n if (isScaleOptions(scale)) {\n // e.g., ignore {color: \"red\"}\n const context = createContext(options);\n let hint;\n // For symbol legends, pass a hint to the symbol scale.\n if (key === \"symbol\") {\n const {fill, stroke = fill === undefined && isScaleOptions(options.color) ? \"color\" : undefined} = options;\n hint = {fill, stroke};\n }\n return value(normalizeScale(key, scale, hint), legendOptions(context, scale, options), (key) =>\n isScaleOptions(options[key]) ? normalizeScale(key, options[key]) : null\n );\n }\n }\n throw new Error(\"unknown legend type; no scale found\");\n}\n\nexport function exposeLegends(scales, context, defaults = {}) {\n return (key, options) => {\n if (!legendRegistry.has(key)) throw new Error(`unknown legend type: ${key}`);\n if (!(key in scales)) return;\n return legendRegistry.get(key)(scales[key], legendOptions(context, defaults[key], options), (key) => scales[key]);\n };\n}\n\nfunction legendOptions({className, ...context}, {label, ticks, tickFormat} = {}, options) {\n return inherit(options, {className, ...context}, {label, ticks, tickFormat});\n}\n\nfunction legendColor(color, {legend = true, ...options}) {\n if (legend === true) legend = color.type === \"ordinal\" ? \"swatches\" : \"ramp\";\n if (color.domain === undefined) return;\n switch (`${legend}`.toLowerCase()) {\n case \"swatches\":\n return legendSwatches(color, options);\n case \"ramp\":\n return legendRamp(color, options);\n default:\n throw new Error(`unknown legend type: ${legend}`);\n }\n}\n\nfunction legendOpacity({type, interpolate, ...scale}, {legend = true, color = rgb(0, 0, 0), ...options}) {\n if (!interpolate) throw new Error(`${type} opacity scales are not supported`);\n if (legend === true) legend = \"ramp\";\n if (`${legend}`.toLowerCase() !== \"ramp\") throw new Error(`${legend} opacity legends are not supported`);\n return legendColor({type, ...scale, interpolate: interpolateOpacity(color)}, {legend, ...options});\n}\n\nfunction interpolateOpacity(color) {\n const {r, g, b} = rgb(color) || rgb(0, 0, 0); // treat invalid color as black\n return (t) => `rgba(${r},${g},${b},${t})`;\n}\n\nexport function createLegends(scales, context, options) {\n const legends = [];\n for (const [key, value] of legendRegistry) {\n const o = options[key];\n if (o?.legend && key in scales) {\n const legend = value(scales[key], legendOptions(context, scales[key], o), (key) => scales[key]);\n if (legend != null) legends.push(legend);\n }\n }\n return legends;\n}\n", "import {create} from \"../context.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeKeyword, number, singleton} from \"../options.js\";\nimport {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform} from \"../style.js\";\n\nconst defaults = {\n ariaLabel: \"frame\",\n fill: \"none\",\n stroke: \"currentColor\",\n clip: false\n};\n\nconst lineDefaults = {\n ariaLabel: \"frame\",\n fill: null,\n stroke: \"currentColor\",\n strokeLinecap: \"square\",\n clip: false\n};\n\nexport class Frame extends Mark {\n constructor(options = {}) {\n const {\n anchor = null,\n inset = 0,\n insetTop = inset,\n insetRight = inset,\n insetBottom = inset,\n insetLeft = inset,\n rx,\n ry\n } = options;\n super(singleton, undefined, options, anchor == null ? defaults : lineDefaults);\n this.anchor = maybeKeyword(anchor, \"anchor\", [\"top\", \"right\", \"bottom\", \"left\"]);\n this.insetTop = number(insetTop);\n this.insetRight = number(insetRight);\n this.insetBottom = number(insetBottom);\n this.insetLeft = number(insetLeft);\n this.rx = number(rx);\n this.ry = number(ry);\n }\n render(index, scales, channels, dimensions, context) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = dimensions;\n const {anchor, insetTop, insetRight, insetBottom, insetLeft, rx, ry} = this;\n const x1 = marginLeft + insetLeft;\n const x2 = width - marginRight - insetRight;\n const y1 = marginTop + insetTop;\n const y2 = height - marginBottom - insetBottom;\n return create(anchor ? \"svg:line\" : \"svg:rect\", context)\n .datum(0)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyDirectStyles, this)\n .call(applyChannelStyles, this, channels)\n .call(applyTransform, this, {})\n .call(\n anchor === \"left\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x1).attr(\"y1\", y1).attr(\"y2\", y2)\n : anchor === \"right\"\n ? (line) => line.attr(\"x1\", x2).attr(\"x2\", x2).attr(\"y1\", y1).attr(\"y2\", y2)\n : anchor === \"top\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x2).attr(\"y1\", y1).attr(\"y2\", y1)\n : anchor === \"bottom\"\n ? (line) => line.attr(\"x1\", x1).attr(\"x2\", x2).attr(\"y1\", y2).attr(\"y2\", y2)\n : (rect) =>\n rect\n .attr(\"x\", x1)\n .attr(\"y\", y1)\n .attr(\"width\", x2 - x1)\n .attr(\"height\", y2 - y1)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry)\n )\n .node();\n }\n}\n\nexport function frame(options) {\n return new Frame(options);\n}\n", "import {select, format as numberFormat, utcFormat} from \"d3\";\nimport {getSource} from \"../channel.js\";\nimport {create} from \"../context.js\";\nimport {defined} from \"../defined.js\";\nimport {formatDefault} from \"../format.js\";\nimport {anchorX, anchorY} from \"../interactions/pointer.js\";\nimport {Mark} from \"../mark.js\";\nimport {maybeAnchor, maybeFrameAnchor, maybeTuple, number, string} from \"../options.js\";\nimport {applyDirectStyles, applyFrameAnchor, applyIndirectStyles, applyTransform, impliedString} from \"../style.js\";\nimport {identity, isIterable, isTemporal, isTextual} from \"../options.js\";\nimport {inferTickFormat} from \"./axis.js\";\nimport {applyIndirectTextStyles, defaultWidth, ellipsis, monospaceWidth} from \"./text.js\";\nimport {cut, clipper, splitter, maybeTextOverflow} from \"./text.js\";\n\nconst defaults = {\n ariaLabel: \"tip\",\n fill: \"var(--plot-background)\",\n stroke: \"currentColor\"\n};\n\n// These channels are not displayed in the default tip; see formatChannels.\nconst ignoreChannels = new Set([\"geometry\", \"href\", \"src\", \"ariaLabel\", \"scales\"]);\n\nexport class Tip extends Mark {\n constructor(data, options = {}) {\n if (options.tip) options = {...options, tip: false};\n if (options.title === undefined && isIterable(data) && isTextual(data)) options = {...options, title: identity};\n const {\n x,\n y,\n x1,\n x2,\n y1,\n y2,\n anchor,\n preferredAnchor = \"bottom\",\n monospace,\n fontFamily = monospace ? \"ui-monospace, monospace\" : undefined,\n fontSize,\n fontStyle,\n fontVariant,\n fontWeight,\n lineHeight = 1,\n lineWidth = 20,\n frameAnchor,\n format,\n textAnchor = \"start\",\n textOverflow,\n textPadding = 8,\n title,\n pointerSize = 12,\n pathFilter = \"drop-shadow(0 3px 4px rgba(0,0,0,0.2))\"\n } = options;\n super(\n data,\n {\n x: {value: x1 != null && x2 != null ? null : x, scale: \"x\", optional: true}, // ignore midpoint\n y: {value: y1 != null && y2 != null ? null : y, scale: \"y\", optional: true}, // ignore midpoint\n x1: {value: x1, scale: \"x\", optional: x2 == null},\n y1: {value: y1, scale: \"y\", optional: y2 == null},\n x2: {value: x2, scale: \"x\", optional: x1 == null},\n y2: {value: y2, scale: \"y\", optional: y1 == null},\n title: {value: title, optional: true} // filter: defined\n },\n options,\n defaults\n );\n this.anchor = maybeAnchor(anchor, \"anchor\");\n this.preferredAnchor = maybeAnchor(preferredAnchor, \"preferredAnchor\");\n this.frameAnchor = maybeFrameAnchor(frameAnchor);\n this.textAnchor = impliedString(textAnchor, \"middle\");\n this.textPadding = +textPadding;\n this.pointerSize = +pointerSize;\n this.pathFilter = string(pathFilter);\n this.lineHeight = +lineHeight;\n this.lineWidth = +lineWidth;\n this.textOverflow = maybeTextOverflow(textOverflow);\n this.monospace = !!monospace;\n this.fontFamily = string(fontFamily);\n this.fontSize = number(fontSize);\n this.fontStyle = string(fontStyle);\n this.fontVariant = string(fontVariant);\n this.fontWeight = string(fontWeight);\n for (const key in defaults) if (key in this.channels) this[key] = defaults[key]; // apply default even if channel\n this.splitLines = splitter(this);\n this.clipLine = clipper(this);\n this.format = {...format}; // defensive copy before mutate; also promote nullish to empty\n }\n render(index, scales, values, dimensions, context) {\n const mark = this;\n const {x, y, fx, fy} = scales;\n const {ownerSVGElement: svg, document} = context;\n const {anchor, monospace, lineHeight, lineWidth} = this;\n const {textPadding: r, pointerSize: m, pathFilter} = this;\n const {marginTop, marginLeft} = dimensions;\n\n // The anchor position is the middle of x1 & y1 and x2 & y2, if available,\n // or x & y; the former is considered more specific because it\u2019s how we\n // disable the implicit stack and interval transforms. If any dimension is\n // unspecified, we fallback to the frame anchor. We also need to know the\n // facet offsets to detect when the tip would draw outside the plot, and\n // thus we need to change the orientation.\n const {x1: X1, y1: Y1, x2: X2, y2: Y2, x: X = X1 ?? X2, y: Y = Y1 ?? Y2} = values;\n const ox = fx ? fx(index.fx) - marginLeft : 0;\n const oy = fy ? fy(index.fy) - marginTop : 0;\n\n // The order of precedence for the anchor position is: the middle of x1 & y1\n // and x2 & y2; or x1 & y1 (e.g., area); or lastly x & y. If a dimension is\n // unspecified, the frame anchor is used.\n const [cx, cy] = applyFrameAnchor(this, dimensions);\n const px = anchorX(values, cx);\n const py = anchorY(values, cy);\n\n // Resolve the text metric implementation. We may need an ellipsis for text\n // truncation, so we optimistically compute the ellipsis width.\n const widthof = monospace ? monospaceWidth : defaultWidth;\n const ee = widthof(ellipsis);\n\n // If there\u2019s a title channel, display that as-is; otherwise, show multiple\n // channels as name-value pairs.\n let sources, format;\n if (\"title\" in values) {\n sources = values.channels;\n format = formatTitle;\n } else {\n sources = getSourceChannels.call(this, values, scales);\n format = formatChannels;\n }\n\n // We don\u2019t call applyChannelStyles because we only use the channels to\n // derive the content of the tip, not its aesthetics.\n const g = create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyIndirectTextStyles, this)\n .call(applyTransform, this, {x: X && x, y: Y && y})\n .call((g) =>\n g\n .selectAll()\n .data(index)\n .enter()\n .append(\"g\")\n .attr(\"transform\", (i) => `translate(${Math.round(px(i))},${Math.round(py(i))})`) // crisp edges\n .call(applyDirectStyles, this)\n .call((g) => g.append(\"path\").attr(\"filter\", pathFilter))\n .call((g) =>\n g.append(\"text\").each(function (i) {\n const that = select(this);\n // prevent style inheritance (from path)\n this.setAttribute(\"fill\", \"currentColor\");\n this.setAttribute(\"fill-opacity\", 1);\n this.setAttribute(\"stroke\", \"none\");\n // iteratively render each channel value\n const lines = format.call(mark, i, index, sources, scales, values);\n if (typeof lines === \"string\") {\n for (const line of mark.splitLines(lines)) {\n renderLine(that, {value: mark.clipLine(line)});\n }\n } else {\n const labels = new Set();\n for (const line of lines) {\n const {label = \"\"} = line;\n if (label && labels.has(label)) continue;\n else labels.add(label);\n renderLine(that, line);\n }\n }\n })\n )\n );\n\n // Renders a single line (a name-value pair) to the tip, truncating the text\n // as needed, and adding a title if the text is truncated. Note that this is\n // just the initial layout of the text; in postrender we will compute the\n // exact text metrics and translate the text as needed once we know the\n // tip\u2019s orientation (anchor).\n function renderLine(selection, {label, value, color, opacity}) {\n (label ??= \"\"), (value ??= \"\");\n const swatch = color != null || opacity != null;\n let title;\n let w = lineWidth * 100;\n const [j] = cut(label, w, widthof, ee);\n if (j >= 0) {\n // label is truncated\n label = label.slice(0, j).trimEnd() + ellipsis;\n title = value.trim();\n value = \"\";\n } else {\n if (label || (!value && !swatch)) value = \" \" + value;\n const [k] = cut(value, w - widthof(label), widthof, ee);\n if (k >= 0) {\n // value is truncated\n title = value.trim();\n value = value.slice(0, k).trimEnd() + ellipsis;\n }\n }\n const line = selection.append(\"tspan\").attr(\"x\", 0).attr(\"dy\", `${lineHeight}em`).text(\"\\u200b\"); // zwsp for double-click\n if (label) line.append(\"tspan\").attr(\"font-weight\", \"bold\").text(label);\n if (value) line.append(() => document.createTextNode(value));\n if (swatch) line.append(\"tspan\").text(\" \u25A0\").attr(\"fill\", color).attr(\"fill-opacity\", opacity).style(\"user-select\", \"none\"); // prettier-ignore\n if (title) line.append(\"title\").text(title);\n }\n\n // Only after the plot is attached to the page can we compute the exact text\n // metrics needed to determine the tip size and orientation (anchor).\n function postrender() {\n const {width, height} = dimensions.facet ?? dimensions;\n g.selectChildren().each(function (i) {\n let {x: tx, width: w, height: h} = this.getBBox();\n (w = Math.round(w)), (h = Math.round(h)); // crisp edges\n let a = anchor; // use the specified anchor, if any\n if (a === undefined) {\n const x = px(i) + ox;\n const y = py(i) + oy;\n const fitLeft = x + w + m + r * 2 < width;\n const fitRight = x - w - m - r * 2 > 0;\n const fitTop = y + h + m + r * 2 < height;\n const fitBottom = y - h - m - r * 2 > 0;\n a =\n fitLeft && fitRight\n ? fitTop && fitBottom\n ? mark.preferredAnchor\n : fitBottom\n ? \"bottom\"\n : \"top\"\n : fitTop && fitBottom\n ? fitLeft\n ? \"left\"\n : \"right\"\n : (fitLeft || fitRight) && (fitTop || fitBottom)\n ? `${fitBottom ? \"bottom\" : \"top\"}-${fitLeft ? \"left\" : \"right\"}`\n : mark.preferredAnchor;\n }\n const path = this.firstChild; // note: assumes exactly two children!\n const text = this.lastChild; // note: assumes exactly two children!\n path.setAttribute(\"d\", getPath(a, m, r, w, h));\n if (tx) for (const t of text.childNodes) t.setAttribute(\"x\", -tx);\n text.setAttribute(\"y\", `${+getLineOffset(a, text.childNodes.length, lineHeight).toFixed(6)}em`);\n text.setAttribute(\"transform\", `translate(${getTextTranslate(a, m, r, w, h)})`);\n });\n g.attr(\"visibility\", null);\n }\n\n // Wait until the plot is inserted into the page so that we can use getBBox\n // to compute the exact text dimensions. If the SVG is already connected, as\n // when the pointer interaction triggers the re-render, use a faster\n // microtask instead of an animation frame; if this SSR (e.g., JSDOM), skip\n // this step. Perhaps this could be done synchronously; getting the\n // dimensions of the SVG is easy, and although accurate text metrics are\n // hard, we could use approximate heuristics.\n if (index.length) {\n g.attr(\"visibility\", \"hidden\"); // hide until postrender\n if (svg.isConnected) Promise.resolve().then(postrender);\n else if (typeof requestAnimationFrame !== \"undefined\") requestAnimationFrame(postrender);\n }\n\n return g.node();\n }\n}\n\nexport function tip(data, {x, y, ...options} = {}) {\n if (options.frameAnchor === undefined) [x, y] = maybeTuple(x, y);\n return new Tip(data, {...options, x, y});\n}\n\nfunction getLineOffset(anchor, length, lineHeight) {\n return /^top(?:-|$)/.test(anchor)\n ? 0.94 - lineHeight\n : /^bottom(?:-|$)/\n ? -0.29 - length * lineHeight\n : (length / 2) * lineHeight;\n}\n\nfunction getTextTranslate(anchor, m, r, width, height) {\n switch (anchor) {\n case \"middle\":\n return [-width / 2, height / 2];\n case \"top-left\":\n return [r, m + r];\n case \"top\":\n return [-width / 2, m / 2 + r];\n case \"top-right\":\n return [-width - r, m + r];\n case \"right\":\n return [-m / 2 - width - r, height / 2];\n case \"bottom-left\":\n return [r, -m - r];\n case \"bottom\":\n return [-width / 2, -m / 2 - r];\n case \"bottom-right\":\n return [-width - r, -m - r];\n case \"left\":\n return [r + m / 2, height / 2];\n }\n}\n\nfunction getPath(anchor, m, r, width, height) {\n const w = width + r * 2;\n const h = height + r * 2;\n switch (anchor) {\n case \"middle\":\n return `M${-w / 2},${-h / 2}h${w}v${h}h${-w}z`;\n case \"top-left\":\n return `M0,0l${m},${m}h${w - m}v${h}h${-w}z`;\n case \"top\":\n return `M0,0l${m / 2},${m / 2}h${(w - m) / 2}v${h}h${-w}v${-h}h${(w - m) / 2}z`;\n case \"top-right\":\n return `M0,0l${-m},${m}h${m - w}v${h}h${w}z`;\n case \"right\":\n return `M0,0l${-m / 2},${-m / 2}v${m / 2 - h / 2}h${-w}v${h}h${w}v${m / 2 - h / 2}z`;\n case \"bottom-left\":\n return `M0,0l${m},${-m}h${w - m}v${-h}h${-w}z`;\n case \"bottom\":\n return `M0,0l${m / 2},${-m / 2}h${(w - m) / 2}v${-h}h${-w}v${h}h${(w - m) / 2}z`;\n case \"bottom-right\":\n return `M0,0l${-m},${-m}h${m - w}v${-h}h${w}z`;\n case \"left\":\n return `M0,0l${m / 2},${-m / 2}v${m / 2 - h / 2}h${w}v${h}h${-w}v${m / 2 - h / 2}z`;\n }\n}\n\n// Note: mutates this.format!\nfunction getSourceChannels({channels}, scales) {\n const sources = {};\n\n // Promote x and y shorthand for paired channels (in order).\n let format = this.format;\n format = maybeExpandPairedFormat(format, channels, \"x\");\n format = maybeExpandPairedFormat(format, channels, \"y\");\n this.format = format;\n\n // Prioritize channels with explicit formats, in the given order.\n for (const key in format) {\n const value = format[key];\n if (value === null || value === false) {\n continue;\n } else if (key === \"fx\" || key === \"fy\") {\n sources[key] = true;\n } else {\n const source = getSource(channels, key);\n if (source) sources[key] = source;\n }\n }\n\n // Then fallback to all other (non-ignored) channels.\n for (const key in channels) {\n if (key in sources || key in format || ignoreChannels.has(key)) continue;\n const source = getSource(channels, key);\n if (source) sources[key] = source;\n }\n\n // And lastly facet channels, but only if this mark is faceted.\n if (this.facet) {\n if (scales.fx && !(\"fx\" in format)) sources.fx = true;\n if (scales.fy && !(\"fy\" in format)) sources.fy = true;\n }\n\n // Promote shorthand string formats, and materialize default formats.\n for (const key in sources) {\n const format = this.format[key];\n if (typeof format === \"string\") {\n const value = sources[key]?.value ?? scales[key]?.domain() ?? [];\n this.format[key] = (isTemporal(value) ? utcFormat : numberFormat)(format);\n } else if (format === undefined || format === true) {\n // For ordinal scales, the inferred tick format can be more concise, such\n // as only showing the year for yearly data.\n const scale = scales[key];\n this.format[key] = scale?.bandwidth ? inferTickFormat(scale, scale.domain()) : formatDefault;\n }\n }\n\n return sources;\n}\n\n// Promote x and y shorthand for paired channels, while preserving order.\nfunction maybeExpandPairedFormat(format, channels, key) {\n if (!(key in format)) return format;\n const key1 = `${key}1`;\n const key2 = `${key}2`;\n if ((key1 in format || !(key1 in channels)) && (key2 in format || !(key2 in channels))) return format;\n const entries = Object.entries(format);\n const value = format[key];\n entries.splice(entries.findIndex(([name]) => name === key) + 1, 0, [key1, value], [key2, value]);\n return Object.fromEntries(entries);\n}\n\nfunction formatTitle(i, index, {title}) {\n return formatDefault(title.value[i], i);\n}\n\nfunction* formatChannels(i, index, channels, scales, values) {\n for (const key in channels) {\n if (key === \"fx\" || key === \"fy\") {\n yield {\n label: formatLabel(scales, channels, key),\n value: this.format[key](index[key], i)\n };\n continue;\n }\n if (key === \"x1\" && \"x2\" in channels) continue;\n if (key === \"y1\" && \"y2\" in channels) continue;\n const channel = channels[key];\n if (key === \"x2\" && \"x1\" in channels) {\n yield {\n label: formatPairLabel(scales, channels, \"x\"),\n value: formatPair(this.format.x2, channels.x1, channel, i)\n };\n } else if (key === \"y2\" && \"y1\" in channels) {\n yield {\n label: formatPairLabel(scales, channels, \"y\"),\n value: formatPair(this.format.y2, channels.y1, channel, i)\n };\n } else {\n const value = channel.value[i];\n const scale = channel.scale;\n if (!defined(value) && scale == null) continue;\n yield {\n label: formatLabel(scales, channels, key),\n value: this.format[key](value, i),\n color: scale === \"color\" ? values[key][i] : null,\n opacity: scale === \"opacity\" ? values[key][i] : null\n };\n }\n }\n}\n\nfunction formatPair(formatValue, c1, c2, i) {\n return c2.hint?.length // e.g., stackY\u2019s y1 and y2\n ? `${formatValue(c2.value[i] - c1.value[i], i)}`\n : `${formatValue(c1.value[i], i)}\u2013${formatValue(c2.value[i], i)}`;\n}\n\nfunction formatPairLabel(scales, channels, key) {\n const l1 = formatLabel(scales, channels, `${key}1`, key);\n const l2 = formatLabel(scales, channels, `${key}2`, key);\n return l1 === l2 ? l1 : `${l1}\u2013${l2}`;\n}\n\nfunction formatLabel(scales, channels, key, defaultLabel = key) {\n const channel = channels[key];\n const scale = scales[channel?.scale ?? key];\n return String(scale?.label ?? channel?.label ?? defaultLabel);\n}\n", "import {creator, select} from \"d3\";\nimport {createChannel, inferChannelScale} from \"./channel.js\";\nimport {createContext} from \"./context.js\";\nimport {createDimensions} from \"./dimensions.js\";\nimport {createFacets, recreateFacets, facetExclude, facetGroups, facetTranslator, facetFilter} from \"./facet.js\";\nimport {pointer, pointerX, pointerY} from \"./interactions/pointer.js\";\nimport {createLegends, exposeLegends} from \"./legends.js\";\nimport {Mark} from \"./mark.js\";\nimport {axisFx, axisFy, axisX, axisY, gridFx, gridFy, gridX, gridY} from \"./marks/axis.js\";\nimport {frame} from \"./marks/frame.js\";\nimport {tip} from \"./marks/tip.js\";\nimport {isColor, isIterable, isNone, isScaleOptions} from \"./options.js\";\nimport {arrayify, map, yes, maybeIntervalTransform, subarray} from \"./options.js\";\nimport {createProjection, getGeometryChannels, hasProjection} from \"./projection.js\";\nimport {createScales, createScaleFunctions, autoScaleRange, exposeScales} from \"./scales.js\";\nimport {innerDimensions, outerDimensions} from \"./scales.js\";\nimport {isPosition, registry as scaleRegistry} from \"./scales/index.js\";\nimport {applyInlineStyles, maybeClassName} from \"./style.js\";\nimport {initializer} from \"./transforms/basic.js\";\nimport {consumeWarnings, warn} from \"./warnings.js\";\n\nexport function plot(options = {}) {\n const {facet, style, title, subtitle, caption, ariaLabel, ariaDescription} = options;\n\n // className for inline styles\n const className = maybeClassName(options.className);\n\n // Flatten any nested marks.\n const marks = options.marks === undefined ? [] : flatMarks(options.marks);\n\n // Add implicit tips.\n marks.push(...inferTips(marks));\n\n // Compute the top-level facet state. This has roughly the same structure as\n // mark-specific facet state, except there isn\u2019t a facetsIndex, and there\u2019s a\n // data and dataLength so we can warn the user if a different data of the same\n // length is used in a mark.\n const topFacetState = maybeTopFacet(facet, options);\n\n // Construct a map from (faceted) Mark instance to facet state, including:\n // channels - an {fx?, fy?} object to add to the fx and fy scale\n // groups - a possibly-nested map from facet values to indexes in the data array\n // facetsIndex - a sparse nested array of indices corresponding to the valid facets\n const facetStateByMark = new Map();\n for (const mark of marks) {\n const facetState = maybeMarkFacet(mark, topFacetState, options);\n if (facetState) facetStateByMark.set(mark, facetState);\n }\n\n // Compute a Map from scale name to an array of associated channels.\n const channelsByScale = new Map();\n if (topFacetState) addScaleChannels(channelsByScale, [topFacetState], options);\n addScaleChannels(channelsByScale, facetStateByMark, options);\n\n // Add implicit axis marks. Because this happens after faceting (because it\n // depends on whether faceting is present), we must initialize the facet state\n // of any implicit axes, too.\n const axes = flatMarks(inferAxes(marks, channelsByScale, options));\n for (const mark of axes) {\n const facetState = maybeMarkFacet(mark, topFacetState, options);\n if (facetState) facetStateByMark.set(mark, facetState);\n }\n marks.unshift(...axes);\n\n // All the possible facets are given by the domains of the fx or fy scales, or\n // the cross-product of these domains if we facet by both x and y. We sort\n // them in order to apply the facet filters afterwards.\n let facets = createFacets(channelsByScale, options);\n\n if (facets !== undefined) {\n const topFacetsIndex = topFacetState ? facetFilter(facets, topFacetState) : undefined;\n\n // Compute a facet index for each mark, parallel to the facets array. For\n // mark-level facets, compute an index for that mark\u2019s data and options.\n // Otherwise, use the top-level facet index.\n for (const mark of marks) {\n if (mark.facet === null || mark.facet === \"super\") continue;\n const facetState = facetStateByMark.get(mark);\n if (facetState === undefined) continue;\n facetState.facetsIndex = mark.fx != null || mark.fy != null ? facetFilter(facets, facetState) : topFacetsIndex;\n }\n\n // The cross product of the domains of fx and fy can include fx-fy\n // combinations for which no mark has an instance associated with that\n // combination, and therefore we don\u2019t want to render this facet (not even\n // the frame). The same can occur if you specify the domain of fx and fy\n // explicitly, but there is no mark instance associated with some values in\n // the domain. Expunge empty facets, and clear the corresponding elements\n // from the nested index in each mark.\n const nonEmpty = new Set();\n for (const {facetsIndex} of facetStateByMark.values()) {\n facetsIndex?.forEach((index, i) => {\n if (index?.length > 0) {\n nonEmpty.add(i);\n }\n });\n }\n\n // If all the facets are empty (as when none of the marks are actually\n // faceted), none of them are empty.\n facets.forEach(\n 0 < nonEmpty.size && nonEmpty.size < facets.length\n ? (f, i) => (f.empty = !nonEmpty.has(i))\n : (f) => (f.empty = false)\n );\n\n // For any mark using the \u201Cexclude\u201D facet mode, invert the index.\n for (const mark of marks) {\n if (mark.facet === \"exclude\") {\n const facetState = facetStateByMark.get(mark);\n if (facetState !== undefined) facetState.facetsIndex = facetExclude(facetState.facetsIndex);\n }\n }\n }\n\n // If a scale is explicitly declared in options, initialize its associated\n // channels to the empty array; this will guarantee that a corresponding scale\n // will be created later (even if there are no other channels). Ignore facet\n // scale declarations, which are handled above.\n for (const key of scaleRegistry.keys()) {\n if (isScaleOptions(options[key]) && key !== \"fx\" && key !== \"fy\") {\n channelsByScale.set(key, []);\n }\n }\n\n // A Map from Mark instance to its render state, including:\n // index - the data index e.g. [0, 1, 2, 3, \u2026]\n // channels - an array of materialized channels e.g. [[\"x\", {value}], \u2026]\n // faceted - a boolean indicating whether this mark is faceted\n // values - an object of scaled values e.g. {x: [40, 32, \u2026], \u2026}\n const stateByMark = new Map();\n\n // Initialize the marks\u2019 state.\n for (const mark of marks) {\n if (stateByMark.has(mark)) throw new Error(\"duplicate mark; each mark must be unique\");\n const {facetsIndex, channels: facetChannels} = facetStateByMark.get(mark) ?? {};\n const {data, facets, channels} = mark.initialize(facetsIndex, facetChannels, options);\n applyScaleTransforms(channels, options);\n stateByMark.set(mark, {data, facets, channels});\n }\n\n // Initalize the scales and dimensions.\n const scaleDescriptors = createScales(addScaleChannels(channelsByScale, stateByMark, options), options);\n const dimensions = createDimensions(scaleDescriptors, marks, options);\n\n autoScaleRange(scaleDescriptors, dimensions);\n\n const scales = createScaleFunctions(scaleDescriptors);\n const {fx, fy} = scales;\n const subdimensions = fx || fy ? innerDimensions(scaleDescriptors, dimensions) : dimensions;\n const superdimensions = fx || fy ? actualDimensions(scales, dimensions) : dimensions;\n\n // Initialize the context.\n const context = createContext(options);\n const document = context.document;\n const svg = creator(\"svg\").call(document.documentElement);\n let figure = svg; // replaced with the figure element, if any\n context.ownerSVGElement = svg;\n context.className = className;\n context.projection = createProjection(options, subdimensions);\n\n // Allows e.g. the axis mark to determine faceting lazily.\n context.filterFacets = (data, channels) => {\n return facetFilter(facets, {channels, groups: facetGroups(data, channels)});\n };\n\n // Allows e.g. the tip mark to reference channels and data on other marks.\n context.getMarkState = (mark) => {\n const state = stateByMark.get(mark);\n const facetState = facetStateByMark.get(mark);\n return {...state, channels: {...state.channels, ...facetState?.channels}};\n };\n\n // Allows e.g. the pointer transform to support viewof.\n context.dispatchValue = (value) => {\n if (figure.value === value) return;\n figure.value = value;\n figure.dispatchEvent(new Event(\"input\", {bubbles: true}));\n };\n\n // Reinitialize; for deriving channels dependent on other channels.\n const newByScale = new Set();\n for (const [mark, state] of stateByMark) {\n if (mark.initializer != null) {\n const dimensions = mark.facet === \"super\" ? superdimensions : subdimensions;\n const update = mark.initializer(state.data, state.facets, state.channels, scales, dimensions, context);\n if (update.data !== undefined) {\n state.data = update.data;\n }\n if (update.facets !== undefined) {\n state.facets = update.facets;\n }\n if (update.channels !== undefined) {\n const {fx, fy, ...channels} = update.channels; // separate facet channels\n inferChannelScales(channels);\n Object.assign(state.channels, channels);\n for (const channel of Object.values(channels)) {\n const {scale} = channel;\n // Initializers aren\u2019t allowed to redefine position scales as this\n // would introduce a circular dependency; so simply scale these\n // channels as-is rather than creating new scales, and assume that\n // they already have the scale\u2019s transform applied, if any (e.g., when\n // generating ticks for the axis mark).\n if (scale != null && !isPosition(scaleRegistry.get(scale))) {\n applyScaleTransform(channel, options);\n newByScale.add(scale);\n }\n }\n // If the initializer returns new mark-level facet channels, we must\n // record that the mark is now faceted. Note: we aren\u2019t actually\n // populating the facet state, but subsequently we won\u2019t need it.\n if (fx != null || fy != null) facetStateByMark.set(mark, true);\n }\n }\n }\n\n // Reconstruct scales if new scaled channels were created during\n // reinitialization. Preserve existing scale labels, if any.\n if (newByScale.size) {\n const newChannelsByScale = new Map();\n addScaleChannels(newChannelsByScale, stateByMark, options, (key) => newByScale.has(key));\n addScaleChannels(channelsByScale, stateByMark, options, (key) => newByScale.has(key));\n const newScaleDescriptors = inheritScaleLabels(createScales(newChannelsByScale, options), scaleDescriptors);\n const {scales: newExposedScales, ...newScales} = createScaleFunctions(newScaleDescriptors);\n Object.assign(scaleDescriptors, newScaleDescriptors);\n Object.assign(scales, newScales);\n Object.assign(scales.scales, newExposedScales);\n }\n\n // Sort and filter the facets to match the fx and fy domains; this is needed\n // because the facets were constructed prior to the fx and fy scales.\n let facetDomains, facetTranslate;\n if (facets !== undefined) {\n facetDomains = {x: fx?.domain(), y: fy?.domain()};\n facets = recreateFacets(facets, facetDomains);\n facetTranslate = facetTranslator(fx, fy, dimensions);\n }\n\n // Compute value objects, applying scales and projection as needed.\n for (const [mark, state] of stateByMark) {\n state.values = mark.scale(state.channels, scales, context);\n }\n\n const {width, height} = dimensions;\n\n select(svg)\n .attr(\"class\", className)\n .attr(\"fill\", \"currentColor\")\n .attr(\"font-family\", \"system-ui, sans-serif\")\n .attr(\"font-size\", 10)\n .attr(\"text-anchor\", \"middle\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr(\"viewBox\", `0 0 ${width} ${height}`)\n .attr(\"aria-label\", ariaLabel)\n .attr(\"aria-description\", ariaDescription)\n .call((svg) =>\n // Warning: if you edit this, change defaultClassName.\n svg.append(\"style\").text(\n `:where(.${className}) {\n --plot-background: white;\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n}\n:where(.${className} text),\n:where(.${className} tspan) {\n white-space: pre;\n}`\n )\n )\n .call(applyInlineStyles, style);\n\n // Render marks.\n for (const mark of marks) {\n const {channels, values, facets: indexes} = stateByMark.get(mark);\n\n // Render a non-faceted mark.\n if (facets === undefined || mark.facet === \"super\") {\n let index = null;\n if (indexes) {\n index = indexes[0];\n index = mark.filter(index, channels, values);\n if (index.length === 0) continue;\n }\n const node = mark.render(index, scales, values, superdimensions, context);\n if (node == null) continue;\n svg.appendChild(node);\n }\n\n // Render a faceted mark.\n else {\n let g;\n for (const f of facets) {\n if (!(mark.facetAnchor?.(facets, facetDomains, f) ?? !f.empty)) continue;\n let index = null;\n if (indexes) {\n const faceted = facetStateByMark.has(mark);\n index = indexes[faceted ? f.i : 0];\n index = mark.filter(index, channels, values);\n if (index.length === 0) continue;\n if (!faceted && index === indexes[0]) index = subarray(index); // copy before assigning fx, fy, fi\n (index.fx = f.x), (index.fy = f.y), (index.fi = f.i);\n }\n const node = mark.render(index, scales, values, subdimensions, context);\n if (node == null) continue;\n // Lazily construct the shared group (to drop empty marks).\n (g ??= select(svg).append(\"g\")).append(() => node).datum(f);\n // Promote ARIA attributes and mark transform to avoid repetition on\n // each facet; this assumes that these attributes are consistent across\n // facets, but that should be the case!\n for (const name of [\"aria-label\", \"aria-description\", \"aria-hidden\", \"transform\"]) {\n if (node.hasAttribute(name)) {\n g.attr(name, node.getAttribute(name));\n node.removeAttribute(name);\n }\n }\n }\n g?.selectChildren().attr(\"transform\", facetTranslate);\n }\n }\n\n // Wrap the plot in a figure, if needed.\n const legends = createLegends(scaleDescriptors, context, options);\n const {figure: figured = title != null || subtitle != null || caption != null || legends.length > 0} = options;\n if (figured) {\n figure = document.createElement(\"figure\");\n figure.className = `${className}-figure`;\n figure.style.maxWidth = \"initial\"; // avoid Observable default style\n if (title != null) figure.append(createTitleElement(document, title, \"h2\"));\n if (subtitle != null) figure.append(createTitleElement(document, subtitle, \"h3\"));\n figure.append(...legends, svg);\n if (caption != null) figure.append(createFigcaption(document, caption));\n }\n\n figure.scale = exposeScales(scales.scales);\n figure.legend = exposeLegends(scaleDescriptors, context, options);\n\n const w = consumeWarnings();\n if (w > 0) {\n select(svg)\n .append(\"text\")\n .attr(\"x\", width)\n .attr(\"y\", 20)\n .attr(\"dy\", \"-1em\")\n .attr(\"text-anchor\", \"end\")\n .attr(\"font-family\", \"initial\") // fix emoji rendering in Chrome\n .text(\"\\u26a0\\ufe0f\") // emoji variation selector\n .append(\"title\")\n .text(`${w.toLocaleString(\"en-US\")} warning${w === 1 ? \"\" : \"s\"}. Please check the console.`);\n }\n\n return figure;\n}\n\nfunction createTitleElement(document, contents, tag) {\n if (contents.ownerDocument) return contents;\n const e = document.createElement(tag);\n e.append(contents);\n return e;\n}\n\nfunction createFigcaption(document, caption) {\n const e = document.createElement(\"figcaption\");\n e.append(caption);\n return e;\n}\n\nfunction plotThis({marks = [], ...options} = {}) {\n return plot({...options, marks: [...marks, this]});\n}\n\n// Note: This side-effect avoids a circular dependency.\nMark.prototype.plot = plotThis;\n\nfunction flatMarks(marks) {\n return marks\n .flat(Infinity)\n .filter((mark) => mark != null)\n .map(markify);\n}\n\nfunction markify(mark) {\n return typeof mark.render === \"function\" ? mark : new Render(mark);\n}\n\nclass Render extends Mark {\n constructor(render) {\n if (typeof render !== \"function\") throw new TypeError(\"invalid mark; missing render function\");\n super();\n this.render = render;\n }\n render() {}\n}\n\n// Note: mutates channel.value to apply the scale transform, if any.\nfunction applyScaleTransforms(channels, options) {\n for (const name in channels) applyScaleTransform(channels[name], options);\n return channels;\n}\n\n// Note: mutates channel.value to apply the scale transform, if any. Also sets\n// channel.transform to false to prevent duplicate transform application.\nfunction applyScaleTransform(channel, options) {\n const {scale, transform: t = true} = channel;\n if (scale == null || !t) return;\n const {\n type,\n percent,\n interval,\n transform = percent ? (x) => x * 100 : maybeIntervalTransform(interval, type)\n } = options[scale] ?? {};\n if (transform == null) return;\n channel.value = map(channel.value, transform);\n channel.transform = false;\n}\n\n// An initializer may generate channels without knowing how the downstream mark\n// will use them. Marks are typically responsible associated scales with\n// channels, but here we assume common behavior across marks.\nfunction inferChannelScales(channels) {\n for (const name in channels) {\n inferChannelScale(name, channels[name]);\n }\n}\n\nfunction addScaleChannels(channelsByScale, stateByMark, options, filter = yes) {\n for (const {channels} of stateByMark.values()) {\n for (const name in channels) {\n const channel = channels[name];\n const {scale} = channel;\n if (scale != null && filter(scale)) {\n // Geo marks affect the default x and y domains if there is no\n // projection. Skip this (as an optimization) when a projection is\n // specified, or when the domains for x and y are specified.\n if (scale === \"projection\") {\n if (!hasProjection(options)) {\n const gx = options.x?.domain === undefined;\n const gy = options.y?.domain === undefined;\n if (gx || gy) {\n const [x, y] = getGeometryChannels(channel);\n if (gx) addScaleChannel(channelsByScale, \"x\", x);\n if (gy) addScaleChannel(channelsByScale, \"y\", y);\n }\n }\n } else {\n addScaleChannel(channelsByScale, scale, channel);\n }\n }\n }\n }\n return channelsByScale;\n}\n\nfunction addScaleChannel(channelsByScale, scale, channel) {\n const scaleChannels = channelsByScale.get(scale);\n if (scaleChannels !== undefined) scaleChannels.push(channel);\n else channelsByScale.set(scale, [channel]);\n}\n\n// Returns the facet groups, and possibly fx and fy channels, associated with\n// the top-level facet option {data, x, y}.\nfunction maybeTopFacet(facet, options) {\n if (facet == null) return;\n const {x, y} = facet;\n if (x == null && y == null) return;\n const data = arrayify(facet.data);\n if (data == null) throw new Error(\"missing facet data\");\n const channels = {};\n if (x != null) channels.fx = createChannel(data, {value: x, scale: \"fx\"});\n if (y != null) channels.fy = createChannel(data, {value: y, scale: \"fy\"});\n applyScaleTransforms(channels, options);\n const groups = facetGroups(data, channels);\n return {channels, groups, data: facet.data};\n}\n\n// Returns the facet groups, and possibly fx and fy channels, associated with a\n// mark, either through top-level faceting or mark-level facet options {fx, fy}.\nfunction maybeMarkFacet(mark, topFacetState, options) {\n if (mark.facet === null || mark.facet === \"super\") return;\n\n // This mark defines a mark-level facet. TODO There\u2019s some code duplication\n // here with maybeTopFacet that we could reduce.\n const {fx, fy} = mark;\n if (fx != null || fy != null) {\n const data = arrayify(mark.data ?? fx ?? fy);\n if (data === undefined) throw new Error(`missing facet data in ${mark.ariaLabel}`);\n if (data === null) return; // ignore channel definitions if no data is provided TODO this right?\n const channels = {};\n if (fx != null) channels.fx = createChannel(data, {value: fx, scale: \"fx\"});\n if (fy != null) channels.fy = createChannel(data, {value: fy, scale: \"fy\"});\n applyScaleTransforms(channels, options);\n return {channels, groups: facetGroups(data, channels)};\n }\n\n // This mark links to a top-level facet, if present.\n if (topFacetState === undefined) return;\n\n // TODO Can we link the top-level facet channels here?\n const {channels, groups, data} = topFacetState;\n if (mark.facet !== \"auto\" || mark.data === data) return {channels, groups};\n\n // Warn for the common pitfall of wanting to facet mapped data with the\n // top-level facet option.\n if (\n data.length > 0 &&\n (groups.size > 1 || (groups.size === 1 && channels.fx && channels.fy && [...groups][0][1].size > 1)) &&\n arrayify(mark.data)?.length === data.length\n ) {\n warn(\n `Warning: the ${mark.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is \"auto\", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`\n );\n }\n}\n\nfunction derive(mark, options = {}) {\n return initializer({...options, x: null, y: null}, (data, facets, channels, scales, dimensions, context) => {\n return context.getMarkState(mark);\n });\n}\n\nfunction inferTips(marks) {\n const tips = [];\n for (const mark of marks) {\n let tipOptions = mark.tip;\n if (tipOptions) {\n if (tipOptions === true) tipOptions = {};\n else if (typeof tipOptions === \"string\") tipOptions = {pointer: tipOptions};\n let {pointer: p, preferredAnchor: a} = tipOptions;\n p = /^x$/i.test(p) ? pointerX : /^y$/i.test(p) ? pointerY : pointer; // TODO validate?\n tipOptions = p(derive(mark, tipOptions));\n tipOptions.title = null; // prevent implicit title for primitive data\n if (a === undefined) tipOptions.preferredAnchor = p === pointerY ? \"left\" : \"bottom\";\n const t = tip(mark.data, tipOptions);\n t.facet = mark.facet; // inherit facet settings\n t.facetAnchor = mark.facetAnchor; // inherit facet settings\n tips.push(t);\n }\n }\n return tips;\n}\n\nfunction inferAxes(marks, channelsByScale, options) {\n let {\n projection,\n x = {},\n y = {},\n fx = {},\n fy = {},\n axis,\n grid,\n facet = {},\n facet: {axis: facetAxis = axis, grid: facetGrid} = facet,\n x: {axis: xAxis = axis, grid: xGrid = xAxis === null ? null : grid} = x,\n y: {axis: yAxis = axis, grid: yGrid = yAxis === null ? null : grid} = y,\n fx: {axis: fxAxis = facetAxis, grid: fxGrid = fxAxis === null ? null : facetGrid} = fx,\n fy: {axis: fyAxis = facetAxis, grid: fyGrid = fyAxis === null ? null : facetGrid} = fy\n } = options;\n\n // Disable axes if the corresponding scale is not present.\n if (projection || (!isScaleOptions(x) && !hasPositionChannel(\"x\", marks))) xAxis = xGrid = null;\n if (projection || (!isScaleOptions(y) && !hasPositionChannel(\"y\", marks))) yAxis = yGrid = null;\n if (!channelsByScale.has(\"fx\")) fxAxis = fxGrid = null;\n if (!channelsByScale.has(\"fy\")) fyAxis = fyGrid = null;\n\n // Resolve the default implicit axes by checking for explicit ones.\n if (xAxis === undefined) xAxis = !hasAxis(marks, \"x\");\n if (yAxis === undefined) yAxis = !hasAxis(marks, \"y\");\n if (fxAxis === undefined) fxAxis = !hasAxis(marks, \"fx\");\n if (fyAxis === undefined) fyAxis = !hasAxis(marks, \"fy\");\n\n // Resolve the default orientation of axes.\n if (xAxis === true) xAxis = \"bottom\";\n if (yAxis === true) yAxis = \"left\";\n if (fxAxis === true) fxAxis = xAxis === \"top\" || xAxis === null ? \"bottom\" : \"top\";\n if (fyAxis === true) fyAxis = yAxis === \"right\" || yAxis === null ? \"left\" : \"right\";\n\n const axes = [];\n maybeGrid(axes, fyGrid, gridFy, fy);\n maybeAxis(axes, fyAxis, axisFy, \"right\", \"left\", facet, fy);\n maybeGrid(axes, fxGrid, gridFx, fx);\n maybeAxis(axes, fxAxis, axisFx, \"top\", \"bottom\", facet, fx);\n maybeGrid(axes, yGrid, gridY, y);\n maybeAxis(axes, yAxis, axisY, \"left\", \"right\", options, y);\n maybeGrid(axes, xGrid, gridX, x);\n maybeAxis(axes, xAxis, axisX, \"bottom\", \"top\", options, x);\n return axes;\n}\n\nfunction maybeAxis(axes, axis, axisType, primary, secondary, defaults, options) {\n if (!axis) return;\n const both = isBoth(axis);\n options = axisOptions(both ? primary : axis, defaults, options);\n const {line} = options;\n if ((axisType === axisY || axisType === axisX) && line && !isNone(line)) axes.push(frame(lineOptions(options)));\n axes.push(axisType(options));\n if (both) axes.push(axisType({...options, anchor: secondary, label: null}));\n}\n\nfunction maybeGrid(axes, grid, gridType, options) {\n if (!grid || isNone(grid)) return;\n axes.push(gridType(gridOptions(grid, options)));\n}\n\nfunction isBoth(value) {\n return /^\\s*both\\s*$/i.test(value);\n}\n\nfunction axisOptions(\n anchor,\n defaults,\n {\n line = defaults.line,\n ticks,\n tickSize,\n tickSpacing,\n tickPadding,\n tickFormat,\n tickRotate,\n fontVariant,\n ariaLabel,\n ariaDescription,\n label = defaults.label,\n labelAnchor,\n labelArrow = defaults.labelArrow,\n labelOffset\n }\n) {\n return {\n anchor,\n line,\n ticks,\n tickSize,\n tickSpacing,\n tickPadding,\n tickFormat,\n tickRotate,\n fontVariant,\n ariaLabel,\n ariaDescription,\n label,\n labelAnchor,\n labelArrow,\n labelOffset\n };\n}\n\nfunction lineOptions(options) {\n const {anchor, line} = options;\n return {anchor, facetAnchor: anchor + \"-empty\", stroke: line === true ? undefined : line};\n}\n\nfunction gridOptions(\n grid,\n {\n stroke = isColor(grid) ? grid : undefined,\n ticks = isGridTicks(grid) ? grid : undefined,\n tickSpacing,\n ariaLabel,\n ariaDescription\n }\n) {\n return {\n stroke,\n ticks,\n tickSpacing,\n ariaLabel,\n ariaDescription\n };\n}\n\nfunction isGridTicks(grid) {\n switch (typeof grid) {\n case \"number\":\n return true;\n case \"string\":\n return !isColor(grid);\n }\n return isIterable(grid) || typeof grid?.range === \"function\";\n}\n\n// Is there an explicit axis already present? TODO We probably want a more\n// explicit test than looking for the ARIA label, but it does afford some\n// flexibility in axis implementation which is nice.\nfunction hasAxis(marks, k) {\n const prefix = `${k}-axis `;\n return marks.some((m) => m.ariaLabel?.startsWith(prefix));\n}\n\nfunction hasPositionChannel(k, marks) {\n for (const mark of marks) {\n for (const key in mark.channels) {\n const {scale} = mark.channels[key];\n if (scale === k || scale === \"projection\") {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction inheritScaleLabels(newScales, scales) {\n for (const key in newScales) {\n const newScale = newScales[key];\n const scale = scales[key];\n if (newScale.label === undefined && scale) {\n newScale.label = scale.label;\n }\n }\n return newScales;\n}\n\n// This differs from the other outerDimensions in that it accounts for rounding\n// and outer padding in the facet scales; we want the frame to align exactly\n// with the actual range, not the desired range.\nfunction actualDimensions({fx, fy}, dimensions) {\n const {marginTop, marginRight, marginBottom, marginLeft, width, height} = outerDimensions(dimensions);\n const fxr = fx && outerRange(fx);\n const fyr = fy && outerRange(fy);\n return {\n marginTop: fy ? fyr[0] : marginTop,\n marginRight: fx ? width - fxr[1] : marginRight,\n marginBottom: fy ? height - fyr[1] : marginBottom,\n marginLeft: fx ? fxr[0] : marginLeft,\n // Some marks, namely the x- and y-axis labels, want to know what the\n // desired (rather than actual) margins are for positioning.\n inset: {\n marginTop: dimensions.marginTop,\n marginRight: dimensions.marginRight,\n marginBottom: dimensions.marginBottom,\n marginLeft: dimensions.marginLeft\n },\n width,\n height\n };\n}\n\nfunction outerRange(scale) {\n const domain = scale.domain();\n let x1 = scale(domain[0]);\n let x2 = scale(domain[domain.length - 1]);\n if (x2 < x1) [x1, x2] = [x2, x1];\n return [x1, x2 + scale.bandwidth()];\n}\n", "import {\n curveBasis,\n curveBasisClosed,\n curveBasisOpen,\n curveBundle,\n curveBumpX,\n curveBumpY,\n curveCardinal,\n curveCardinalClosed,\n curveCardinalOpen,\n curveCatmullRom,\n curveCatmullRomClosed,\n curveCatmullRomOpen,\n curveLinear,\n curveLinearClosed,\n curveMonotoneX,\n curveMonotoneY,\n curveNatural,\n curveStep,\n curveStepAfter,\n curveStepBefore\n} from \"d3\";\n\nconst curves = new Map([\n [\"basis\", curveBasis],\n [\"basis-closed\", curveBasisClosed],\n [\"basis-open\", curveBasisOpen],\n [\"bundle\", curveBundle],\n [\"bump-x\", curveBumpX],\n [\"bump-y\", curveBumpY],\n [\"cardinal\", curveCardinal],\n [\"cardinal-closed\", curveCardinalClosed],\n [\"cardinal-open\", curveCardinalOpen],\n [\"catmull-rom\", curveCatmullRom],\n [\"catmull-rom-closed\", curveCatmullRomClosed],\n [\"catmull-rom-open\", curveCatmullRomOpen],\n [\"linear\", curveLinear],\n [\"linear-closed\", curveLinearClosed],\n [\"monotone-x\", curveMonotoneX],\n [\"monotone-y\", curveMonotoneY],\n [\"natural\", curveNatural],\n [\"step\", curveStep],\n [\"step-after\", curveStepAfter],\n [\"step-before\", curveStepBefore]\n]);\n\nexport function maybeCurve(curve = curveLinear, tension) {\n if (typeof curve === \"function\") return curve; // custom curve\n const c = curves.get(`${curve}`.toLowerCase());\n if (!c) throw new Error(`unknown curve: ${curve}`);\n if (tension !== undefined) {\n if (\"beta\" in c) {\n return c.beta(tension);\n } else if (\"tension\" in c) {\n return c.tension(tension);\n } else if (\"alpha\" in c) {\n return c.alpha(tension);\n }\n }\n return c;\n}\n\n// For the \u201Cauto\u201D curve, return a symbol instead of a curve implementation;\n// we\u2019ll use d3.geoPath to render if there\u2019s a projection.\nexport function maybeCurveAuto(curve = curveAuto, tension) {\n return typeof curve !== \"function\" && `${curve}`.toLowerCase() === \"auto\" ? curveAuto : maybeCurve(curve, tension);\n}\n\n// This is a special built-in curve that will use d3.geoPath when there is a\n// projection, and the linear curve when there is not. You can explicitly\n// opt-out of d3.geoPath and instead use d3.line with the \"linear\" curve.\nexport function curveAuto(context) {\n return curveLinear(context);\n}\n", "import {\n bisect,\n extent,\n thresholdFreedmanDiaconis,\n thresholdScott,\n thresholdSturges,\n tickIncrement,\n ticks,\n utcTickInterval\n} from \"d3\";\nimport {withTip} from \"../mark.js\";\nimport {\n coerceDate,\n coerceNumbers,\n identity,\n isInterval,\n isIterable,\n isTemporal,\n isTimeInterval,\n labelof,\n map,\n maybeApplyInterval,\n maybeColorChannel,\n maybeColumn,\n maybeRangeInterval,\n maybeTuple,\n maybeValue,\n mid,\n valueof\n} from \"../options.js\";\nimport {maybeUtcInterval} from \"../time.js\";\nimport {basic} from \"./basic.js\";\nimport {\n hasOutput,\n maybeEvaluator,\n maybeGroup,\n maybeOutput,\n maybeOutputs,\n maybeReduce,\n maybeSort,\n maybeSubgroup,\n reduceCount,\n reduceFirst,\n reduceIdentity,\n reduceZ\n} from \"./group.js\";\nimport {maybeInsetX, maybeInsetY} from \"./inset.js\";\n\n// Group on {z, fill, stroke}, then optionally on y, then bin x.\nexport function binX(outputs = {y: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = options;\n return binn(maybeBinValue(x, options, identity), null, null, y, outputs, maybeInsetX(options));\n}\n\n// Group on {z, fill, stroke}, then optionally on x, then bin y.\nexport function binY(outputs = {x: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = options;\n return binn(null, maybeBinValue(y, options, identity), x, null, outputs, maybeInsetY(options));\n}\n\n// Group on {z, fill, stroke}, then bin on x and y.\nexport function bin(outputs = {fill: \"count\"}, options = {}) {\n [outputs, options] = mergeOptions(outputs, options);\n const {x, y} = maybeBinValueTuple(options);\n return binn(x, y, null, null, outputs, maybeInsetX(maybeInsetY(options)));\n}\n\nfunction maybeDenseInterval(bin, k, options = {}) {\n if (options?.interval == null) return options;\n const {reduce = reduceFirst} = options;\n const outputs = {filter: null};\n if (options[k] != null) outputs[k] = reduce;\n if (options[`${k}1`] != null) outputs[`${k}1`] = reduce;\n if (options[`${k}2`] != null) outputs[`${k}2`] = reduce;\n return bin(outputs, options);\n}\n\nexport function maybeDenseIntervalX(options = {}) {\n return maybeDenseInterval(binX, \"y\", withTip(options, \"x\"));\n}\n\nexport function maybeDenseIntervalY(options = {}) {\n return maybeDenseInterval(binY, \"x\", withTip(options, \"y\"));\n}\n\nfunction binn(\n bx, // optionally bin on x (exclusive with gx)\n by, // optionally bin on y (exclusive with gy)\n gx, // optionally group on x (exclusive with bx and gy)\n gy, // optionally group on y (exclusive with by and gx)\n {\n data: reduceData = reduceIdentity, // TODO avoid materializing when unused?\n filter = reduceCount, // return only non-empty bins by default\n sort,\n reverse,\n ...outputs // output channel definitions\n } = {},\n inputs = {} // input channels and options\n) {\n bx = maybeBin(bx);\n by = maybeBin(by);\n\n // Compute the outputs.\n outputs = maybeBinOutputs(outputs, inputs);\n reduceData = maybeBinReduce(reduceData, identity);\n sort = sort == null ? undefined : maybeBinOutput(\"sort\", sort, inputs);\n filter = filter == null ? undefined : maybeBinEvaluator(\"filter\", filter, inputs);\n\n // Don\u2019t group on a channel if an output requires it as an input!\n if (gx != null && hasOutput(outputs, \"x\", \"x1\", \"x2\")) gx = null;\n if (gy != null && hasOutput(outputs, \"y\", \"y1\", \"y2\")) gy = null;\n\n // Produce x1, x2, y1, and y2 output channels as appropriate (when binning).\n const [BX1, setBX1] = maybeColumn(bx);\n const [BX2, setBX2] = maybeColumn(bx);\n const [BY1, setBY1] = maybeColumn(by);\n const [BY2, setBY2] = maybeColumn(by);\n\n // Produce x or y output channels as appropriate (when grouping).\n const [k, gk] = gx != null ? [gx, \"x\"] : gy != null ? [gy, \"y\"] : [];\n const [GK, setGK] = maybeColumn(k);\n\n // Greedily materialize the z, fill, and stroke channels (if channels and not\n // constants) so that we can reference them for subdividing groups without\n // computing them more than once. We also want to consume options that should\n // only apply to this transform rather than passing them through to the next.\n const {\n x,\n y,\n z,\n fill,\n stroke,\n x1,\n x2, // consumed if x is an output\n y1,\n y2, // consumed if y is an output\n domain,\n cumulative,\n thresholds,\n interval,\n ...options\n } = inputs;\n const [GZ, setGZ] = maybeColumn(z);\n const [vfill] = maybeColorChannel(fill);\n const [vstroke] = maybeColorChannel(stroke);\n const [GF, setGF] = maybeColumn(vfill);\n const [GS, setGS] = maybeColumn(vstroke);\n\n return {\n ...(\"z\" in inputs && {z: GZ || z}),\n ...(\"fill\" in inputs && {fill: GF || fill}),\n ...(\"stroke\" in inputs && {stroke: GS || stroke}),\n ...basic(options, (data, facets, plotOptions) => {\n const K = maybeApplyInterval(valueof(data, k), plotOptions?.[gk]);\n const Z = valueof(data, z);\n const F = valueof(data, vfill);\n const S = valueof(data, vstroke);\n const G = maybeSubgroup(outputs, {z: Z, fill: F, stroke: S});\n const groupFacets = [];\n const groupData = [];\n const GK = K && setGK([]);\n const GZ = Z && setGZ([]);\n const GF = F && setGF([]);\n const GS = S && setGS([]);\n const BX1 = bx && setBX1([]);\n const BX2 = bx && setBX2([]);\n const BY1 = by && setBY1([]);\n const BY2 = by && setBY2([]);\n const bin = bing(bx, by, data);\n let i = 0;\n for (const o of outputs) o.initialize(data);\n if (sort) sort.initialize(data);\n if (filter) filter.initialize(data);\n for (const facet of facets) {\n const groupFacet = [];\n for (const o of outputs) o.scope(\"facet\", facet);\n if (sort) sort.scope(\"facet\", facet);\n if (filter) filter.scope(\"facet\", facet);\n for (const [f, I] of maybeGroup(facet, G)) {\n for (const [k, g] of maybeGroup(I, K)) {\n for (const [b, extent] of bin(g)) {\n if (G) extent.z = f;\n if (filter && !filter.reduce(b, extent)) continue;\n groupFacet.push(i++);\n groupData.push(reduceData.reduceIndex(b, data, extent));\n if (K) GK.push(k);\n if (Z) GZ.push(G === Z ? f : Z[(b.length > 0 ? b : g)[0]]);\n if (F) GF.push(G === F ? f : F[(b.length > 0 ? b : g)[0]]);\n if (S) GS.push(G === S ? f : S[(b.length > 0 ? b : g)[0]]);\n if (BX1) BX1.push(extent.x1), BX2.push(extent.x2);\n if (BY1) BY1.push(extent.y1), BY2.push(extent.y2);\n for (const o of outputs) o.reduce(b, extent);\n if (sort) sort.reduce(b, extent);\n }\n }\n }\n groupFacets.push(groupFacet);\n }\n maybeSort(groupFacets, sort, reverse);\n return {data: groupData, facets: groupFacets};\n }),\n ...(!hasOutput(outputs, \"x\") && (BX1 ? {x1: BX1, x2: BX2, x: mid(BX1, BX2)} : {x, x1, x2})),\n ...(!hasOutput(outputs, \"y\") && (BY1 ? {y1: BY1, y2: BY2, y: mid(BY1, BY2)} : {y, y1, y2})),\n ...(GK && {[gk]: GK}),\n ...Object.fromEntries(outputs.map(({name, output}) => [name, output]))\n };\n}\n\n// Allow bin options to be specified as part of outputs; merge them into options.\nfunction mergeOptions({cumulative, domain, thresholds, interval, ...outputs}, options) {\n return [outputs, {cumulative, domain, thresholds, interval, ...options}];\n}\n\nfunction maybeBinValue(value, {cumulative, domain, thresholds, interval}, defaultValue) {\n value = {...maybeValue(value)};\n if (value.domain === undefined) value.domain = domain;\n if (value.cumulative === undefined) value.cumulative = cumulative;\n if (value.thresholds === undefined) value.thresholds = thresholds;\n if (value.interval === undefined) value.interval = interval;\n if (value.value === undefined) value.value = defaultValue;\n value.thresholds = maybeThresholds(value.thresholds, value.interval);\n return value;\n}\n\nfunction maybeBinValueTuple(options) {\n let {x, y} = options;\n x = maybeBinValue(x, options);\n y = maybeBinValue(y, options);\n [x.value, y.value] = maybeTuple(x.value, y.value);\n return {x, y};\n}\n\nfunction maybeBin(options) {\n if (options == null) return;\n const {value, cumulative, domain = extent, thresholds} = options;\n const bin = (data) => {\n let V = valueof(data, value);\n let T; // bin thresholds\n if (isTemporal(V) || isTimeThresholds(thresholds)) {\n V = map(V, coerceDate, Float64Array); // like coerceDates, but faster\n let [min, max] = typeof domain === \"function\" ? domain(V) : domain;\n let t = typeof thresholds === \"function\" && !isInterval(thresholds) ? thresholds(V, min, max) : thresholds;\n if (typeof t === \"number\") t = utcTickInterval(min, max, t);\n if (isInterval(t)) {\n if (domain === extent) {\n min = t.floor(min);\n max = t.offset(t.floor(max));\n }\n t = t.range(min, t.offset(max));\n }\n T = t;\n } else {\n V = coerceNumbers(V);\n let [min, max] = typeof domain === \"function\" ? domain(V) : domain;\n let t = typeof thresholds === \"function\" && !isInterval(thresholds) ? thresholds(V, min, max) : thresholds;\n if (typeof t === \"number\") {\n // This differs from d3.ticks with regard to exclusive bounds: we want a\n // first threshold less than or equal to the minimum, and a last\n // threshold (strictly) greater than the maximum.\n if (domain === extent) {\n let step = tickIncrement(min, max, t);\n if (isFinite(step)) {\n if (step > 0) {\n let r0 = Math.round(min / step);\n let r1 = Math.round(max / step);\n if (!(r0 * step <= min)) --r0;\n if (!(r1 * step > max)) ++r1;\n let n = r1 - r0 + 1;\n t = new Float64Array(n);\n for (let i = 0; i < n; ++i) t[i] = (r0 + i) * step;\n } else if (step < 0) {\n step = -step;\n let r0 = Math.round(min * step);\n let r1 = Math.round(max * step);\n if (!(r0 / step <= min)) --r0;\n if (!(r1 / step > max)) ++r1;\n let n = r1 - r0 + 1;\n t = new Float64Array(n);\n for (let i = 0; i < n; ++i) t[i] = (r0 + i) / step;\n } else {\n t = [min];\n }\n } else {\n t = [min];\n }\n } else {\n t = ticks(min, max, t);\n }\n } else if (isInterval(t)) {\n if (domain === extent) {\n min = t.floor(min);\n max = t.offset(t.floor(max));\n }\n t = t.range(min, t.offset(max));\n }\n T = t;\n }\n const E = [];\n if (T.length === 1) E.push([T[0], T[0]]); // collapsed domain\n else for (let i = 1; i < T.length; ++i) E.push([T[i - 1], T[i]]);\n E.bin = (cumulative < 0 ? bin1cn : cumulative > 0 ? bin1cp : bin1)(E, T, V);\n return E;\n };\n bin.label = labelof(value);\n return bin;\n}\n\nexport function maybeThresholds(thresholds, interval, defaultThresholds = thresholdAuto) {\n if (thresholds === undefined) {\n return interval === undefined ? defaultThresholds : maybeRangeInterval(interval);\n }\n if (typeof thresholds === \"string\") {\n switch (thresholds.toLowerCase()) {\n case \"freedman-diaconis\":\n return thresholdFreedmanDiaconis;\n case \"scott\":\n return thresholdScott;\n case \"sturges\":\n return thresholdSturges;\n case \"auto\":\n return thresholdAuto;\n }\n return maybeUtcInterval(thresholds);\n }\n return thresholds; // pass array, count, or function to bin.thresholds\n}\n\nfunction maybeBinOutputs(outputs, inputs) {\n return maybeOutputs(outputs, inputs, maybeBinOutput);\n}\n\nfunction maybeBinOutput(name, reduce, inputs) {\n return maybeOutput(name, reduce, inputs, maybeBinEvaluator);\n}\n\nfunction maybeBinEvaluator(name, reduce, inputs) {\n return maybeEvaluator(name, reduce, inputs, maybeBinReduce);\n}\n\nfunction maybeBinReduce(reduce, value) {\n return maybeReduce(reduce, value, maybeBinReduceFallback);\n}\n\nfunction maybeBinReduceFallback(reduce) {\n switch (`${reduce}`.toLowerCase()) {\n case \"x\":\n return reduceX;\n case \"x1\":\n return reduceX1;\n case \"x2\":\n return reduceX2;\n case \"y\":\n return reduceY;\n case \"y1\":\n return reduceY1;\n case \"y2\":\n return reduceY2;\n case \"z\":\n return reduceZ;\n }\n throw new Error(`invalid bin reduce: ${reduce}`);\n}\n\nfunction thresholdAuto(values, min, max) {\n return Math.min(200, thresholdScott(values, min, max));\n}\n\nfunction isTimeThresholds(t) {\n return isTimeInterval(t) || (isIterable(t) && isTemporal(t));\n}\n\nfunction bing(bx, by, data) {\n const EX = bx?.(data);\n const EY = by?.(data);\n return EX && EY\n ? function* (I) {\n const X = EX.bin(I); // first bin on x\n for (const [ix, [x1, x2]] of EX.entries()) {\n const Y = EY.bin(X[ix]); // then bin on y\n for (const [iy, [y1, y2]] of EY.entries()) {\n yield [Y[iy], {data, x1, y1, x2, y2}];\n }\n }\n }\n : EX\n ? function* (I) {\n const X = EX.bin(I);\n for (const [i, [x1, x2]] of EX.entries()) {\n yield [X[i], {data, x1, x2}];\n }\n }\n : function* (I) {\n const Y = EY.bin(I);\n for (const [i, [y1, y2]] of EY.entries()) {\n yield [Y[i], {data, y1, y2}];\n }\n };\n}\n\n// non-cumulative distribution\nfunction bin1(E, T, V) {\n T = coerceNumbers(T); // for faster bisection\n return (I) => {\n const B = E.map(() => []);\n for (const i of I) B[bisect(T, V[i]) - 1]?.push(i); // TODO quantization?\n return B;\n };\n}\n\n// cumulative distribution\nfunction bin1cp(E, T, V) {\n const bin = bin1(E, T, V);\n return (I) => {\n const B = bin(I);\n for (let i = 1, n = B.length; i < n; ++i) {\n const C = B[i - 1];\n const b = B[i];\n for (const j of C) b.push(j);\n }\n return B;\n };\n}\n\n// complementary cumulative distribution\nfunction bin1cn(E, T, V) {\n const bin = bin1(E, T, V);\n return (I) => {\n const B = bin(I);\n for (let i = B.length - 2; i >= 0; --i) {\n const C = B[i + 1];\n const b = B[i];\n for (const j of C) b.push(j);\n }\n return B;\n };\n}\n\nfunction mid1(x1, x2) {\n const m = (+x1 + +x2) / 2;\n return x1 instanceof Date ? new Date(m) : m;\n}\n\nconst reduceX = {\n reduceIndex(I, X, {x1, x2}) {\n return mid1(x1, x2);\n }\n};\n\nconst reduceY = {\n reduceIndex(I, X, {y1, y2}) {\n return mid1(y1, y2);\n }\n};\n\nconst reduceX1 = {\n reduceIndex(I, X, {x1}) {\n return x1;\n }\n};\n\nconst reduceX2 = {\n reduceIndex(I, X, {x2}) {\n return x2;\n }\n};\n\nconst reduceY1 = {\n reduceIndex(I, X, {y1}) {\n return y1;\n }\n};\n\nconst reduceY2 = {\n reduceIndex(I, X, {y2}) {\n return y2;\n }\n};\n", "import {hasX, hasY, identity} from \"../options.js\";\n\nexport function maybeIdentityX(options = {}) {\n return hasX(options) ? options : {...options, x: identity};\n}\n\nexport function maybeIdentityY(options = {}) {\n return hasY(options) ? options : {...options, y: identity};\n}\n", "import {reindex, slice} from \"../options.js\";\n\nexport function exclusiveFacets(data, facets) {\n if (facets.length === 1) return {data, facets}; // only one facet; trivially exclusive\n\n const n = data.length;\n const O = new Uint8Array(n);\n let overlaps = 0;\n\n // Count the number of overlapping indexes across facets.\n for (const facet of facets) {\n for (const i of facet) {\n if (O[i]) ++overlaps;\n O[i] = 1;\n }\n }\n\n // Do nothing if the facets are already exclusive.\n if (overlaps === 0) return {data, facets}; // facets are exclusive\n\n // For each overlapping index (duplicate), assign a new unique index at the\n // end of the existing array, duplicating the datum. For example, [[0, 1, 2],\n // [2, 1, 3]] would become [[0, 1, 2], [4, 5, 3]]. Also attach a reindex to\n // the data to preserve the association of channel values specified as arrays.\n data = slice(data);\n const R = (data[reindex] = new Uint32Array(n + overlaps));\n facets = facets.map((facet) => slice(facet, Uint32Array));\n let j = n;\n O.fill(0);\n for (const facet of facets) {\n for (let k = 0, m = facet.length; k < m; ++k) {\n const i = facet[k];\n if (O[i]) (facet[k] = j), (data[j] = data[i]), (R[j] = i), ++j;\n else R[i] = i;\n O[i] = 1;\n }\n }\n\n return {data, facets};\n}\n", "import {InternMap, cumsum, greatest, group, groupSort, max, min, rollup, sum} from \"d3\";\nimport {ascendingDefined, descendingDefined} from \"../defined.js\";\nimport {withTip} from \"../mark.js\";\nimport {maybeApplyInterval, maybeColumn, maybeZ, maybeZero} from \"../options.js\";\nimport {column, field, mid, one, range, valueof} from \"../options.js\";\nimport {basic} from \"./basic.js\";\nimport {exclusiveFacets} from \"./exclusiveFacets.js\";\n\nexport function stackX(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x, ...rest} = options; // note: consumes x!\n const [transform, Y, x1, x2] = stack(y, x, \"y\", \"x\", stackOptions, rest);\n return {...transform, y1, y: Y, x1, x2, x: mid(x1, x2)};\n}\n\nexport function stackX1(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x} = options;\n const [transform, Y, X] = stack(y, x, \"y\", \"x\", stackOptions, options);\n return {...transform, y1, y: Y, x: X};\n}\n\nexport function stackX2(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {y1, y = y1, x} = options;\n const [transform, Y, , X] = stack(y, x, \"y\", \"x\", stackOptions, options);\n return {...transform, y1, y: Y, x: X};\n}\n\nexport function stackY(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y, ...rest} = options; // note: consumes y!\n const [transform, X, y1, y2] = stack(x, y, \"x\", \"y\", stackOptions, rest);\n return {...transform, x1, x: X, y1, y2, y: mid(y1, y2)};\n}\n\nexport function stackY1(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y} = options;\n const [transform, X, Y] = stack(x, y, \"x\", \"y\", stackOptions, options);\n return {...transform, x1, x: X, y: Y};\n}\n\nexport function stackY2(stackOptions = {}, options = {}) {\n if (arguments.length === 1) [stackOptions, options] = mergeOptions(stackOptions);\n const {x1, x = x1, y} = options;\n const [transform, X, , Y] = stack(x, y, \"x\", \"y\", stackOptions, options);\n return {...transform, x1, x: X, y: Y};\n}\n\nexport function maybeStackX({x, x1, x2, ...options} = {}) {\n options = withTip(options, \"y\");\n if (x1 === undefined && x2 === undefined) return stackX({x, ...options});\n [x1, x2] = maybeZero(x, x1, x2);\n return {...options, x1, x2};\n}\n\nexport function maybeStackY({y, y1, y2, ...options} = {}) {\n options = withTip(options, \"x\");\n if (y1 === undefined && y2 === undefined) return stackY({y, ...options});\n [y1, y2] = maybeZero(y, y1, y2);\n return {...options, y1, y2};\n}\n\n// The reverse option is ambiguous: it is both a stack option and a basic\n// transform. If only one options object is specified, we interpret it as a\n// stack option, and therefore must remove it from the propagated options.\nfunction mergeOptions(options) {\n const {offset, order, reverse, ...rest} = options;\n return [{offset, order, reverse}, rest];\n}\n\n// This is a hint to the tooltip mark that the y1 and y2 channels (for stackY,\n// or conversely x1 and x2 for stackX) represent a stacked length, and that the\n// tooltip should therefore show y2-y1 instead of an extent.\nconst lengthy = {length: true};\n\nfunction stack(x, y = one, kx, ky, {offset, order, reverse}, options) {\n if (y === null) throw new Error(`stack requires ${ky}`);\n const z = maybeZ(options);\n const [X, setX] = maybeColumn(x);\n const [Y1, setY1] = column(y);\n const [Y2, setY2] = column(y);\n Y1.hint = Y2.hint = lengthy;\n offset = maybeOffset(offset);\n order = maybeOrder(order, offset, ky);\n return [\n basic(options, (data, facets, plotOptions) => {\n ({data, facets} = exclusiveFacets(data, facets));\n const X = x == null ? undefined : setX(maybeApplyInterval(valueof(data, x), plotOptions?.[kx]));\n const Y = valueof(data, y, Float64Array);\n const Z = valueof(data, z);\n const compare = order && order(data, X, Y, Z);\n const n = data.length;\n const Y1 = setY1(new Float64Array(n));\n const Y2 = setY2(new Float64Array(n));\n const facetstacks = [];\n for (const facet of facets) {\n const stacks = X ? Array.from(group(facet, (i) => X[i]).values()) : [facet];\n if (compare) for (const stack of stacks) stack.sort(compare);\n for (const stack of stacks) {\n let yn = 0;\n let yp = 0;\n if (reverse) stack.reverse();\n for (const i of stack) {\n const y = Y[i];\n if (y < 0) yn = Y2[i] = (Y1[i] = yn) + y;\n else if (y > 0) yp = Y2[i] = (Y1[i] = yp) + y;\n else Y2[i] = Y1[i] = yp; // NaN or zero\n }\n }\n facetstacks.push(stacks);\n }\n if (offset) offset(facetstacks, Y1, Y2, Z);\n return {data, facets};\n }),\n X,\n Y1,\n Y2\n ];\n}\n\nfunction maybeOffset(offset) {\n if (offset == null) return;\n if (typeof offset === \"function\") return offset;\n switch (`${offset}`.toLowerCase()) {\n case \"expand\":\n case \"normalize\":\n return offsetExpand;\n case \"center\":\n case \"silhouette\":\n return offsetCenter;\n case \"wiggle\":\n return offsetWiggle;\n }\n throw new Error(`unknown offset: ${offset}`);\n}\n\n// Given a single stack, returns the minimum and maximum values from the given\n// Y2 column. Note that this relies on Y2 always being the outer column for\n// diverging values.\nfunction extent(stack, Y2) {\n let min = 0,\n max = 0;\n for (const i of stack) {\n const y = Y2[i];\n if (y < min) min = y;\n if (y > max) max = y;\n }\n return [min, max];\n}\n\nfunction offsetExpand(facetstacks, Y1, Y2) {\n for (const stacks of facetstacks) {\n for (const stack of stacks) {\n const [yn, yp] = extent(stack, Y2);\n for (const i of stack) {\n const m = 1 / (yp - yn || 1);\n Y1[i] = m * (Y1[i] - yn);\n Y2[i] = m * (Y2[i] - yn);\n }\n }\n }\n}\n\nfunction offsetCenter(facetstacks, Y1, Y2) {\n for (const stacks of facetstacks) {\n for (const stack of stacks) {\n const [yn, yp] = extent(stack, Y2);\n for (const i of stack) {\n const m = (yp + yn) / 2;\n Y1[i] -= m;\n Y2[i] -= m;\n }\n }\n offsetZero(stacks, Y1, Y2);\n }\n offsetCenterFacets(facetstacks, Y1, Y2);\n}\n\nfunction offsetWiggle(facetstacks, Y1, Y2, Z) {\n for (const stacks of facetstacks) {\n const prev = new InternMap();\n let y = 0;\n for (const stack of stacks) {\n let j = -1;\n const Fi = stack.map((i) => Math.abs(Y2[i] - Y1[i]));\n const Df = stack.map((i) => {\n j = Z ? Z[i] : ++j;\n const value = Y2[i] - Y1[i];\n const diff = prev.has(j) ? value - prev.get(j) : 0;\n prev.set(j, value);\n return diff;\n });\n const Cf1 = [0, ...cumsum(Df)];\n for (const i of stack) {\n Y1[i] += y;\n Y2[i] += y;\n }\n const s1 = sum(Fi);\n if (s1) y -= sum(Fi, (d, i) => (Df[i] / 2 + Cf1[i]) * d) / s1;\n }\n offsetZero(stacks, Y1, Y2);\n }\n offsetCenterFacets(facetstacks, Y1, Y2);\n}\n\nfunction offsetZero(stacks, Y1, Y2) {\n const m = min(stacks, (stack) => min(stack, (i) => Y1[i]));\n for (const stack of stacks) {\n for (const i of stack) {\n Y1[i] -= m;\n Y2[i] -= m;\n }\n }\n}\n\nfunction offsetCenterFacets(facetstacks, Y1, Y2) {\n const n = facetstacks.length;\n if (n === 1) return;\n const facets = facetstacks.map((stacks) => stacks.flat());\n const m = facets.map((I) => (min(I, (i) => Y1[i]) + max(I, (i) => Y2[i])) / 2);\n const m0 = min(m);\n for (let j = 0; j < n; j++) {\n const p = m0 - m[j];\n for (const i of facets[j]) {\n Y1[i] += p;\n Y2[i] += p;\n }\n }\n}\n\nfunction maybeOrder(order, offset, ky) {\n if (order === undefined && offset === offsetWiggle) return orderInsideOut(ascendingDefined);\n if (order == null) return;\n if (typeof order === \"string\") {\n const negate = order.startsWith(\"-\");\n const compare = negate ? descendingDefined : ascendingDefined;\n switch ((negate ? order.slice(1) : order).toLowerCase()) {\n case \"value\":\n case ky:\n return orderY(compare);\n case \"z\":\n return orderZ(compare);\n case \"sum\":\n return orderSum(compare);\n case \"appearance\":\n return orderAppearance(compare);\n case \"inside-out\":\n return orderInsideOut(compare);\n }\n return orderAccessor(field(order));\n }\n if (typeof order === \"function\") return (order.length === 1 ? orderAccessor : orderComparator)(order);\n if (Array.isArray(order)) return orderGiven(order);\n throw new Error(`invalid order: ${order}`);\n}\n\n// by value\nfunction orderY(compare) {\n return (data, X, Y) => (i, j) => compare(Y[i], Y[j]);\n}\n\n// by location\nfunction orderZ(compare) {\n return (data, X, Y, Z) => (i, j) => compare(Z[i], Z[j]);\n}\n\n// by sum of value (a.k.a. \u201Cascending\u201D)\nfunction orderSum(compare) {\n return orderZDomain(compare, (data, X, Y, Z) =>\n groupSort(\n range(data),\n (I) => sum(I, (i) => Y[i]),\n (i) => Z[i]\n )\n );\n}\n\n// by x = argmax of value\nfunction orderAppearance(compare) {\n return orderZDomain(compare, (data, X, Y, Z) =>\n groupSort(\n range(data),\n (I) => X[greatest(I, (i) => Y[i])],\n (i) => Z[i]\n )\n );\n}\n\n// by x = argmax of value, but rearranged inside-out by alternating series\n// according to the sign of a running divergence of sums\nfunction orderInsideOut(compare) {\n return orderZDomain(compare, (data, X, Y, Z) => {\n const I = range(data);\n const K = groupSort(\n I,\n (I) => X[greatest(I, (i) => Y[i])],\n (i) => Z[i]\n );\n const sums = rollup(\n I,\n (I) => sum(I, (i) => Y[i]),\n (i) => Z[i]\n );\n const Kp = [],\n Kn = [];\n let s = 0;\n for (const k of K) {\n if (s < 0) {\n s += sums.get(k);\n Kp.push(k);\n } else {\n s -= sums.get(k);\n Kn.push(k);\n }\n }\n return Kn.reverse().concat(Kp);\n });\n}\n\nfunction orderAccessor(f) {\n return (data) => {\n const O = valueof(data, f);\n return (i, j) => ascendingDefined(O[i], O[j]);\n };\n}\n\nfunction orderComparator(f) {\n return (data) => (i, j) => f(data[i], data[j]);\n}\n\nfunction orderGiven(domain) {\n return orderZDomain(ascendingDefined, () => domain);\n}\n\n// Given an ordering (domain) of distinct values in z that can be derived from\n// the data, returns a comparator that can be used to sort stacks. Note that\n// this is a series order: it will be consistent across stacks.\nfunction orderZDomain(compare, domain) {\n return (data, X, Y, Z) => {\n if (!Z) throw new Error(\"missing channel: z\");\n const map = new InternMap(domain(data, X, Y, Z).map((d, i) => [d, i]));\n return (i, j) => compare(map.get(Z[i]), map.get(Z[j]));\n };\n}\n", "import {area as shapeArea} from \"d3\";\nimport {create} from \"../context.js\";\nimport {maybeCurve} from \"../curve.js\";\nimport {Mark} from \"../mark.js\";\nimport {first, indexOf, maybeZ, second} from \"../options.js\";\nimport {\n applyDirectStyles,\n applyIndirectStyles,\n applyTransform,\n applyGroupedChannelStyles,\n groupIndex\n} from \"../style.js\";\nimport {maybeDenseIntervalX, maybeDenseIntervalY} from \"../transforms/bin.js\";\nimport {maybeIdentityX, maybeIdentityY} from \"../transforms/identity.js\";\nimport {maybeStackX, maybeStackY} from \"../transforms/stack.js\";\n\nconst defaults = {\n ariaLabel: \"area\",\n strokeWidth: 1,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeMiterlimit: 1\n};\n\nexport class Area extends Mark {\n constructor(data, options = {}) {\n const {x1, y1, x2, y2, z, curve, tension} = options;\n super(\n data,\n {\n x1: {value: x1, scale: \"x\"},\n y1: {value: y1, scale: \"y\"},\n x2: {value: x2, scale: \"x\", optional: true},\n y2: {value: y2, scale: \"y\", optional: true},\n z: {value: maybeZ(options), optional: true}\n },\n options,\n defaults\n );\n this.z = z;\n this.curve = maybeCurve(curve, tension);\n }\n filter(index) {\n return index;\n }\n render(index, scales, channels, dimensions, context) {\n const {x1: X1, y1: Y1, x2: X2 = X1, y2: Y2 = Y1} = channels;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, scales, 0, 0)\n .call((g) =>\n g\n .selectAll()\n .data(groupIndex(index, [X1, Y1, X2, Y2], this, channels))\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .call(applyGroupedChannelStyles, this, channels)\n .attr(\n \"d\",\n shapeArea()\n .curve(this.curve)\n .defined((i) => i >= 0)\n .x0((i) => X1[i])\n .y0((i) => Y1[i])\n .x1((i) => X2[i])\n .y1((i) => Y2[i])\n )\n )\n .node();\n }\n}\n\nexport function area(data, options) {\n if (options === undefined) return areaY(data, {x: first, y: second});\n return new Area(data, options);\n}\n\nexport function areaX(data, options) {\n const {y = indexOf, ...rest} = maybeDenseIntervalY(options);\n return new Area(data, maybeStackX(maybeIdentityX({...rest, y1: y, y2: undefined})));\n}\n\nexport function areaY(data, options) {\n const {x = indexOf, ...rest} = maybeDenseIntervalX(options);\n return new Area(data, maybeStackY(maybeIdentityY({...rest, x1: x, x2: undefined})));\n}\n", "import {geoPath, line as shapeLine} from \"d3\";\nimport {create} from \"../context.js\";\nimport {curveAuto, maybeCurveAuto} from \"../curve.js\";\nimport {Mark} from \"../mark.js\";\nimport {applyGroupedMarkers, markers} from \"../marker.js\";\nimport {coerceNumbers, indexOf, identity, maybeTuple, maybeZ} from \"../options.js\";\nimport {\n applyDirectStyles,\n applyIndirectStyles,\n applyTransform,\n applyGroupedChannelStyles,\n groupIndex\n} from \"../style.js\";\nimport {maybeDenseIntervalX, maybeDenseIntervalY} from \"../transforms/bin.js\";\n\nconst defaults = {\n ariaLabel: \"line\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 1.5,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeMiterlimit: 1\n};\n\nexport class Line extends Mark {\n constructor(data, options = {}) {\n const {x, y, z, curve, tension} = options;\n super(\n data,\n {\n x: {value: x, scale: \"x\"},\n y: {value: y, scale: \"y\"},\n z: {value: maybeZ(options), optional: true}\n },\n options,\n defaults\n );\n this.z = z;\n this.curve = maybeCurveAuto(curve, tension);\n markers(this, options);\n }\n filter(index) {\n return index;\n }\n project(channels, values, context) {\n // For the auto curve, projection is handled at render.\n if (this.curve !== curveAuto) {\n super.project(channels, values, context);\n }\n }\n render(index, scales, channels, dimensions, context) {\n const {x: X, y: Y} = channels;\n const {curve} = this;\n return create(\"svg:g\", context)\n .call(applyIndirectStyles, this, dimensions, context)\n .call(applyTransform, this, scales)\n .call((g) =>\n g\n .selectAll()\n .data(groupIndex(index, [X, Y], this, channels))\n .enter()\n .append(\"path\")\n .call(applyDirectStyles, this)\n .call(applyGroupedChannelStyles, this, channels)\n .call(applyGroupedMarkers, this, channels, context)\n .attr(\n \"d\",\n curve === curveAuto && context.projection\n ? sphereLine(context.projection, X, Y)\n : shapeLine()\n .curve(curve)\n .defined((i) => i >= 0)\n .x((i) => X[i])\n .y((i) => Y[i])\n )\n )\n .node();\n }\n}\n\nfunction sphereLine(projection, X, Y) {\n const path = geoPath(projection);\n X = coerceNumbers(X);\n Y = coerceNumbers(Y);\n return (I) => {\n let line = [];\n const lines = [line];\n for (const i of I) {\n // Check for undefined value; see groupIndex.\n if (i === -1) {\n line = [];\n lines.push(line);\n } else {\n line.push([X[i], Y[i]]);\n }\n }\n return path({type: \"MultiLineString\", coordinates: lines});\n };\n}\n\nexport function line(data, {x, y, ...options} = {}) {\n [x, y] = maybeTuple(x, y);\n return new Line(data, {...options, x, y});\n}\n\nexport function lineX(data, {x = identity, y = indexOf, ...options} = {}) {\n return new Line(data, maybeDenseIntervalY({...options, x, y}));\n}\n\nexport function lineY(data, {x = indexOf, y = identity, ...options} = {}) {\n return new Line(data, maybeDenseIntervalX({...options, x, y}));\n}\n", "import * as Plot from \"@observablehq/plot\";\nimport * as d3 from \"d3\";\nimport {\n format,\n parse,\n setDay,\n setHours,\n setMinutes,\n setMonth,\n setSeconds,\n setYear,\n} from \"date-fns\";\nimport { h, VNode } from \"preact\";\nimport { useEffect, useRef, useState } from \"preact/hooks\";\n// import {createElement as h} from \"preact\";\ninterface Props {}\n\ninterface Data {\n operation: string;\n date: Date;\n value: number;\n interest: number;\n raw: any;\n}\nconst before = new Date(2023, 11, 11, 0, 0, 0);\nfunction defined(x: Data | undefined): x is Data {\n return (\n !!x &&\n x.operation !== \" BID 4796 PROG APOY REF TRANS\" &&\n x.date.getTime() < before.getTime()\n );\n}\n\nexport function Histogram({}: Props): VNode {\n const containerRef = useRef(null);\n const [goog, setGoog] = useState>();\n const [aapl, setAapl] = useState>();\n useEffect(() => {\n d3.csv(\"assets/data/goog.csv\", d3.autoType).then((d) => {\n setGoog(d);\n });\n d3.csv(\"assets/data/aapl.csv\", d3.autoType).then((d) => {\n setAapl(d);\n });\n }, []);\n\n useEffect(() => {\n if (goog === undefined) return;\n if (aapl === undefined) return;\n if (containerRef.current === null) return;\n\n const plot = Plot.plot({\n style: \"width: 100%;\",\n grid: true,\n height: 300,\n x: { label: \"Fecha \" },\n y: { label: \"Precio (ARS)\" },\n marks: [\n Plot.lineY(goog, { x: \"Date\", y: \"Close\", stroke: \"red\" }),\n Plot.lineY(aapl, { x: \"Date\", y: \"Close\", stroke: \"blue\" }),\n ],\n });\n\n containerRef.current.append(plot);\n return () => plot.remove();\n }, [goog, aapl]);\n\n return
    ;\n}\n\nexport function Normalized({}: Props): VNode {\n const containerRef = useRef(null);\n const [riaa, setRiaa] = useState>();\n useEffect(() => {\n d3.csv(\"assets/data/riaa-us-revenue.csv\", d3.autoType).then((d) => {\n setRiaa(d);\n });\n }, []);\n\n useEffect(() => {\n if (riaa === undefined) return;\n if (containerRef.current === null) return;\n\n // const plot = Plot.plot({\n // style: \"width: 100%;\",\n // grid: true,\n // height: 300,\n // x: { label: \"Fecha \" },\n // y: { label: \"Precio (ARS)\", percent: true },\n // marks: [\n // Plot.areaY(\n // riaa,\n // Plot.stackY(\n // { offset: \"normalize\", order: \"group\", reverse: true },\n // { x: \"year\", y: \"revenue\", z: \"format\", fill: \"group\" }\n // )\n // ),\n // Plot.ruleY([0, 1]),\n // ],\n // });\n console.log(riaa)\n const plot = Plot.plot({\n y: {\n label: \"\u2191 Annual revenue (%)\",\n percent: true\n },\n marks: [\n Plot.areaY(riaa, Plot.stackY({offset: \"normalize\", order: \"group\", reverse: true}, {x: \"year\", y: \"revenue\", z: \"format\", fill: \"group\"})),\n Plot.ruleY([0, 1])\n ]\n })\n\n containerRef.current.append(plot);\n return () => plot.remove();\n }, [riaa]);\n\n return
    ;\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { useEffect, useState } from \"preact/hooks\";\nimport { AbsoluteTime } from \"./time.js\";\nimport { Codec, codecForString } from \"./codec.js\";\n\ndeclare const opaque_StorageKey: unique symbol;\n\ntype StorageKey = {\n id: string;\n [opaque_StorageKey]: true;\n codec: Codec;\n};\n\nexport function buildStorageKey(\n name: string,\n codec: Codec,\n): StorageKey;\nexport function buildStorageKey(name: string): StorageKey;\nexport function buildStorageKey(\n name: string,\n codec?: Codec,\n): StorageKey {\n return {\n id: name,\n codec: codec ?? (codecForString() as Codec),\n } as StorageKey;\n}\n\n\nexport interface StorageState {\n value: Type;\n update: (s: Type) => void;\n reset: () => void;\n}\n\nexport function assertUnreachable(x: never): never {\n throw new Error(\"Didn't expect to get here\");\n}\n\nexport function canonicalizeBaseUrl(url: string): string {\n if (!url.startsWith(\"http\") && !url.startsWith(\"https\")) {\n url = \"https://\" + url;\n }\n const x = new URL(url);\n if (!x.pathname.endsWith(\"/\")) {\n x.pathname = x.pathname + \"/\";\n }\n x.search = \"\";\n x.hash = \"\";\n return x.href;\n}\n\nexport enum KnownErrorCode {\n UNEXPECTED_EXCEPTION = 0,\n}\n\nexport interface KnownErrorDetail {\n code: KnownErrorCode;\n when?: AbsoluteTime;\n hint?: string;\n [x: string]: unknown;\n}\n\nexport interface DetailsMap {\n [KnownErrorCode.UNEXPECTED_EXCEPTION]: {\n };\n}\n\ntype empty = Record;\n\ntype ErrBody = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;\n\nexport class KnownError extends Error {\n errorDetail: KnownErrorDetail & T;\n cause: Error | undefined;\n static GENERIC_TIMEOUT: any;\n static GENERIC_CLIENT_INTERNAL_ERROR: any;\n static HTTP_REQUEST_GENERIC_TIMEOUT: any;\n static HTTP_REQUEST_THROTTLED: any;\n static RECEIVED_MALFORMED_RESPONSE: any;\n static NETWORK_ERROR: any;\n static UNEXPECTED_REQUEST_ERROR: any;\n private constructor(d: KnownErrorDetail & T, cause?: Error) {\n super(d.hint ?? `Error (code ${d.code})`);\n this.errorDetail = d;\n this.cause = cause;\n Object.setPrototypeOf(this, KnownError.prototype);\n }\n\n static fromDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n cause?: Error,\n ): KnownError {\n if (!hint) {\n hint = getDefaultHint(code);\n }\n const when = AbsoluteTime.now();\n return new KnownError({ code, when, hint, ...detail }, cause);\n }\n\n static fromUncheckedDetail(d: KnownErrorDetail, c?: Error): KnownError {\n return new KnownError({ ...d }, c);\n }\n\n static fromException(e: any): KnownError {\n const errDetail = getErrorDetailFromException(e);\n return new KnownError(errDetail, e);\n }\n\n hasErrorCode(\n code: C,\n ): this is KnownError {\n return this.errorDetail.code === code;\n }\n\n toString(): string {\n return `KnownError: ${JSON.stringify(this.errorDetail)}`;\n }\n}\n\n/**\n * Convert an exception (or anything that was thrown) into\n * a KnownErrorDetail object.\n */\nexport function getErrorDetailFromException(e: any): KnownErrorDetail {\n if (e instanceof KnownError) {\n return e.errorDetail;\n }\n if (e instanceof Error) {\n const err = makeErrorDetail(\n KnownErrorCode.UNEXPECTED_EXCEPTION,\n {\n stack: e.stack,\n },\n `unexpected exception (message: ${e.message})`,\n );\n return err;\n }\n // Something was thrown that is not even an exception!\n // Try to stringify it.\n let excString: string;\n try {\n excString = e.toString();\n } catch (e) {\n // Something went horribly wrong.\n excString = \"can't stringify exception\";\n }\n const err = makeErrorDetail(\n KnownErrorCode.UNEXPECTED_EXCEPTION,\n {},\n `unexpected exception (not an exception, ${excString})`,\n );\n return err;\n}\n\nfunction getDefaultHint(code: number): string {\n const errName = KnownErrorCode[code];\n if (errName) {\n return `Error (${errName})`;\n } else {\n return `Error ()`;\n }\n}\n\nfunction makeErrorDetail(\n code: C,\n detail: ErrBody,\n hint?: string,\n): KnownErrorDetail {\n if (!hint && !(detail as any).hint) {\n hint = getDefaultHint(code);\n }\n const when = AbsoluteTime.now();\n return { code, when, hint, ...detail };\n}\n\n\n/**\n * Validate (the number part of) an amount. If needed,\n * replace comma with a dot. Returns 'false' whenever\n * the input is invalid, the valid amount otherwise.\n */\nconst amountRegex = /^[0-9]+(.[0-9]+)?$/;\nexport function validateAmount(\n maybeAmount: string | undefined,\n): string | undefined {\n if (!maybeAmount || !amountRegex.test(maybeAmount)) {\n return;\n }\n return maybeAmount;\n}\n\n/**\n * Extract IBAN from a Payto URI.\n */\nexport function getIbanFromPayto(url: string): string {\n const pathSplit = new URL(url).pathname.split(\"/\");\n let lastIndex = pathSplit.length - 1;\n // Happens if the path ends with \"/\".\n if (pathSplit[lastIndex] === \"\") lastIndex--;\n const iban = pathSplit[lastIndex];\n return iban;\n}\n\nexport function undefinedIfEmpty(obj: T): T | undefined {\n return Object.keys(obj).some(\n (k) => (obj as Record)[k] !== undefined,\n )\n ? obj\n : undefined;\n}\n\nexport type PartialButDefined = {\n [P in keyof T]: T[P] | undefined;\n};\n\n/**\n * every non-map field can be undefined\n */\nexport type RecursivePartial = {\n [P in keyof Type]?: Type[P] extends (infer U)[]\n ? RecursivePartial[]\n : Type[P] extends object\n ? RecursivePartial\n : Type[P];\n};\n\nexport enum TanChannel {\n SMS = \"sms\",\n EMAIL = \"email\",\n}\nexport enum CashoutStatus {\n // The payment was initiated after a valid\n // TAN was received by the bank.\n CONFIRMED = \"confirmed\",\n\n // The cashout was created and now waits\n // for the TAN by the author.\n PENDING = \"pending\",\n}\n\n\nexport const PAGINATED_LIST_SIZE = 5;\n// when doing paginated request, ask for one more\n// and use it to know if there are more to request\nexport const PAGINATED_LIST_REQUEST = PAGINATED_LIST_SIZE + 1;\n\n\nexport function useLocalStorage(\n key: StorageKey,\n defaultValue: Type,\n): StorageState {\n\n const current = convert(localStorage.get(key.id), key, defaultValue);\n\n const [_, setStoredValue] = useState(AbsoluteTime.now().t_ms);\n\n useEffect(() => {\n return localStorage.onUpdate(key.id, () => {\n // const newValue = storage.get(key.id);\n setStoredValue(AbsoluteTime.now().t_ms);\n });\n }, [key.id]);\n\n const setValue = (value?: Type): void => {\n if (value === undefined) {\n localStorage.delete(key.id);\n } else {\n localStorage.set(\n key.id,\n key.codec ? JSON.stringify(value) : (value as string),\n );\n }\n };\n\n return {\n value: current,\n update: setValue,\n reset: () => {\n setValue(defaultValue);\n },\n };\n}\n\nfunction convert(updated: string | undefined, key: StorageKey, defaultValue: Type): Type {\n if (updated === undefined) return defaultValue; //optional\n try {\n return key.codec.decode(JSON.parse(updated));\n } catch (e) {\n //decode error\n return defaultValue;\n }\n}\n", "/*\n This file is part of GNU Taler\n (C) 2018-2019 GNUnet e.V.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Type-safe codecs for converting from/to JSON.\n */\n\n/**\n * Error thrown when decoding fails.\n */\nexport class DecodingError extends Error {\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, DecodingError.prototype);\n this.name = \"DecodingError\";\n }\n}\n\n/**\n * Context information to show nicer error messages when decoding fails.\n */\nexport interface Context {\n readonly path?: string[];\n}\n\nexport function renderContext(c?: Context): string {\n const p = c?.path;\n if (p) {\n return p.join(\".\");\n } else {\n return \"(unknown)\";\n }\n}\n\nfunction joinContext(c: Context | undefined, part: string): Context {\n const path = c?.path ?? [];\n return {\n path: path.concat([part]),\n };\n}\n\n/**\n * A codec converts untyped JSON to a typed object.\n */\nexport interface Codec {\n /**\n * Decode untyped JSON to an object of type [[V]].\n */\n readonly decode: (x: any, c?: Context) => V;\n}\n\ntype SingletonRecord = { [Y in K]: V };\n\ninterface Prop {\n name: string;\n codec: Codec;\n}\n\ninterface Alternative {\n tagValue: any;\n codec: Codec;\n}\n\nclass ObjectCodecBuilder {\n private propList: Prop[] = [];\n\n /**\n * Define a property for the object.\n */\n property(\n x: K,\n codec: Codec,\n ): ObjectCodecBuilder> {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.propList.push({ name: x, codec: codec });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(objectDisplayName: string): Codec {\n const propList = this.propList;\n return {\n decode(x: any, c?: Context): PartialOutputType {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n if (typeof x !== \"object\") {\n throw new DecodingError(\n `expected object for ${objectDisplayName} at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n const obj: any = {};\n for (const prop of propList) {\n const propRawVal = x[prop.name];\n const propVal = prop.codec.decode(\n propRawVal,\n joinContext(c, prop.name),\n );\n obj[prop.name] = propVal;\n }\n return obj as PartialOutputType;\n },\n };\n }\n}\n\nclass UnionCodecBuilder<\n TargetType,\n TagPropertyLabel extends keyof TargetType,\n CommonBaseType,\n PartialTargetType,\n> {\n private alternatives = new Map();\n\n constructor(\n private discriminator: TagPropertyLabel,\n private baseCodec?: Codec,\n ) { }\n\n /**\n * Define a property for the object.\n */\n alternative(\n tagValue: TargetType[TagPropertyLabel],\n codec: Codec,\n ): UnionCodecBuilder<\n TargetType,\n TagPropertyLabel,\n CommonBaseType,\n PartialTargetType | V\n > {\n if (!codec) {\n throw Error(\"inner codec must be defined\");\n }\n this.alternatives.set(tagValue, { codec, tagValue });\n return this as any;\n }\n\n /**\n * Return the built codec.\n *\n * @param objectDisplayName name of the object that this codec operates on,\n * used in error messages.\n */\n build(\n objectDisplayName: string,\n ): Codec {\n const alternatives = this.alternatives;\n const discriminator = this.discriminator;\n const baseCodec = this.baseCodec;\n return {\n decode(x: any, c?: Context): R {\n if (!c) {\n c = {\n path: [`(${objectDisplayName})`],\n };\n }\n const d = x[discriminator];\n if (d === undefined) {\n throw new DecodingError(\n `expected tag for ${objectDisplayName} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const alt = alternatives.get(d);\n if (!alt) {\n throw new DecodingError(\n `unknown tag for ${objectDisplayName} ${d} at ${renderContext(\n c,\n )}.${String(discriminator)}`,\n );\n }\n const altDecoded = alt.codec.decode(x);\n if (baseCodec) {\n const baseDecoded = baseCodec.decode(x, c);\n return { ...baseDecoded, ...altDecoded };\n } else {\n return altDecoded;\n }\n },\n };\n }\n}\n\nexport class UnionCodecPreBuilder {\n discriminateOn(\n discriminator: D,\n baseCodec?: Codec,\n ): UnionCodecBuilder {\n return new UnionCodecBuilder(discriminator, baseCodec);\n }\n}\n\n/**\n * Return a builder for a codec that decodes an object with properties.\n */\nexport function buildCodecForObject(): ObjectCodecBuilder {\n return new ObjectCodecBuilder();\n}\n\nexport function buildCodecForUnion(): UnionCodecPreBuilder {\n return new UnionCodecPreBuilder();\n}\n\n/**\n * Return a codec for a mapping from a string to values described by the inner codec.\n */\nexport function codecForMap(\n innerCodec: Codec,\n): Codec<{ [x: string]: T }> {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): { [x: string]: T } {\n const map: { [x: string]: T } = {};\n if (typeof x !== \"object\") {\n throw new DecodingError(`expected object at ${renderContext(c)}`);\n }\n for (const i in x) {\n map[i] = innerCodec.decode(x[i], joinContext(c, `[${i}]`));\n }\n return map;\n },\n };\n}\n\n/**\n * Return a codec for a list, containing values described by the inner codec.\n */\nexport function codecForList(innerCodec: Codec): Codec {\n if (!innerCodec) {\n throw Error(\"inner codec must be defined\");\n }\n return {\n decode(x: any, c?: Context): T[] {\n const arr: T[] = [];\n if (!Array.isArray(x)) {\n throw new DecodingError(`expected array at ${renderContext(c)}`);\n }\n for (const i in x) {\n arr.push(innerCodec.decode(x[i], joinContext(c, `[${i}]`)));\n }\n return arr;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForNumber(): Codec {\n return {\n decode(x: any, c?: Context): number {\n if (typeof x === \"number\") {\n return x;\n }\n throw new DecodingError(\n `expected number at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a number.\n */\nexport function codecForBoolean(): Codec {\n return {\n decode(x: any, c?: Context): boolean {\n if (typeof x === \"boolean\") {\n return x;\n }\n throw new DecodingError(\n `expected boolean at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForString(): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x === \"string\") {\n return x;\n }\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForStringURL(shouldEndWithSlash?: boolean): Codec {\n return {\n decode(x: any, c?: Context): string {\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string at ${renderContext(c)} but got ${typeof x}`,\n );\n }\n if (shouldEndWithSlash && !x.endsWith(\"/\")) {\n throw new DecodingError(\n `expected URL string that ends with slash at ${renderContext(\n c,\n )} but got ${x}`,\n );\n }\n try {\n const url = new URL(x);\n return x;\n } catch (e) {\n if (e instanceof Error) {\n throw new DecodingError(e.message);\n } else {\n throw new DecodingError(\n `expected an URL string at ${renderContext(c)} but got \"${x}\"`,\n );\n }\n }\n },\n };\n}\n\n/**\n * Codec that allows any value.\n */\nexport function codecForAny(): Codec {\n return {\n decode(x: any, c?: Context): any {\n return x;\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a string.\n */\nexport function codecForConstString(s: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === s) {\n return x;\n }\n if (typeof x !== \"string\") {\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n }\n throw new DecodingError(\n `expected string constant \"${s}\" at ${renderContext(\n c,\n )} but got string value \"${x}\"`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstTrue(): Codec {\n return {\n decode(x: any, c?: Context): true {\n if (x === true) {\n return x;\n }\n throw new DecodingError(\n `expected boolean true at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a boolean true constant.\n */\nexport function codecForConstFalse(): Codec {\n return {\n decode(x: any, c?: Context): false {\n if (x === false) {\n return x;\n }\n throw new DecodingError(\n `expected boolean false at ${renderContext(c)} but got ${typeof x}`,\n );\n },\n };\n}\n\n/**\n * Return a codec for a value that must be a constant number.\n */\nexport function codecForConstNumber(n: V): Codec {\n return {\n decode(x: any, c?: Context): V {\n if (x === n) {\n return x;\n }\n throw new DecodingError(\n `expected number constant \"${n}\" at ${renderContext(\n c,\n )} but got ${typeof x}`,\n );\n },\n };\n}\n\nexport function codecOptional(innerCodec: Codec): Codec {\n return {\n decode(x: any, c?: Context): V | undefined {\n if (x === undefined || x === null) {\n return undefined;\n }\n return innerCodec.decode(x, c);\n },\n };\n}\n\nexport type CodecType = T extends Codec ? X : any;\n\nexport function codecForEither>>(\n ...alts: [...T]\n): Codec> {\n return {\n decode(x: any, c?: Context): any {\n for (const alt of alts) {\n try {\n return alt.decode(x, c);\n } catch (e) {\n continue;\n }\n }\n throw new DecodingError(\n `No alternative matched at at ${renderContext(c)}`,\n );\n },\n };\n}\n\nconst x = codecForEither(codecForString(), codecForNumber());\n", "/*\n This file is part of GNU Taler\n (C) 2017-2019 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\n/**\n * Helpers for relative and absolute time.\n */\n\n/**\n * Imports.\n */\nimport { Codec, Context, renderContext } from \"./codec.js\";\n\ndeclare const flavor_AbsoluteTime: unique symbol;\ndeclare const flavor_TalerProtocolTimestamp: unique symbol;\ndeclare const flavor_TalerPreciseTimestamp: unique symbol;\n\nconst opaque_AbsoluteTime: unique symbol = Symbol(\"opaque_AbsoluteTime\");\n\n// FIXME: Make this opaque!\nexport interface AbsoluteTime {\n /**\n * Timestamp in milliseconds.\n */\n readonly t_ms: number | \"never\";\n\n readonly _flavor?: typeof flavor_AbsoluteTime;\n\n // Make the type opaque, we only want our constructors\n // to able to create an AbsoluteTime value.\n [opaque_AbsoluteTime]: true;\n}\n\nexport interface TalerProtocolTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n readonly _flavor?: typeof flavor_TalerProtocolTimestamp;\n}\n\n/**\n * Precise timestamp, typically used in the wallet-core\n * API but not in other Taler APIs so far.\n */\nexport interface TalerPreciseTimestamp {\n /**\n * Seconds (as integer) since epoch.\n */\n readonly t_s: number | \"never\";\n\n /**\n * Optional microsecond offset (non-negative integer).\n */\n readonly off_us?: number;\n\n readonly _flavor?: typeof flavor_TalerPreciseTimestamp;\n}\n\nexport namespace TalerPreciseTimestamp {\n export function now(): TalerPreciseTimestamp {\n const absNow = AbsoluteTime.now();\n return AbsoluteTime.toPreciseTimestamp(absNow);\n }\n\n export function round(t: TalerPreciseTimestamp): TalerProtocolTimestamp {\n return {\n t_s: t.t_s,\n };\n }\n\n export function fromSeconds(s: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(s),\n off_us: Math.floor((s - Math.floor(s)) / 1000 / 1000),\n };\n }\n\n export function fromMilliseconds(ms: number): TalerPreciseTimestamp {\n return {\n t_s: Math.floor(ms / 1000),\n off_us: Math.floor((ms - Math.floor(ms / 1000) * 1000) * 1000),\n };\n }\n}\n\nexport namespace TalerProtocolTimestamp {\n export function now(): TalerProtocolTimestamp {\n return AbsoluteTime.toProtocolTimestamp(AbsoluteTime.now());\n }\n\n export function zero(): TalerProtocolTimestamp {\n return {\n t_s: 0,\n };\n }\n\n export function never(): TalerProtocolTimestamp {\n return {\n t_s: \"never\",\n };\n }\n\n export function isNever(t: TalerProtocolTimestamp): boolean {\n return t.t_s === \"never\";\n }\n\n export function fromSeconds(s: number): TalerProtocolTimestamp {\n return {\n t_s: s,\n };\n }\n\n export function min(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\") {\n return { t_s: t2.t_s };\n }\n if (t2.t_s === \"never\") {\n return { t_s: t1.t_s };\n }\n return { t_s: Math.min(t1.t_s, t2.t_s) };\n }\n export function max(\n t1: TalerProtocolTimestamp,\n t2: TalerProtocolTimestamp,\n ): TalerProtocolTimestamp {\n if (t1.t_s === \"never\" || t2.t_s === \"never\") {\n return { t_s: \"never\" };\n }\n return { t_s: Math.max(t1.t_s, t2.t_s) };\n }\n}\n\nexport interface Duration {\n /**\n * Duration in milliseconds.\n */\n readonly d_ms: number | \"forever\";\n}\n\nexport interface TalerProtocolDuration {\n readonly d_us: number | \"forever\";\n}\n\n/**\n * Timeshift in milliseconds.\n */\nlet timeshift = 0;\n\n/**\n * Set timetravel offset in milliseconds.\n *\n * Use carefully and only for testing.\n */\nexport function setDangerousTimetravel(dt: number): void {\n timeshift = dt;\n}\n\nexport namespace Duration {\n export function toMilliseconds(d: Duration): number {\n if (d.d_ms === \"forever\") {\n return Number.MAX_VALUE;\n }\n return d.d_ms;\n }\n export function getRemaining(\n deadline: AbsoluteTime,\n now = AbsoluteTime.now(),\n ): Duration {\n if (deadline.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (now.t_ms === \"never\") {\n throw Error(\"invalid argument for 'now'\");\n }\n if (deadline.t_ms < now.t_ms) {\n return { d_ms: 0 };\n }\n return { d_ms: deadline.t_ms - now.t_ms };\n }\n\n export function fromPrettyString(s: string): Duration {\n let dMs = 0;\n let currentNum = \"\";\n let parsingNum = true;\n for (let i = 0; i < s.length; i++) {\n const cc = s.charCodeAt(i);\n if (cc >= \"0\".charCodeAt(0) && cc <= \"9\".charCodeAt(0)) {\n if (!parsingNum) {\n throw Error(\"invalid duration, unexpected number\");\n }\n currentNum += s[i];\n continue;\n }\n if (s[i] == \" \") {\n if (currentNum != \"\") {\n parsingNum = false;\n }\n continue;\n }\n\n if (currentNum == \"\") {\n throw Error(\"invalid duration, missing number\");\n }\n\n if (s[i] === \"s\") {\n dMs += 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"m\") {\n dMs += 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"h\") {\n dMs += 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else if (s[i] === \"d\") {\n dMs += 24 * 60 * 60 * 1000 * Number.parseInt(currentNum, 10);\n } else {\n throw Error(\"invalid duration, unsupported unit\");\n }\n currentNum = \"\";\n parsingNum = true;\n }\n return {\n d_ms: dMs,\n };\n }\n\n /**\n * Compare two durations. Returns 0 when equal, -1 when a < b\n * and +1 when a > b.\n */\n export function cmp(d1: Duration, d2: Duration): 1 | 0 | -1 {\n if (d1.d_ms === \"forever\") {\n if (d2.d_ms === \"forever\") {\n return 0;\n }\n return 1;\n }\n if (d2.d_ms === \"forever\") {\n return -1;\n }\n if (d1.d_ms == d2.d_ms) {\n return 0;\n }\n if (d1.d_ms > d2.d_ms) {\n return 1;\n }\n return -1;\n }\n\n export function max(d1: Duration, d2: Duration): Duration {\n return durationMax(d1, d2);\n }\n\n export function min(d1: Duration, d2: Duration): Duration {\n return durationMin(d1, d2);\n }\n\n export function multiply(d1: Duration, n: number): Duration {\n return durationMul(d1, n);\n }\n\n export function toIntegerYears(d: Duration): number {\n if (typeof d.d_ms !== \"number\") {\n throw Error(\"infinite duration\");\n }\n return Math.ceil(d.d_ms / 1000 / 60 / 60 / 24 / 365);\n }\n\n export function fromSpec(spec: {\n seconds?: number;\n minutes?: number;\n hours?: number;\n days?: number;\n months?: number;\n years?: number;\n }): Duration {\n let d_ms = 0;\n d_ms += (spec.seconds ?? 0) * SECONDS;\n d_ms += (spec.minutes ?? 0) * MINUTES;\n d_ms += (spec.hours ?? 0) * HOURS;\n d_ms += (spec.days ?? 0) * DAYS;\n d_ms += (spec.months ?? 0) * MONTHS;\n d_ms += (spec.years ?? 0) * YEARS;\n return { d_ms };\n }\n\n export function getForever(): Duration {\n return { d_ms: \"forever\" };\n }\n\n export function getZero(): Duration {\n return { d_ms: 0 };\n }\n\n export function fromTalerProtocolDuration(\n d: TalerProtocolDuration,\n ): Duration {\n if (d.d_us === \"forever\") {\n return {\n d_ms: \"forever\",\n };\n }\n return {\n d_ms: Math.floor(d.d_us / 1000),\n };\n }\n\n export function toTalerProtocolDuration(d: Duration): TalerProtocolDuration {\n if (d.d_ms === \"forever\") {\n return {\n d_us: \"forever\",\n };\n }\n return {\n d_us: d.d_ms * 1000,\n };\n }\n\n export function fromMilliseconds(ms: number): Duration {\n return {\n d_ms: ms,\n };\n }\n\n export function clamp(args: {\n lower: Duration;\n upper: Duration;\n value: Duration;\n }): Duration {\n return durationMax(durationMin(args.value, args.upper), args.lower);\n }\n}\n\nexport namespace AbsoluteTime {\n export function getStampMsNow(): number {\n return new Date().getTime();\n }\n\n export function getStampMsNever(): number {\n return Number.MAX_SAFE_INTEGER;\n }\n\n export function now(): AbsoluteTime {\n return {\n t_ms: new Date().getTime() + timeshift,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function never(): AbsoluteTime {\n return {\n t_ms: \"never\",\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromMilliseconds(ms: number): AbsoluteTime {\n return {\n t_ms: ms,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function cmp(t1: AbsoluteTime, t2: AbsoluteTime): number {\n if (t1.t_ms === \"never\") {\n if (t2.t_ms === \"never\") {\n return 0;\n }\n return 1;\n }\n if (t2.t_ms === \"never\") {\n return -1;\n }\n if (t1.t_ms == t2.t_ms) {\n return 0;\n }\n if (t1.t_ms > t2.t_ms) {\n return 1;\n }\n return -1;\n }\n\n export function min(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: t2.t_ms, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.min(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function max(t1: AbsoluteTime, t2: AbsoluteTime): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (t2.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(t1.t_ms, t2.t_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function difference(t1: AbsoluteTime, t2: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n if (t2.t_ms === \"never\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.abs(t1.t_ms - t2.t_ms) };\n }\n\n export function isExpired(t: AbsoluteTime) {\n return cmp(t, now()) <= 0;\n }\n\n export function isNever(t: AbsoluteTime): boolean {\n return t.t_ms === \"never\";\n }\n\n export function fromProtocolTimestamp(\n t: TalerProtocolTimestamp,\n ): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return {\n t_ms: t.t_s * 1000,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromStampMs(stampMs: number): AbsoluteTime {\n return {\n t_ms: stampMs,\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function fromPreciseTimestamp(t: TalerPreciseTimestamp): AbsoluteTime {\n if (t.t_s === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n const offsetUs = t.off_us ?? 0;\n return {\n t_ms: t.t_s * 1000 + Math.floor(offsetUs / 1000),\n [opaque_AbsoluteTime]: true,\n };\n }\n\n export function toStampMs(at: AbsoluteTime): number {\n if (at.t_ms === \"never\") {\n return Number.MAX_SAFE_INTEGER;\n }\n return at.t_ms;\n }\n\n export function toPreciseTimestamp(at: AbsoluteTime): TalerPreciseTimestamp {\n if (at.t_ms == \"never\") {\n return {\n t_s: \"never\",\n };\n }\n const t_s = Math.floor(at.t_ms / 1000);\n const off_us = Math.floor(1000 * (at.t_ms - t_s * 1000));\n return {\n t_s,\n off_us,\n };\n }\n\n export function toProtocolTimestamp(\n at: AbsoluteTime,\n ): TalerProtocolTimestamp {\n if (at.t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n return {\n t_s: Math.floor(at.t_ms / 1000),\n };\n }\n\n export function isBetween(\n t: AbsoluteTime,\n start: AbsoluteTime,\n end: AbsoluteTime,\n ): boolean {\n if (cmp(t, start) < 0) {\n return false;\n }\n if (cmp(t, end) > 0) {\n return false;\n }\n return true;\n }\n\n export function toIsoString(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"\";\n } else {\n return new Date(t.t_ms).toISOString();\n }\n }\n\n export function addDuration(t1: AbsoluteTime, d: Duration): AbsoluteTime {\n if (t1.t_ms === \"never\" || d.d_ms === \"forever\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n return { t_ms: t1.t_ms + d.d_ms, [opaque_AbsoluteTime]: true };\n }\n\n /**\n * Get the remaining duration until {@param t1}.\n *\n * If {@param t1} already happened, the remaining duration\n * is zero.\n */\n export function remaining(t1: AbsoluteTime): Duration {\n if (t1.t_ms === \"never\") {\n return Duration.getForever();\n }\n const stampNow = now();\n if (stampNow.t_ms === \"never\") {\n throw Error(\"invariant violated\");\n }\n return Duration.fromMilliseconds(Math.max(0, t1.t_ms - stampNow.t_ms));\n }\n\n export function subtractDuraction(\n t1: AbsoluteTime,\n d: Duration,\n ): AbsoluteTime {\n if (t1.t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n if (d.d_ms === \"forever\") {\n return { t_ms: 0, [opaque_AbsoluteTime]: true };\n }\n return { t_ms: Math.max(0, t1.t_ms - d.d_ms), [opaque_AbsoluteTime]: true };\n }\n\n export function stringify(t: AbsoluteTime): string {\n if (t.t_ms === \"never\") {\n return \"never\";\n }\n return new Date(t.t_ms).toISOString();\n }\n}\n\nconst SECONDS = 1000;\nconst MINUTES = SECONDS * 60;\nconst HOURS = MINUTES * 60;\nconst DAYS = HOURS * 24;\nconst MONTHS = DAYS * 30;\nconst YEARS = DAYS * 365;\n\nexport function durationMin(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: d2.d_ms };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: d1.d_ms };\n }\n return { d_ms: Math.min(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMax(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n if (d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.max(d1.d_ms, d2.d_ms) };\n}\n\nexport function durationMul(d: Duration, n: number): Duration {\n if (d.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: Math.round(d.d_ms * n) };\n}\n\nexport function durationAdd(d1: Duration, d2: Duration): Duration {\n if (d1.d_ms === \"forever\" || d2.d_ms === \"forever\") {\n return { d_ms: \"forever\" };\n }\n return { d_ms: d1.d_ms + d2.d_ms };\n}\n\nexport const codecForAbsoluteTime: Codec = {\n decode(x: any, c?: Context): AbsoluteTime {\n if (x === undefined) {\n throw Error(`got undefined and expected absolute time at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_ms: \"never\", [opaque_AbsoluteTime]: true };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_ms, [opaque_AbsoluteTime]: true };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForTimestamp: Codec = {\n decode(x: any, c?: Context): TalerProtocolTimestamp {\n // Compatibility, should be removed soon.\n if (x === undefined) {\n throw Error(`got undefined and expected timestamp at ${renderContext(c)}`);\n }\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n const t_s = x.t_s;\n if (typeof t_s === \"string\") {\n if (t_s === \"never\") {\n return { t_s: \"never\" };\n }\n throw Error(`expected timestamp at ${renderContext(c)}`);\n }\n if (typeof t_s === \"number\") {\n return { t_s };\n }\n throw Error(`expected protocol timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForPreciseTimestamp: Codec = {\n decode(x: any, c?: Context): TalerPreciseTimestamp {\n const t_ms = x.t_ms;\n if (typeof t_ms === \"string\") {\n if (t_ms === \"never\") {\n return { t_s: \"never\" };\n }\n } else if (typeof t_ms === \"number\") {\n return { t_s: Math.floor(t_ms / 1000) };\n }\n throw Error(`expected precise timestamp at ${renderContext(c)}`);\n },\n};\n\nexport const codecForDuration: Codec = {\n decode(x: any, c?: Context): TalerProtocolDuration {\n const d_us = x.d_us;\n if (typeof d_us === \"string\") {\n if (d_us === \"forever\") {\n return { d_us: \"forever\" };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n }\n if (typeof d_us === \"number\") {\n return { d_us };\n }\n throw Error(`expected duration at ${renderContext(c)}`);\n },\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { ComponentChildren, createContext, h, VNode } from \"preact\";\nimport { useContext } from \"preact/hooks\";\nimport { AppUiSettings } from \"../settings.js\";\n\n/**\n *\n * @author Sebastian Javier Marchano (sebasjm)\n */\n\nexport type Type = AppUiSettings;\n\nconst initial: AppUiSettings = {};\nconst Context = createContext(initial);\n\nexport const useSettingsContext = (): Type => useContext(Context);\n\nexport const SettingsProvider = ({\n children,\n value,\n}: {\n value: AppUiSettings;\n children: ComponentChildren;\n}): VNode => {\n return h(Context.Provider, {\n value,\n children,\n });\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\nexport interface StringsType {\n // X-Domain or 'messages'\n domain: string;\n lang: string;\n completeness: number;\n plural_forms: string;\n locale_data: {\n messages: Record;\n };\n}\nexport const strings: Record = {};\n\nstrings[\"it\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"it\",\n },\n \"Operation failed, please report\": [\"Registrazione\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"Show withdrawal confirmation\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"Ritira contante\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"Lista conti pubblici non trovata.\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"Prelevare\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"Chiudi il ritiro Taler\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\n \"La banca sta creando l'operazione...\",\n ],\n 'The destination account \"%1$s\" was not found.': [\n \"Lista conti pubblici non trovata.\",\n ],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\n \"Lista conti pubblici non trovata.\",\n ],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n subject: [\"Soggetto\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"Importo\"],\n \"amount to transfer\": [\"Somma da ritirare\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"Credenziali invalide.\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n Password: [\"\"],\n \"password of the account\": [\"Storico dei conti pubblici\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"Registrati\"],\n \"Wire transfer completed!\": [\"Bonifico\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"Conferma il ritiro\"],\n \"Wire transfer details\": [\"Bonifico\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"Questo ritiro \u00E8 stato annullato!\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"Registrazione\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"Ultime transazioni:\"],\n Date: [\"Data\"],\n Counterpart: [\"Controparte\"],\n Subject: [\"Soggetto\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"Storico dei conti pubblici\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"indirizzo Payto\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"Chiudi il bonifico\"],\n \"Wire transfer created!\": [\"Bonifico\"],\n Accounts: [\"Importo\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"Somma da ritirare\"],\n \"Amount to receive\": [\"Somma da ritirare\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"Credenziali invalide.\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"Lista conti pubblici non trovata.\"],\n \"Latest cashouts\": [\"Ultime transazioni:\"],\n Created: [\"\"],\n Confirmed: [\"Conferma\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"Annulla\"],\n Confirm: [\"Conferma\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\n \"Usa questo codice QR per ritirare contante nel tuo wallet:\",\n ],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"Conferma il ritiro\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"Prelevare\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"Ritira contante nel portafoglio Taler\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\n \"Trasferisci fondi a un altro conto di questa banca:\",\n ],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"Effettua un bonifico\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"Questo ritiro \u00E8 stato annullato!\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"Bonifico\"],\n Withdrawal: [\"Prelevare\"],\n \"Confirm the operation\": [\"Conferma il ritiro\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"it\",\n completeness: 14,\n};\n\nstrings[\"fr\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n > 1;\",\n lang: \"fr\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"\"],\n \"amount to transfer\": [\"\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"\"],\n Counterpart: [\"\"],\n Subject: [\"\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"\"],\n \"Confirm the operation\": [\"\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n > 1;\",\n lang: \"fr\",\n completeness: 0,\n};\n\nstrings[\"es\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"es\",\n },\n \"Operation failed, please report\": [\n \"La operaic\u00F3n fall\u00F3, por favor reportelo\",\n ],\n \"Request timeout\": [\"La petici\u00F3n al servidor agoto su tiempo\"],\n \"Request throttled\": [\"La petici\u00F3n al servidor interrumpida\"],\n \"Malformed response\": [\"Respuesta malformada\"],\n \"Network error\": [\"Error de conexi\u00F3n\"],\n \"Unexpected request error\": [\"Error de pedido inesperado\"],\n \"Unexpected error\": [\"Error inesperado\"],\n \"IBAN numbers usually have more that 4 digits\": [\n \"Los n\u00FAmeros IBAN usualmente tienen mas de 4 digitos\",\n ],\n \"IBAN numbers usually have less that 34 digits\": [\n \"Los n\u00FAmeros IBAN usualmente tienen menos de 34 digitos\",\n ],\n \"IBAN country code not found\": [\"C\u00F3digo de pais de IBAN no encontrado\"],\n \"IBAN number is not valid, checksum is wrong\": [\n \"El n\u00FAmero IBAN no es v\u00E1lido, fall\u00F3 la verificaci\u00F3n\",\n ],\n \"Max withdrawal amount\": [\"Monto m\u00E1ximo de extracci\u00F3n\"],\n \"Show withdrawal confirmation\": [\"Mostrar confirmaci\u00F3n de extracci\u00F3n\"],\n \"Show demo description\": [\"Mostrar descripci\u00F3n de demo\"],\n \"Show install wallet first\": [\"Mostrar instalar la billetera primero\"],\n \"Use fast withdrawal form\": [\"Usar formulario de extracci\u00F3n r\u00E1pida\"],\n \"Show debug info\": [\"Mostrar informaci\u00F3n de depuraci\u00F3n\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\n \"La operaci\u00F3n en la reserva ya ha sido confirmada previamente y no puede ser abortada\",\n ],\n \"The operation id is invalid.\": [\"El id de operaci\u00F3n es invalido.\"],\n \"The operation was not found.\": [\"La operaci\u00F3n no se encontr\u00F3.\"],\n \"If you have a Taler wallet installed in this device\": [\n \"Si tienes una billetera Taler instalada en este dispositivo\",\n ],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\n \"Veras los detalles de la operaci\u00F3n en tu billetera incluyendo comisiones (si aplic\u00E1n). Si todav\u00EDa no tienes una puedes instalarla siguiendo las instrucciones en\",\n ],\n \"this page\": [\"esta p\u00E1gina\"],\n Withdraw: [\"Retirar\"],\n \"Or if you have the wallet in another device\": [\n \"O si tienes la billetera en otro dispositivo\",\n ],\n \"Scan the QR below to start the withdrawal.\": [\n \"Escanea el QR debajo para comenzar la extracci\u00F3n.\",\n ],\n required: [\"requerido\"],\n \"IBAN should have just uppercased letters and numbers\": [\n \"IBAN deber\u00EDa tener letras may\u00FAsculas y n\u00FAmeros\",\n ],\n \"not valid\": [\"no v\u00E1lido\"],\n \"should be greater than 0\": [\"Deber\u00EDa ser mas grande que 0\"],\n \"balance is not enough\": [\"el saldo no es suficiente\"],\n \"does not follow the pattern\": [\"no tiene un patr\u00F3n valido\"],\n 'only \"IBAN\" target are supported': [\n 'solo cuentas \"IBAN\" son soportadas',\n ],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n 'usa el par\u00E1metro \"amount\" para indicar el monto a ser transferido',\n ],\n \"the amount is not valid\": [\"el monto no es v\u00E1lido\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\n 'usa el par\u00E1metro \"message\" para indicar un texto de referencia en la transferencia',\n ],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\n \"El pedido era inv\u00E1lido o el URI payto:// usado tiene caracter\u00EDsticas inaceptables.\",\n ],\n \"Not enough permission to complete the operation.\": [\n \"Sin permisos suficientes para completar la operaci\u00F3n.\",\n ],\n 'The destination account \"%1$s\" was not found.': [\n 'La cuenta de destino \"%1$s\" no fue encontrada.',\n ],\n \"The origin and the destination of the transfer can't be the same.\": [\n \"El origen y destino de la transferencia no puede ser la misma.\",\n ],\n \"Your balance is not enough.\": [\"El saldo no es suficiente.\"],\n 'The origin account \"%1$s\" was not found.': [\n 'La cuenta origen \"%1$s\" no fue encontrada.',\n ],\n \"Using a form\": [\"Usando un formulario\"],\n \"Import payto:// URI\": [\"Importando un URI payto://\"],\n Recipient: [\"Destinatario\"],\n \"IBAN of the recipient's account\": [\n \"Numero IBAN de la cuenta destinataria\",\n ],\n \"Transfer subject\": [\"Asunto de transferencia\"],\n subject: [\"asunto\"],\n \"some text to identify the transfer\": [\n \"alg\u00FAn texto para identificar la transferencia\",\n ],\n Amount: [\"Monto\"],\n \"amount to transfer\": [\"monto a transferir\"],\n \"payto URI:\": [\"payto URI:\"],\n \"uniform resource identifier of the target account\": [\n \"identificador de recurso uniforme de la cuenta destino\",\n ],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\n \"payto://iban/[iban-destinatario]?message=[asunto]&amount=[%1$s:X.Y]\",\n ],\n Cancel: [\"Cancelar\"],\n Send: [\"Env\u00EDar\"],\n \"Missing username\": [\"Falta nombre de usuario\"],\n \"Missing password\": [\"Falta contrase\u00F1a\"],\n 'Wrong credentials for \"%1$s\"': ['Credenciales incorrectas para \"%1$s\"'],\n \"Account not found\": [\"Cuenta no encontrada\"],\n Username: [\"Nombre de usuario\"],\n \"username of the account\": [\"nombre de usuario de la cuenta\"],\n Password: [\"Contrase\u00F1a\"],\n \"password of the account\": [\"contrase\u00F1a de la cuenta\"],\n Check: [\"Verificar\"],\n \"Log in\": [\"Acceso\"],\n Register: [\"Registrarse\"],\n \"Wire transfer completed!\": [\"Transferencia bancaria completada!\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\n \"La extracci\u00F3n fue abortada anteriormente y no puede ser confirmada\",\n ],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\n \"La operaci\u00F3n de extracci\u00F3n no puede ser confirmada antes de que una billetera acepte la transaccion.\",\n ],\n \"Your balance is not enough for the operation.\": [\n \"El saldo no es suficiente para la operaci\u00F3n.\",\n ],\n \"Confirm the withdrawal operation\": [\n \"Confirme la operaci\u00F3n de extracci\u00F3n\",\n ],\n \"Wire transfer details\": [\"Detalle de transferencia bancaria\"],\n \"Taler Exchange operator's account\": [\n \"Cuenta del operador del Taler Exchange\",\n ],\n \"Taler Exchange operator's name\": [\n \"Nombre del operador del Taler Exchange\",\n ],\n Transfer: [\"Transferencia\"],\n \"Authentication required\": [\"Autenticaci\u00F3n requerida\"],\n \"This operation was created with other username\": [\n \"Esta operaci\u00F3n fue creada con otro usuario\",\n ],\n \"Operation aborted\": [\"Operaci\u00F3n abortada\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\n \"La transferencia bancaria a la cuenta del operador del Taler Exchange fue abortada, su saldo no fue afectado.\",\n ],\n \"You can close this page now or continue to the account page.\": [\n \"Ya puedes cerrar esta pagina or continuar a la p\u00E1gina de estado de cuenta.\",\n ],\n Continue: [\"Continuar\"],\n \"Withdrawal confirmed\": [\"La extracci\u00F3n fue confirmada\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\n \"La transferencia bancaria al operador Taler fue iniciada. Pronto recibir\u00E1s el monto pedido en tu billetera Taler.\",\n ],\n Done: [\"Listo\"],\n \"Operation canceled\": [\"Operaci\u00F3n cancelada\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\n \"La operaci\u00F3n est\u00E1 marcada como 'seleccionada' pero algunos pasos en la extracci\u00F3n fallaron\",\n ],\n \"The account is selected but no withdrawal identification found.\": [\n \"La cuenta est\u00E1 seleccionada pero no se encontr\u00F3 el identificador de extracci\u00F3n.\",\n ],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\n \"Hay un identificador de extracci\u00F3n pero la cuenta no ha sido seleccionada o la selccionada es inv\u00E1lida.\",\n ],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\n \"No hay un identificador de extracci\u00F3n y ninguna cuenta a sido seleccionada o la seleccionada es inv\u00E1lida.\",\n ],\n \"Operation not found\": [\"Operaci\u00F3n no encontrada\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\n \"Esta operaci\u00F3n no es conocida por el servidor. El identificador de operaci\u00F3n es incorrecto o el server borr\u00F3 la informaci\u00F3n de la operaci\u00F3n antes de llegar hasta aqu\u00ED.\",\n ],\n \"Cotinue to dashboard\": [\"Continuar al panel\"],\n \"The Withdrawal URI is not valid\": [\"El URI de estracci\u00F3n no es v\u00E1lido\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\n 'El servidor de bank no esta spoportado. Version soportada \"%1$s\", version del server \"%2$s\"',\n ],\n \"Internal error, please report.\": [\n \"Error interno, por favor reporte el error.\",\n ],\n Preferences: [\"Preferencias\"],\n \"Welcome, %1$s\": [\"Bienvenido/a, %1$s\"],\n \"Latest transactions\": [\"\u00DAltimas transacciones\"],\n Date: [\"Fecha\"],\n Counterpart: [\"Contraparte\"],\n Subject: [\"Asunto\"],\n sent: [\"enviado\"],\n received: [\"recibido\"],\n \"invalid value\": [\"valor inv\u00E1lido\"],\n to: [\"hacia\"],\n from: [\"desde\"],\n \"First page\": [\"Primera p\u00E1gina\"],\n Next: [\"Siguiente\"],\n \"History of public accounts\": [\"Historial de cuentas p\u00FAblicas\"],\n \"Currently, the bank is not accepting new registrations!\": [\n \"Actualmente, el banco no est\u00E1 aceptado nuevos registros!\",\n ],\n \"Missing name\": [\"Falta nombre\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\n \"Solo use letras y n\u00FAmeros, y comience con una letra min\u00FAscula\",\n ],\n \"Passwords don't match\": [\"La contrase\u00F1a no coincide\"],\n \"Server replied with invalid phone or email.\": [\n \"El servidor repondio con tel\u00E9fono o direcci\u00F3n de correo inv\u00E1lido.\",\n ],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"El registro est\u00E1 deshabilitado porque el banco se qued\u00F3 sin cr\u00E9dito bonus.\",\n ],\n \"No enough permission to create that account.\": [\n \"Sin permisos suficientes para crear esa cuenta.\",\n ],\n \"That account id is already taken.\": [\n \"El identificador de cuenta ya est\u00E1 tomado.\",\n ],\n \"That username is already taken.\": [\n \"El nombre de usuario ya est\u00E1 tomado.\",\n ],\n \"That username can't be used because is reserved.\": [\n \"El nombre de usuario no puede ser usado porque esta reservado.\",\n ],\n \"Only admin is allow to set debt limit.\": [\n \"Solo el administrador tiene permitido cambiar el l\u00EDmite de deuda.\",\n ],\n \"No information for the selected authentication channel.\": [\n \"No hay informaci\u00F3n para el canal de autenticaci\u00F3n seleccionado.\",\n ],\n \"Authentication channel is not supported.\": [\n \"Canal de autenticaci\u00F3n no esta soportado.\",\n ],\n \"Only admin can create accounts with second factor authentication.\": [\n \"Solo el administrador puede crear cuentas con el segundo factor de autenticaci\u00F3n.\",\n ],\n \"Account registration\": [\"Registro de cuenta\"],\n \"Repeat password\": [\"Repita la contrase\u00F1a\"],\n Name: [\"Nombre\"],\n \"Create a random temporary user\": [\"Crear un usuario aleatorio temporal\"],\n \"Make a wire transfer\": [\"Hacer una transferencia bancaria\"],\n \"Wire transfer created!\": [\"Transferencia bancaria creada!\"],\n Accounts: [\"Cuentas\"],\n \"A list of all business account in the bank.\": [\n \"Una lista de todas las cuentas en el banco.\",\n ],\n \"Create account\": [\"Crear cuenta\"],\n Balance: [\"Saldo\"],\n Actions: [\"Acciones\"],\n unknown: [\"desconocido\"],\n \"change password\": [\"cambiar contrase\u00F1a\"],\n remove: [\"elimiar\"],\n \"Select a section\": [\"Seleccione una secci\u00F3n\"],\n \"Last hour\": [\"\u00DAltima hora\"],\n \"Last day\": [\"\u00DAltimo d\u00EDa\"],\n \"Last month\": [\"\u00DAltimo mes\"],\n \"Last year\": [\"\u00DAltimo a\u00F1o\"],\n \"Last Year\": [\"\u00DAltimo A\u00F1o\"],\n \"Trading volume on %1$s compared to %2$s\": [\n \"V\u00F3lumen de comercio en %1$s comparado con %2$s\",\n ],\n Cashin: [\"Ingreso\"],\n Cashout: [\"Egreso\"],\n Payin: [\"Envios de dinero\"],\n Payout: [\"Recibos de dinero\"],\n \"download stats as CSV\": [\"descargar estad\u00EDsticas en CSV\"],\n \"Descreased by\": [\"Descendiente por\"],\n \"Increased by\": [\"Ascendente por\"],\n \"Unable to create a cashout\": [\"Imposible crear un egreso\"],\n \"The bank configuration does not support cashout operations.\": [\n \"La configuraci\u00F3n del banco no soporta operaciones de egreso.\",\n ],\n invalid: [\"inv\u00E1lido\"],\n \"need to be higher due to fees\": [\n \"necesita ser mayor debido a las comisiones\",\n ],\n \"the total transfer at destination will be zero\": [\n \"el total de la transferencia en destino ser\u00E1 cero\",\n ],\n \"Cashout created\": [\"Egreso creado\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\n \"Se detect\u00F3 una petici\u00F3n duplicada, verifique si la operaci\u00F3n tuvo \u00E9xito o intente otra vez.\",\n ],\n \"The conversion rate was incorrectly applied\": [\n \"La tasa de conversi\u00F3n se aplic\u00F3 incorrectamente\",\n ],\n \"The account does not have sufficient funds\": [\n \"La cuenta no tiene fondos suficientes\",\n ],\n \"Cashouts are not supported\": [\"Egresos no est\u00E1n soportados\"],\n \"Missing cashout URI in the profile\": [\n \"Falta direcci\u00F3n de egreso en el perf\u00EDl\",\n ],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\n \"El env\u00EDo del mensaje de confirmaci\u00F3n fall\u00F3, intente mas tarde o contacte al administrador.\",\n ],\n \"Convertion rate\": [\"Tasa de conversi\u00F3n\"],\n Fee: [\"Comisi\u00F3n\"],\n \"To account\": [\"Hacia cuenta\"],\n \"No cashout account\": [\"No hay cuenta de egreso\"],\n \"Before doing a cashout you need to complete your profile\": [\n \"Antes de hacer un egreso necesita completar su perf\u00EDl\",\n ],\n \"Amount to send\": [\"Monto a enviar\"],\n \"Amount to receive\": [\"Monto a recibir\"],\n \"Total cost\": [\"Costo total\"],\n \"Balance left\": [\"Saldo remanente\"],\n \"Before fee\": [\"Antes de comisi\u00F3n\"],\n \"Total cashout transfer\": [\"Total de egreso\"],\n \"No cashout channel available\": [\"No hay canal de egreso disponible\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\n \"Antes de hacer un egreso el servidor necesita proveer un segundo canal para confirmar la operaci\u00F3n\",\n ],\n \"Second factor authentication\": [\"Segundo factor de autenticaci\u00F3n\"],\n Email: [\"Correo eletr\u00F3nico\"],\n \"add a email in your profile to enable this option\": [\n \"agrege un correo en su perf\u00EDl para habilitar esta opci\u00F3n\",\n ],\n SMS: [\"SMS\"],\n \"add a phone number in your profile to enable this option\": [\n \"agregue un n\u00FAmero de tel\u00E9fono para habilitar esta opci\u00F3n\",\n ],\n Details: [\"Detalles\"],\n Delete: [\"Borrar\"],\n Credentials: [\"Credenciales\"],\n Cashouts: [\"Egresos\"],\n \"it doesnt have the pattern of an IBAN number\": [\n \"no tiene el patr\u00F3n de un n\u00FAmero IBAN\",\n ],\n \"it doesnt have the pattern of an email\": [\n \"no tiene el patr\u00F3n de un correo electr\u00F3nico\",\n ],\n \"should start with +\": [\"deber\u00EDa comenzar con un +\"],\n \"phone number can't have other than numbers\": [\n \"n\u00FAmero de tel\u00E9fono no puede tener otra cosa que numeros\",\n ],\n \"account identification in the bank\": [\n \"identificador de cuenta en el banco\",\n ],\n \"name of the person owner the account\": [\n \"nombre de la persona due\u00F1a de la cuenta\",\n ],\n \"Internal IBAN\": [\"IBAN interno\"],\n \"if empty a random account number will be assigned\": [\n \"si est\u00E1 vac\u00EDo un n\u00FAmero de cuenta aleatorio ser\u00E1 asignado\",\n ],\n \"account identification for bank transfer\": [\n \"identificador de cuenta para transferencia bancaria\",\n ],\n Phone: [\"Tel\u00E9fono\"],\n \"Cashout IBAN\": [\"IBAN de egreso\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\n \"numero de cuenta donde el dinero ser\u00E1 enviado cuando se ejecuten egresos\",\n ],\n \"Max debt\": [\"M\u00E1xima deuda\"],\n \"how much is user able to transfer after zero balance\": [\n \"cuanto tiene habilitado a transferir despues de un saldo en cero\",\n ],\n \"Is this a Taler Exchange?\": [\"Es un Taler Exchange?\"],\n \"This server doesn't support second factor authentication.\": [\n \"Este servidor no tiene soporte para segundo factor de autenticaci\u00F3n.\",\n ],\n \"Enable second factor authentication\": [\n \"H\u00E1bilitar segundo factor de autenticaci\u00F3n\",\n ],\n \"Using email\": [\"Usando correo eletr\u00F3nico\"],\n \"Using SMS\": [\"Usando SMS\"],\n \"Is this account public?\": [\"Es una cuenta p\u00FAblica?\"],\n \"public accounts have their balance publicly accesible\": [\n \"las cuentas p\u00FAblicas tienen su saldo accesible al p\u00FAblico\",\n ],\n \"Account updated\": [\"Cuenta actualizada\"],\n \"The rights to change the account are not sufficient\": [\n \"Los permisos para cambiar la cuenta no son suficientes\",\n ],\n \"The username was not found\": [\"El nombre de usaurio no se encontr\u00F3\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\n \"No puede cambiar el nombre legal, por favor contacte el administrador de la cuenta.\",\n ],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\n \"No puede cambiar el l\u00EDmite de deuda, por favor contacte el administrador de la cuenta.\",\n ],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\n \"No puede cambiar la direcci\u00F3n de egreso, por favor contacte al administrador de la cuenta.\",\n ],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\n \"No puede cambiar los datos de contacto, por favor contacte al administrador de la cuenta.\",\n ],\n 'Account \"%1$s\"': ['Cuenta \"%1$s\"'],\n \"Change details\": [\"Cambiar detalles\"],\n Update: [\"Actualizar\"],\n \"password doesn't match\": [\"la contrase\u00F1a no coincide\"],\n \"Password changed\": [\"La contrase\u00F1a cambi\u00F3\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"No est\u00E1 autorizado a cambiar el password, quiz\u00E1 la sesi\u00F3n es invalida.\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\n \"Se necesita el password viejo para cambiar la contrase\u00F1a. Si no lo tiene contacte a su administrador.\",\n ],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"Su actual contrase\u00F1a no coincide, no puede cambiar a una nueva contrase\u00F1a.\",\n ],\n \"Update password\": [\"Actualizar contrase\u00F1a\"],\n \"New password\": [\"Nueva contrase\u00F1a\"],\n \"Type it again\": [\"Escribalo otra vez\"],\n \"repeat the same password\": [\"repita la misma contrase\u00F1a\"],\n \"Current password\": [\"Contrase\u00F1a actual\"],\n \"your current password, for security\": [\n \"su actual contrase\u00F1a, por seguridad\",\n ],\n Change: [\"Cambiar\"],\n \"Can't delete the account\": [\"No se puede eliminar la cuenta\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\n \"La cuenta no puede ser eliminada mientras tiene saldo. Primero asegures\u00E9 que el due\u00F1o haga un egreso completo.\",\n ],\n \"Account removed\": [\"Cuenta eliminada\"],\n \"No enough permission to delete the account.\": [\n \"No tiene permisos suficientes para eliminar la cuenta.\",\n ],\n \"The username was not found.\": [\"El nombr ede usuario no se encontr\u00F3.\"],\n \"Can't delete a reserved username.\": [\n \"No se puede eliminar un nombre de usuario reservado.\",\n ],\n \"Can't delete an account with balance different than zero.\": [\n \"No se puede eliminar una cuenta con saldo diferente a cero.\",\n ],\n \"name doesn't match\": [\"el nombre no coincide\"],\n \"You are going to remove the account\": [\"Est\u00E1 por eliminar la cuenta\"],\n \"This step can't be undone.\": [\"Este paso no puede ser deshecho.\"],\n 'Deleting account \"%1$s\"': ['Borrando cuenta \"%1$s\"'],\n Verification: [\"Verificaci\u00F3n\"],\n \"enter the account name that is going to be deleted\": [\n \"ingrese el nombre de cuenta que ser\u00E1 eliminado\",\n ],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\n 'Cuenta creada con contrase\u00F1a \"%1$s\". El usuario debe cambiar la contrase\u00F1a en el siguiente ingreso.',\n ],\n \"Server replied that phone or email is invalid\": [\n \"El servidor respondi\u00F3 que el tel\u00E9fono o correo eletr\u00F3nico es invalido\",\n ],\n \"The rights to perform the operation are not sufficient\": [\n \"Los permisos para ejecutar la operaci\u00F3n no son suficientes\",\n ],\n \"Account username is already taken\": [\n \"El nombre del usuario ya est\u00E1 tomado\",\n ],\n \"Account id is already taken\": [\"El id de cuenta ya est\u00E1 tomado\"],\n \"Bank ran out of bonus credit.\": [\n \"El banco no tiene mas cr\u00E9dito de bonus.\",\n ],\n \"Account username can't be used because is reserved\": [\n \"El nombre de usuario de la cuenta no puede userse porque est\u00E1 reservado\",\n ],\n \"Can't create accounts\": [\"No puede crear cuentas\"],\n \"Only system admin can create accounts.\": [\n \"Solo los administradores del sistema pueden crear cuentas.\",\n ],\n \"New business account\": [\"Nueva cuenta\"],\n Create: [\"Crear\"],\n \"Cashout not supported.\": [\"Egreso no soportado.\"],\n \"Account not found.\": [\"Cuenta no encontrada.\"],\n \"Latest cashouts\": [\"\u00DAltimos egresos\"],\n Created: [\"Creado\"],\n Confirmed: [\"Confirmado\"],\n \"Total debit\": [\"D\u00E9bito total\"],\n \"Total credit\": [\"Cr\u00E9dito total\"],\n Status: [\"Estado\"],\n never: [\"nunca\"],\n \"Cashout for account %1$s\": [\"Egreso para cuenta %1$s\"],\n \"This cashout not found. Maybe already aborted.\": [\n \"Este egreso no se encontr\u00F3. Quiz\u00E1 fue abortado.\",\n ],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"Egreso no econtrado. Tambi\u00E9n puede significar que ya ha sido abortado.\",\n ],\n \"Cashout was already confimed.\": [\"Egreso ya fue confirmado.\"],\n \"Cashout operation is not supported.\": [\n \"Operaci\u00F3n de egreso no soportada.\",\n ],\n \"The cashout operation is already aborted.\": [\n \"La operaci\u00F3n de egreso ya est\u00E1 abortada.\",\n ],\n \"Missing destination account.\": [\"Falta cuenta destino.\"],\n \"Too many failed attempts.\": [\"Demasiados intentos fallidos.\"],\n \"The code for this cashout is invalid.\": [\n \"El c\u00F3digo para este egreso es invalido.\",\n ],\n \"Cashout detail\": [\"Detalles de egreso\"],\n Debited: [\"Debitado\"],\n Credited: [\"Acreditado\"],\n \"Enter the confirmation code\": [\"Ingresar el c\u00F3digo de confirmaci\u00F3n\"],\n Abort: [\"Abortar\"],\n Confirm: [\"Confirmar\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\n \"No autorizado para hacer la operaci\u00F3n, quiz\u00E1 la sesi\u00F3n haya expirado or cambi\u00F3 la contrase\u00F1a.\",\n ],\n \"The operation was rejected due to insufficient funds.\": [\n \"La operaci\u00F3n fue rechazada debido a saldo insuficiente.\",\n ],\n \"Do not show this again\": [\"No mostrar otra vez\"],\n Close: [\"Cerrar\"],\n \"On this device\": [\"En este dispositivo\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\n 'Si esta usando un explorador web de escritorio deber\u00EDas acceder ahora a tu billletera con la GNU Taler WebExtension o hacer click en el link si tu extensi\u00F3n tiene la configuraci\u00F3n \"Inyectar soporte para Taler\" habilitada.',\n ],\n Start: [\"Comenzar\"],\n \"On a mobile phone\": [\"En un dispotivo mobile\"],\n \"Scan the QR code with your mobile device.\": [\n \"Escanear el c\u00F3digo QR con tu dispotivo m\u00F3vil.\",\n ],\n \"There is an operation already\": [\"Ya hay una operaci\u00F3n\"],\n \"Complete or cancel the operation in\": [\n \"Completa o cancela la operaci\u00F3n en\",\n ],\n \"Server responded with an invalid withdraw URI\": [\n \"El servidor respondi\u00F3 con una URI de extracci\u00F3n inv\u00E1lida\",\n ],\n \"Withdraw URI: %1$s\": [\"URI de extracci\u00F3n: %1$s\"],\n \"The operation was rejected due to insufficient funds\": [\n \"La operaci\u00F3n fue rechazada debido a fundos insuficientes\",\n ],\n \"Prepare your wallet\": [\"Prepare su billetera\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\n \"Despues de usar tu billetera necesitar\u00E1s confirmar o cancelar la operaci\u00F3n en este sitio.\",\n ],\n \"You need a GNU Taler Wallet\": [\"Necesitas una GNU Taler Wallet\"],\n \"If you don't have one yet you can follow the instruction in\": [\n \"Si no tienes una todav\u00EDa puedes seguir las instrucciones en\",\n ],\n \"Send money\": [\"Enviar dinero\"],\n \"to a %1$s wallet\": [\"a una billetera %1$s\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"Extraer dinero digital a tu billetera m\u00F3vil o extesi\u00F3n web\",\n ],\n \"operation ready\": [\"operaci\u00F3n lista\"],\n \"to another bank account\": [\"a otra cuenta bancaria\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"Hacer una transferencia bancaria a una cuenta con un n\u00FAmero de cuenta conocido.\",\n ],\n \"Transfer details\": [\"Detalles de transferencia\"],\n \"This is a demo bank\": [\"Este es un banco de demostraci\u00F3n\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\n \"Esta parte de la demostraci\u00F3n muestra c\u00F3mo funciona un banco que soporta Taler directamente. Adem\u00E1s de usar tu propia cuenta de banco, tambi\u00E9n podr\u00E1s ver el historial de transacciones de algunas %1$s.\",\n ],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\n \"Esta parte de la demostraci\u00F3n muetra como un banco que soporta Taler directamente funcionar\u00EDa.\",\n ],\n \"Pending account delete operation\": [\n \"Operaci\u00F3n pendiente de eliminaci\u00F3n de cuenta\",\n ],\n \"Pending account update operation\": [\n \"Operaci\u00F3n pendiente de actualizaci\u00F3n de cuenta\",\n ],\n \"Pending password update operation\": [\n \"Operaci\u00F3n pendiente de actualizaci\u00F3n de password\",\n ],\n \"Pending transaction operation\": [\"Operaci\u00F3n pendiente de transacci\u00F3n\"],\n \"Pending withdrawal operation\": [\"Operaci\u00F3n pendiente de extracci\u00F3n\"],\n \"Pending cashout operation\": [\"Operaci\u00F3n pendiente de egreso\"],\n \"You can complete or cancel the operation in\": [\n \"Puedes completar o cancelar la operaci\u00F3n en\",\n ],\n \"Download bank stats\": [\"Descargar estad\u00EDsticas del banco\"],\n \"Include hour metric\": [\"Incluir m\u00E9trica horaria\"],\n \"Include day metric\": [\"Incluir m\u00E9trica diaria\"],\n \"Include month metric\": [\"Incluir m\u00E9trica mensual\"],\n \"Include year metric\": [\"Incluir m\u00E9trica anual\"],\n \"Include table header\": [\"Incluir encabezado de tabla\"],\n \"Add previous metric for compare\": [\n \"Agregar m\u00E9trica previa para comparar\",\n ],\n \"Fail on first error\": [\"Fallar en el primer error\"],\n Download: [\"Descargar\"],\n \"downloading... %1$s\": [\"descargando... %1$s\"],\n \"Download completed\": [\"Descarga completada\"],\n \"click here to save the file in your computer\": [\n \"click aqu\u00ED para guardar el archivo en su computadora\",\n ],\n \"Challenge not found.\": [\"Desaf\u00EDo no encontrado.\"],\n \"This user is not authorized to complete this challenge.\": [\n \"Este usuario no est\u00E1 autorizado para completar este desaf\u00EDo.\",\n ],\n \"Too many attemps, try another code.\": [\n \"Demasiados intentos, intente otro c\u00F3digo.\",\n ],\n \"The confirmation code is wrong, try again.\": [\n \"El c\u00F3digo de confirmaci\u00F3n es erroneo, intente otra vez.\",\n ],\n \"The operation expired.\": [\"La operaci\u00F3n expir\u00F3.\"],\n \"The operation failed.\": [\"La operaci\u00F3n fall\u00F3.\"],\n \"The operation needs another confirmation to complete.\": [\n \"La operaci\u00F3n necesita otra confirmaci\u00F3n para completar.\",\n ],\n \"Account delete\": [\"Eliminaci\u00F3n de cuenta\"],\n \"Account update\": [\"Actualizaci\u00F3n de cuenta\"],\n \"Password update\": [\"Actualizaci\u00F3n de contrase\u00F1a\"],\n \"Wire transfer\": [\"Transferencia bancaria\"],\n Withdrawal: [\"Extracci\u00F3n\"],\n \"Confirm the operation\": [\"Confirmar la operaci\u00F3n\"],\n \"Send again\": [\"Enviar otra vez\"],\n \"Send code\": [\"Enviar c\u00F3digo\"],\n \"Operation details\": [\"Detalles de operaci\u00F3n\"],\n \"Challenge details\": [\"Detalles del desaf\u00EDo\"],\n \"Sent at\": [\"Enviado a\"],\n \"To phone\": [\"Al tel\u00E9fono\"],\n \"To email\": [\"Al email\"],\n \"Welcome to %1$s!\": [\"Bienvenido a %1$s!\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"es\",\n completeness: 100,\n};\n\nstrings[\"en\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=(n != 1);\",\n lang: \"en\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"\"],\n \"amount to transfer\": [\"\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"\"],\n Counterpart: [\"\"],\n Subject: [\"\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\"\"],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"\"],\n \"Confirm the operation\": [\"\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=(n != 1);\",\n lang: \"en\",\n completeness: 100,\n};\n\nstrings[\"de\"] = {\n locale_data: {\n messages: {\n \"\": {\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"de\",\n },\n \"Operation failed, please report\": [\"\"],\n \"Request timeout\": [\"\"],\n \"Request throttled\": [\"\"],\n \"Malformed response\": [\"\"],\n \"Network error\": [\"\"],\n \"Unexpected request error\": [\"\"],\n \"Unexpected error\": [\"\"],\n \"IBAN numbers usually have more that 4 digits\": [\"\"],\n \"IBAN numbers usually have less that 34 digits\": [\"\"],\n \"IBAN country code not found\": [\"\"],\n \"IBAN number is not valid, checksum is wrong\": [\"\"],\n \"Max withdrawal amount\": [\"\"],\n \"Show withdrawal confirmation\": [\"\"],\n \"Show demo description\": [\"\"],\n \"Show install wallet first\": [\"\"],\n \"Use fast withdrawal form\": [\"\"],\n \"Show debug info\": [\"\"],\n \"The reserve operation has been confirmed previously and can't be aborted\":\n [\"\"],\n \"The operation id is invalid.\": [\"\"],\n \"The operation was not found.\": [\"\"],\n \"If you have a Taler wallet installed in this device\": [\"\"],\n \"You will see the details of the operation in your wallet including the fees (if applies). If you still don't have one you can install it following instructions in\":\n [\"\"],\n \"this page\": [\"\"],\n Withdraw: [\"\"],\n \"Or if you have the wallet in another device\": [\"\"],\n \"Scan the QR below to start the withdrawal.\": [\"\"],\n required: [\"\"],\n \"IBAN should have just uppercased letters and numbers\": [\"\"],\n \"not valid\": [\"\"],\n \"should be greater than 0\": [\"\"],\n \"balance is not enough\": [\"\"],\n \"does not follow the pattern\": [\"\"],\n 'only \"IBAN\" target are supported': [\"\"],\n 'use the \"amount\" parameter to specify the amount to be transferred': [\n \"\",\n ],\n \"the amount is not valid\": [\"\"],\n 'use the \"message\" parameter to specify a reference text for the transfer':\n [\"\"],\n \"The request was invalid or the payto://-URI used unacceptable features.\":\n [\"\"],\n \"Not enough permission to complete the operation.\": [\"\"],\n 'The destination account \"%1$s\" was not found.': [\"\"],\n \"The origin and the destination of the transfer can't be the same.\": [\"\"],\n \"Your balance is not enough.\": [\"\"],\n 'The origin account \"%1$s\" was not found.': [\"\"],\n \"Using a form\": [\"\"],\n \"Import payto:// URI\": [\"\"],\n Recipient: [\"\"],\n \"IBAN of the recipient's account\": [\"\"],\n \"Transfer subject\": [\"\"],\n subject: [\"Verwendungszweck\"],\n \"some text to identify the transfer\": [\"\"],\n Amount: [\"Betrag\"],\n \"amount to transfer\": [\"Betrag\"],\n \"payto URI:\": [\"\"],\n \"uniform resource identifier of the target account\": [\"\"],\n \"payto://iban/[receiver-iban]?message=[subject]&amount=[%1$s:X.Y]\": [\"\"],\n Cancel: [\"\"],\n Send: [\"\"],\n \"Missing username\": [\"\"],\n \"Missing password\": [\"\"],\n 'Wrong credentials for \"%1$s\"': [\"\"],\n \"Account not found\": [\"\"],\n Username: [\"\"],\n \"username of the account\": [\"\"],\n Password: [\"\"],\n \"password of the account\": [\"Buchungen auf \u00F6ffentlich sichtbaren Konten\"],\n Check: [\"\"],\n \"Log in\": [\"\"],\n Register: [\"\"],\n \"Wire transfer completed!\": [\"\"],\n \"The withdrawal has been aborted previously and can't be confirmed\": [\"\"],\n \"The withdrawal operation can't be confirmed before a wallet accepted the transaction.\":\n [\"\"],\n \"Your balance is not enough for the operation.\": [\"\"],\n \"Confirm the withdrawal operation\": [\"Abhebung best\u00E4tigen\"],\n \"Wire transfer details\": [\"\"],\n \"Taler Exchange operator's account\": [\"\"],\n \"Taler Exchange operator's name\": [\"\"],\n Transfer: [\"\"],\n \"Authentication required\": [\"\"],\n \"This operation was created with other username\": [\"\"],\n \"Operation aborted\": [\"\"],\n \"The wire transfer to the Taler Exchange operator's account was aborted, your balance was not affected.\":\n [\"\"],\n \"You can close this page now or continue to the account page.\": [\"\"],\n Continue: [\"\"],\n \"Withdrawal confirmed\": [\"\"],\n \"The wire transfer to the Taler operator has been initiated. You will soon receive the requested amount in your Taler wallet.\":\n [\"\"],\n Done: [\"\"],\n \"Operation canceled\": [\"\"],\n \"The operation is marked as 'selected' but some step in the withdrawal failed\":\n [\"\"],\n \"The account is selected but no withdrawal identification found.\": [\"\"],\n \"There is a withdrawal identification but no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"No withdrawal ID found and no account has been selected or the selected account is invalid.\":\n [\"\"],\n \"Operation not found\": [\"\"],\n \"This operation is not known by the server. The operation id is wrong or the server deleted the operation information before reaching here.\":\n [\"\"],\n \"Cotinue to dashboard\": [\"\"],\n \"The Withdrawal URI is not valid\": [\"\"],\n 'the bank backend is not supported. supported version \"%1$s\", server version \"%2$s\"':\n [\"\"],\n \"Internal error, please report.\": [\"\"],\n Preferences: [\"\"],\n \"Welcome, %1$s\": [\"\"],\n \"Latest transactions\": [\"\"],\n Date: [\"Datum\"],\n Counterpart: [\"Empf\u00E4nger\"],\n Subject: [\"Verwendungszweck\"],\n sent: [\"\"],\n received: [\"\"],\n \"invalid value\": [\"\"],\n to: [\"\"],\n from: [\"\"],\n \"First page\": [\"\"],\n Next: [\"\"],\n \"History of public accounts\": [\n \"Buchungen auf \u00F6ffentlich sichtbaren Konten\",\n ],\n \"Currently, the bank is not accepting new registrations!\": [\"\"],\n \"Missing name\": [\"\"],\n \"Use letters and numbers only, and start with a lowercase letter\": [\"\"],\n \"Passwords don't match\": [\"\"],\n \"Server replied with invalid phone or email.\": [\"\"],\n \"Registration is disabled because the bank ran out of bonus credit.\": [\n \"\",\n ],\n \"No enough permission to create that account.\": [\"\"],\n \"That account id is already taken.\": [\"\"],\n \"That username is already taken.\": [\"\"],\n \"That username can't be used because is reserved.\": [\"\"],\n \"Only admin is allow to set debt limit.\": [\"\"],\n \"No information for the selected authentication channel.\": [\"\"],\n \"Authentication channel is not supported.\": [\"\"],\n \"Only admin can create accounts with second factor authentication.\": [\"\"],\n \"Account registration\": [\"\"],\n \"Repeat password\": [\"\"],\n Name: [\"\"],\n \"Create a random temporary user\": [\"\"],\n \"Make a wire transfer\": [\"\"],\n \"Wire transfer created!\": [\"\"],\n Accounts: [\"Betrag\"],\n \"A list of all business account in the bank.\": [\"\"],\n \"Create account\": [\"\"],\n Balance: [\"\"],\n Actions: [\"\"],\n unknown: [\"\"],\n \"change password\": [\"\"],\n remove: [\"\"],\n \"Select a section\": [\"\"],\n \"Last hour\": [\"\"],\n \"Last day\": [\"\"],\n \"Last month\": [\"\"],\n \"Last year\": [\"\"],\n \"Last Year\": [\"\"],\n \"Trading volume on %1$s compared to %2$s\": [\"\"],\n Cashin: [\"\"],\n Cashout: [\"\"],\n Payin: [\"\"],\n Payout: [\"\"],\n \"download stats as CSV\": [\"\"],\n \"Descreased by\": [\"\"],\n \"Increased by\": [\"\"],\n \"Unable to create a cashout\": [\"\"],\n \"The bank configuration does not support cashout operations.\": [\"\"],\n invalid: [\"\"],\n \"need to be higher due to fees\": [\"\"],\n \"the total transfer at destination will be zero\": [\"\"],\n \"Cashout created\": [\"\"],\n \"Duplicated request detected, check if the operation succeded or try again.\":\n [\"\"],\n \"The conversion rate was incorrectly applied\": [\"\"],\n \"The account does not have sufficient funds\": [\"\"],\n \"Cashouts are not supported\": [\"\"],\n \"Missing cashout URI in the profile\": [\"\"],\n \"Sending the confirmation message failed, retry later or contact the administrator.\":\n [\"\"],\n \"Convertion rate\": [\"\"],\n Fee: [\"\"],\n \"To account\": [\"\"],\n \"No cashout account\": [\"\"],\n \"Before doing a cashout you need to complete your profile\": [\"\"],\n \"Amount to send\": [\"Betrag\"],\n \"Amount to receive\": [\"\"],\n \"Total cost\": [\"\"],\n \"Balance left\": [\"\"],\n \"Before fee\": [\"\"],\n \"Total cashout transfer\": [\"\"],\n \"No cashout channel available\": [\"\"],\n \"Before doing a cashout the server need to provide an second channel to confirm the operation\":\n [\"\"],\n \"Second factor authentication\": [\"\"],\n Email: [\"\"],\n \"add a email in your profile to enable this option\": [\"\"],\n SMS: [\"\"],\n \"add a phone number in your profile to enable this option\": [\"\"],\n Details: [\"\"],\n Delete: [\"\"],\n Credentials: [\"\"],\n Cashouts: [\"\"],\n \"it doesnt have the pattern of an IBAN number\": [\"\"],\n \"it doesnt have the pattern of an email\": [\"\"],\n \"should start with +\": [\"\"],\n \"phone number can't have other than numbers\": [\"\"],\n \"account identification in the bank\": [\"\"],\n \"name of the person owner the account\": [\"\"],\n \"Internal IBAN\": [\"\"],\n \"if empty a random account number will be assigned\": [\"\"],\n \"account identification for bank transfer\": [\"\"],\n Phone: [\"\"],\n \"Cashout IBAN\": [\"\"],\n \"account number where the money is going to be sent when doing cashouts\":\n [\"\"],\n \"Max debt\": [\"\"],\n \"how much is user able to transfer after zero balance\": [\"\"],\n \"Is this a Taler Exchange?\": [\"\"],\n \"This server doesn't support second factor authentication.\": [\"\"],\n \"Enable second factor authentication\": [\"\"],\n \"Using email\": [\"\"],\n \"Using SMS\": [\"\"],\n \"Is this account public?\": [\"\"],\n \"public accounts have their balance publicly accesible\": [\"\"],\n \"Account updated\": [\"\"],\n \"The rights to change the account are not sufficient\": [\"\"],\n \"The username was not found\": [\"\"],\n \"You can't change the legal name, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the debt limit, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the cashout address, please contact the your account administrator.\":\n [\"\"],\n \"You can't change the contact data, please contact the your account administrator.\":\n [\"\"],\n 'Account \"%1$s\"': [\"\"],\n \"Change details\": [\"\"],\n Update: [\"\"],\n \"password doesn't match\": [\"\"],\n \"Password changed\": [\"\"],\n \"Not authorized to change the password, maybe the session is invalid.\": [\n \"\",\n ],\n \"You need to provide the old password. If you don't have it contact your account administrator.\":\n [\"\"],\n \"Your current password doesn't match, can't change to a new password.\": [\n \"\",\n ],\n \"Update password\": [\"\"],\n \"New password\": [\"\"],\n \"Type it again\": [\"\"],\n \"repeat the same password\": [\"\"],\n \"Current password\": [\"\"],\n \"your current password, for security\": [\"\"],\n Change: [\"\"],\n \"Can't delete the account\": [\"\"],\n \"The account can't be delete while still holding some balance. First make sure that the owner make a complete cashout.\":\n [\"\"],\n \"Account removed\": [\"\"],\n \"No enough permission to delete the account.\": [\"\"],\n \"The username was not found.\": [\"\"],\n \"Can't delete a reserved username.\": [\"\"],\n \"Can't delete an account with balance different than zero.\": [\"\"],\n \"name doesn't match\": [\"\"],\n \"You are going to remove the account\": [\"\"],\n \"This step can't be undone.\": [\"\"],\n 'Deleting account \"%1$s\"': [\"\"],\n Verification: [\"\"],\n \"enter the account name that is going to be deleted\": [\"\"],\n 'Account created with password \"%1$s\". The user must change the password on the next login.':\n [\"\"],\n \"Server replied that phone or email is invalid\": [\"\"],\n \"The rights to perform the operation are not sufficient\": [\"\"],\n \"Account username is already taken\": [\"\"],\n \"Account id is already taken\": [\"\"],\n \"Bank ran out of bonus credit.\": [\"\"],\n \"Account username can't be used because is reserved\": [\"\"],\n \"Can't create accounts\": [\"\"],\n \"Only system admin can create accounts.\": [\"\"],\n \"New business account\": [\"\"],\n Create: [\"\"],\n \"Cashout not supported.\": [\"\"],\n \"Account not found.\": [\"\"],\n \"Latest cashouts\": [\"\"],\n Created: [\"\"],\n Confirmed: [\"Best\u00E4tigen\"],\n \"Total debit\": [\"\"],\n \"Total credit\": [\"\"],\n Status: [\"\"],\n never: [\"\"],\n \"Cashout for account %1$s\": [\"\"],\n \"This cashout not found. Maybe already aborted.\": [\"\"],\n \"Cashout not found. It may be also mean that it was already aborted.\": [\n \"\",\n ],\n \"Cashout was already confimed.\": [\"\"],\n \"Cashout operation is not supported.\": [\"\"],\n \"The cashout operation is already aborted.\": [\"\"],\n \"Missing destination account.\": [\"\"],\n \"Too many failed attempts.\": [\"\"],\n \"The code for this cashout is invalid.\": [\"\"],\n \"Cashout detail\": [\"\"],\n Debited: [\"\"],\n Credited: [\"\"],\n \"Enter the confirmation code\": [\"\"],\n Abort: [\"\"],\n Confirm: [\"Best\u00E4tigen\"],\n \"Unauthorized to make the operation, maybe the session has expired or the password changed.\":\n [\"\"],\n \"The operation was rejected due to insufficient funds.\": [\"\"],\n \"Do not show this again\": [\"\"],\n Close: [\"\"],\n \"On this device\": [\"\"],\n 'If you are using a web browser on desktop you should access your wallet with the GNU Taler WebExtension now or click the link if your WebExtension have the \"Inject Taler support\" option enabled.':\n [\"\"],\n Start: [\"\"],\n \"On a mobile phone\": [\"\"],\n \"Scan the QR code with your mobile device.\": [\"\"],\n \"There is an operation already\": [\"\"],\n \"Complete or cancel the operation in\": [\"Abhebung best\u00E4tigen\"],\n \"Server responded with an invalid withdraw URI\": [\"\"],\n \"Withdraw URI: %1$s\": [\"\"],\n \"The operation was rejected due to insufficient funds\": [\"\"],\n \"Prepare your wallet\": [\"\"],\n \"After using your wallet you will need to confirm or cancel the operation on this site.\":\n [\"\"],\n \"You need a GNU Taler Wallet\": [\"\"],\n \"If you don't have one yet you can follow the instruction in\": [\"\"],\n \"Send money\": [\"\"],\n \"to a %1$s wallet\": [\"\"],\n \"Withdraw digital money into your mobile wallet or browser extension\": [\n \"\",\n ],\n \"operation ready\": [\"\"],\n \"to another bank account\": [\"\"],\n \"Make a wire transfer to an account with known bank account number.\": [\n \"\",\n ],\n \"Transfer details\": [\"\"],\n \"This is a demo bank\": [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work. In addition to using your own bank account, you can also see the transaction history of some %1$s.\":\n [\"\"],\n \"This part of the demo shows how a bank that supports Taler directly would work.\":\n [\"\"],\n \"Pending account delete operation\": [\"\"],\n \"Pending account update operation\": [\"\"],\n \"Pending password update operation\": [\"\"],\n \"Pending transaction operation\": [\"\"],\n \"Pending withdrawal operation\": [\"\"],\n \"Pending cashout operation\": [\"\"],\n \"You can complete or cancel the operation in\": [\"\"],\n \"Download bank stats\": [\"\"],\n \"Include hour metric\": [\"\"],\n \"Include day metric\": [\"\"],\n \"Include month metric\": [\"\"],\n \"Include year metric\": [\"\"],\n \"Include table header\": [\"\"],\n \"Add previous metric for compare\": [\"\"],\n \"Fail on first error\": [\"\"],\n Download: [\"\"],\n \"downloading... %1$s\": [\"\"],\n \"Download completed\": [\"\"],\n \"click here to save the file in your computer\": [\"\"],\n \"Challenge not found.\": [\"\"],\n \"This user is not authorized to complete this challenge.\": [\"\"],\n \"Too many attemps, try another code.\": [\"\"],\n \"The confirmation code is wrong, try again.\": [\"\"],\n \"The operation expired.\": [\"\"],\n \"The operation failed.\": [\"\"],\n \"The operation needs another confirmation to complete.\": [\"\"],\n \"Account delete\": [\"\"],\n \"Account update\": [\"\"],\n \"Password update\": [\"\"],\n \"Wire transfer\": [\"\"],\n Withdrawal: [\"Abhebung best\u00E4tigen\"],\n \"Confirm the operation\": [\"Abhebung best\u00E4tigen\"],\n \"Send again\": [\"\"],\n \"Send code\": [\"\"],\n \"Operation details\": [\"\"],\n \"Challenge details\": [\"\"],\n \"Sent at\": [\"\"],\n \"To phone\": [\"\"],\n \"To email\": [\"\"],\n \"Welcome to %1$s!\": [\"\"],\n },\n },\n domain: \"messages\",\n plural_forms: \"nplurals=2; plural=n != 1;\",\n lang: \"de\",\n completeness: 4,\n};\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { Codec, buildCodecForObject, codecForBoolean, codecForMap, codecForString, codecOptional } from \"./codec.js\";\nimport { canonicalizeBaseUrl } from \"./utils.js\";\n\nexport interface AppUiSettings {\n // Where libeufin backend is localted\n // default: window.origin without \"webui/\"\n backendBaseURL?: string;\n // Shows a button \"create random account\" in the registration form\n // Useful for testing\n // default: false\n allowRandomAccountCreation?: boolean;\n // Create all random accounts with password \"123\"\n // Useful for testing\n // default: false\n simplePasswordForRandomAccounts?: boolean;\n // URL where the user is going to be redirected after\n // clicking in Taler Logo\n // default: home page\n iconLinkURL?: string;\n // Mapping for every link shown in the top navitation bar\n // - key: link label, what the user will read\n // - value: link target, where the user is going to be redirected\n // default: empty list\n topNavSites?: Record;\n}\n\n/**\n * Global settings for the UI.\n */\nconst defaultSettings: AppUiSettings = {\n backendBaseURL: buildDefaultBackendBaseURL(),\n iconLinkURL: undefined,\n simplePasswordForRandomAccounts: false,\n allowRandomAccountCreation: false,\n topNavSites: {},\n};\n\nconst codecForAppUiSettings = (): Codec =>\n buildCodecForObject()\n .property(\"backendBaseURL\", codecOptional(codecForString()))\n .property(\"allowRandomAccountCreation\", codecOptional(codecForBoolean()))\n .property(\n \"simplePasswordForRandomAccounts\",\n codecOptional(codecForBoolean()),\n )\n .property(\"iconLinkURL\", codecOptional(codecForString()))\n .property(\"topNavSites\", codecOptional(codecForMap(codecForString())))\n .build(\"AppUiSettings\");\n\nfunction removeUndefineField(obj: T): T {\n const keys = Object.keys(obj) as Array;\n return keys.reduce((prev, cur) => {\n if (typeof prev[cur] === \"undefined\") {\n delete prev[cur];\n }\n return prev;\n }, obj);\n}\n\nexport function fetchSettings(listener: (s: AppUiSettings) => void): void {\n fetch(\"./settings.json\")\n .then((resp) => resp.json())\n .then((json) => codecForAppUiSettings().decode(json))\n .then((result) =>\n listener({\n ...defaultSettings,\n ...removeUndefineField(result),\n }),\n )\n .catch((e) => {\n console.log(\"failed to fetch settings\", e);\n listener(defaultSettings);\n });\n}\n\nfunction buildDefaultBackendBaseURL(): string | undefined {\n if (typeof window !== \"undefined\") {\n const currentLocation = new URL(\n window.location.pathname,\n window.location.origin,\n ).href;\n /**\n * By default, backend serves the html content\n * from the /webui root.\n */\n return canonicalizeBaseUrl(currentLocation.replace(\"/webui\", \"\"));\n }\n throw Error(\"No default URL\");\n}\n", "/*\n This file is part of GNU Taler\n (C) 2022-2024 Taler Systems S.A.\n\n GNU Taler is free software; you can redistribute it and/or modify it under the\n terms of the GNU General Public License as published by the Free Software\n Foundation; either version 3, or (at your option) any later version.\n\n GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY\n WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License along with\n GNU Taler; see the file COPYING. If not, see \n */\n\nimport { App } from \"./app.js\";\nimport { h, render } from \"preact\";\nimport \"./scss/main.css\";\n\nconst app = document.getElementById(\"app\");\n\nif (app) {\n render(, app);\n} else {\n console.error(\"HTML element with id 'app' not found.\");\n}\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,QAAI,SAAU,SAAUA,YAAW;AAC/B;AAEA,UAAI,OAAO,KACP,WAAW,GACX,UAAU,kBACV,cAAc,aAAa,OAAO,GAClC,mBAAmB;AAEvB,UAAI,uBAAuB,OAAO,WAAW;AAE7C,eAAS,QAAQC,IAAG,OAAO,UAAU,eAAe;AAChD,YAAI,OAAOA,OAAM;AAAa,iBAAO,QAAQ,CAAC;AAC9C,YAAI,OAAO,UAAU;AAAa,iBAAO,CAAC,UAAU,MAAM,CAAC,WAAW,WAAWA,EAAC,IAAI,UAAUA,IAAG,OAAO,UAAU,aAAa;AACjI,eAAO,WAAWA,EAAC;AAAA,MACvB;AAEA,eAAS,WAAW,OAAOC,OAAM;AAC7B,aAAK,QAAQ;AACb,aAAK,OAAOA;AACZ,aAAK,UAAU;AAAA,MACnB;AACA,iBAAW,YAAY,OAAO,OAAO,QAAQ,SAAS;AAEtD,eAAS,aAAa,OAAO;AACzB,aAAK,QAAQ;AACb,aAAK,OAAO,QAAQ;AACpB,aAAK,UAAU;AAAA,MACnB;AACA,mBAAa,YAAY,OAAO,OAAO,QAAQ,SAAS;AAExD,eAAS,a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EACvB,GAAG,IAAI,gBAAgB;EACvB,GAAG,IAAI,gBAAgB;EACvB,GAAG,IAAI,gBAAgB;EACvB,GAAG,IAAI,aAAa;EACpB,GAAG,IAAI,aAAa;EACpB,GAAG,IAAI,uBAAuB;EAC9B,GAAG,IAAI,uBAAuB;EAC9B,GAAG,IAAI,kBAAkB;EACzB,GAAG,IAAI,uBAAuB;EAC9B,GAAG,IAAI,4BAA4B;AACrC;AO3GA,IAAIC,wBAAuB;EACzB,kBAAkB;IAChB,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,UAAU;IACR,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,aAAa;IACX,YAAY;IACZ,iBAAiB;EACnB;EACA,kBAAkB;IAChB,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,UAAU;IACR,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,aAAa;IACX,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,QAAQ;IACN,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,OAAO;IACL,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,aAAa;IACX,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,QAAQ;IACN,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA,iBAAiB;MACf,KAAK;MACL,OAAO;IACT;EACF;EACA,cAAc;IACZ,YAAY;MACV,KAAK;MACL,OAAO;IACT;IACA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;AACT;;;AwYnFA;AAGA,IAAM,MAAM,SAAS,eAAe,KAAK;AAEzC,IAAI,KAAK;AACP,IAAO,kBAAC,SAAI,GAAI,GAAG;AACrB,OAAO;AACL,UAAQ,MAAM,uCAAuC;AACvD;", "names": ["undefined", "v", "sign", "n", "length", "i", "x", "add", "a", "b", "r", "base", "sum", "l", "difference", "j", "y", "d", "c", "l2", "abs", "q", "self", "_2", "exp", "t", "iterations", "fn", "p", "e", "max", "min", "range", "top", "text", "start", "pow", "left", "root", "slice", "_", "i", "l", "Jed", "i18n", "x", "k", "match", "pad", "n", "p", "hash", "parse", "self", "stack", "table", "EOF", "symbol", "a", "r", "lexer", "c", "assign", "obj", "props", "i", "removeNode", "node", "parentNode", "removeChild", "createElement", "type", "children", "key", "ref", "normalizedProps", "arguments", "length", "slice", "call", "defaultProps", "createVNode", "original", "vnode", "__k", "__", "__b", "__e", "__d", "__c", "__h", "constructor", "__v", "vnodeId", "options", "createRef", "current", "Fragment", "Component", "context", "this", "getDomSibling", "childIndex", "indexOf", "sibling", "updateParentDomPointers", "child", "base", "enqueueRender", "c", "rerenderQueue", "push", "process", "prevDebounce", "debounceRendering", "setTimeout", "queue", "__r", "sort", "a", "b", "some", "component", "commitQueue", "oldVNode", "oldDom", "parentDom", "__P", "diff", "ownerSVGElement", "commitRoot", "diffChildren", "renderResult", "newParentVNode", "oldParentVNode", "globalContext", "isSvg", "excessDomChildren", "isHydrating", "j", "childVNode", "newDom", "firstChildDom", "refs", "oldChildren", "EMPTY_ARR", "oldChildrenLength", "Array", "isArray", "EMPTY_OBJ", "reorderChildren", "placeChild", "unmount", "applyRef", "tmp", "toChildArray", "out", "nextDom", "sibDom", "outer", "appendChild", "nextSibling", "insertBefore", "diffProps", "dom", "newProps", "oldProps", "hydrate", "setProperty", "setStyle", "style", "value", "IS_NON_DIMENSIONAL", "test", "name", "oldValue", "useCapture", "o", "cssText", "replace", "toLowerCase", "l", "addEventListener", "eventProxyCapture", "eventProxy", "removeEventListener", "e", "removeAttribute", "setAttribute", "event", "newVNode", "isNew", "oldState", "snapshot", "clearProcessingException", "provider", "componentContext", "renderHook", "count", "newType", "contextType", "__E", "prototype", "render", "doRender", "sub", "state", "_sb", "__s", "getDerivedStateFromProps", "componentWillMount", "componentDidMount", "componentWillReceiveProps", "shouldComponentUpdate", "forEach", "componentWillUpdate", "componentDidUpdate", "getChildContext", "getSnapshotBeforeUpdate", "diffElementNodes", "diffed", "root", "cb", "oldHtml", "newHtml", "nodeType", "localName", "document", "createTextNode", "createElementNS", "is", "data", "childNodes", "dangerouslySetInnerHTML", "attributes", "__html", "innerHTML", "checked", "parentVNode", "skipRemove", "r", "componentWillUnmount", "replaceNode", "firstChild", "cloneElement", "createContext", "defaultValue", "contextId", "Consumer", "contextValue", "Provider", "subs", "ctx", "_props", "old", "splice", "isValidElement", "error", "errorInfo", "ctor", "handled", "getDerivedStateFromError", "setState", "componentDidCatch", "update", "callback", "s", "forceUpdate", "getHookState", "index", "type", "options", "__h", "currentComponent", "currentHook", "hooks", "__H", "__", "length", "push", "__V", "EMPTY", "useState", "initialState", "useReducer", "invokeOrReturn", "reducer", "init", "hookState", "currentIndex", "_reducer", "__c", "action", "currentValue", "__N", "nextValue", "setState", "_hasScuFromHooks", "prevScu", "shouldComponentUpdate", "p", "s", "c", "stateHooks", "filter", "x", "every", "call", "this", "shouldUpdate", "forEach", "hookItem", "props", "useEffect", "callback", "args", "state", "__s", "argsChanged", "_pendingArgs", "useLayoutEffect", "useRef", "initialValue", "useMemo", "current", "useImperativeHandle", "ref", "createHandle", "concat", "factory", "useCallback", "useContext", "context", "provider", "sub", "value", "useDebugValue", "formatter", "useErrorBoundary", "cb", "errState", "componentDidCatch", "err", "errorInfo", "undefined", "useId", "root", "__v", "__m", "mask", "flushAfterPaintEffects", "component", "afterPaintEffects", "shift", "invokeCleanup", "invokeEffect", "e", "__e", "afterNextFrame", "raf", "done", "clearTimeout", "timeout", "HAS_RAF", "cancelAnimationFrame", "setTimeout", "requestAnimationFrame", "hook", "comp", "cleanup", "oldArgs", "newArgs", "some", "arg", "f", "previousComponent", "prevRaf", "oldBeforeDiff", "oldBeforeRender", "oldAfterDiff", "oldCommit", "oldBeforeUnmount", "diffed", "unmount", "__b", "vnode", "commitQueue", "hasErrored", "assign", "obj", "props", "i", "shallowDiffers", "a", "b", "is", "x", "y", "PureComponent", "p", "this", "memo", "c", "comparer", "shouldUpdate", "nextProps", "ref", "updateRef", "call", "current", "Memoed", "shouldComponentUpdate", "createElement", "displayName", "name", "prototype", "isReactComponent", "forwardRef", "fn", "Forwarded", "clone", "$$typeof", "REACT_FORWARD_SYMBOL", "render", "__f", "detachedClone", "vnode", "detachedParent", "parentDom", "__c", "forEach", "effect", "__H", "__P", "__k", "map", "child", "removeOriginal", "originalParent", "__v", "__e", "insertBefore", "__d", "Suspense", "__u", "_suspenders", "suspended", "component", "__", "__a", "lazy", "loader", "prom", "error", "Lazy", "then", "exports", "default", "e", "SuspenseList", "_next", "_map", "ContextProvider", "getChildContext", "context", "children", "Portal", "_this", "container", "_container", "componentWillUnmount", "_temp", "nodeType", "parentNode", "childNodes", "appendChild", "push", "before", "removeChild", "splice", "indexOf", "createPortal", "el", "containerInfo", "parent", "callback", "textContent", "preactRender", "hydrate", "preactHydrate", "empty", "isPropagationStopped", "cancelBubble", "isDefaultPrevented", "defaultPrevented", "createFactory", "type", "bind", "isValidElement", "element", "REACT_ELEMENT_TYPE", "cloneElement", "preactCloneElement", "apply", "arguments", "unmountComponentAtNode", "findDOMNode", "base", "Fragment", "startTransition", "cb", "useDeferredValue", "val", "useTransition", "useLayoutEffect", "useSyncExternalStore", "subscribe", "getSnapshot", "value", "_useState", "useState", "_instance", "_getSnapshot", "forceUpdate", "useEffect", "oldDiffHook", "mapFn", "Children", "oldCatchError", "oldUnmount", "resolve", "CAMEL_PROPS", "IS_DOM", "onChangeInputType", "oldEventHook", "currentComponent", "classNameDescriptor", "oldVNodeHook", "oldBeforeRender", "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED", "version", "unstable_batchedUpdates", "flushSync", "StrictMode", "useInsertionEffect", "index", "Component", "isPureReactComponent", "state", "options", "__b", "Symbol", "for", "toChildArray", "count", "length", "only", "normalized", "toArray", "newVNode", "oldVNode", "errorInfo", "unmount", "__R", "__h", "promise", "suspendingVNode", "suspendingComponent", "resolved", "onResolved", "onSuspensionComplete", "suspendedVNode", "setState", "pop", "wasHydrating", "document", "detachedComponent", "__O", "fallback", "list", "node", "delete", "revealOrder", "size", "delegated", "get", "unsuspend", "wrappedUnsuspend", "Map", "reverse", "set", "componentDidUpdate", "componentDidMount", "test", "key", "Object", "defineProperty", "configurable", "v", "writable", "event", "persist", "nativeEvent", "class", "normalizedProps", "nonCustomElement", "toLowerCase", "replace", "multiple", "Array", "isArray", "selected", "defaultValue", "className", "enumerable", "__r", "ReactCurrentDispatcher", "readContext", "__n", "arg", "useId", "useReducer", "useRef", "useImperativeHandle", "useMemo", "useCallback", "useContext", "useDebugValue", "createContext", "createRef", "e", "h", "a", "b", "k", "l", "m", "n", "p", "q", "d", "f", "c", "g", "r", "t", "u", "init", "r", "i", "x", "n", "h", "l", "y", "d", "x", "y", "r", "a", "i", "o", "v", "c", "p", "q", "b", "t", "n", "j", "m", "d", "t0", "t1", "t2", "t3", "t12", "t13", "t22", "t23", "b2", "b3", "m", "n", "i", "j", "h", "l", "a", "b", "c", "d", "x", "r", "p", "q", "e", "f", "g", "t", "s", "r", "x", "i", "j", "k", "r", "p", "q", "t", "s", "m", "n", "i", "t", "h", "p", "q", "i", "n", "b", "h", "fn", "x", "z", "i", "o", "y", "m", "n", "h", "r", "j", "p", "x", "n", "i", "v", "TalerErrorCode", "timer", "CancellationToken", "a", "r", "n", "x", "c", "a2", "x1", "x2", "first", "a", "b", "n", "r", "s", "r2", "i", "index", "normal", "small", "type", "array", "fn", "length", "string", "counter", "k", "i", "n", "basic", "j", "index", "w", "t", "m", "q", "string", "i", "c", "hex", "init", "pair", "x", "a", "b", "scheme", "R", "numbers", "n", "counter", "pointer", "length", "number", "e", "path", "base", "res", "v", "URL", "URLSearchParams", "x", "URL", "e", "s", "i", "s2", "LogLevel", "m", "e", "location", "c", "p", "path", "x", "x", "c", "map", "i", "x", "c", "x", "c", "s", "x", "c", "x", "c", "e", "HttpStatusCode", "TalerPreciseTimestamp", "now", "t", "s", "TalerProtocolTimestamp", "zero", "min", "t1", "t2", "max", "Duration", "d", "now", "s", "i", "d2", "max", "min", "n", "AbsoluteTime", "t1", "t2", "difference", "t", "at", "start", "x", "c", "logger", "e", "logger", "e", "r", "LibtoolVersion", "compare", "v", "s", "error", "ExchangeProtocolVersion", "MerchantProtocolVersion", "TokenFamilyKind", "logger", "logger", "ReserveTransactionType", "logger", "logger", "CreditDebitIndicator", "K", "w", "v", "p", "a", "b", "c", "d", "e", "f", "g", "h", "u", "i", "j", "t1", "t2", "left", "h", "blockSize", "k", "i", "b2", "DenominationPubKey", "p2", "DenomKeyType", "t", "AmlState", "n", "a", "d", "v", "N", "i", "j", "s", "c", "p", "hash", "d", "logger", "n", "TalerSignaturePurpose", "WalletAccountMergeFlags", "c", "p", "x", "bigint", "Edx25519", "L", "sign", "a", "AgeRestriction", "count", "m", "groups", "i", "c2", "k2", "d", "group", "ContractFormatTag", "logger", "ContractTermsUtil", "path", "i", "x", "h", "k", "e", "hash", "d", "c", "e", "e", "err", "fnutil", "f", "x", "x", "c", "TransactionMajorState", "TransactionMinorState", "TransactionAction", "TransactionType", "WithdrawalType", "DenomLossEventType", "PaymentStatus", "TransactionAmountMode", "BalanceFlag", "ScopeType", "CoinStatus", "ConfirmPayResultType", "PreparePayResultType", "RefreshReason", "ExchangeTosStatus", "ExchangeEntryStatus", "ExchangeUpdateStatus", "RecoveryMergeStrategy", "AttentionPriority", "AttentionType", "ProviderPaymentType", "TalerBankConversionCacheEviction", "MonitorTimeframeParam", "TanChannel", "TalerCoreBankCacheEviction", "logger", "compare", "body", "ChallengerCacheEviction", "TalerExchangeCacheEviction", "TalerMerchantInstanceCacheEviction", "TalerMerchantManagementCacheEviction", "logger", "strings", "s", "i", "values", "children", "c", "i", "x", "children", "n", "c", "s", "NotificationType", "ObservabilityEventType", "s", "pi", "c", "path", "q", "URLSearchParams", "p", "r", "TalerUriType", "TalerUriAction", "s", "pi", "c", "q", "URLSearchParams", "p", "v", "k", "path", "URL", "logger", "h", "v", "index", "k", "_", "p", "h", "e", "match", "l", "max", "initial", "storage", "storage", "error", "d", "logger", "reverse", "path", "values", "format", "defaultWidth", "index", "string", "array", "number", "_typeof", "obj", "date", "defaultOptions", "MILLISECONDS_IN_WEEK", "formatDistance", "count", "formatRelative", "ordinalNumber", "number", "valueCallback", "index", "_typeof", "obj", "o", "p", "_setPrototypeOf", "self", "e", "_getPrototypeOf", "i", "Setter", "ValueSetter", "utcDate", "set", "_classCallCheck", "_defineProperties", "i", "_createClass", "Parser", "match", "_typeof", "obj", "_inherits", "_setPrototypeOf", "o", "p", "_createSuper", "_isNativeReflectConstruct", "_getPrototypeOf", "_possibleConstructorReturn", "self", "_assertThisInitialized", "e", "_defineProperty", "EraParser", "parse", "set", "date", "sign", "seconds", "n", "YearParser", "valueCallback", "LocalWeekYearParser", "ISOWeekYearParser", "ExtendedYearParser", "QuarterParser", "StandAloneQuarterParser", "MonthParser", "StandAloneMonthParser", "LocalWeekParser", "ISOWeekParser", "DateParser", "DayOfYearParser", "defaultOptions", "DayParser", "LocalDayParser", "StandAloneLocalDayParser", "ISODayParser", "AMPMParser", "AMPMMidnightParser", "DayPeriodParser", "Hour1to12Parser", "Hour0to23Parser", "Hour0To11Parser", "Hour1To24Parser", "MinuteParser", "SecondParser", "FractionOfSecondParser", "ISOTimezoneWithZParser", "ISOTimezoneParser", "TimestampSecondsParser", "TimestampMillisecondsParser", "parsers", "formatDistanceLocale", "formatDistance", "count", "formatDistance_default", "dateFormats", "timeFormats", "dateTimeFormats", "formatLong", "formatLong_default", "formatRelativeLocale", "formatRelative", "formatRelative_default", "eraValues", "quarterValues", "monthValues", "dayValues", "dayPeriodValues", "formattingDayPeriodValues", "ordinalNumber", "number", "localize", "argumentCallback", "localize_default", "matchOrdinalNumberPattern", "parseOrdinalNumberPattern", "matchEraPatterns", "parseEraPatterns", "matchQuarterPatterns", "parseQuarterPatterns", "matchMonthPatterns", "parseMonthPatterns", "matchDayPatterns", "parseDayPatterns", "matchDayPeriodPatterns", "parseDayPeriodPatterns", "match", "valueCallback", "index", "match_default", "locale", "date", "unit", "Context", "createContext", "initial", "children", "useEffect", "h", "useContext", "createContext", "createContext", "createContext", "createContext", "Context", "createContext", "useContext", "path", "children", "useState", "params", "useEffect", "h", "children", "h", "Context", "__export", "p", "h", "children", "e", "h", "createContext", "v", "a", "b", "cache", "type", "index", "f", "h", "s", "error", "it", "get", "set", "mutate", "i", "_", "timeout", "u2", "f2", "q", "p", "fn", "use", "middleware", "i", "index", "cache", "compare", "_", "t", "T", "error", "type", "now", "timer", "interval", "x", "SWRConfig", "a", "b", "a", "b", "f", "d", "x", "left", "a", "mid", "right", "center", "i", "x", "values", "valueof", "index", "values", "valueof", "count", "index", "array", "length", "values", "reduce", "j", "index", "i", "values", "valueof", "sum", "index", "v", "values", "valueof", "count", "mean", "sum", "index", "values", "valueof", "v", "values", "valueof", "min", "max", "index", "x", "p", "i", "j", "y", "n", "key", "values", "x", "values", "values", "reduce", "values", "map", "reduce", "i", "groups", "keyof", "index", "group", "values", "F", "f", "index", "d", "i", "j", "c", "compare", "a", "b", "x", "values", "reduce", "key", "e2", "start", "count", "error", "i2", "reverse", "n", "ticks", "i", "values", "values", "valueof", "max", "index", "values", "valueof", "max", "maxIndex", "index", "values", "valueof", "min", "index", "values", "valueof", "min", "minIndex", "index", "array", "k", "left", "right", "compare", "n", "m", "z", "s", "t", "i", "j", "values", "compare", "max", "defined", "values", "p", "valueof", "n", "i", "values", "min", "max", "c", "d", "values", "min", "max", "c", "d", "values", "valueof", "count", "sum", "index", "values", "valueof", "array", "values", "valueof", "index", "count", "values", "pairs", "first", "a", "b", "start", "n", "i", "range", "values", "valueof", "sum", "index", "values", "x", "x", "y", "number", "d", "offset", "tickFormat", "k", "transform", "axis", "values", "format", "range", "position", "selection", "path", "line", "text", "p", "_", "noop", "i", "n", "_", "t", "T", "copy", "type", "c", "i", "document", "groups", "m", "j", "group", "n", "i", "x", "empty", "groups", "m", "j", "group", "n", "i", "match", "match", "match", "groups", "m", "j", "group", "n", "i", "datum", "x", "group", "i", "groups", "m", "j", "selection", "m", "j", "n", "merge", "i", "groups", "j", "m", "group", "i", "compare", "ascending", "a", "b", "groups", "m", "j", "group", "n", "i", "groups", "j", "m", "group", "i", "n", "groups", "j", "m", "group", "i", "n", "v", "v", "v", "string", "i", "n", "v", "v", "create", "before", "create", "parseTypenames", "t", "i", "on", "j", "m", "o", "n", "type", "window", "dispatch_default", "groups", "j", "m", "group", "i", "n", "groups", "dispatch_default", "select_default", "point", "format", "m", "l", "n", "r", "g", "b", "a", "o", "opacity", "k", "h", "s", "min", "max", "m2", "K", "t2", "o", "r", "g", "b", "y", "x", "z", "l", "a", "b", "opacity", "k", "K", "y", "x", "z", "t", "t2", "o", "h", "h", "c", "l", "opacity", "o", "k", "K", "A", "B", "C", "D", "E", "o", "r", "g", "b", "l", "k", "s", "h", "opacity", "a", "t1", "v2", "t2", "t3", "values", "n", "t", "i", "values", "n", "t", "i", "v2", "constant_default", "x", "a", "d", "t", "b", "y", "constant_default", "y", "color", "rgb", "start", "r", "g", "b", "opacity", "t", "n", "i", "a", "b", "n", "c", "i", "t", "x", "a", "b", "x", "c", "i", "t", "a", "b", "d", "t", "a", "b", "t", "a", "b", "i", "c", "k", "t", "zero", "b", "t", "a", "i", "s", "q", "o", "a", "b", "t", "c", "constant_default", "a", "b", "t", "degrees", "identity", "a", "b", "c", "d", "e", "f", "m", "identity", "parse", "s", "translate", "q", "i", "a", "b", "t", "n", "o", "hsl", "hue", "start", "h", "s", "l", "opacity", "t", "lab", "start", "l", "a", "b", "opacity", "t", "hcl", "hue", "start", "h", "c", "l", "opacity", "t", "cubehelix", "hue", "y", "start", "h", "s", "l", "opacity", "t", "values", "i", "n", "v", "I", "t", "n", "i", "f", "timer", "time", "t", "e", "now", "t0", "t1", "t2", "time", "t", "id", "index", "group", "get", "set", "self", "timer", "start", "i", "j", "n", "o", "t", "empty", "i", "interrupt_default", "id", "set", "i", "n", "t", "get", "transition", "a", "b", "c", "attrRemove", "attrRemoveNS", "attrConstant", "attrConstantNS", "attrFunction", "attrFunctionNS", "attr_default", "i", "i", "t", "t0", "id", "get", "id", "set", "get", "id", "set", "get", "id", "v", "set", "filter_default", "match", "groups", "m", "j", "group", "n", "i", "merge_default", "transition", "m", "j", "n", "merge", "i", "t", "i", "id", "set", "on", "on_default", "get", "id", "i", "remove_default", "select_default", "id", "groups", "m", "j", "group", "n", "i", "get", "selectAll_default", "id", "groups", "m", "j", "group", "n", "i", "children", "inherit", "get", "k", "l", "Selection", "selection_default", "styleRemove", "styleConstant", "styleFunction", "id", "remove", "set", "on", "style_default", "i", "i", "t", "textConstant", "textFunction", "text_default", "i", "t", "t0", "groups", "m", "j", "group", "n", "i", "inherit", "get", "id", "set", "on", "groups", "id", "select_default", "selectAll_default", "filter_default", "merge_default", "selection_default", "on_default", "attr_default", "style_default", "text_default", "remove_default", "t", "id", "transition_default", "groups", "m", "j", "group", "n", "i", "interrupt_default", "transition_default", "max", "min", "e", "number2", "X", "x", "Y", "y", "t", "epsilon", "strings", "i", "n", "d", "k", "x", "y", "x1", "y1", "x2", "y2", "r", "x0", "y0", "l", "w", "h", "i", "f", "column", "s", "length", "date", "seconds", "milliseconds", "delimiter", "parse", "text", "convert", "N", "I", "n", "t", "j", "c", "format", "number", "m", "text_default", "init", "parse", "init", "text_default", "csv", "tsv", "x", "p", "i", "x", "i", "t", "j", "g", "length", "i", "match", "s", "n", "i", "x", "p", "d", "i", "n", "x", "p", "d", "x", "p", "identity_default", "x", "map", "locale", "group", "identity_default", "sign", "symbol", "zero", "type", "format", "i", "n", "c", "length", "formatPrefix", "f", "e", "k", "value", "max", "epsilon", "epsilon2", "pi", "tau", "degrees", "radians", "abs", "x", "pi", "noop", "i", "n", "cartesian", "spherical", "a", "b", "k", "d", "l", "a", "b", "compose", "x", "y", "abs", "pi", "tau", "x", "y", "z", "k", "radians", "degrees", "radius", "t0", "t1", "tau", "point", "t", "epsilon", "line", "x", "y", "m", "noop", "a", "b", "abs", "epsilon", "point", "compareIntersection", "i", "n", "x", "epsilon", "start", "array", "a", "b", "point", "abs", "pi", "tau", "sum", "epsilon", "i", "n", "m", "j", "sign", "k", "epsilon2", "start", "line", "point", "i", "n", "m", "a", "b", "epsilon", "pi", "abs", "epsilon", "radius", "radians", "abs", "epsilon", "point2", "v", "c", "pi", "t", "a", "b", "c2", "A", "B", "u", "w", "t2", "q", "z", "delta", "r", "code", "a", "b", "x0", "y0", "x1", "y1", "t0", "t1", "r", "x0", "y0", "x1", "y1", "x", "y", "a", "p", "abs", "epsilon", "compareIntersection", "b", "first", "point", "i", "n", "ring", "j", "m", "visible", "v", "identity_default", "x", "noop", "abs", "area", "x", "y", "x0", "y0", "noop", "x", "y", "X2", "Y2", "Z2", "x00", "y00", "x0", "y0", "x", "y", "z", "_", "x", "y", "tau", "noop", "x00", "y00", "x0", "y0", "noop", "length", "x", "y", "append", "appendRound", "_", "x", "y", "r", "s", "strings", "i", "j", "d", "k", "projection", "path", "_", "identity_default", "d", "s", "x", "y", "projection", "extent", "b", "w", "h", "k", "x", "y", "radians", "project", "x", "y", "x0", "y0", "x1", "y1", "d2", "a", "b", "c", "m", "abs", "epsilon", "p", "x2", "y2", "x00", "y00", "point", "x", "y", "radians", "r", "k", "transform", "a", "b", "project", "x0", "y0", "x1", "y1", "identity_default", "cache", "projection", "point", "degrees", "_", "extent", "center", "pi", "m", "p", "_", "radians", "degrees", "x", "y", "y0", "y1", "n", "abs", "epsilon", "c", "project", "x", "y", "r", "l", "pi", "n", "x", "y", "i", "cache", "point", "k", "t", "_", "epsilon", "extent", "x", "y", "k", "z", "c", "z", "c", "z", "x", "y", "tau", "project", "m", "center", "translate", "x0", "y0", "x1", "y1", "_", "k", "pi", "t", "y", "y0", "y1", "n", "f", "project", "x", "epsilon", "r", "l", "abs", "pi", "y0", "y1", "n", "g", "abs", "epsilon", "project", "x", "y", "l", "pi", "A2", "A3", "A4", "M", "l", "l2", "x", "y", "i", "abs", "epsilon2", "x", "y", "k", "x", "y", "epsilon", "x", "y", "k", "z", "x", "y", "m", "center", "_", "range", "index", "range", "d", "i", "_", "ordinalRange", "n", "reverse", "start", "values", "i", "_", "copy", "constants", "x", "number", "x", "identity", "x", "normalize", "a", "b", "constants", "t", "range", "j", "d", "r", "i", "transformer", "transform", "piecewise", "n", "y", "_", "number", "u", "start", "count", "count", "d", "start", "linear", "identity", "x", "_", "number", "interval", "x0", "x1", "t", "x", "base", "f", "k", "transform", "_", "count", "d", "u", "v", "r", "i", "j", "t", "n", "z", "log", "transformer", "c", "x", "transform", "_", "transformer", "x", "transform", "identity", "_", "pow", "transformer", "quantile", "range", "i", "n", "x", "y", "_", "d", "range", "n", "x", "_", "y", "i", "t0", "t1", "count", "field", "interval", "date", "start", "range", "d", "date", "start", "k", "date", "start", "date", "start", "date", "start", "date", "start", "i", "date", "start", "date", "start", "date", "start", "k", "tickIntervals", "ticks", "start", "count", "reverse", "interval", "i", "step", "t", "d", "date", "y", "m", "locale", "formatYear", "formats", "string", "i", "j", "n", "c", "pad", "format", "Z", "parse", "f", "p", "sign", "length", "s", "z", "locale", "defaultLocale", "t", "number", "ticks", "second", "format", "formatYear", "tickFormat", "date", "y", "_", "interval", "d", "count", "copy", "transformer", "x0", "x1", "x2", "s", "t0", "t1", "t2", "identity", "transform", "x", "_", "range", "r2", "t", "copy", "n", "i", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "scheme", "t", "cubehelix_default", "c", "t", "c", "t", "x", "t", "range", "n", "t", "constant_default", "x", "constant", "cos", "min", "sin", "sqrt", "epsilon", "pi", "halfPi", "tau", "_", "d", "x", "x", "y", "x", "p", "y", "line_default", "x", "y", "defined", "constant_default", "path", "line", "i", "n", "d", "_", "area_default", "x0", "y0", "y1", "x1", "defined", "constant_default", "path", "area", "x", "y", "i", "j", "k", "n", "d", "line_default", "_", "x", "y", "sqrt3", "sqrt", "r", "min", "t", "u", "circle_default", "r", "sqrt", "pi", "tau", "r", "sqrt", "sqrt", "y", "x", "r", "sqrt", "r", "sqrt", "min", "w", "sqrt", "x", "r", "sqrt", "sin", "pi", "tau", "cos", "r", "sqrt", "x", "y", "i", "a", "c", "s", "sqrt3", "sqrt", "y", "sqrt3", "sqrt", "s", "t", "u", "c", "s", "sqrt", "k", "a", "r", "x0", "y0", "x1", "y1", "x2", "y2", "r", "sqrt", "min", "circle_default", "point", "x", "y", "basis_default", "x", "y", "point", "basisClosed_default", "x", "y", "x0", "y0", "point", "x", "y", "j", "x0", "y0", "i", "t", "beta", "point", "x", "y", "custom", "tension", "x", "y", "point", "custom", "tension", "x", "y", "point", "custom", "tension", "point", "x", "y", "x1", "y1", "x2", "y2", "epsilon", "a", "n", "b", "m", "custom", "alpha", "x", "y", "point", "custom", "alpha", "x", "y", "point", "custom", "alpha", "x", "y", "sign", "x", "x2", "y2", "p", "t", "h", "point", "t0", "t1", "x0", "y0", "x1", "y1", "y", "x", "y", "n", "i", "m", "a", "b", "r", "t", "x", "y", "x1", "k", "x", "y", "point", "location", "identity", "x", "ascendingDefined", "a", "b", "format", "date", "seconds", "milliseconds", "formatYear", "pad", "re", "string", "values", "first", "durationSecond", "durationMinute", "durationHour", "durationDay", "durationWeek", "durationMonth", "durationYear", "interval", "match", "type", "n", "d", "i", "format", "template", "f2", "a", "b", "intervalType", "format2", "x", "X", "j", "type", "map", "values", "index", "f", "arrayify", "d", "i", "range", "identity", "one", "x", "number", "x", "second", "x", "reduce", "p", "I", "f", "values", "map", "i", "arrayify", "type", "slice", "y", "y1", "y2", "sort", "x", "x1", "x2", "x3", "identity", "y", "second", "z", "range", "n", "r", "i", "values", "index", "map", "i", "I", "i", "j", "keyof", "v", "x1", "x2", "X1", "X2", "map", "_", "V", "t", "interval", "type", "n", "d", "x", "values", "type", "inherit", "o", "defaults", "named", "color", "length", "projection", "sqrt3", "circle_default", "symbol", "t1", "transform", "initializer", "t2", "arrayify", "i2", "c2", "d2", "f2", "V", "I", "i", "I", "compare", "i", "j", "I", "ascendingDefined", "V", "reduce", "O", "I", "extent", "reducer", "V", "range", "X", "i", "o", "sort", "reverse", "S", "compare", "i", "j", "ascendingDefined", "f", "reduce", "I", "X", "extent", "x", "n", "groups", "V", "second", "top", "bottom", "s", "basis", "I", "X", "z", "type", "filter", "values", "map", "x", "y", "reverse", "reduce", "X", "reducer", "range", "I", "i", "V2", "j", "k2", "X1", "X2", "x2", "ascendingDefined", "document", "create", "select_default", "w", "pi", "tau", "projection", "transform", "x0", "y0", "x1", "y1", "k", "x", "y", "identity", "s", "conicProjection", "x2", "y2", "createProjection", "kx", "ky", "type", "values", "n", "X", "Y", "i", "X", "Y", "x", "y", "scheme", "scheme11", "scheme9", "cubehelix_default", "n", "t", "s", "length", "r", "range", "f", "i", "t", "unit", "lab", "type", "nice", "zero", "scheme", "interval", "range", "length", "color", "reverse", "n", "arrayify", "m", "_", "min", "max", "slice", "linear", "pow", "base", "log", "constant", "quantile", "x", "sign", "d", "s", "identity", "f", "radius", "k", "r", "v", "j", "transform", "type", "nice", "scheme", "range", "color", "reverse", "arrayify", "min", "max", "mid", "transformPow", "base", "transformLog", "constant", "transformSymlog", "x", "transformSqrt", "type", "interval", "range", "reverse", "inferDomain", "scheme", "map", "color", "t0", "d", "n", "t", "values", "v", "min", "max", "ascendingDefined", "nice", "zero", "projection", "transform", "type", "interval", "x", "y", "l", "left", "right", "top", "bottom", "n", "start", "m", "length", "_", "i", "type", "values", "range", "scheme", "projection", "t", "length", "color", "type", "i", "n", "c", "values", "map", "type", "range", "interval", "transform", "d", "slice", "t", "k", "i", "locale", "format", "i", "date", "format", "locale", "number", "v", "opacity", "selection", "L", "i", "T", "tip", "F", "S", "O", "H", "c", "I", "Z", "z", "G", "position", "A", "C", "keyof", "j", "k", "id", "create", "g", "projection", "h", "a", "x", "y", "number", "marks", "marginTop", "marginRight", "marginBottom", "marginLeft", "x", "y", "projection", "w", "k", "type", "transform", "min", "max", "x", "y", "i", "X", "Y", "f", "a", "b", "I", "range", "G", "index", "e", "d", "n", "j", "V", "map", "v", "keyof", "empty", "groups", "defaults", "sort", "tip", "arrayify", "range", "index", "values", "filter", "i", "marks", "r2", "s", "v", "d", "c", "pointer", "kx", "ky", "x", "y", "index", "values", "render", "px", "i", "py", "g", "s", "f", "r", "I", "p", "j", "X1", "X2", "X", "Y1", "Y2", "Y", "color", "ticks", "tickFormat", "opacity", "create", "svg", "g", "x", "range", "type", "n", "i", "j", "d", "linear", "map", "_", "radians", "color", "create", "path", "S", "i", "id", "interval", "k", "v", "v2", "V", "transform", "map", "V2", "x", "y1", "y2", "number", "index", "y", "X", "Y1", "Y2", "create", "g", "i", "x1", "x2", "Y", "X1", "X2", "identity", "strings", "n", "j", "copy", "i", "s", "defaults", "x", "y", "text", "identity", "index", "X", "Y", "R", "T", "create", "g", "i", "selection", "n", "m", "inferFontVariant", "j", "k", "start", "sum", "I", "w", "l", "ellipsis", "e", "defaults", "l", "r", "x", "y", "length", "index", "X", "Y", "L", "A", "create", "g", "i", "p", "x", "identity", "y", "maybeAnchor", "anchorY", "anchorX", "k", "color", "opacity", "x", "number", "data", "marginTop", "marginRight", "marginBottom", "marginLeft", "y", "radians", "text", "ticks", "tickFormat", "inferFontVariant", "x1", "x2", "y1", "y2", "initializer", "interval", "arrayify", "min", "max", "n", "d", "i", "range", "identity", "m", "l", "s", "color", "opacity", "selection", "symbol", "r", "scale", "d", "p", "tickFormat", "create", "defaults", "key", "ticks", "tickFormat", "inherit", "color", "type", "r", "g", "b", "t", "o", "defaults", "number", "index", "x1", "x2", "y1", "y2", "create", "line", "frame", "defaults", "identity", "x", "y", "x1", "x2", "y1", "y2", "format", "number", "index", "values", "document", "r", "m", "X1", "Y1", "X2", "Y2", "X", "Y", "g", "create", "i", "select_default", "line", "selection", "color", "opacity", "w", "j", "k", "h", "a", "path", "text", "t", "length", "c2", "l2", "marks", "index", "i", "f", "facets", "document", "dimensions", "fx", "fy", "select_default", "svg", "values", "indexes", "g", "w", "e", "t", "type", "interval", "transform", "x", "map", "filter", "y", "arrayify", "groups", "data", "channels", "p", "a", "projection", "axis", "defaults", "line", "frame", "ticks", "tickFormat", "k", "m", "x1", "x2", "basis_default", "basisClosed_default", "c", "x", "y", "identity", "k", "reduce", "filter", "sort", "reverse", "identity", "k", "x", "y", "z", "x1", "x2", "y1", "y2", "interval", "K", "Z", "F", "S", "G", "GK", "GZ", "GF", "GS", "BX1", "BX2", "BY1", "BY2", "i", "o", "f", "I", "g", "b", "extent", "V", "T", "map", "min", "max", "t", "n", "i", "E", "interval", "reduce", "values", "I", "X", "x1", "x2", "Y", "y1", "y2", "B", "C", "b", "j", "m", "identity", "n", "O", "i", "slice", "R", "j", "k", "m", "mergeOptions", "x1", "x", "y", "transform", "X", "y1", "y2", "y", "y1", "y2", "mergeOptions", "offset", "reverse", "x", "one", "kx", "ky", "z", "X", "Y1", "Y2", "maybeOrder", "Y", "Z", "compare", "n", "i", "stack", "yn", "extent", "min", "max", "m", "j", "d", "I", "p", "ascendingDefined", "range", "K", "s", "k", "f", "O", "map", "defaults", "x1", "y1", "x2", "y2", "z", "index", "X1", "Y1", "X2", "Y2", "create", "g", "area_default", "i", "x", "defaults", "x", "y", "z", "index", "values", "X", "Y", "create", "g", "line_default", "i", "projection", "path", "I", "line", "x", "y", "identity", "_", "p", "h", "csv", "d", "plot", "DecodingError", "renderContext", "c", "p", "joinContext", "path", "ObjectCodecBuilder", "x", "buildCodecForObject", "ObjectCodecBuilder", "codecForMap", "x", "c", "map", "DecodingError", "renderContext", "i", "joinContext", "codecForNumber", "x", "c", "DecodingError", "renderContext", "codecForBoolean", "codecForString", "codecOptional", "x", "c", "codecForEither", "e", "DecodingError", "renderContext", "codecForString", "codecForNumber", "opaque_AbsoluteTime", "TalerPreciseTimestamp", "now", "AbsoluteTime", "t", "s", "TalerProtocolTimestamp", "zero", "min", "t1", "t2", "max", "timeshift", "Duration", "d", "now", "AbsoluteTime", "s", "i", "d2", "max", "durationMax", "min", "durationMin", "n", "durationMul", "SECONDS", "MINUTES", "HOURS", "DAYS", "MONTHS", "YEARS", "timeshift", "opaque_AbsoluteTime", "t1", "t2", "difference", "t", "at", "start", "assertUnreachable", "x", "canonicalizeBaseUrl", "children", "i18n", "location", "h", "p", "assertUnreachable", "initial", "Context", "children", "Context", "buildCodecForObject", "codecOptional", "codecForString", "codecForBoolean", "codecForMap", "e", "canonicalizeBaseUrl", "p", "h", "SWRConfig", "map"] } diff --git a/src/Routing.tsx b/src/Routing.tsx index a1cb89d..5d24dff 100644 --- a/src/Routing.tsx +++ b/src/Routing.tsx @@ -43,7 +43,7 @@ function AppFrame({ children }: { children: ComponentChildren }) { alt="Your Company" />
    -