@bigbinary/neeto-playwright-commons 1.9.32 → 1.9.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -3,24 +3,25 @@ import * as fs$d from 'fs';
3
3
  import fs__default, { writeFileSync as writeFileSync$1, unlinkSync, readFileSync } from 'fs';
4
4
  import test$1, { expect, test as test$2, defineConfig, devices } from '@playwright/test';
5
5
  import { curry, not, isEmpty as isEmpty$1, isNil, isNotNil, mergeDeepLeft, mergeAll } from 'ramda';
6
- import require$$0$2 from 'util';
6
+ import require$$0$1 from 'util';
7
7
  import * as Path from 'path';
8
8
  import Path__default from 'path';
9
9
  import { faker } from '@faker-js/faker';
10
10
  import MailosaurClient from 'mailosaur';
11
11
  import dayjs from 'dayjs';
12
- import require$$0$4 from 'tty';
13
- import require$$0$3 from 'os';
12
+ import require$$0$3 from 'tty';
13
+ import require$$0$2 from 'os';
14
+ import stealth$1 from 'puppeteer-extra-plugin-stealth';
14
15
  import Stream$4 from 'stream';
15
- import require$$0$5 from 'events';
16
+ import require$$0$4 from 'events';
16
17
  import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
17
- import { isNotEmpty, humanize, isPresent, dynamicArray, isNotPresent } from '@bigbinary/neeto-cist';
18
+ import { isNotEmpty, humanize, hyphenate, isPresent, dynamicArray, isNotPresent } from '@bigbinary/neeto-cist';
18
19
  import http$1 from 'http';
19
20
  import Url from 'url';
20
- import require$$0$6 from 'punycode';
21
+ import require$$0$5 from 'punycode';
21
22
  import https$1 from 'https';
22
23
  import zlib$5 from 'zlib';
23
- import require$$0$7 from 'assert';
24
+ import require$$0$6 from 'assert';
24
25
  import require$$3 from 'buffer';
25
26
  import require$$3$1 from 'querystring';
26
27
  import require$$1$1 from 'string_decoder';
@@ -1828,7 +1829,7 @@ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
1828
1829
  return intrinsic;
1829
1830
  };
1830
1831
 
1831
- var util_inspect = require$$0$2.inspect;
1832
+ var util_inspect = require$$0$1.inspect;
1832
1833
 
1833
1834
  var hasMap = typeof Map === 'function' && Map.prototype;
1834
1835
  var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
@@ -2549,7 +2550,7 @@ var arrayToObject = function arrayToObject(source, options) {
2549
2550
  return obj;
2550
2551
  };
2551
2552
 
2552
- var merge$3 = function merge(target, source, options) {
2553
+ var merge$2 = function merge(target, source, options) {
2553
2554
  /* eslint no-param-reassign: 0 */
2554
2555
  if (!source) {
2555
2556
  return target;
@@ -2766,7 +2767,7 @@ var utils$o = {
2766
2767
  isBuffer: isBuffer,
2767
2768
  isRegExp: isRegExp,
2768
2769
  maybeMap: maybeMap,
2769
- merge: merge$3
2770
+ merge: merge$2
2770
2771
  };
2771
2772
 
2772
2773
  var getSideChannel = sideChannel;
@@ -3174,6 +3175,7 @@ var parseValues = function parseQueryStringValues(str, options) {
3174
3175
  var obj = { __proto__: null };
3175
3176
 
3176
3177
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
3178
+ cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
3177
3179
  var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
3178
3180
  var parts = cleanStr.split(options.delimiter, limit);
3179
3181
  var skipIndex = -1; // Keep track of where the utf8 sentinel was found
@@ -4424,7 +4426,7 @@ var hasRequiredSupportsColor;
4424
4426
  function requireSupportsColor () {
4425
4427
  if (hasRequiredSupportsColor) return supportsColor_1;
4426
4428
  hasRequiredSupportsColor = 1;
4427
- const os = require$$0$3;
4429
+ const os = require$$0$2;
4428
4430
  const hasFlag = requireHasFlag();
4429
4431
 
4430
4432
  const env = process.env;
@@ -4568,8 +4570,8 @@ function requireNode () {
4568
4570
  if (hasRequiredNode) return node.exports;
4569
4571
  hasRequiredNode = 1;
4570
4572
  (function (module, exports) {
4571
- const tty = require$$0$4;
4572
- const util = require$$0$2;
4573
+ const tty = require$$0$3;
4574
+ const util = require$$0$1;
4573
4575
 
4574
4576
  /**
4575
4577
  * This is the Node.js implementation of `debug()`.
@@ -4843,7 +4845,7 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
4843
4845
  }
4844
4846
 
4845
4847
  var srcExports = src$1.exports;
4846
- var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
4848
+ var Debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
4847
4849
 
4848
4850
  /*!
4849
4851
  * playwright-extra v4.3.5 by berstend
@@ -4926,7 +4928,7 @@ const playwrightLoader = new Loader('playwright', [
4926
4928
  'playwright'
4927
4929
  ]);
4928
4930
 
4929
- const debug = debug$3('playwright-extra:puppeteer-compat');
4931
+ const debug = Debug('playwright-extra:puppeteer-compat');
4930
4932
  const isPlaywrightPage = (obj) => {
4931
4933
  return 'unroute' in obj;
4932
4934
  };
@@ -5116,7 +5118,7 @@ function createBrowserShim(browser) {
5116
5118
  return shim;
5117
5119
  }
5118
5120
 
5119
- const debug$1 = debug$3('playwright-extra:plugins');
5121
+ const debug$1 = Debug('playwright-extra:plugins');
5120
5122
  class PluginList {
5121
5123
  constructor() {
5122
5124
  this._plugins = [];
@@ -5457,7 +5459,7 @@ If your bundler has issues with dynamic imports take a look at '.plugins.setDepe
5457
5459
  }
5458
5460
  }
5459
5461
 
5460
- const debug$2 = debug$3('playwright-extra');
5462
+ const debug$2 = Debug('playwright-extra');
5461
5463
  /**
5462
5464
  * Modular plugin framework to teach `playwright` new tricks.
5463
5465
  */
@@ -5735,715 +5737,6 @@ playwrightLoader.lazyloadExportOrDie('selectors');
5735
5737
  playwrightLoader.lazyloadExportOrDie('devices');
5736
5738
  playwrightLoader.lazyloadExportOrDie('errors');
5737
5739
 
5738
- /*!
5739
- * puppeteer-extra-plugin v3.2.2 by berstend
5740
- * https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin
5741
- * @license MIT
5742
- */
5743
-
5744
- /** @private */
5745
- const merge$2 = require('merge-deep');
5746
- /**
5747
- * Base class for `puppeteer-extra` plugins.
5748
- *
5749
- * Provides convenience methods to avoid boilerplate.
5750
- *
5751
- * All common `puppeteer` browser events will be bound to
5752
- * the plugin instance, if a respectively named class member is found.
5753
- *
5754
- * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well.
5755
- *
5756
- * @example
5757
- * // hello-world-plugin.js
5758
- * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')
5759
- *
5760
- * class Plugin extends PuppeteerExtraPlugin {
5761
- * constructor (opts = { }) { super(opts) }
5762
- *
5763
- * get name () { return 'hello-world' }
5764
- *
5765
- * async onPageCreated (page) {
5766
- * this.debug('page created', page.url())
5767
- * const ua = await page.browser().userAgent()
5768
- * this.debug('user agent', ua)
5769
- * }
5770
- * }
5771
- *
5772
- * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) }
5773
- *
5774
- *
5775
- * // foo.js
5776
- * const puppeteer = require('puppeteer-extra')
5777
- * puppeteer.use(require('./hello-world-plugin')())
5778
- *
5779
- * ;(async () => {
5780
- * const browser = await puppeteer.launch({headless: false})
5781
- * const page = await browser.newPage()
5782
- * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'})
5783
- * await browser.close()
5784
- * })()
5785
- *
5786
- */
5787
- class PuppeteerExtraPlugin$1 {
5788
- constructor(opts) {
5789
- this._debugBase = debug$3(`puppeteer-extra-plugin:base:${this.name}`);
5790
- this._childClassMembers = [];
5791
- this._opts = merge$2(this.defaults, opts || {});
5792
- this._debugBase('Initialized.');
5793
- }
5794
- /**
5795
- * Plugin name (required).
5796
- *
5797
- * Convention:
5798
- * - Package: `puppeteer-extra-plugin-anonymize-ua`
5799
- * - Name: `anonymize-ua`
5800
- *
5801
- * @example
5802
- * get name () { return 'anonymize-ua' }
5803
- */
5804
- get name() {
5805
- throw new Error('Plugin must override "name"');
5806
- }
5807
- /**
5808
- * Plugin defaults (optional).
5809
- *
5810
- * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation).
5811
- *
5812
- * The result of merging defaults with user supplied options can be accessed through `this.opts`.
5813
- *
5814
- * @see [[opts]]
5815
- *
5816
- * @example
5817
- * get defaults () {
5818
- * return {
5819
- * stripHeadless: true,
5820
- * makeWindows: true,
5821
- * customFn: null
5822
- * }
5823
- * }
5824
- *
5825
- * // Users can overwrite plugin defaults during instantiation:
5826
- * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))
5827
- */
5828
- get defaults() {
5829
- return {};
5830
- }
5831
- /**
5832
- * Plugin requirements (optional).
5833
- *
5834
- * Signal certain plugin requirements to the base class and the user.
5835
- *
5836
- * Currently supported:
5837
- * - `launch`
5838
- * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`),
5839
- * will output a warning to the user.
5840
- * - `headful`
5841
- * - If the plugin doesn't work in `headless: true` mode,
5842
- * will output a warning to the user.
5843
- * - `dataFromPlugins`
5844
- * - In case the plugin requires data from other plugins.
5845
- * will enable usage of `this.getDataFromPlugins()`.
5846
- * - `runLast`
5847
- * - In case the plugin prefers to run after the others.
5848
- * Useful when the plugin needs data from others.
5849
- *
5850
- * @example
5851
- * get requirements () {
5852
- * return new Set(['runLast', 'dataFromPlugins'])
5853
- * }
5854
- */
5855
- get requirements() {
5856
- return new Set([]);
5857
- }
5858
- /**
5859
- * Plugin dependencies (optional).
5860
- *
5861
- * Missing plugins will be required() by puppeteer-extra.
5862
- *
5863
- * @example
5864
- * get dependencies () {
5865
- * return new Set(['user-preferences'])
5866
- * }
5867
- * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.
5868
- */
5869
- get dependencies() {
5870
- return new Set([]);
5871
- }
5872
- /**
5873
- * Plugin data (optional).
5874
- *
5875
- * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,
5876
- * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`).
5877
- *
5878
- * Convention: `[ {name: 'Any name', value: 'Any value'} ]`
5879
- *
5880
- * @see [[getDataFromPlugins]]
5881
- *
5882
- * @example
5883
- * // plugin1.js
5884
- * get data () {
5885
- * return [
5886
- * {
5887
- * name: 'userPreferences',
5888
- * value: { foo: 'bar' }
5889
- * },
5890
- * {
5891
- * name: 'userPreferences',
5892
- * value: { hello: 'world' }
5893
- * }
5894
- * ]
5895
- *
5896
- * // plugin2.js
5897
- * get requirements () { return new Set(['dataFromPlugins']) }
5898
- *
5899
- * async beforeLaunch () {
5900
- * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value)
5901
- * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ]
5902
- * }
5903
- */
5904
- get data() {
5905
- return [];
5906
- }
5907
- /**
5908
- * Access the plugin options (usually the `defaults` merged with user defined options)
5909
- *
5910
- * To skip the auto-merging of defaults with user supplied opts don't define a `defaults`
5911
- * property and set the `this._opts` Object in your plugin constructor directly.
5912
- *
5913
- * @see [[defaults]]
5914
- *
5915
- * @example
5916
- * get defaults () { return { foo: "bar" } }
5917
- *
5918
- * async onPageCreated (page) {
5919
- * this.debug(this.opts.foo) // => bar
5920
- * }
5921
- */
5922
- get opts() {
5923
- return this._opts;
5924
- }
5925
- /**
5926
- * Convenience debug logger based on the [debug] module.
5927
- * Will automatically namespace the logging output to the plugin package name.
5928
- * [debug]: https://www.npmjs.com/package/debug
5929
- *
5930
- * ```bash
5931
- * # toggle output using environment variables
5932
- * DEBUG=puppeteer-extra-plugin:<plugin_name> node foo.js
5933
- * # to debug all the things:
5934
- * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js
5935
- * ```
5936
- *
5937
- * @example
5938
- * this.debug('hello world')
5939
- * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'
5940
- */
5941
- get debug() {
5942
- return debug$3(`puppeteer-extra-plugin:${this.name}`);
5943
- }
5944
- /**
5945
- * Before a new browser instance is created/launched.
5946
- *
5947
- * Can be used to modify the puppeteer launch options by modifying or returning them.
5948
- *
5949
- * Plugins using this method will be called in sequence to each
5950
- * be able to update the launch options.
5951
- *
5952
- * @example
5953
- * async beforeLaunch (options) {
5954
- * if (this.opts.flashPluginPath) {
5955
- * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`)
5956
- * }
5957
- * }
5958
- *
5959
- * @param options - Puppeteer launch options
5960
- */
5961
- async beforeLaunch(options) {
5962
- // noop
5963
- }
5964
- /**
5965
- * After the browser has launched.
5966
- *
5967
- * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
5968
- * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created.
5969
- * In order to make the plugins as stateless as possible don't store a reference to the browser instance
5970
- * in the plugin but rather consider alternatives.
5971
- *
5972
- * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`.
5973
- *
5974
- * Alternatively you could expose a class method that takes a browser instance as a parameter to work with:
5975
- *
5976
- * ```es6
5977
- * const fancyPlugin = require('puppeteer-extra-plugin-fancy')()
5978
- * puppeteer.use(fancyPlugin)
5979
- * const browser = await puppeteer.launch()
5980
- * await fancyPlugin.killBrowser(browser)
5981
- * ```
5982
- *
5983
- * @param browser - The `puppeteer` browser instance.
5984
- * @param opts.options - Puppeteer launch options used.
5985
- *
5986
- * @example
5987
- * async afterLaunch (browser, opts) {
5988
- * this.debug('browser has been launched', opts.options)
5989
- * }
5990
- */
5991
- async afterLaunch(browser, opts = { options: {} }) {
5992
- // noop
5993
- }
5994
- /**
5995
- * Before connecting to an existing browser instance.
5996
- *
5997
- * Can be used to modify the puppeteer connect options by modifying or returning them.
5998
- *
5999
- * Plugins using this method will be called in sequence to each
6000
- * be able to update the launch options.
6001
- *
6002
- * @param {Object} options - Puppeteer connect options
6003
- * @return {Object=}
6004
- */
6005
- async beforeConnect(options) {
6006
- // noop
6007
- }
6008
- /**
6009
- * After connecting to an existing browser instance.
6010
- *
6011
- * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
6012
- *
6013
- * @param browser - The `puppeteer` browser instance.
6014
- * @param {Object} opts
6015
- * @param {Object} opts.options - Puppeteer connect options used.
6016
- *
6017
- */
6018
- async afterConnect(browser, opts = {}) {
6019
- // noop
6020
- }
6021
- /**
6022
- * Called when a browser instance is available.
6023
- *
6024
- * This applies to both `puppeteer.launch()` and `puppeteer.connect()`.
6025
- *
6026
- * Convenience method created for plugins that need access to a browser instance
6027
- * and don't mind if it has been created through `launch` or `connect`.
6028
- *
6029
- * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
6030
- *
6031
- * @param browser - The `puppeteer` browser instance.
6032
- */
6033
- async onBrowser(browser, opts) {
6034
- // noop
6035
- }
6036
- /**
6037
- * Called when a target is created, for example when a new page is opened by window.open or browser.newPage.
6038
- *
6039
- * > Note: This includes target creations in incognito browser contexts.
6040
- *
6041
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
6042
- *
6043
- * @param {Puppeteer.Target} target
6044
- */
6045
- async onTargetCreated(target) {
6046
- // noop
6047
- }
6048
- /**
6049
- * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience.
6050
- *
6051
- * > Note: This includes page creations in incognito browser contexts.
6052
- *
6053
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
6054
- *
6055
- * @param {Puppeteer.Target} target
6056
- *
6057
- * @example
6058
- * async onPageCreated (page) {
6059
- * let ua = await page.browser().userAgent()
6060
- * if (this.opts.stripHeadless) {
6061
- * ua = ua.replace('HeadlessChrome/', 'Chrome/')
6062
- * }
6063
- * this.debug('new ua', ua)
6064
- * await page.setUserAgent(ua)
6065
- * }
6066
- */
6067
- async onPageCreated(page) {
6068
- // noop
6069
- }
6070
- /**
6071
- * Called when the url of a target changes.
6072
- *
6073
- * > Note: This includes target changes in incognito browser contexts.
6074
- *
6075
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
6076
- *
6077
- * @param {Puppeteer.Target} target
6078
- */
6079
- async onTargetChanged(target) {
6080
- // noop
6081
- }
6082
- /**
6083
- * Called when a target is destroyed, for example when a page is closed.
6084
- *
6085
- * > Note: This includes target destructions in incognito browser contexts.
6086
- *
6087
- * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
6088
- *
6089
- * @param {Puppeteer.Target} target
6090
- */
6091
- async onTargetDestroyed(target) {
6092
- // noop
6093
- }
6094
- /**
6095
- * Called when Puppeteer gets disconnected from the Chromium instance.
6096
- *
6097
- * This might happen because of one of the following:
6098
- * - Chromium is closed or crashed
6099
- * - The `browser.disconnect` method was called
6100
- */
6101
- async onDisconnected() {
6102
- // noop
6103
- }
6104
- /**
6105
- * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved
6106
- * and should be used instead of `onClose`.
6107
- *
6108
- * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios.
6109
- * In order for plugins to clean up properly (e.g. deleting temporary files)
6110
- * the `onClose` method had been introduced.
6111
- *
6112
- * > Note: Might be called multiple times on exit.
6113
- *
6114
- * > Note: This only includes browser instances created through `.launch()`.
6115
- */
6116
- async onClose() {
6117
- // noop
6118
- }
6119
- /**
6120
- * After the plugin has been registered in `puppeteer-extra`.
6121
- *
6122
- * Normally right after `puppeteer.use(plugin)` is called
6123
- */
6124
- async onPluginRegistered() {
6125
- // noop
6126
- }
6127
- /**
6128
- * Helper method to retrieve `data` objects from other plugins.
6129
- *
6130
- * A plugin needs to state the `dataFromPlugins` requirement
6131
- * in order to use this method. Will be mapped to `puppeteer.getPluginData`.
6132
- *
6133
- * @param name - Filter data by `name` property
6134
- *
6135
- * @see [data]
6136
- * @see [requirements]
6137
- */
6138
- getDataFromPlugins(name) {
6139
- return [];
6140
- }
6141
- /**
6142
- * Will match plugin dependencies against all currently registered plugins.
6143
- * Is being called by `puppeteer-extra` and used to require missing dependencies.
6144
- *
6145
- * @param {Array<Object>} plugins
6146
- * @return {Set} - list of missing plugin names
6147
- *
6148
- * @private
6149
- */
6150
- _getMissingDependencies(plugins) {
6151
- const pluginNames = new Set(plugins.map((p) => p.name));
6152
- const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x)));
6153
- return missing;
6154
- }
6155
- /**
6156
- * Conditionally bind browser/process events to class members.
6157
- * The idea is to reduce event binding boilerplate in plugins.
6158
- *
6159
- * For efficiency we make sure the plugin is using the respective event
6160
- * by checking the child class members before registering the listener.
6161
- *
6162
- * @param {<Puppeteer.Browser>} browser
6163
- * @param {Object} opts - Options
6164
- * @param {string} opts.context - Puppeteer context (launch/connect)
6165
- * @param {Object} [opts.options] - Puppeteer launch or connect options
6166
- * @param {Array<string>} [opts.defaultArgs] - The default flags that Chromium will be launched with
6167
- *
6168
- * @private
6169
- */
6170
- async _bindBrowserEvents(browser, opts = {}) {
6171
- if (this._hasChildClassMember('onTargetCreated') ||
6172
- this._hasChildClassMember('onPageCreated')) {
6173
- browser.on('targetcreated', this._onTargetCreated.bind(this));
6174
- }
6175
- if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) {
6176
- browser.on('targetchanged', this.onTargetChanged.bind(this));
6177
- }
6178
- if (this._hasChildClassMember('onTargetDestroyed') &&
6179
- this.onTargetDestroyed) {
6180
- browser.on('targetdestroyed', this.onTargetDestroyed.bind(this));
6181
- }
6182
- if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) {
6183
- browser.on('disconnected', this.onDisconnected.bind(this));
6184
- }
6185
- if (opts.context === 'launch' && this._hasChildClassMember('onClose')) {
6186
- // The disconnect event has been improved since puppeteer v1.6.0
6187
- // onClose is being kept mostly for legacy reasons
6188
- if (this.onClose) {
6189
- process.on('exit', this.onClose.bind(this));
6190
- browser.on('disconnected', this.onClose.bind(this));
6191
- if (opts.options.handleSIGINT !== false) {
6192
- process.on('SIGINT', this.onClose.bind(this));
6193
- }
6194
- if (opts.options.handleSIGTERM !== false) {
6195
- process.on('SIGTERM', this.onClose.bind(this));
6196
- }
6197
- if (opts.options.handleSIGHUP !== false) {
6198
- process.on('SIGHUP', this.onClose.bind(this));
6199
- }
6200
- }
6201
- }
6202
- if (opts.context === 'launch' && this.afterLaunch) {
6203
- await this.afterLaunch(browser, opts);
6204
- }
6205
- if (opts.context === 'connect' && this.afterConnect) {
6206
- await this.afterConnect(browser, opts);
6207
- }
6208
- if (this.onBrowser)
6209
- await this.onBrowser(browser, opts);
6210
- }
6211
- /**
6212
- * @private
6213
- */
6214
- async _onTargetCreated(target) {
6215
- if (this.onTargetCreated)
6216
- await this.onTargetCreated(target);
6217
- // Pre filter pages for plugin developers convenience
6218
- if (target.type() === 'page') {
6219
- try {
6220
- const page = await target.page();
6221
- if (!page) {
6222
- return;
6223
- }
6224
- const validPage = 'isClosed' in page && !page.isClosed();
6225
- if (this.onPageCreated && validPage) {
6226
- await this.onPageCreated(page);
6227
- }
6228
- }
6229
- catch (err) {
6230
- console.error(err);
6231
- }
6232
- }
6233
- }
6234
- /**
6235
- * @private
6236
- */
6237
- _register(prototype) {
6238
- this._registerChildClassMembers(prototype);
6239
- if (this.onPluginRegistered)
6240
- this.onPluginRegistered();
6241
- }
6242
- /**
6243
- * @private
6244
- */
6245
- _registerChildClassMembers(prototype) {
6246
- this._childClassMembers = Object.getOwnPropertyNames(prototype);
6247
- }
6248
- /**
6249
- * @private
6250
- */
6251
- _hasChildClassMember(name) {
6252
- return !!this._childClassMembers.includes(name);
6253
- }
6254
- /**
6255
- * @private
6256
- */
6257
- get _isPuppeteerExtraPlugin() {
6258
- return true;
6259
- }
6260
- }
6261
-
6262
- var index_esm = /*#__PURE__*/Object.freeze({
6263
- __proto__: null,
6264
- PuppeteerExtraPlugin: PuppeteerExtraPlugin$1
6265
- });
6266
-
6267
- var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(index_esm);
6268
-
6269
- const { PuppeteerExtraPlugin } = require$$0$1;
6270
-
6271
- /**
6272
- * Stealth mode: Applies various techniques to make detection of headless puppeteer harder. 💯
6273
- *
6274
- * ### Purpose
6275
- * There are a couple of ways the use of puppeteer can easily be detected by a target website.
6276
- * The addition of `HeadlessChrome` to the user-agent being only the most obvious one.
6277
- *
6278
- * The goal of this plugin is to be the definite companion to puppeteer to avoid
6279
- * detection, applying new techniques as they surface.
6280
- *
6281
- * As this cat & mouse game is in it's infancy and fast-paced the plugin
6282
- * is kept as flexibile as possible, to support quick testing and iterations.
6283
- *
6284
- * ### Modularity
6285
- * This plugin uses `puppeteer-extra`'s dependency system to only require
6286
- * code mods for evasions that have been enabled, to keep things modular and efficient.
6287
- *
6288
- * The `stealth` plugin is a convenience wrapper that requires multiple [evasion techniques](./evasions/)
6289
- * automatically and comes with defaults. You could also bypass the main module and require
6290
- * specific evasion plugins yourself, if you whish to do so (as they're standalone `puppeteer-extra` plugins):
6291
- *
6292
- * ```es6
6293
- * // bypass main module and require a specific stealth plugin directly:
6294
- * puppeteer.use(require('puppeteer-extra-plugin-stealth/evasions/console.debug')())
6295
- * ```
6296
- *
6297
- * ### Contributing
6298
- * PRs are welcome, if you want to add a new evasion technique I suggest you
6299
- * look at the [template](./evasions/_template) to kickstart things.
6300
- *
6301
- * ### Kudos
6302
- * Thanks to [Evan Sangaline](https://intoli.com/blog/not-possible-to-block-chrome-headless/) and [Paul Irish](https://github.com/paulirish/headless-cat-n-mouse) for kickstarting the discussion!
6303
- *
6304
- * ---
6305
- *
6306
- * @todo
6307
- * - white-/blacklist with url globs (make this a generic plugin method?)
6308
- * - dynamic whitelist based on function evaluation
6309
- *
6310
- * @example
6311
- * const puppeteer = require('puppeteer-extra')
6312
- * // Enable stealth plugin with all evasions
6313
- * puppeteer.use(require('puppeteer-extra-plugin-stealth')())
6314
- *
6315
- *
6316
- * ;(async () => {
6317
- * // Launch the browser in headless mode and set up a page.
6318
- * const browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: true })
6319
- * const page = await browser.newPage()
6320
- *
6321
- * // Navigate to the page that will perform the tests.
6322
- * const testUrl = 'https://intoli.com/blog/' +
6323
- * 'not-possible-to-block-chrome-headless/chrome-headless-test.html'
6324
- * await page.goto(testUrl)
6325
- *
6326
- * // Save a screenshot of the results.
6327
- * const screenshotPath = '/tmp/headless-test-result.png'
6328
- * await page.screenshot({path: screenshotPath})
6329
- * console.log('have a look at the screenshot:', screenshotPath)
6330
- *
6331
- * await browser.close()
6332
- * })()
6333
- *
6334
- * @param {Object} [opts] - Options
6335
- * @param {Set<string>} [opts.enabledEvasions] - Specify which evasions to use (by default all)
6336
- *
6337
- */
6338
- class StealthPlugin extends PuppeteerExtraPlugin {
6339
- constructor(opts = {}) {
6340
- super(opts);
6341
- }
6342
-
6343
- get name() {
6344
- return 'stealth'
6345
- }
6346
-
6347
- get defaults() {
6348
- const availableEvasions = new Set([
6349
- 'chrome.app',
6350
- 'chrome.csi',
6351
- 'chrome.loadTimes',
6352
- 'chrome.runtime',
6353
- 'defaultArgs',
6354
- 'iframe.contentWindow',
6355
- 'media.codecs',
6356
- 'navigator.hardwareConcurrency',
6357
- 'navigator.languages',
6358
- 'navigator.permissions',
6359
- 'navigator.plugins',
6360
- 'navigator.webdriver',
6361
- 'sourceurl',
6362
- 'user-agent-override',
6363
- 'webgl.vendor',
6364
- 'window.outerdimensions'
6365
- ]);
6366
- return {
6367
- availableEvasions,
6368
- // Enable all available evasions by default
6369
- enabledEvasions: new Set([...availableEvasions])
6370
- }
6371
- }
6372
-
6373
- /**
6374
- * Requires evasion techniques dynamically based on configuration.
6375
- *
6376
- * @private
6377
- */
6378
- get dependencies() {
6379
- return new Set(
6380
- [...this.opts.enabledEvasions].map(e => `${this.name}/evasions/${e}`)
6381
- )
6382
- }
6383
-
6384
- /**
6385
- * Get all available evasions.
6386
- *
6387
- * Please look into the [evasions directory](./evasions/) for an up to date list.
6388
- *
6389
- * @type {Set<string>} - A Set of all available evasions.
6390
- *
6391
- * @example
6392
- * const pluginStealth = require('puppeteer-extra-plugin-stealth')()
6393
- * console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' }
6394
- * puppeteer.use(pluginStealth)
6395
- */
6396
- get availableEvasions() {
6397
- return this.defaults.availableEvasions
6398
- }
6399
-
6400
- /**
6401
- * Get all enabled evasions.
6402
- *
6403
- * Enabled evasions can be configured either through `opts` or by modifying this property.
6404
- *
6405
- * @type {Set<string>} - A Set of all enabled evasions.
6406
- *
6407
- * @example
6408
- * // Remove specific evasion from enabled ones dynamically
6409
- * const pluginStealth = require('puppeteer-extra-plugin-stealth')()
6410
- * pluginStealth.enabledEvasions.delete('console.debug')
6411
- * puppeteer.use(pluginStealth)
6412
- */
6413
- get enabledEvasions() {
6414
- return this.opts.enabledEvasions
6415
- }
6416
-
6417
- /**
6418
- * @private
6419
- */
6420
- set enabledEvasions(evasions) {
6421
- this.opts.enabledEvasions = evasions;
6422
- }
6423
-
6424
- async onBrowser(browser) {
6425
- if (browser && browser.setMaxListeners) {
6426
- // Increase event emitter listeners to prevent MaxListenersExceededWarning
6427
- browser.setMaxListeners(30);
6428
- }
6429
- }
6430
- }
6431
-
6432
- /**
6433
- * Default export, PuppeteerExtraStealthPlugin
6434
- *
6435
- * @param {Object} [opts] - Options
6436
- * @param {Set<string>} [opts.enabledEvasions] - Specify which evasions to use (by default all)
6437
- */
6438
- const defaultExport = opts => new StealthPlugin(opts);
6439
- var puppeteerExtraPluginStealth = defaultExport;
6440
-
6441
- // const moduleExport = defaultExport
6442
- // moduleExport.StealthPlugin = StealthPlugin
6443
- // module.exports = moduleExport
6444
-
6445
- var stealth$1 = /*@__PURE__*/getDefaultExportFromCjs(puppeteerExtraPluginStealth);
6446
-
6447
5740
  var stealth = test$2.extend({
6448
5741
  browser: async ({ browser }, use) => {
6449
5742
  await browser.close();
@@ -6572,7 +5865,7 @@ var path$a = {};
6572
5865
 
6573
5866
  Object.defineProperty(path$a, "__esModule", { value: true });
6574
5867
  path$a.convertPosixPathToPattern = path$a.convertWindowsPathToPattern = path$a.convertPathToPattern = path$a.escapePosixPath = path$a.escapeWindowsPath = path$a.escape = path$a.removeLeadingDotSegment = path$a.makeAbsolute = path$a.unixify = void 0;
6575
- const os$1 = require$$0$3;
5868
+ const os$1 = require$$0$2;
6576
5869
  const path$9 = Path__default;
6577
5870
  const IS_WINDOWS_PLATFORM = os$1.platform() === 'win32';
6578
5871
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
@@ -6814,7 +6107,7 @@ var isGlob$1 = function isGlob(str, options) {
6814
6107
 
6815
6108
  var isGlob = isGlob$1;
6816
6109
  var pathPosixDirname = Path__default.posix.dirname;
6817
- var isWin32 = require$$0$3.platform() === 'win32';
6110
+ var isWin32 = require$$0$2.platform() === 'win32';
6818
6111
 
6819
6112
  var slash = '/';
6820
6113
  var backslash = /\\/g;
@@ -7310,7 +6603,7 @@ var toRegexRange_1 = toRegexRange$1;
7310
6603
  * Licensed under the MIT License.
7311
6604
  */
7312
6605
 
7313
- const util$8 = require$$0$2;
6606
+ const util$8 = require$$0$1;
7314
6607
  const toRegexRange = toRegexRange_1;
7315
6608
 
7316
6609
  const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -10342,7 +9635,7 @@ var picomatch_1 = picomatch$2;
10342
9635
 
10343
9636
  var picomatch$1 = picomatch_1;
10344
9637
 
10345
- const util$7 = require$$0$2;
9638
+ const util$7 = require$$0$1;
10346
9639
  const braces = braces_1;
10347
9640
  const picomatch = picomatch$1;
10348
9641
  const utils$c = utils$g;
@@ -12176,7 +11469,7 @@ class Reader$1 {
12176
11469
  reader$1.default = Reader$1;
12177
11470
 
12178
11471
  Object.defineProperty(async$4, "__esModule", { value: true });
12179
- const events_1 = require$$0$5;
11472
+ const events_1 = require$$0$4;
12180
11473
  const fsScandir$2 = out$2;
12181
11474
  const fastq = queueExports;
12182
11475
  const common$2 = common$4;
@@ -13047,7 +12340,7 @@ var settings = {};
13047
12340
  Object.defineProperty(exports, "__esModule", { value: true });
13048
12341
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
13049
12342
  const fs = fs__default;
13050
- const os = require$$0$3;
12343
+ const os = require$$0$2;
13051
12344
  /**
13052
12345
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
13053
12346
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
@@ -13556,7 +12849,7 @@ const TOASTR_MESSAGES = {
13556
12849
  zapierApiKeyGenerated: "Zapier API key is generated successfully!",
13557
12850
  };
13558
12851
  const ZAPIER_LIMIT_EXHAUSTED_MESSAGE = "Zapier free task limit is exhausted. Test will be aborted";
13559
- const EMOJI_PICKER_LABEL = "Smileys & People";
12852
+ const EMOJI_LABEL = "thumbs up";
13560
12853
  const ATTACHMENT_DELETION_TOASTR_MESSAGE = "Attachment has been successfully deleted.";
13561
12854
 
13562
12855
  const HELP_CENTER_SELECTORS = {
@@ -14413,6 +13706,7 @@ class ZapierPage extends IntegrationBase {
14413
13706
  const DESCRIPTION_EDITOR_TEXTS = {
14414
13707
  fontSize: "Font size",
14415
13708
  paragraph: "Paragraph",
13709
+ normalText: "Normal text",
14416
13710
  pasteLink: "Paste the link here...",
14417
13711
  invalidURLError: "Please enter a valid URL",
14418
13712
  pasteURL: "Paste URL",
@@ -14421,6 +13715,8 @@ const DESCRIPTION_EDITOR_TEXTS = {
14421
13715
  link: "Link",
14422
13716
  cannedResponseHeader: "Canned responses",
14423
13717
  paragraphOption: "paragraph",
13718
+ search: "Search",
13719
+ emoji: "Emoji",
14424
13720
  };
14425
13721
  const EXPANDED_FONT_SIZE = {
14426
13722
  h1: "Heading 1",
@@ -14468,7 +13764,7 @@ const NEETO_EDITOR_SELECTORS = {
14468
13764
  addLinkTextField: "neeto-editor-add-link-text-input",
14469
13765
  addURLTextField: "neeto-editor-add-link-url-input",
14470
13766
  submitLinkButton: "neeto-editor-add-link",
14471
- fontSizeDropdown: (currentOption = "Paragraph") => `${joinHyphenCase(currentOption)}-dropdown-icon`,
13767
+ fontSizeDropdown: (currentOption) => `${joinHyphenCase(currentOption)}-dropdown-icon`,
14472
13768
  fixedMenuArrow: "neeto-editor-fixed-menu-arrow",
14473
13769
  cannedResponseOption: "neeto-editor-fixed-menu-canned-responses-option",
14474
13770
  cannedResponseSelectContainer: "select-a-canned-response-select-container",
@@ -14494,6 +13790,9 @@ const NEETO_EDITOR_SELECTORS = {
14494
13790
  errorText: "neeto-editor-error-text",
14495
13791
  content: "editor-content",
14496
13792
  imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
13793
+ dynamicVariablesButton: "dynamic-variables-button",
13794
+ emojiContainer: "neeto-editor-emoji-picker",
13795
+ dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${hyphenate(variable)}`,
14497
13796
  };
14498
13797
  const NEETO_TEXT_MODIFIER_SELECTORS = {
14499
13798
  strikeOption: "neeto-editor-fixed-menu-strike-option",
@@ -14504,7 +13803,7 @@ const TEXT_MODIFIER_SELECTORS = {
14504
13803
  boldOption: "neeto-editor-fixed-menu-bold-option",
14505
13804
  italicsOption: "neeto-editor-fixed-menu-italic-option",
14506
13805
  codeOption: "neeto-editor-fixed-menu-code-option",
14507
- blockquoteOption: "neeto-editor-fixed-menu-block-quote-option",
13806
+ blockquoteOption: "neeto-editor-fixed-menu-blockquote-option",
14508
13807
  codeblockOption: "neeto-editor-fixed-menu-code-block-option",
14509
13808
  };
14510
13809
  const LIST_MODIFIER_SELECTORS = {
@@ -14522,40 +13821,44 @@ const FONT_SIZE_SELECTORS = {
14522
13821
  /* eslint-disable playwright/no-nth-methods */
14523
13822
  class EditorPage {
14524
13823
  constructor(page, neetoPlaywrightUtilities) {
14525
- this.verifyDescriptionEditor = async ({ text, linkUrl = faker.internet.url(), filePath = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
14526
- await this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField).fill(text);
14527
- await this.page
14528
- .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown())
13824
+ this.verifyDescriptionEditor = async ({ text, editorWrapper, dynamicVariables, defaultFontSizeOption = "Paragraph", linkUrl = faker.internet.url(), filePath = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
13825
+ if (!editorWrapper)
13826
+ editorWrapper = this.page;
13827
+ await editorWrapper
13828
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13829
+ .fill(text);
13830
+ await editorWrapper
13831
+ .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(defaultFontSizeOption))
14529
13832
  .click();
14530
13833
  const fontSize = Object.keys(FONT_SIZE_SELECTORS);
14531
13834
  for (const font of fontSize) {
14532
13835
  const fontKey = font;
14533
- await this.page.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
14534
- await expect(this.page
13836
+ await editorWrapper.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
13837
+ await expect(editorWrapper
14535
13838
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14536
13839
  .getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
14537
- await this.page
13840
+ await editorWrapper
14538
13841
  .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(EXPANDED_FONT_SIZE[fontKey]))
14539
13842
  .click();
14540
13843
  }
14541
13844
  if (await this.paragraphSelector.isVisible()) {
14542
13845
  await this.paragraphSelector.click();
14543
13846
  const paragraphRole = DESCRIPTION_EDITOR_TEXTS.paragraphOption;
14544
- await expect(this.page
13847
+ await expect(editorWrapper
14545
13848
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14546
13849
  .getByRole(paragraphRole)).toBeVisible();
14547
13850
  }
14548
13851
  (await this.fixedMenuArrowSelector.isVisible()) &&
14549
13852
  (await this.fixedMenuArrowSelector.click());
14550
- await this.page.getByText(text).click({ clickCount: 3 });
13853
+ await editorWrapper.getByText(text).click({ clickCount: 3 });
14551
13854
  const textModifier = Object.keys(TEXT_MODIFIER_SELECTORS);
14552
13855
  for (const modifier of textModifier) {
14553
13856
  const modifierKey = modifier;
14554
13857
  const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
14555
- const textModifierSelector = this.page.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
13858
+ const textModifierSelector = editorWrapper.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
14556
13859
  if (await textModifierSelector.isVisible()) {
14557
13860
  await textModifierSelector.click();
14558
- await expect(this.page
13861
+ await expect(editorWrapper
14559
13862
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14560
13863
  .getByRole(textModifierRole)).toBeVisible();
14561
13864
  await textModifierSelector.click();
@@ -14564,10 +13867,10 @@ class EditorPage {
14564
13867
  const textDeskModifier = Object.keys(NEETO_TEXT_MODIFIER_SELECTORS);
14565
13868
  for (const modifier of textDeskModifier) {
14566
13869
  const modifierKey = modifier;
14567
- const textModifierSelector = this.page.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
13870
+ const textModifierSelector = editorWrapper.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
14568
13871
  if (await textModifierSelector.isVisible()) {
14569
13872
  await textModifierSelector.click();
14570
- await expect(this.page
13873
+ await expect(editorWrapper
14571
13874
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14572
13875
  .locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
14573
13876
  await textModifierSelector.click();
@@ -14576,10 +13879,10 @@ class EditorPage {
14576
13879
  const listModifier = Object.keys(LIST_MODIFIER_SELECTORS);
14577
13880
  for (const modifier of listModifier) {
14578
13881
  const modifierKey = modifier;
14579
- const listModifierSelector = this.page.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
13882
+ const listModifierSelector = editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
14580
13883
  if (await listModifierSelector.isVisible()) {
14581
13884
  await listModifierSelector.click();
14582
- await expect(this.page
13885
+ await expect(editorWrapper
14583
13886
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14584
13887
  .locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
14585
13888
  await listModifierSelector.click();
@@ -14594,7 +13897,7 @@ class EditorPage {
14594
13897
  .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
14595
13898
  .click();
14596
13899
  const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
14597
- await expect(this.page
13900
+ await expect(editorWrapper
14598
13901
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14599
13902
  .getByRole(linkRole)).toBeVisible();
14600
13903
  await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
@@ -14619,10 +13922,10 @@ class EditorPage {
14619
13922
  await this.page
14620
13923
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
14621
13924
  .click();
13925
+ await this.neetoPlaywrightUtilities.verifyToast({
13926
+ message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
13927
+ });
14622
13928
  }
14623
- await this.neetoPlaywrightUtilities.verifyToast({
14624
- message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
14625
- });
14626
13929
  if (await this.imageUploadOption.isVisible()) {
14627
13930
  await this.imageUploadOption.click();
14628
13931
  const fileUploaderPromise = this.page.waitForEvent("filechooser");
@@ -14633,7 +13936,6 @@ class EditorPage {
14633
13936
  const imagePath = Path.join(__dirname, filePath);
14634
13937
  await fileUploader.setFiles(imagePath);
14635
13938
  await expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
14636
- await this.neetoPlaywrightUtilities.verifyToast();
14637
13939
  await this.imageWrapper
14638
13940
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
14639
13941
  .click();
@@ -14674,11 +13976,11 @@ class EditorPage {
14674
13976
  message: cannedResponseSuccessMessage,
14675
13977
  });
14676
13978
  }
14677
- if (await this.page
13979
+ if (await editorWrapper
14678
13980
  .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption)
14679
13981
  .isVisible()) {
14680
13982
  await this.videoEmbedOption.click();
14681
- await this.videoEmbedOption.fill(videoUrl);
13983
+ await this.videoEmbedInput.fill(videoUrl);
14682
13984
  await this.page
14683
13985
  .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
14684
13986
  .click();
@@ -14694,12 +13996,35 @@ class EditorPage {
14694
13996
  if (await this.emojiDropdownIcon.isVisible()) {
14695
13997
  await this.emojiDropdownIcon.click();
14696
13998
  await this.page
14697
- .getByRole("region", {
14698
- name: EMOJI_PICKER_LABEL,
14699
- })
14700
- .getByText("👍")
13999
+ .getByRole("button", { name: DESCRIPTION_EDITOR_TEXTS.emoji })
14701
14000
  .click();
14702
- await expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
14001
+ await expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)).toBeVisible({
14002
+ timeout: 10000,
14003
+ });
14004
+ await this.page
14005
+ .getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)
14006
+ .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
14007
+ .fill(EMOJI_LABEL);
14008
+ await this.page.keyboard.press("Enter");
14009
+ await expect(editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
14010
+ await this.page.keyboard.press("Escape");
14011
+ }
14012
+ if (dynamicVariables &&
14013
+ (await editorWrapper
14014
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14015
+ .isVisible())) {
14016
+ for (const dynamicVariable of dynamicVariables) {
14017
+ await editorWrapper
14018
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14019
+ .click();
14020
+ await expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
14021
+ await this.page
14022
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(dynamicVariable))
14023
+ .click();
14024
+ await expect(editorWrapper
14025
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14026
+ .getByText(dynamicVariable)).toBeVisible();
14027
+ }
14703
14028
  }
14704
14029
  };
14705
14030
  this.page = page;
@@ -14715,6 +14040,7 @@ class EditorPage {
14715
14040
  this.imageUploadOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
14716
14041
  this.cannedResponseOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
14717
14042
  this.videoEmbedOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
14043
+ this.videoEmbedInput = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedInput);
14718
14044
  this.videoWrapperSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
14719
14045
  this.emojiDropdownIcon = this.page
14720
14046
  .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
@@ -17323,12 +16649,12 @@ function intToRGBA(i) {
17323
16649
  a
17324
16650
  };
17325
16651
  }
17326
- const c$1 = [];
16652
+ const c = [];
17327
16653
  function initCoefficients(size) {
17328
16654
  for (let i = 1; i < size; i++) {
17329
- c$1[i] = 1;
16655
+ c[i] = 1;
17330
16656
  }
17331
- c$1[0] = 1 / Math.sqrt(2.0);
16657
+ c[0] = 1 / Math.sqrt(2.0);
17332
16658
  }
17333
16659
  function applyDCT(f, size) {
17334
16660
  const N = size;
@@ -17342,7 +16668,7 @@ function applyDCT(f, size) {
17342
16668
  sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j];
17343
16669
  }
17344
16670
  }
17345
- sum *= c$1[u] * c$1[v] / 4;
16671
+ sum *= c[u] * c[v] / 4;
17346
16672
  F[u][v] = sum;
17347
16673
  }
17348
16674
  }
@@ -95227,7 +94553,7 @@ var require$$1 = [
95227
94553
  ]
95228
94554
  ];
95229
94555
 
95230
- var punycode = require$$0$6;
94556
+ var punycode = require$$0$5;
95231
94557
  var mappingTable = require$$1;
95232
94558
 
95233
94559
  var PROCESSING_OPTIONS = {
@@ -95422,7 +94748,7 @@ tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
95422
94748
  urlStateMachine.exports;
95423
94749
 
95424
94750
  (function (module) {
95425
- const punycode = require$$0$6;
94751
+ const punycode = require$$0$5;
95426
94752
  const tr46$1 = tr46;
95427
94753
 
95428
94754
  const specialSchemes = {
@@ -99049,7 +98375,7 @@ function multiply(src, dst) {
99049
98375
  a
99050
98376
  };
99051
98377
  }
99052
- function add(src, dst) {
98378
+ function add$1(src, dst) {
99053
98379
  let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
99054
98380
  src.a *= ops;
99055
98381
  const a = dst.a + src.a - dst.a * src.a;
@@ -99215,7 +98541,7 @@ var compositeModes = /*#__PURE__*/Object.freeze({
99215
98541
  srcOver: srcOver,
99216
98542
  dstOver: dstOver,
99217
98543
  multiply: multiply,
99218
- add: add,
98544
+ add: add$1,
99219
98545
  screen: screen,
99220
98546
  overlay: overlay,
99221
98547
  darken: darken,
@@ -103978,7 +103304,7 @@ const emptyBitmap = {
103978
103304
  * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap
103979
103305
  */
103980
103306
 
103981
- class Jimp$1 extends require$$0$5 {
103307
+ class Jimp$1 extends require$$0$4 {
103982
103308
  // An object representing a bitmap in memory, comprising:
103983
103309
  // - data: a buffer of the bitmap data
103984
103310
  // - width: the width of the image in pixels
@@ -107590,7 +106916,7 @@ var parserAsync = {exports: {}};
107590
106916
 
107591
106917
  var chunkstream = {exports: {}};
107592
106918
 
107593
- let util$5 = require$$0$2;
106919
+ let util$5 = require$$0$1;
107594
106920
  let Stream$2 = Stream$4;
107595
106921
 
107596
106922
  let ChunkStream$2 = (chunkstream.exports = function () {
@@ -108073,7 +107399,7 @@ Filter$2.prototype._reverseFilterLine = function (rawData) {
108073
107399
 
108074
107400
  var filterParseExports = filterParse.exports;
108075
107401
 
108076
- let util$4 = require$$0$2;
107402
+ let util$4 = require$$0$1;
108077
107403
  let ChunkStream$1 = chunkstreamExports;
108078
107404
  let Filter$1 = filterParseExports;
108079
107405
 
@@ -108825,7 +108151,7 @@ var formatNormaliser$2 = function (indata, imageData, skipRescale = false) {
108825
108151
  return outdata;
108826
108152
  };
108827
108153
 
108828
- let util$3 = require$$0$2;
108154
+ let util$3 = require$$0$1;
108829
108155
  let zlib$4 = zlib$5;
108830
108156
  let ChunkStream = chunkstreamExports;
108831
108157
  let FilterAsync = filterParseAsyncExports;
@@ -109456,7 +108782,7 @@ Packer$3.prototype.packIEND = function () {
109456
108782
 
109457
108783
  var packerExports = packer.exports;
109458
108784
 
109459
- let util$2 = require$$0$2;
108785
+ let util$2 = require$$0$1;
109460
108786
  let Stream$1 = Stream$4;
109461
108787
  let constants$2 = constants$6;
109462
108788
  let Packer$2 = packerExports;
@@ -109515,9 +108841,9 @@ syncInflate.exports;
109515
108841
 
109516
108842
  (function (module, exports) {
109517
108843
 
109518
- let assert = require$$0$7.ok;
108844
+ let assert = require$$0$6.ok;
109519
108845
  let zlib = zlib$5;
109520
- let util = require$$0$2;
108846
+ let util = require$$0$1;
109521
108847
 
109522
108848
  let kMaxLength = require$$3.kMaxLength;
109523
108849
 
@@ -109934,7 +109260,7 @@ pngSync.write = function (png, options) {
109934
109260
 
109935
109261
  var PNG_1;
109936
109262
 
109937
- let util$1 = require$$0$2;
109263
+ let util$1 = require$$0$1;
109938
109264
  let Stream = Stream$4;
109939
109265
  let Parser = parserAsyncExports;
109940
109266
  let Packer = packerAsyncExports;
@@ -120705,31 +120031,31 @@ __export(constants_exports, {
120705
120031
  // src/constants/bt709.ts
120706
120032
  var bt709_exports = {};
120707
120033
  __export(bt709_exports, {
120708
- Y: () => Y$1,
120709
- x: () => x$1,
120710
- y: () => y$1
120034
+ Y: () => Y,
120035
+ x: () => x,
120036
+ y: () => y
120711
120037
  });
120712
- var Y$1 = /* @__PURE__ */ ((Y2) => {
120038
+ var Y = /* @__PURE__ */ ((Y2) => {
120713
120039
  Y2[Y2["RED"] = 0.2126] = "RED";
120714
120040
  Y2[Y2["GREEN"] = 0.7152] = "GREEN";
120715
120041
  Y2[Y2["BLUE"] = 0.0722] = "BLUE";
120716
120042
  Y2[Y2["WHITE"] = 1] = "WHITE";
120717
120043
  return Y2;
120718
- })(Y$1 || {});
120719
- var x$1 = /* @__PURE__ */ ((x2) => {
120044
+ })(Y || {});
120045
+ var x = /* @__PURE__ */ ((x2) => {
120720
120046
  x2[x2["RED"] = 0.64] = "RED";
120721
120047
  x2[x2["GREEN"] = 0.3] = "GREEN";
120722
120048
  x2[x2["BLUE"] = 0.15] = "BLUE";
120723
120049
  x2[x2["WHITE"] = 0.3127] = "WHITE";
120724
120050
  return x2;
120725
- })(x$1 || {});
120726
- var y$1 = /* @__PURE__ */ ((y2) => {
120051
+ })(x || {});
120052
+ var y = /* @__PURE__ */ ((y2) => {
120727
120053
  y2[y2["RED"] = 0.33] = "RED";
120728
120054
  y2[y2["GREEN"] = 0.6] = "GREEN";
120729
120055
  y2[y2["BLUE"] = 0.06] = "BLUE";
120730
120056
  y2[y2["WHITE"] = 0.329] = "WHITE";
120731
120057
  return y2;
120732
- })(y$1 || {});
120058
+ })(y || {});
120733
120059
 
120734
120060
  // src/conversion/index.ts
120735
120061
  var conversion_exports = {};
@@ -125699,7 +125025,7 @@ var normalize$1 = (() => ({
125699
125025
  }
125700
125026
  }));
125701
125027
 
125702
- var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=http$1;var https=https$1;var url$1=Url;var qs=require$$3$1;var zlib=zlib$5;var util=require$$0$2;var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url$1.parse(opts.url):url$1.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object.assign(options,opts);}options.port=Number(options.port);if(options.hasOwnProperty('timeout'))delete options.timeout;if(options.compressed===true){options.headers['accept-encoding']='gzip, deflate';}if(opts.hasOwnProperty('form')){if(_typeof(opts.form)!=='object'){throw new Error('phin \'form\' option must be of type Object if present.')}var formDataString=qs.stringify(opts.form);options.headers['Content-Type']='application/x-www-form-urlencoded';options.headers['Content-Length']=Buffer.byteLength(formDataString);opts.data=formDataString;}var req=void 0;var resHandler=function resHandler(res){var stream=res;if(options.compressed===true){if(res.headers['content-encoding']==='gzip'){stream=res.pipe(zlib.createGunzip());}else if(res.headers['content-encoding']==='deflate'){stream=res.pipe(zlib.createInflate());}}if(options.stream===true){res.stream=stream;if(cb)cb(null,res);}else {res.body=new Buffer([]);stream.on('data',function(chunk){res.body=Buffer.concat([res.body,chunk]);});stream.on('end',function(){if(cb){if(options.parse==='json'){try{res.body=JSON.parse(res.body.toString());}catch(err){cb('Invalid JSON received.',res);return}}cb(null,res);}});}};switch(addr.protocol.toLowerCase()){case'http:':req=http.request(options,resHandler);break;case'https:':req=https.request(options,resHandler);break;default:if(cb)cb(new Error('Invalid / unknown URL protocol. Expected HTTP or HTTPS.'),null);return;}if(typeof opts.timeout==='number'){req.setTimeout(opts.timeout,function(){req.abort();if(cb)cb(new Error('Timeout has been reached.'),null);cb=null;});}req.on('error',function(err){if(cb)cb(err,null);});if(opts.hasOwnProperty('data')){var postData=opts.data;if(!(opts.data instanceof Buffer)&&_typeof(opts.data)==='object'){var contentType=options.headers['content-type']||options.headers['Content-Type'];if(contentType==='application/x-www-form-urlencoded'){postData=qs.stringify(opts.data);}else {try{postData=JSON.stringify(opts.data);}catch(err){if(cb)cb(new Error('Couldn\'t stringify object. (Likely due to a circular reference.)'),null);}}}req.write(postData);}req.end();};phin.promisified=function(opts,http){return new Promise(function(resolve,reject){phin(opts,function(err,res){if(err){reject(err);}else {resolve(res);}});})};if(util.promisify){phin[util.promisify.custom]=phin.promisified;}var phin_compiled=phin;
125028
+ var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=http$1;var https=https$1;var url$1=Url;var qs=require$$3$1;var zlib=zlib$5;var util=require$$0$1;var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url$1.parse(opts.url):url$1.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object.assign(options,opts);}options.port=Number(options.port);if(options.hasOwnProperty('timeout'))delete options.timeout;if(options.compressed===true){options.headers['accept-encoding']='gzip, deflate';}if(opts.hasOwnProperty('form')){if(_typeof(opts.form)!=='object'){throw new Error('phin \'form\' option must be of type Object if present.')}var formDataString=qs.stringify(opts.form);options.headers['Content-Type']='application/x-www-form-urlencoded';options.headers['Content-Length']=Buffer.byteLength(formDataString);opts.data=formDataString;}var req=void 0;var resHandler=function resHandler(res){var stream=res;if(options.compressed===true){if(res.headers['content-encoding']==='gzip'){stream=res.pipe(zlib.createGunzip());}else if(res.headers['content-encoding']==='deflate'){stream=res.pipe(zlib.createInflate());}}if(options.stream===true){res.stream=stream;if(cb)cb(null,res);}else {res.body=new Buffer([]);stream.on('data',function(chunk){res.body=Buffer.concat([res.body,chunk]);});stream.on('end',function(){if(cb){if(options.parse==='json'){try{res.body=JSON.parse(res.body.toString());}catch(err){cb('Invalid JSON received.',res);return}}cb(null,res);}});}};switch(addr.protocol.toLowerCase()){case'http:':req=http.request(options,resHandler);break;case'https:':req=https.request(options,resHandler);break;default:if(cb)cb(new Error('Invalid / unknown URL protocol. Expected HTTP or HTTPS.'),null);return;}if(typeof opts.timeout==='number'){req.setTimeout(opts.timeout,function(){req.abort();if(cb)cb(new Error('Timeout has been reached.'),null);cb=null;});}req.on('error',function(err){if(cb)cb(err,null);});if(opts.hasOwnProperty('data')){var postData=opts.data;if(!(opts.data instanceof Buffer)&&_typeof(opts.data)==='object'){var contentType=options.headers['content-type']||options.headers['Content-Type'];if(contentType==='application/x-www-form-urlencoded'){postData=qs.stringify(opts.data);}else {try{postData=JSON.stringify(opts.data);}catch(err){if(cb)cb(new Error('Couldn\'t stringify object. (Likely due to a circular reference.)'),null);}}}req.write(postData);}req.end();};phin.promisified=function(opts,http){return new Promise(function(resolve,reject){phin(opts,function(err,res){if(err){reject(err);}else {resolve(res);}});})};if(util.promisify){phin[util.promisify.custom]=phin.promisified;}var phin_compiled=phin;
125703
125029
 
125704
125030
  var parseBmfontAscii = function parseBMFontAscii(data) {
125705
125031
  if (!data)
@@ -132073,7 +131399,7 @@ function requireParser () {
132073
131399
 
132074
131400
  sax = requireSax();
132075
131401
 
132076
- events = require$$0$5;
131402
+ events = require$$0$4;
132077
131403
 
132078
131404
  bom = requireBom();
132079
131405
 
@@ -147025,1094 +146351,1420 @@ const decodeQRCodeFromFile = async (filePath) => {
147025
146351
  return decodedString;
147026
146352
  };
147027
146353
 
146354
+ //! otpauth 9.3.1 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
146355
+ //! noble-hashes 1.4.0 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
147028
146356
  /// <reference types="./otpauth.d.ts" />
146357
+ // @ts-nocheck
147029
146358
  /**
147030
- * Converts an integer to an ArrayBuffer.
146359
+ * Converts an integer to an Uint8Array.
147031
146360
  * @param {number} num Integer.
147032
- * @returns {ArrayBuffer} ArrayBuffer.
147033
- */
147034
- const uintToBuf = num => {
147035
- const buf = new ArrayBuffer(8);
147036
- const arr = new Uint8Array(buf);
147037
- let acc = num;
147038
- for (let i = 7; i >= 0; i--) {
147039
- if (acc === 0) break;
147040
- arr[i] = acc & 255;
147041
- acc -= arr[i];
147042
- acc /= 256;
147043
- }
147044
- return buf;
146361
+ * @returns {Uint8Array} Uint8Array.
146362
+ */ const uintDecode = (num)=>{
146363
+ const buf = new ArrayBuffer(8);
146364
+ const arr = new Uint8Array(buf);
146365
+ let acc = num;
146366
+ for(let i = 7; i >= 0; i--){
146367
+ if (acc === 0) break;
146368
+ arr[i] = acc & 255;
146369
+ acc -= arr[i];
146370
+ acc /= 256;
146371
+ }
146372
+ return arr;
147045
146373
  };
147046
146374
 
146375
+ function number(n) {
146376
+ if (!Number.isSafeInteger(n) || n < 0) throw new Error(`positive integer expected, not ${n}`);
146377
+ }
146378
+ // copied from utils
146379
+ function isBytes(a) {
146380
+ return a instanceof Uint8Array || a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array';
146381
+ }
146382
+ function bytes(b, ...lengths) {
146383
+ if (!isBytes(b)) throw new Error('Uint8Array expected');
146384
+ if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
146385
+ }
146386
+ function hash(h) {
146387
+ if (typeof h !== 'function' || typeof h.create !== 'function') throw new Error('Hash should be wrapped by utils.wrapConstructor');
146388
+ number(h.outputLen);
146389
+ number(h.blockLen);
146390
+ }
146391
+ function exists(instance, checkFinished = true) {
146392
+ if (instance.destroyed) throw new Error('Hash instance has been destroyed');
146393
+ if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');
146394
+ }
146395
+ function output(out, instance) {
146396
+ bytes(out);
146397
+ const min = instance.outputLen;
146398
+ if (out.length < min) {
146399
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
146400
+ }
146401
+ }
146402
+
146403
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
146404
+ // node.js versions earlier than v19 don't declare it in global scope.
146405
+ // For node.js, package.json#exports field mapping rewrites import
146406
+ // from `crypto` to `cryptoNode`, which imports native module.
146407
+ // Makes the utils un-importable in browsers without a bundler.
146408
+ // Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
146409
+ const u32 = (arr)=>new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
146410
+ // Cast array to view
146411
+ const createView = (arr)=>new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
146412
+ // The rotate right (circular right shift) operation for uint32
146413
+ const rotr = (word, shift)=>word << 32 - shift | word >>> shift;
146414
+ // The rotate left (circular left shift) operation for uint32
146415
+ const rotl = (word, shift)=>word << shift | word >>> 32 - shift >>> 0;
146416
+ const isLE = new Uint8Array(new Uint32Array([
146417
+ 0x11223344
146418
+ ]).buffer)[0] === 0x44;
146419
+ // The byte swap operation for uint32
146420
+ const byteSwap = (word)=>word << 24 & 0xff000000 | word << 8 & 0xff0000 | word >>> 8 & 0xff00 | word >>> 24 & 0xff;
146421
+ // In place byte swap for Uint32Array
146422
+ function byteSwap32(arr) {
146423
+ for(let i = 0; i < arr.length; i++){
146424
+ arr[i] = byteSwap(arr[i]);
146425
+ }
146426
+ }
147047
146427
  /**
147048
- * A JavaScript implementation of the SHA family of hashes - defined in FIPS PUB 180-4, FIPS PUB 202,
147049
- * and SP 800-185 - as well as the corresponding HMAC implementation as defined in FIPS PUB 198-1.
147050
- *
147051
- * Copyright 2008-2023 Brian Turek, 1998-2009 Paul Johnston & Contributors
147052
- * Distributed under the BSD License
147053
- * See http://caligatio.github.com/jsSHA/ for more information
147054
- */
147055
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
147056
- n = "ARRAYBUFFER not supported by this environment",
147057
- e = "UINT8ARRAY not supported by this environment";
147058
- function r(t, n, e, r) {
147059
- let i, s, o;
147060
- const h = n || [0],
147061
- u = (e = e || 0) >>> 3,
147062
- w = -1 === r ? 3 : 0;
147063
- for (i = 0; i < t.length; i += 1) o = i + u, s = o >>> 2, h.length <= s && h.push(0), h[s] |= t[i] << 8 * (w + r * (o % 4));
147064
- return {
147065
- value: h,
147066
- binLen: 8 * t.length + e
147067
- };
146428
+ * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
146429
+ */ function utf8ToBytes(str) {
146430
+ if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
146431
+ return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
147068
146432
  }
147069
- function i(i, s, o) {
147070
- switch (s) {
147071
- case "UTF8":
147072
- case "UTF16BE":
147073
- case "UTF16LE":
147074
- break;
147075
- default:
147076
- throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE");
147077
- }
147078
- switch (i) {
147079
- case "HEX":
147080
- return function (t, n, e) {
147081
- return function (t, n, e, r) {
147082
- let i, s, o, h;
147083
- if (0 != t.length % 2) throw new Error("String of HEX type must be in byte increments");
147084
- const u = n || [0],
147085
- w = (e = e || 0) >>> 3,
147086
- c = -1 === r ? 3 : 0;
147087
- for (i = 0; i < t.length; i += 2) {
147088
- if (s = parseInt(t.substr(i, 2), 16), isNaN(s)) throw new Error("String of HEX type contains invalid characters");
147089
- for (h = (i >>> 1) + w, o = h >>> 2; u.length <= o;) u.push(0);
147090
- u[o] |= s << 8 * (c + r * (h % 4));
147091
- }
147092
- return {
147093
- value: u,
147094
- binLen: 4 * t.length + e
147095
- };
147096
- }(t, n, e, o);
147097
- };
147098
- case "TEXT":
147099
- return function (t, n, e) {
147100
- return function (t, n, e, r, i) {
147101
- let s,
147102
- o,
147103
- h,
147104
- u,
147105
- w,
147106
- c,
147107
- f,
147108
- a,
147109
- l = 0;
147110
- const A = e || [0],
147111
- E = (r = r || 0) >>> 3;
147112
- if ("UTF8" === n) for (f = -1 === i ? 3 : 0, h = 0; h < t.length; h += 1) for (s = t.charCodeAt(h), o = [], 128 > s ? o.push(s) : 2048 > s ? (o.push(192 | s >>> 6), o.push(128 | 63 & s)) : 55296 > s || 57344 <= s ? o.push(224 | s >>> 12, 128 | s >>> 6 & 63, 128 | 63 & s) : (h += 1, s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(h)), o.push(240 | s >>> 18, 128 | s >>> 12 & 63, 128 | s >>> 6 & 63, 128 | 63 & s)), u = 0; u < o.length; u += 1) {
147113
- for (c = l + E, w = c >>> 2; A.length <= w;) A.push(0);
147114
- A[w] |= o[u] << 8 * (f + i * (c % 4)), l += 1;
147115
- } else for (f = -1 === i ? 2 : 0, a = "UTF16LE" === n && 1 !== i || "UTF16LE" !== n && 1 === i, h = 0; h < t.length; h += 1) {
147116
- for (s = t.charCodeAt(h), !0 === a && (u = 255 & s, s = u << 8 | s >>> 8), c = l + E, w = c >>> 2; A.length <= w;) A.push(0);
147117
- A[w] |= s << 8 * (f + i * (c % 4)), l += 2;
147118
- }
147119
- return {
147120
- value: A,
147121
- binLen: 8 * l + r
147122
- };
147123
- }(t, s, n, e, o);
147124
- };
147125
- case "B64":
147126
- return function (n, e, r) {
147127
- return function (n, e, r, i) {
147128
- let s,
147129
- o,
147130
- h,
147131
- u,
147132
- w,
147133
- c,
147134
- f,
147135
- a = 0;
147136
- const l = e || [0],
147137
- A = (r = r || 0) >>> 3,
147138
- E = -1 === i ? 3 : 0,
147139
- H = n.indexOf("=");
147140
- if (-1 === n.search(/^[a-zA-Z0-9=+/]+$/)) throw new Error("Invalid character in base-64 string");
147141
- if (n = n.replace(/=/g, ""), -1 !== H && H < n.length) throw new Error("Invalid '=' found in base-64 string");
147142
- for (o = 0; o < n.length; o += 4) {
147143
- for (w = n.substr(o, 4), u = 0, h = 0; h < w.length; h += 1) s = t.indexOf(w.charAt(h)), u |= s << 18 - 6 * h;
147144
- for (h = 0; h < w.length - 1; h += 1) {
147145
- for (f = a + A, c = f >>> 2; l.length <= c;) l.push(0);
147146
- l[c] |= (u >>> 16 - 8 * h & 255) << 8 * (E + i * (f % 4)), a += 1;
146433
+ /**
146434
+ * Normalizes (non-hex) string or Uint8Array to Uint8Array.
146435
+ * Warning: when Uint8Array is passed, it would NOT get copied.
146436
+ * Keep in mind for future mutable operations.
146437
+ */ function toBytes(data) {
146438
+ if (typeof data === 'string') data = utf8ToBytes(data);
146439
+ bytes(data);
146440
+ return data;
146441
+ }
146442
+ // For runtime check if class implements interface
146443
+ class Hash {
146444
+ // Safe version that clones internal state
146445
+ clone() {
146446
+ return this._cloneInto();
146447
+ }
146448
+ }
146449
+ function wrapConstructor(hashCons) {
146450
+ const hashC = (msg)=>hashCons().update(toBytes(msg)).digest();
146451
+ const tmp = hashCons();
146452
+ hashC.outputLen = tmp.outputLen;
146453
+ hashC.blockLen = tmp.blockLen;
146454
+ hashC.create = ()=>hashCons();
146455
+ return hashC;
146456
+ }
146457
+
146458
+ // HMAC (RFC 2104)
146459
+ class HMAC extends Hash {
146460
+ update(buf) {
146461
+ exists(this);
146462
+ this.iHash.update(buf);
146463
+ return this;
146464
+ }
146465
+ digestInto(out) {
146466
+ exists(this);
146467
+ bytes(out, this.outputLen);
146468
+ this.finished = true;
146469
+ this.iHash.digestInto(out);
146470
+ this.oHash.update(out);
146471
+ this.oHash.digestInto(out);
146472
+ this.destroy();
146473
+ }
146474
+ digest() {
146475
+ const out = new Uint8Array(this.oHash.outputLen);
146476
+ this.digestInto(out);
146477
+ return out;
146478
+ }
146479
+ _cloneInto(to) {
146480
+ // Create new instance without calling constructor since key already in state and we don't know it.
146481
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
146482
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
146483
+ to = to;
146484
+ to.finished = finished;
146485
+ to.destroyed = destroyed;
146486
+ to.blockLen = blockLen;
146487
+ to.outputLen = outputLen;
146488
+ to.oHash = oHash._cloneInto(to.oHash);
146489
+ to.iHash = iHash._cloneInto(to.iHash);
146490
+ return to;
146491
+ }
146492
+ destroy() {
146493
+ this.destroyed = true;
146494
+ this.oHash.destroy();
146495
+ this.iHash.destroy();
146496
+ }
146497
+ constructor(hash$1, _key){
146498
+ super();
146499
+ this.finished = false;
146500
+ this.destroyed = false;
146501
+ hash(hash$1);
146502
+ const key = toBytes(_key);
146503
+ this.iHash = hash$1.create();
146504
+ if (typeof this.iHash.update !== 'function') throw new Error('Expected instance of class which extends utils.Hash');
146505
+ this.blockLen = this.iHash.blockLen;
146506
+ this.outputLen = this.iHash.outputLen;
146507
+ const blockLen = this.blockLen;
146508
+ const pad = new Uint8Array(blockLen);
146509
+ // blockLen can be bigger than outputLen
146510
+ pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
146511
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36;
146512
+ this.iHash.update(pad);
146513
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
146514
+ this.oHash = hash$1.create();
146515
+ // Undo internal XOR && apply outer XOR
146516
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36 ^ 0x5c;
146517
+ this.oHash.update(pad);
146518
+ pad.fill(0);
146519
+ }
146520
+ }
146521
+ /**
146522
+ * HMAC: RFC2104 message authentication code.
146523
+ * @param hash - function that would be used e.g. sha256
146524
+ * @param key - message key
146525
+ * @param message - message data
146526
+ */ const hmac = (hash, key, message)=>new HMAC(hash, key).update(message).digest();
146527
+ hmac.create = (hash, key)=>new HMAC(hash, key);
146528
+
146529
+ // Polyfill for Safari 14
146530
+ function setBigUint64(view, byteOffset, value, isLE) {
146531
+ if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);
146532
+ const _32n = BigInt(32);
146533
+ const _u32_max = BigInt(0xffffffff);
146534
+ const wh = Number(value >> _32n & _u32_max);
146535
+ const wl = Number(value & _u32_max);
146536
+ const h = isLE ? 4 : 0;
146537
+ const l = isLE ? 0 : 4;
146538
+ view.setUint32(byteOffset + h, wh, isLE);
146539
+ view.setUint32(byteOffset + l, wl, isLE);
146540
+ }
146541
+ // Choice: a ? b : c
146542
+ const Chi = (a, b, c)=>a & b ^ ~a & c;
146543
+ // Majority function, true if any two inpust is true
146544
+ const Maj = (a, b, c)=>a & b ^ a & c ^ b & c;
146545
+ /**
146546
+ * Merkle-Damgard hash construction base class.
146547
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
146548
+ */ class HashMD extends Hash {
146549
+ update(data) {
146550
+ exists(this);
146551
+ const { view, buffer, blockLen } = this;
146552
+ data = toBytes(data);
146553
+ const len = data.length;
146554
+ for(let pos = 0; pos < len;){
146555
+ const take = Math.min(blockLen - this.pos, len - pos);
146556
+ // Fast path: we have at least one block in input, cast it to view and process
146557
+ if (take === blockLen) {
146558
+ const dataView = createView(data);
146559
+ for(; blockLen <= len - pos; pos += blockLen)this.process(dataView, pos);
146560
+ continue;
147147
146561
  }
147148
- }
147149
- return {
147150
- value: l,
147151
- binLen: 8 * a + r
147152
- };
147153
- }(n, e, r, o);
147154
- };
147155
- case "BYTES":
147156
- return function (t, n, e) {
147157
- return function (t, n, e, r) {
147158
- let i, s, o, h;
147159
- const u = n || [0],
147160
- w = (e = e || 0) >>> 3,
147161
- c = -1 === r ? 3 : 0;
147162
- for (s = 0; s < t.length; s += 1) i = t.charCodeAt(s), h = s + w, o = h >>> 2, u.length <= o && u.push(0), u[o] |= i << 8 * (c + r * (h % 4));
147163
- return {
147164
- value: u,
147165
- binLen: 8 * t.length + e
147166
- };
147167
- }(t, n, e, o);
147168
- };
147169
- case "ARRAYBUFFER":
147170
- try {
147171
- new ArrayBuffer(0);
147172
- } catch (t) {
147173
- throw new Error(n);
147174
- }
147175
- return function (t, n, e) {
147176
- return function (t, n, e, i) {
147177
- return r(new Uint8Array(t), n, e, i);
147178
- }(t, n, e, o);
147179
- };
147180
- case "UINT8ARRAY":
147181
- try {
147182
- new Uint8Array(0);
147183
- } catch (t) {
147184
- throw new Error(e);
147185
- }
147186
- return function (t, n, e) {
147187
- return r(t, n, e, o);
147188
- };
147189
- default:
147190
- throw new Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY");
147191
- }
147192
- }
147193
- function s(r, i, s, o) {
147194
- switch (r) {
147195
- case "HEX":
147196
- return function (t) {
147197
- return function (t, n, e, r) {
147198
- const i = "0123456789abcdef";
147199
- let s,
147200
- o,
147201
- h = "";
147202
- const u = n / 8,
147203
- w = -1 === e ? 3 : 0;
147204
- for (s = 0; s < u; s += 1) o = t[s >>> 2] >>> 8 * (w + e * (s % 4)), h += i.charAt(o >>> 4 & 15) + i.charAt(15 & o);
147205
- return r.outputUpper ? h.toUpperCase() : h;
147206
- }(t, i, s, o);
147207
- };
147208
- case "B64":
147209
- return function (n) {
147210
- return function (n, e, r, i) {
147211
- let s,
147212
- o,
147213
- h,
147214
- u,
147215
- w,
147216
- c = "";
147217
- const f = e / 8,
147218
- a = -1 === r ? 3 : 0;
147219
- for (s = 0; s < f; s += 3) for (u = s + 1 < f ? n[s + 1 >>> 2] : 0, w = s + 2 < f ? n[s + 2 >>> 2] : 0, h = (n[s >>> 2] >>> 8 * (a + r * (s % 4)) & 255) << 16 | (u >>> 8 * (a + r * ((s + 1) % 4)) & 255) << 8 | w >>> 8 * (a + r * ((s + 2) % 4)) & 255, o = 0; o < 4; o += 1) c += 8 * s + 6 * o <= e ? t.charAt(h >>> 6 * (3 - o) & 63) : i.b64Pad;
147220
- return c;
147221
- }(n, i, s, o);
147222
- };
147223
- case "BYTES":
147224
- return function (t) {
147225
- return function (t, n, e) {
147226
- let r,
147227
- i,
147228
- s = "";
147229
- const o = n / 8,
147230
- h = -1 === e ? 3 : 0;
147231
- for (r = 0; r < o; r += 1) i = t[r >>> 2] >>> 8 * (h + e * (r % 4)) & 255, s += String.fromCharCode(i);
147232
- return s;
147233
- }(t, i, s);
147234
- };
147235
- case "ARRAYBUFFER":
147236
- try {
147237
- new ArrayBuffer(0);
147238
- } catch (t) {
147239
- throw new Error(n);
147240
- }
147241
- return function (t) {
147242
- return function (t, n, e) {
147243
- let r;
147244
- const i = n / 8,
147245
- s = new ArrayBuffer(i),
147246
- o = new Uint8Array(s),
147247
- h = -1 === e ? 3 : 0;
147248
- for (r = 0; r < i; r += 1) o[r] = t[r >>> 2] >>> 8 * (h + e * (r % 4)) & 255;
147249
- return s;
147250
- }(t, i, s);
147251
- };
147252
- case "UINT8ARRAY":
147253
- try {
147254
- new Uint8Array(0);
147255
- } catch (t) {
147256
- throw new Error(e);
147257
- }
147258
- return function (t) {
147259
- return function (t, n, e) {
147260
- let r;
147261
- const i = n / 8,
147262
- s = -1 === e ? 3 : 0,
147263
- o = new Uint8Array(i);
147264
- for (r = 0; r < i; r += 1) o[r] = t[r >>> 2] >>> 8 * (s + e * (r % 4)) & 255;
147265
- return o;
147266
- }(t, i, s);
147267
- };
147268
- default:
147269
- throw new Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY");
147270
- }
147271
- }
147272
- const o = 4294967296,
147273
- h = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298],
147274
- u = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428],
147275
- w = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225],
147276
- c = "Chosen SHA variant is not supported",
147277
- f = "Cannot set numRounds with MAC";
147278
- function a(t, n) {
147279
- let e, r;
147280
- const i = t.binLen >>> 3,
147281
- s = n.binLen >>> 3,
147282
- o = i << 3,
147283
- h = 4 - i << 3;
147284
- if (i % 4 != 0) {
147285
- for (e = 0; e < s; e += 4) r = i + e >>> 2, t.value[r] |= n.value[e >>> 2] << o, t.value.push(0), t.value[r + 1] |= n.value[e >>> 2] >>> h;
147286
- return (t.value.length << 2) - 4 >= s + i && t.value.pop(), {
147287
- value: t.value,
147288
- binLen: t.binLen + n.binLen
146562
+ buffer.set(data.subarray(pos, pos + take), this.pos);
146563
+ this.pos += take;
146564
+ pos += take;
146565
+ if (this.pos === blockLen) {
146566
+ this.process(view, 0);
146567
+ this.pos = 0;
146568
+ }
146569
+ }
146570
+ this.length += data.length;
146571
+ this.roundClean();
146572
+ return this;
146573
+ }
146574
+ digestInto(out) {
146575
+ exists(this);
146576
+ output(out, this);
146577
+ this.finished = true;
146578
+ // Padding
146579
+ // We can avoid allocation of buffer for padding completely if it
146580
+ // was previously not allocated here. But it won't change performance.
146581
+ const { buffer, view, blockLen, isLE } = this;
146582
+ let { pos } = this;
146583
+ // append the bit '1' to the message
146584
+ buffer[pos++] = 0b10000000;
146585
+ this.buffer.subarray(pos).fill(0);
146586
+ // we have less than padOffset left in buffer, so we cannot put length in
146587
+ // current block, need process it and pad again
146588
+ if (this.padOffset > blockLen - pos) {
146589
+ this.process(view, 0);
146590
+ pos = 0;
146591
+ }
146592
+ // Pad until full block byte with zeros
146593
+ for(let i = pos; i < blockLen; i++)buffer[i] = 0;
146594
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
146595
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
146596
+ // So we just write lowest 64 bits of that value.
146597
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
146598
+ this.process(view, 0);
146599
+ const oview = createView(out);
146600
+ const len = this.outputLen;
146601
+ // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
146602
+ if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');
146603
+ const outLen = len / 4;
146604
+ const state = this.get();
146605
+ if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');
146606
+ for(let i = 0; i < outLen; i++)oview.setUint32(4 * i, state[i], isLE);
146607
+ }
146608
+ digest() {
146609
+ const { buffer, outputLen } = this;
146610
+ this.digestInto(buffer);
146611
+ const res = buffer.slice(0, outputLen);
146612
+ this.destroy();
146613
+ return res;
146614
+ }
146615
+ _cloneInto(to) {
146616
+ to || (to = new this.constructor());
146617
+ to.set(...this.get());
146618
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
146619
+ to.length = length;
146620
+ to.pos = pos;
146621
+ to.finished = finished;
146622
+ to.destroyed = destroyed;
146623
+ if (length % blockLen) to.buffer.set(buffer);
146624
+ return to;
146625
+ }
146626
+ constructor(blockLen, outputLen, padOffset, isLE){
146627
+ super();
146628
+ this.blockLen = blockLen;
146629
+ this.outputLen = outputLen;
146630
+ this.padOffset = padOffset;
146631
+ this.isLE = isLE;
146632
+ this.finished = false;
146633
+ this.length = 0;
146634
+ this.pos = 0;
146635
+ this.destroyed = false;
146636
+ this.buffer = new Uint8Array(blockLen);
146637
+ this.view = createView(this.buffer);
146638
+ }
146639
+ }
146640
+
146641
+ // SHA1 (RFC 3174) was cryptographically broken. It's still used. Don't use it for a new protocol.
146642
+ // Initial state
146643
+ const SHA1_IV = /* @__PURE__ */ new Uint32Array([
146644
+ 0x67452301,
146645
+ 0xefcdab89,
146646
+ 0x98badcfe,
146647
+ 0x10325476,
146648
+ 0xc3d2e1f0
146649
+ ]);
146650
+ // Temporary buffer, not used to store anything between runs
146651
+ // Named this way because it matches specification.
146652
+ const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
146653
+ class SHA1 extends HashMD {
146654
+ get() {
146655
+ const { A, B, C, D, E } = this;
146656
+ return [
146657
+ A,
146658
+ B,
146659
+ C,
146660
+ D,
146661
+ E
146662
+ ];
146663
+ }
146664
+ set(A, B, C, D, E) {
146665
+ this.A = A | 0;
146666
+ this.B = B | 0;
146667
+ this.C = C | 0;
146668
+ this.D = D | 0;
146669
+ this.E = E | 0;
146670
+ }
146671
+ process(view, offset) {
146672
+ for(let i = 0; i < 16; i++, offset += 4)SHA1_W[i] = view.getUint32(offset, false);
146673
+ for(let i = 16; i < 80; i++)SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
146674
+ // Compression function main loop, 80 rounds
146675
+ let { A, B, C, D, E } = this;
146676
+ for(let i = 0; i < 80; i++){
146677
+ let F, K;
146678
+ if (i < 20) {
146679
+ F = Chi(B, C, D);
146680
+ K = 0x5a827999;
146681
+ } else if (i < 40) {
146682
+ F = B ^ C ^ D;
146683
+ K = 0x6ed9eba1;
146684
+ } else if (i < 60) {
146685
+ F = Maj(B, C, D);
146686
+ K = 0x8f1bbcdc;
146687
+ } else {
146688
+ F = B ^ C ^ D;
146689
+ K = 0xca62c1d6;
146690
+ }
146691
+ const T = rotl(A, 5) + F + E + K + SHA1_W[i] | 0;
146692
+ E = D;
146693
+ D = C;
146694
+ C = rotl(B, 30);
146695
+ B = A;
146696
+ A = T;
146697
+ }
146698
+ // Add the compressed chunk to the current hash value
146699
+ A = A + this.A | 0;
146700
+ B = B + this.B | 0;
146701
+ C = C + this.C | 0;
146702
+ D = D + this.D | 0;
146703
+ E = E + this.E | 0;
146704
+ this.set(A, B, C, D, E);
146705
+ }
146706
+ roundClean() {
146707
+ SHA1_W.fill(0);
146708
+ }
146709
+ destroy() {
146710
+ this.set(0, 0, 0, 0, 0);
146711
+ this.buffer.fill(0);
146712
+ }
146713
+ constructor(){
146714
+ super(64, 20, 8, false);
146715
+ this.A = SHA1_IV[0] | 0;
146716
+ this.B = SHA1_IV[1] | 0;
146717
+ this.C = SHA1_IV[2] | 0;
146718
+ this.D = SHA1_IV[3] | 0;
146719
+ this.E = SHA1_IV[4] | 0;
146720
+ }
146721
+ }
146722
+ const sha1 = /* @__PURE__ */ wrapConstructor(()=>new SHA1());
146723
+
146724
+ // SHA2-256 need to try 2^128 hashes to execute birthday attack.
146725
+ // BTC network is doing 2^67 hashes/sec as per early 2023.
146726
+ // Round constants:
146727
+ // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
146728
+ // prettier-ignore
146729
+ const SHA256_K = /* @__PURE__ */ new Uint32Array([
146730
+ 0x428a2f98,
146731
+ 0x71374491,
146732
+ 0xb5c0fbcf,
146733
+ 0xe9b5dba5,
146734
+ 0x3956c25b,
146735
+ 0x59f111f1,
146736
+ 0x923f82a4,
146737
+ 0xab1c5ed5,
146738
+ 0xd807aa98,
146739
+ 0x12835b01,
146740
+ 0x243185be,
146741
+ 0x550c7dc3,
146742
+ 0x72be5d74,
146743
+ 0x80deb1fe,
146744
+ 0x9bdc06a7,
146745
+ 0xc19bf174,
146746
+ 0xe49b69c1,
146747
+ 0xefbe4786,
146748
+ 0x0fc19dc6,
146749
+ 0x240ca1cc,
146750
+ 0x2de92c6f,
146751
+ 0x4a7484aa,
146752
+ 0x5cb0a9dc,
146753
+ 0x76f988da,
146754
+ 0x983e5152,
146755
+ 0xa831c66d,
146756
+ 0xb00327c8,
146757
+ 0xbf597fc7,
146758
+ 0xc6e00bf3,
146759
+ 0xd5a79147,
146760
+ 0x06ca6351,
146761
+ 0x14292967,
146762
+ 0x27b70a85,
146763
+ 0x2e1b2138,
146764
+ 0x4d2c6dfc,
146765
+ 0x53380d13,
146766
+ 0x650a7354,
146767
+ 0x766a0abb,
146768
+ 0x81c2c92e,
146769
+ 0x92722c85,
146770
+ 0xa2bfe8a1,
146771
+ 0xa81a664b,
146772
+ 0xc24b8b70,
146773
+ 0xc76c51a3,
146774
+ 0xd192e819,
146775
+ 0xd6990624,
146776
+ 0xf40e3585,
146777
+ 0x106aa070,
146778
+ 0x19a4c116,
146779
+ 0x1e376c08,
146780
+ 0x2748774c,
146781
+ 0x34b0bcb5,
146782
+ 0x391c0cb3,
146783
+ 0x4ed8aa4a,
146784
+ 0x5b9cca4f,
146785
+ 0x682e6ff3,
146786
+ 0x748f82ee,
146787
+ 0x78a5636f,
146788
+ 0x84c87814,
146789
+ 0x8cc70208,
146790
+ 0x90befffa,
146791
+ 0xa4506ceb,
146792
+ 0xbef9a3f7,
146793
+ 0xc67178f2
146794
+ ]);
146795
+ // Initial state:
146796
+ // first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19
146797
+ // prettier-ignore
146798
+ const SHA256_IV = /* @__PURE__ */ new Uint32Array([
146799
+ 0x6a09e667,
146800
+ 0xbb67ae85,
146801
+ 0x3c6ef372,
146802
+ 0xa54ff53a,
146803
+ 0x510e527f,
146804
+ 0x9b05688c,
146805
+ 0x1f83d9ab,
146806
+ 0x5be0cd19
146807
+ ]);
146808
+ // Temporary buffer, not used to store anything between runs
146809
+ // Named this way because it matches specification.
146810
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
146811
+ class SHA256 extends HashMD {
146812
+ get() {
146813
+ const { A, B, C, D, E, F, G, H } = this;
146814
+ return [
146815
+ A,
146816
+ B,
146817
+ C,
146818
+ D,
146819
+ E,
146820
+ F,
146821
+ G,
146822
+ H
146823
+ ];
146824
+ }
146825
+ // prettier-ignore
146826
+ set(A, B, C, D, E, F, G, H) {
146827
+ this.A = A | 0;
146828
+ this.B = B | 0;
146829
+ this.C = C | 0;
146830
+ this.D = D | 0;
146831
+ this.E = E | 0;
146832
+ this.F = F | 0;
146833
+ this.G = G | 0;
146834
+ this.H = H | 0;
146835
+ }
146836
+ process(view, offset) {
146837
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
146838
+ for(let i = 0; i < 16; i++, offset += 4)SHA256_W[i] = view.getUint32(offset, false);
146839
+ for(let i = 16; i < 64; i++){
146840
+ const W15 = SHA256_W[i - 15];
146841
+ const W2 = SHA256_W[i - 2];
146842
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
146843
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
146844
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
146845
+ }
146846
+ // Compression function main loop, 64 rounds
146847
+ let { A, B, C, D, E, F, G, H } = this;
146848
+ for(let i = 0; i < 64; i++){
146849
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
146850
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
146851
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
146852
+ const T2 = sigma0 + Maj(A, B, C) | 0;
146853
+ H = G;
146854
+ G = F;
146855
+ F = E;
146856
+ E = D + T1 | 0;
146857
+ D = C;
146858
+ C = B;
146859
+ B = A;
146860
+ A = T1 + T2 | 0;
146861
+ }
146862
+ // Add the compressed chunk to the current hash value
146863
+ A = A + this.A | 0;
146864
+ B = B + this.B | 0;
146865
+ C = C + this.C | 0;
146866
+ D = D + this.D | 0;
146867
+ E = E + this.E | 0;
146868
+ F = F + this.F | 0;
146869
+ G = G + this.G | 0;
146870
+ H = H + this.H | 0;
146871
+ this.set(A, B, C, D, E, F, G, H);
146872
+ }
146873
+ roundClean() {
146874
+ SHA256_W.fill(0);
146875
+ }
146876
+ destroy() {
146877
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
146878
+ this.buffer.fill(0);
146879
+ }
146880
+ constructor(){
146881
+ super(64, 32, 8, false);
146882
+ // We cannot use array here since array allows indexing by variable
146883
+ // which means optimizer/compiler cannot use registers.
146884
+ this.A = SHA256_IV[0] | 0;
146885
+ this.B = SHA256_IV[1] | 0;
146886
+ this.C = SHA256_IV[2] | 0;
146887
+ this.D = SHA256_IV[3] | 0;
146888
+ this.E = SHA256_IV[4] | 0;
146889
+ this.F = SHA256_IV[5] | 0;
146890
+ this.G = SHA256_IV[6] | 0;
146891
+ this.H = SHA256_IV[7] | 0;
146892
+ }
146893
+ }
146894
+ // Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
146895
+ class SHA224 extends SHA256 {
146896
+ constructor(){
146897
+ super();
146898
+ this.A = 0xc1059ed8 | 0;
146899
+ this.B = 0x367cd507 | 0;
146900
+ this.C = 0x3070dd17 | 0;
146901
+ this.D = 0xf70e5939 | 0;
146902
+ this.E = 0xffc00b31 | 0;
146903
+ this.F = 0x68581511 | 0;
146904
+ this.G = 0x64f98fa7 | 0;
146905
+ this.H = 0xbefa4fa4 | 0;
146906
+ this.outputLen = 28;
146907
+ }
146908
+ }
146909
+ /**
146910
+ * SHA2-256 hash function
146911
+ * @param message - data that would be hashed
146912
+ */ const sha256 = /* @__PURE__ */ wrapConstructor(()=>new SHA256());
146913
+ const sha224 = /* @__PURE__ */ wrapConstructor(()=>new SHA224());
146914
+
146915
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
146916
+ const _32n = /* @__PURE__ */ BigInt(32);
146917
+ // We are not using BigUint64Array, because they are extremely slow as per 2022
146918
+ function fromBig(n, le = false) {
146919
+ if (le) return {
146920
+ h: Number(n & U32_MASK64),
146921
+ l: Number(n >> _32n & U32_MASK64)
146922
+ };
146923
+ return {
146924
+ h: Number(n >> _32n & U32_MASK64) | 0,
146925
+ l: Number(n & U32_MASK64) | 0
147289
146926
  };
147290
- }
147291
- return {
147292
- value: t.value.concat(n.value),
147293
- binLen: t.binLen + n.binLen
147294
- };
147295
146927
  }
147296
- function l(t) {
147297
- const n = {
147298
- outputUpper: !1,
147299
- b64Pad: "=",
147300
- outputLen: -1
147301
- },
147302
- e = t || {},
147303
- r = "Output length must be a multiple of 8";
147304
- if (n.outputUpper = e.outputUpper || !1, e.b64Pad && (n.b64Pad = e.b64Pad), e.outputLen) {
147305
- if (e.outputLen % 8 != 0) throw new Error(r);
147306
- n.outputLen = e.outputLen;
147307
- } else if (e.shakeLen) {
147308
- if (e.shakeLen % 8 != 0) throw new Error(r);
147309
- n.outputLen = e.shakeLen;
147310
- }
147311
- if ("boolean" != typeof n.outputUpper) throw new Error("Invalid outputUpper formatting option");
147312
- if ("string" != typeof n.b64Pad) throw new Error("Invalid b64Pad formatting option");
147313
- return n;
146928
+ function split(lst, le = false) {
146929
+ let Ah = new Uint32Array(lst.length);
146930
+ let Al = new Uint32Array(lst.length);
146931
+ for(let i = 0; i < lst.length; i++){
146932
+ const { h, l } = fromBig(lst[i], le);
146933
+ [Ah[i], Al[i]] = [
146934
+ h,
146935
+ l
146936
+ ];
146937
+ }
146938
+ return [
146939
+ Ah,
146940
+ Al
146941
+ ];
147314
146942
  }
147315
- function A(t, n, e, r) {
147316
- const s = t + " must include a value and format";
147317
- if (!n) {
147318
- if (!r) throw new Error(s);
147319
- return r;
147320
- }
147321
- if (void 0 === n.value || !n.format) throw new Error(s);
147322
- return i(n.format, n.encoding || "UTF8", e)(n.value);
146943
+ const toBig = (h, l)=>BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
146944
+ // for Shift in [0, 32)
146945
+ const shrSH = (h, _l, s)=>h >>> s;
146946
+ const shrSL = (h, l, s)=>h << 32 - s | l >>> s;
146947
+ // Right rotate for Shift in [1, 32)
146948
+ const rotrSH = (h, l, s)=>h >>> s | l << 32 - s;
146949
+ const rotrSL = (h, l, s)=>h << 32 - s | l >>> s;
146950
+ // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
146951
+ const rotrBH = (h, l, s)=>h << 64 - s | l >>> s - 32;
146952
+ const rotrBL = (h, l, s)=>h >>> s - 32 | l << 64 - s;
146953
+ // Right rotate for shift===32 (just swaps l&h)
146954
+ const rotr32H = (_h, l)=>l;
146955
+ const rotr32L = (h, _l)=>h;
146956
+ // Left rotate for Shift in [1, 32)
146957
+ const rotlSH = (h, l, s)=>h << s | l >>> 32 - s;
146958
+ const rotlSL = (h, l, s)=>l << s | h >>> 32 - s;
146959
+ // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
146960
+ const rotlBH = (h, l, s)=>l << s - 32 | h >>> 64 - s;
146961
+ const rotlBL = (h, l, s)=>h << s - 32 | l >>> 64 - s;
146962
+ // JS uses 32-bit signed integers for bitwise operations which means we cannot
146963
+ // simple take carry out of low bit sum by shift, we need to use division.
146964
+ function add(Ah, Al, Bh, Bl) {
146965
+ const l = (Al >>> 0) + (Bl >>> 0);
146966
+ return {
146967
+ h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
146968
+ l: l | 0
146969
+ };
147323
146970
  }
147324
- class E {
147325
- constructor(t, n, e) {
147326
- const r = e || {};
147327
- if (this.t = n, this.i = r.encoding || "UTF8", this.numRounds = r.numRounds || 1, isNaN(this.numRounds) || this.numRounds !== parseInt(this.numRounds, 10) || 1 > this.numRounds) throw new Error("numRounds must a integer >= 1");
147328
- this.o = t, this.h = [], this.u = 0, this.l = !1, this.A = 0, this.H = !1, this.S = [], this.p = [];
147329
- }
147330
- update(t) {
147331
- let n,
147332
- e = 0;
147333
- const r = this.m >>> 5,
147334
- i = this.C(t, this.h, this.u),
147335
- s = i.binLen,
147336
- o = i.value,
147337
- h = s >>> 5;
147338
- for (n = 0; n < h; n += r) e + this.m <= s && (this.U = this.v(o.slice(n, n + r), this.U), e += this.m);
147339
- return this.A += e, this.h = o.slice(e >>> 5), this.u = s % this.m, this.l = !0, this;
147340
- }
147341
- getHash(t, n) {
147342
- let e,
147343
- r,
147344
- i = this.R;
147345
- const o = l(n);
147346
- if (this.K) {
147347
- if (-1 === o.outputLen) throw new Error("Output length must be specified in options");
147348
- i = o.outputLen;
147349
- }
147350
- const h = s(t, i, this.T, o);
147351
- if (this.H && this.g) return h(this.g(o));
147352
- for (r = this.F(this.h.slice(), this.u, this.A, this.L(this.U), i), e = 1; e < this.numRounds; e += 1) this.K && i % 32 != 0 && (r[r.length - 1] &= 16777215 >>> 24 - i % 32), r = this.F(r, i, 0, this.B(this.o), i);
147353
- return h(r);
147354
- }
147355
- setHMACKey(t, n, e) {
147356
- if (!this.M) throw new Error("Variant does not support HMAC");
147357
- if (this.l) throw new Error("Cannot set MAC key after calling update");
147358
- const r = i(n, (e || {}).encoding || "UTF8", this.T);
147359
- this.k(r(t));
147360
- }
147361
- k(t) {
147362
- const n = this.m >>> 3,
147363
- e = n / 4 - 1;
147364
- let r;
147365
- if (1 !== this.numRounds) throw new Error(f);
147366
- if (this.H) throw new Error("MAC key already set");
147367
- for (n < t.binLen / 8 && (t.value = this.F(t.value, t.binLen, 0, this.B(this.o), this.R)); t.value.length <= e;) t.value.push(0);
147368
- for (r = 0; r <= e; r += 1) this.S[r] = 909522486 ^ t.value[r], this.p[r] = 1549556828 ^ t.value[r];
147369
- this.U = this.v(this.S, this.U), this.A = this.m, this.H = !0;
147370
- }
147371
- getHMAC(t, n) {
147372
- const e = l(n);
147373
- return s(t, this.R, this.T, e)(this.Y());
147374
- }
147375
- Y() {
147376
- let t;
147377
- if (!this.H) throw new Error("Cannot call getHMAC without first setting MAC key");
147378
- const n = this.F(this.h.slice(), this.u, this.A, this.L(this.U), this.R);
147379
- return t = this.v(this.p, this.B(this.o)), t = this.F(n, this.R, this.m, t, this.R), t;
147380
- }
147381
- }
147382
- function H(t, n) {
147383
- return t << n | t >>> 32 - n;
147384
- }
147385
- function S(t, n) {
147386
- return t >>> n | t << 32 - n;
147387
- }
147388
- function b(t, n) {
147389
- return t >>> n;
147390
- }
147391
- function p(t, n, e) {
147392
- return t ^ n ^ e;
147393
- }
147394
- function d(t, n, e) {
147395
- return t & n ^ ~t & e;
147396
- }
147397
- function m(t, n, e) {
147398
- return t & n ^ t & e ^ n & e;
147399
- }
147400
- function C(t) {
147401
- return S(t, 2) ^ S(t, 13) ^ S(t, 22);
147402
- }
147403
- function y(t, n) {
147404
- const e = (65535 & t) + (65535 & n);
147405
- return (65535 & (t >>> 16) + (n >>> 16) + (e >>> 16)) << 16 | 65535 & e;
147406
- }
147407
- function U(t, n, e, r) {
147408
- const i = (65535 & t) + (65535 & n) + (65535 & e) + (65535 & r);
147409
- return (65535 & (t >>> 16) + (n >>> 16) + (e >>> 16) + (r >>> 16) + (i >>> 16)) << 16 | 65535 & i;
147410
- }
147411
- function v(t, n, e, r, i) {
147412
- const s = (65535 & t) + (65535 & n) + (65535 & e) + (65535 & r) + (65535 & i);
147413
- return (65535 & (t >>> 16) + (n >>> 16) + (e >>> 16) + (r >>> 16) + (i >>> 16) + (s >>> 16)) << 16 | 65535 & s;
147414
- }
147415
- function R(t) {
147416
- return S(t, 7) ^ S(t, 18) ^ b(t, 3);
147417
- }
147418
- function K(t) {
147419
- return S(t, 6) ^ S(t, 11) ^ S(t, 25);
147420
- }
147421
- function T(t) {
147422
- return [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
147423
- }
147424
- function g(t, n) {
147425
- let e, r, i, s, o, h, u;
147426
- const w = [];
147427
- for (e = n[0], r = n[1], i = n[2], s = n[3], o = n[4], u = 0; u < 80; u += 1) w[u] = u < 16 ? t[u] : H(w[u - 3] ^ w[u - 8] ^ w[u - 14] ^ w[u - 16], 1), h = u < 20 ? v(H(e, 5), d(r, i, s), o, 1518500249, w[u]) : u < 40 ? v(H(e, 5), p(r, i, s), o, 1859775393, w[u]) : u < 60 ? v(H(e, 5), m(r, i, s), o, 2400959708, w[u]) : v(H(e, 5), p(r, i, s), o, 3395469782, w[u]), o = s, s = i, i = H(r, 30), r = e, e = h;
147428
- return n[0] = y(e, n[0]), n[1] = y(r, n[1]), n[2] = y(i, n[2]), n[3] = y(s, n[3]), n[4] = y(o, n[4]), n;
147429
- }
147430
- function F(t, n, e, r) {
147431
- let i;
147432
- const s = 15 + (n + 65 >>> 9 << 4),
147433
- h = n + e;
147434
- for (; t.length <= s;) t.push(0);
147435
- for (t[n >>> 5] |= 128 << 24 - n % 32, t[s] = 4294967295 & h, t[s - 1] = h / o | 0, i = 0; i < t.length; i += 16) r = g(t.slice(i, i + 16), r);
147436
- return r;
147437
- }
147438
- let L = class extends E {
147439
- constructor(t, n, e) {
147440
- if ("SHA-1" !== t) throw new Error(c);
147441
- super(t, n, e);
147442
- const r = e || {};
147443
- this.M = !0, this.g = this.Y, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = g, this.L = function (t) {
147444
- return t.slice();
147445
- }, this.B = T, this.F = F, this.U = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.m = 512, this.R = 160, this.K = !1, r.hmacKey && this.k(A("hmacKey", r.hmacKey, this.T));
147446
- }
146971
+ // Addition with more than 2 elements
146972
+ const add3L = (Al, Bl, Cl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
146973
+ const add3H = (low, Ah, Bh, Ch)=>Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
146974
+ const add4L = (Al, Bl, Cl, Dl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
146975
+ const add4H = (low, Ah, Bh, Ch, Dh)=>Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
146976
+ const add5L = (Al, Bl, Cl, Dl, El)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
146977
+ const add5H = (low, Ah, Bh, Ch, Dh, Eh)=>Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
146978
+ // prettier-ignore
146979
+ const u64 = {
146980
+ fromBig,
146981
+ split,
146982
+ toBig,
146983
+ shrSH,
146984
+ shrSL,
146985
+ rotrSH,
146986
+ rotrSL,
146987
+ rotrBH,
146988
+ rotrBL,
146989
+ rotr32H,
146990
+ rotr32L,
146991
+ rotlSH,
146992
+ rotlSL,
146993
+ rotlBH,
146994
+ rotlBL,
146995
+ add,
146996
+ add3L,
146997
+ add3H,
146998
+ add4L,
146999
+ add4H,
147000
+ add5H,
147001
+ add5L
147447
147002
  };
147448
- function B(t) {
147449
- let n;
147450
- return n = "SHA-224" == t ? u.slice() : w.slice(), n;
147451
- }
147452
- function M(t, n) {
147453
- let e, r, i, s, o, u, w, c, f, a, l;
147454
- const A = [];
147455
- for (e = n[0], r = n[1], i = n[2], s = n[3], o = n[4], u = n[5], w = n[6], c = n[7], l = 0; l < 64; l += 1) A[l] = l < 16 ? t[l] : U(S(E = A[l - 2], 17) ^ S(E, 19) ^ b(E, 10), A[l - 7], R(A[l - 15]), A[l - 16]), f = v(c, K(o), d(o, u, w), h[l], A[l]), a = y(C(e), m(e, r, i)), c = w, w = u, u = o, o = y(s, f), s = i, i = r, r = e, e = y(f, a);
147456
- var E;
147457
- return n[0] = y(e, n[0]), n[1] = y(r, n[1]), n[2] = y(i, n[2]), n[3] = y(s, n[3]), n[4] = y(o, n[4]), n[5] = y(u, n[5]), n[6] = y(w, n[6]), n[7] = y(c, n[7]), n;
147458
- }
147459
- let k = class extends E {
147460
- constructor(t, n, e) {
147461
- if ("SHA-224" !== t && "SHA-256" !== t) throw new Error(c);
147462
- super(t, n, e);
147463
- const r = e || {};
147464
- this.g = this.Y, this.M = !0, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = M, this.L = function (t) {
147465
- return t.slice();
147466
- }, this.B = B, this.F = function (n, e, r, i) {
147467
- return function (t, n, e, r, i) {
147468
- let s, h;
147469
- const u = 15 + (n + 65 >>> 9 << 4),
147470
- w = n + e;
147471
- for (; t.length <= u;) t.push(0);
147472
- for (t[n >>> 5] |= 128 << 24 - n % 32, t[u] = 4294967295 & w, t[u - 1] = w / o | 0, s = 0; s < t.length; s += 16) r = M(t.slice(s, s + 16), r);
147473
- return h = "SHA-224" === i ? [r[0], r[1], r[2], r[3], r[4], r[5], r[6]] : r, h;
147474
- }(n, e, r, i, t);
147475
- }, this.U = B(t), this.m = 512, this.R = "SHA-224" === t ? 224 : 256, this.K = !1, r.hmacKey && this.k(A("hmacKey", r.hmacKey, this.T));
147476
- }
147477
- };
147478
- class Y {
147479
- constructor(t, n) {
147480
- this.N = t, this.I = n;
147481
- }
147482
- }
147483
- function N(t, n) {
147484
- let e;
147485
- return n > 32 ? (e = 64 - n, new Y(t.I << n | t.N >>> e, t.N << n | t.I >>> e)) : 0 !== n ? (e = 32 - n, new Y(t.N << n | t.I >>> e, t.I << n | t.N >>> e)) : t;
147486
- }
147487
- function I(t, n) {
147488
- let e;
147489
- return n < 32 ? (e = 32 - n, new Y(t.N >>> n | t.I << e, t.I >>> n | t.N << e)) : (e = 64 - n, new Y(t.I >>> n | t.N << e, t.N >>> n | t.I << e));
147490
- }
147491
- function X(t, n) {
147492
- return new Y(t.N >>> n, t.I >>> n | t.N << 32 - n);
147493
- }
147494
- function z(t, n, e) {
147495
- return new Y(t.N & n.N ^ t.N & e.N ^ n.N & e.N, t.I & n.I ^ t.I & e.I ^ n.I & e.I);
147496
- }
147497
- function x(t) {
147498
- const n = I(t, 28),
147499
- e = I(t, 34),
147500
- r = I(t, 39);
147501
- return new Y(n.N ^ e.N ^ r.N, n.I ^ e.I ^ r.I);
147502
- }
147503
- function _(t, n) {
147504
- let e, r;
147505
- e = (65535 & t.I) + (65535 & n.I), r = (t.I >>> 16) + (n.I >>> 16) + (e >>> 16);
147506
- const i = (65535 & r) << 16 | 65535 & e;
147507
- e = (65535 & t.N) + (65535 & n.N) + (r >>> 16), r = (t.N >>> 16) + (n.N >>> 16) + (e >>> 16);
147508
- return new Y((65535 & r) << 16 | 65535 & e, i);
147509
- }
147510
- function O(t, n, e, r) {
147511
- let i, s;
147512
- i = (65535 & t.I) + (65535 & n.I) + (65535 & e.I) + (65535 & r.I), s = (t.I >>> 16) + (n.I >>> 16) + (e.I >>> 16) + (r.I >>> 16) + (i >>> 16);
147513
- const o = (65535 & s) << 16 | 65535 & i;
147514
- i = (65535 & t.N) + (65535 & n.N) + (65535 & e.N) + (65535 & r.N) + (s >>> 16), s = (t.N >>> 16) + (n.N >>> 16) + (e.N >>> 16) + (r.N >>> 16) + (i >>> 16);
147515
- return new Y((65535 & s) << 16 | 65535 & i, o);
147516
- }
147517
- function P(t, n, e, r, i) {
147518
- let s, o;
147519
- s = (65535 & t.I) + (65535 & n.I) + (65535 & e.I) + (65535 & r.I) + (65535 & i.I), o = (t.I >>> 16) + (n.I >>> 16) + (e.I >>> 16) + (r.I >>> 16) + (i.I >>> 16) + (s >>> 16);
147520
- const h = (65535 & o) << 16 | 65535 & s;
147521
- s = (65535 & t.N) + (65535 & n.N) + (65535 & e.N) + (65535 & r.N) + (65535 & i.N) + (o >>> 16), o = (t.N >>> 16) + (n.N >>> 16) + (e.N >>> 16) + (r.N >>> 16) + (i.N >>> 16) + (s >>> 16);
147522
- return new Y((65535 & o) << 16 | 65535 & s, h);
147523
- }
147524
- function V(t, n) {
147525
- return new Y(t.N ^ n.N, t.I ^ n.I);
147526
- }
147527
- function Z(t) {
147528
- const n = I(t, 19),
147529
- e = I(t, 61),
147530
- r = X(t, 6);
147531
- return new Y(n.N ^ e.N ^ r.N, n.I ^ e.I ^ r.I);
147532
- }
147533
- function j(t) {
147534
- const n = I(t, 1),
147535
- e = I(t, 8),
147536
- r = X(t, 7);
147537
- return new Y(n.N ^ e.N ^ r.N, n.I ^ e.I ^ r.I);
147538
- }
147539
- function q(t) {
147540
- const n = I(t, 14),
147541
- e = I(t, 18),
147542
- r = I(t, 41);
147543
- return new Y(n.N ^ e.N ^ r.N, n.I ^ e.I ^ r.I);
147544
- }
147545
- const D = [new Y(h[0], 3609767458), new Y(h[1], 602891725), new Y(h[2], 3964484399), new Y(h[3], 2173295548), new Y(h[4], 4081628472), new Y(h[5], 3053834265), new Y(h[6], 2937671579), new Y(h[7], 3664609560), new Y(h[8], 2734883394), new Y(h[9], 1164996542), new Y(h[10], 1323610764), new Y(h[11], 3590304994), new Y(h[12], 4068182383), new Y(h[13], 991336113), new Y(h[14], 633803317), new Y(h[15], 3479774868), new Y(h[16], 2666613458), new Y(h[17], 944711139), new Y(h[18], 2341262773), new Y(h[19], 2007800933), new Y(h[20], 1495990901), new Y(h[21], 1856431235), new Y(h[22], 3175218132), new Y(h[23], 2198950837), new Y(h[24], 3999719339), new Y(h[25], 766784016), new Y(h[26], 2566594879), new Y(h[27], 3203337956), new Y(h[28], 1034457026), new Y(h[29], 2466948901), new Y(h[30], 3758326383), new Y(h[31], 168717936), new Y(h[32], 1188179964), new Y(h[33], 1546045734), new Y(h[34], 1522805485), new Y(h[35], 2643833823), new Y(h[36], 2343527390), new Y(h[37], 1014477480), new Y(h[38], 1206759142), new Y(h[39], 344077627), new Y(h[40], 1290863460), new Y(h[41], 3158454273), new Y(h[42], 3505952657), new Y(h[43], 106217008), new Y(h[44], 3606008344), new Y(h[45], 1432725776), new Y(h[46], 1467031594), new Y(h[47], 851169720), new Y(h[48], 3100823752), new Y(h[49], 1363258195), new Y(h[50], 3750685593), new Y(h[51], 3785050280), new Y(h[52], 3318307427), new Y(h[53], 3812723403), new Y(h[54], 2003034995), new Y(h[55], 3602036899), new Y(h[56], 1575990012), new Y(h[57], 1125592928), new Y(h[58], 2716904306), new Y(h[59], 442776044), new Y(h[60], 593698344), new Y(h[61], 3733110249), new Y(h[62], 2999351573), new Y(h[63], 3815920427), new Y(3391569614, 3928383900), new Y(3515267271, 566280711), new Y(3940187606, 3454069534), new Y(4118630271, 4000239992), new Y(116418474, 1914138554), new Y(174292421, 2731055270), new Y(289380356, 3203993006), new Y(460393269, 320620315), new Y(685471733, 587496836), new Y(852142971, 1086792851), new Y(1017036298, 365543100), new Y(1126000580, 2618297676), new Y(1288033470, 3409855158), new Y(1501505948, 4234509866), new Y(1607167915, 987167468), new Y(1816402316, 1246189591)];
147546
- function G(t) {
147547
- return "SHA-384" === t ? [new Y(3418070365, u[0]), new Y(1654270250, u[1]), new Y(2438529370, u[2]), new Y(355462360, u[3]), new Y(1731405415, u[4]), new Y(41048885895, u[5]), new Y(3675008525, u[6]), new Y(1203062813, u[7])] : [new Y(w[0], 4089235720), new Y(w[1], 2227873595), new Y(w[2], 4271175723), new Y(w[3], 1595750129), new Y(w[4], 2917565137), new Y(w[5], 725511199), new Y(w[6], 4215389547), new Y(w[7], 327033209)];
147548
- }
147549
- function J(t, n) {
147550
- let e, r, i, s, o, h, u, w, c, f, a, l;
147551
- const A = [];
147552
- for (e = n[0], r = n[1], i = n[2], s = n[3], o = n[4], h = n[5], u = n[6], w = n[7], a = 0; a < 80; a += 1) a < 16 ? (l = 2 * a, A[a] = new Y(t[l], t[l + 1])) : A[a] = O(Z(A[a - 2]), A[a - 7], j(A[a - 15]), A[a - 16]), c = P(w, q(o), (H = h, S = u, new Y((E = o).N & H.N ^ ~E.N & S.N, E.I & H.I ^ ~E.I & S.I)), D[a], A[a]), f = _(x(e), z(e, r, i)), w = u, u = h, h = o, o = _(s, c), s = i, i = r, r = e, e = _(c, f);
147553
- var E, H, S;
147554
- return n[0] = _(e, n[0]), n[1] = _(r, n[1]), n[2] = _(i, n[2]), n[3] = _(s, n[3]), n[4] = _(o, n[4]), n[5] = _(h, n[5]), n[6] = _(u, n[6]), n[7] = _(w, n[7]), n;
147555
- }
147556
- let Q = class extends E {
147557
- constructor(t, n, e) {
147558
- if ("SHA-384" !== t && "SHA-512" !== t) throw new Error(c);
147559
- super(t, n, e);
147560
- const r = e || {};
147561
- this.g = this.Y, this.M = !0, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = J, this.L = function (t) {
147562
- return t.slice();
147563
- }, this.B = G, this.F = function (n, e, r, i) {
147564
- return function (t, n, e, r, i) {
147565
- let s, h;
147566
- const u = 31 + (n + 129 >>> 10 << 5),
147567
- w = n + e;
147568
- for (; t.length <= u;) t.push(0);
147569
- for (t[n >>> 5] |= 128 << 24 - n % 32, t[u] = 4294967295 & w, t[u - 1] = w / o | 0, s = 0; s < t.length; s += 32) r = J(t.slice(s, s + 32), r);
147570
- return h = "SHA-384" === i ? [r[0].N, r[0].I, r[1].N, r[1].I, r[2].N, r[2].I, r[3].N, r[3].I, r[4].N, r[4].I, r[5].N, r[5].I] : [r[0].N, r[0].I, r[1].N, r[1].I, r[2].N, r[2].I, r[3].N, r[3].I, r[4].N, r[4].I, r[5].N, r[5].I, r[6].N, r[6].I, r[7].N, r[7].I], h;
147571
- }(n, e, r, i, t);
147572
- }, this.U = G(t), this.m = 1024, this.R = "SHA-384" === t ? 384 : 512, this.K = !1, r.hmacKey && this.k(A("hmacKey", r.hmacKey, this.T));
147573
- }
147574
- };
147575
- const W = [new Y(0, 1), new Y(0, 32898), new Y(2147483648, 32906), new Y(2147483648, 2147516416), new Y(0, 32907), new Y(0, 2147483649), new Y(2147483648, 2147516545), new Y(2147483648, 32777), new Y(0, 138), new Y(0, 136), new Y(0, 2147516425), new Y(0, 2147483658), new Y(0, 2147516555), new Y(2147483648, 139), new Y(2147483648, 32905), new Y(2147483648, 32771), new Y(2147483648, 32770), new Y(2147483648, 128), new Y(0, 32778), new Y(2147483648, 2147483658), new Y(2147483648, 2147516545), new Y(2147483648, 32896), new Y(0, 2147483649), new Y(2147483648, 2147516424)],
147576
- $ = [[0, 36, 3, 41, 18], [1, 44, 10, 45, 2], [62, 6, 43, 15, 61], [28, 55, 25, 21, 56], [27, 20, 39, 8, 14]];
147577
- function tt(t) {
147578
- let n;
147579
- const e = [];
147580
- for (n = 0; n < 5; n += 1) e[n] = [new Y(0, 0), new Y(0, 0), new Y(0, 0), new Y(0, 0), new Y(0, 0)];
147581
- return e;
147582
- }
147583
- function nt(t) {
147584
- let n;
147585
- const e = [];
147586
- for (n = 0; n < 5; n += 1) e[n] = t[n].slice();
147587
- return e;
147588
- }
147589
- function et(t, n) {
147590
- let e, r, i, s;
147591
- const o = [],
147592
- h = [];
147593
- if (null !== t) for (r = 0; r < t.length; r += 2) n[(r >>> 1) % 5][(r >>> 1) / 5 | 0] = V(n[(r >>> 1) % 5][(r >>> 1) / 5 | 0], new Y(t[r + 1], t[r]));
147594
- for (e = 0; e < 24; e += 1) {
147595
- for (s = tt(), r = 0; r < 5; r += 1) o[r] = (u = n[r][0], w = n[r][1], c = n[r][2], f = n[r][3], a = n[r][4], new Y(u.N ^ w.N ^ c.N ^ f.N ^ a.N, u.I ^ w.I ^ c.I ^ f.I ^ a.I));
147596
- for (r = 0; r < 5; r += 1) h[r] = V(o[(r + 4) % 5], N(o[(r + 1) % 5], 1));
147597
- for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) n[r][i] = V(n[r][i], h[r]);
147598
- for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) s[i][(2 * r + 3 * i) % 5] = N(n[r][i], $[r][i]);
147599
- for (r = 0; r < 5; r += 1) for (i = 0; i < 5; i += 1) n[r][i] = V(s[r][i], new Y(~s[(r + 1) % 5][i].N & s[(r + 2) % 5][i].N, ~s[(r + 1) % 5][i].I & s[(r + 2) % 5][i].I));
147600
- n[0][0] = V(n[0][0], W[e]);
147601
- }
147602
- var u, w, c, f, a;
147603
- return n;
147604
- }
147605
- function rt(t) {
147606
- let n,
147607
- e,
147608
- r = 0;
147609
- const i = [0, 0],
147610
- s = [4294967295 & t, t / o & 2097151];
147611
- for (n = 6; n >= 0; n--) e = s[n >> 2] >>> 8 * n & 255, 0 === e && 0 === r || (i[r + 1 >> 2] |= e << 8 * (r + 1), r += 1);
147612
- return r = 0 !== r ? r : 1, i[0] |= r, {
147613
- value: r + 1 > 4 ? i : [i[0]],
147614
- binLen: 8 + 8 * r
147615
- };
147616
- }
147617
- function it(t) {
147618
- return a(rt(t.binLen), t);
147619
- }
147620
- function st(t, n) {
147621
- let e,
147622
- r = rt(n);
147623
- r = a(r, t);
147624
- const i = n >>> 2,
147625
- s = (i - r.value.length % i) % i;
147626
- for (e = 0; e < s; e++) r.value.push(0);
147627
- return r.value;
147628
- }
147629
- let ot = class extends E {
147630
- constructor(t, n, e) {
147631
- let r = 6,
147632
- s = 0;
147633
- super(t, n, e);
147634
- const o = e || {};
147635
- if (1 !== this.numRounds) {
147636
- if (o.kmacKey || o.hmacKey) throw new Error(f);
147637
- if ("CSHAKE128" === this.o || "CSHAKE256" === this.o) throw new Error("Cannot set numRounds for CSHAKE variants");
147638
- }
147639
- switch (this.T = 1, this.C = i(this.t, this.i, this.T), this.v = et, this.L = nt, this.B = tt, this.U = tt(), this.K = !1, t) {
147640
- case "SHA3-224":
147641
- this.m = s = 1152, this.R = 224, this.M = !0, this.g = this.Y;
147642
- break;
147643
- case "SHA3-256":
147644
- this.m = s = 1088, this.R = 256, this.M = !0, this.g = this.Y;
147645
- break;
147646
- case "SHA3-384":
147647
- this.m = s = 832, this.R = 384, this.M = !0, this.g = this.Y;
147648
- break;
147649
- case "SHA3-512":
147650
- this.m = s = 576, this.R = 512, this.M = !0, this.g = this.Y;
147651
- break;
147652
- case "SHAKE128":
147653
- r = 31, this.m = s = 1344, this.R = -1, this.K = !0, this.M = !1, this.g = null;
147654
- break;
147655
- case "SHAKE256":
147656
- r = 31, this.m = s = 1088, this.R = -1, this.K = !0, this.M = !1, this.g = null;
147657
- break;
147658
- case "KMAC128":
147659
- r = 4, this.m = s = 1344, this.X(e), this.R = -1, this.K = !0, this.M = !1, this.g = this._;
147660
- break;
147661
- case "KMAC256":
147662
- r = 4, this.m = s = 1088, this.X(e), this.R = -1, this.K = !0, this.M = !1, this.g = this._;
147663
- break;
147664
- case "CSHAKE128":
147665
- this.m = s = 1344, r = this.O(e), this.R = -1, this.K = !0, this.M = !1, this.g = null;
147666
- break;
147667
- case "CSHAKE256":
147668
- this.m = s = 1088, r = this.O(e), this.R = -1, this.K = !0, this.M = !1, this.g = null;
147669
- break;
147670
- default:
147671
- throw new Error(c);
147672
- }
147673
- this.F = function (t, n, e, i, o) {
147674
- return function (t, n, e, r, i, s, o) {
147675
- let h,
147676
- u,
147677
- w = 0;
147678
- const c = [],
147679
- f = i >>> 5,
147680
- a = n >>> 5;
147681
- for (h = 0; h < a && n >= i; h += f) r = et(t.slice(h, h + f), r), n -= i;
147682
- for (t = t.slice(h), n %= i; t.length < f;) t.push(0);
147683
- for (h = n >>> 3, t[h >> 2] ^= s << h % 4 * 8, t[f - 1] ^= 2147483648, r = et(t, r); 32 * c.length < o && (u = r[w % 5][w / 5 | 0], c.push(u.I), !(32 * c.length >= o));) c.push(u.N), w += 1, 0 == 64 * w % i && (et(null, r), w = 0);
147684
- return c;
147685
- }(t, n, 0, i, s, r, o);
147686
- }, o.hmacKey && this.k(A("hmacKey", o.hmacKey, this.T));
147687
- }
147688
- O(t, n) {
147689
- const e = function (t) {
147690
- const n = t || {};
147691
- return {
147692
- funcName: A("funcName", n.funcName, 1, {
147693
- value: [],
147694
- binLen: 0
147695
- }),
147696
- customization: A("Customization", n.customization, 1, {
147697
- value: [],
147698
- binLen: 0
147699
- })
147700
- };
147701
- }(t || {});
147702
- n && (e.funcName = n);
147703
- const r = a(it(e.funcName), it(e.customization));
147704
- if (0 !== e.customization.binLen || 0 !== e.funcName.binLen) {
147705
- const t = st(r, this.m >>> 3);
147706
- for (let n = 0; n < t.length; n += this.m >>> 5) this.U = this.v(t.slice(n, n + (this.m >>> 5)), this.U), this.A += this.m;
147707
- return 4;
147708
- }
147709
- return 31;
147710
- }
147711
- X(t) {
147712
- const n = function (t) {
147713
- const n = t || {};
147714
- return {
147715
- kmacKey: A("kmacKey", n.kmacKey, 1),
147716
- funcName: {
147717
- value: [1128353099],
147718
- binLen: 32
147719
- },
147720
- customization: A("Customization", n.customization, 1, {
147721
- value: [],
147722
- binLen: 0
147723
- })
147724
- };
147725
- }(t || {});
147726
- this.O(t, n.funcName);
147727
- const e = st(it(n.kmacKey), this.m >>> 3);
147728
- for (let t = 0; t < e.length; t += this.m >>> 5) this.U = this.v(e.slice(t, t + (this.m >>> 5)), this.U), this.A += this.m;
147729
- this.H = !0;
147730
- }
147731
- _(t) {
147732
- const n = a({
147733
- value: this.h.slice(),
147734
- binLen: this.u
147735
- }, function (t) {
147736
- let n,
147737
- e,
147738
- r = 0;
147739
- const i = [0, 0],
147740
- s = [4294967295 & t, t / o & 2097151];
147741
- for (n = 6; n >= 0; n--) e = s[n >> 2] >>> 8 * n & 255, 0 === e && 0 === r || (i[r >> 2] |= e << 8 * r, r += 1);
147742
- return r = 0 !== r ? r : 1, i[r >> 2] |= r << 8 * r, {
147743
- value: r + 1 > 4 ? i : [i[0]],
147744
- binLen: 8 + 8 * r
147745
- };
147746
- }(t.outputLen));
147747
- return this.F(n.value, n.binLen, this.A, this.L(this.U), t.outputLen);
147748
- }
147749
- };
147750
- class ht {
147751
- constructor(t, n, e) {
147752
- if ("SHA-1" == t) this.P = new L(t, n, e);else if ("SHA-224" == t || "SHA-256" == t) this.P = new k(t, n, e);else if ("SHA-384" == t || "SHA-512" == t) this.P = new Q(t, n, e);else {
147753
- if ("SHA3-224" != t && "SHA3-256" != t && "SHA3-384" != t && "SHA3-512" != t && "SHAKE128" != t && "SHAKE256" != t && "CSHAKE128" != t && "CSHAKE256" != t && "KMAC128" != t && "KMAC256" != t) throw new Error(c);
147754
- this.P = new ot(t, n, e);
147003
+
147004
+ // Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):
147005
+ // prettier-ignore
147006
+ const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (()=>u64.split([
147007
+ '0x428a2f98d728ae22',
147008
+ '0x7137449123ef65cd',
147009
+ '0xb5c0fbcfec4d3b2f',
147010
+ '0xe9b5dba58189dbbc',
147011
+ '0x3956c25bf348b538',
147012
+ '0x59f111f1b605d019',
147013
+ '0x923f82a4af194f9b',
147014
+ '0xab1c5ed5da6d8118',
147015
+ '0xd807aa98a3030242',
147016
+ '0x12835b0145706fbe',
147017
+ '0x243185be4ee4b28c',
147018
+ '0x550c7dc3d5ffb4e2',
147019
+ '0x72be5d74f27b896f',
147020
+ '0x80deb1fe3b1696b1',
147021
+ '0x9bdc06a725c71235',
147022
+ '0xc19bf174cf692694',
147023
+ '0xe49b69c19ef14ad2',
147024
+ '0xefbe4786384f25e3',
147025
+ '0x0fc19dc68b8cd5b5',
147026
+ '0x240ca1cc77ac9c65',
147027
+ '0x2de92c6f592b0275',
147028
+ '0x4a7484aa6ea6e483',
147029
+ '0x5cb0a9dcbd41fbd4',
147030
+ '0x76f988da831153b5',
147031
+ '0x983e5152ee66dfab',
147032
+ '0xa831c66d2db43210',
147033
+ '0xb00327c898fb213f',
147034
+ '0xbf597fc7beef0ee4',
147035
+ '0xc6e00bf33da88fc2',
147036
+ '0xd5a79147930aa725',
147037
+ '0x06ca6351e003826f',
147038
+ '0x142929670a0e6e70',
147039
+ '0x27b70a8546d22ffc',
147040
+ '0x2e1b21385c26c926',
147041
+ '0x4d2c6dfc5ac42aed',
147042
+ '0x53380d139d95b3df',
147043
+ '0x650a73548baf63de',
147044
+ '0x766a0abb3c77b2a8',
147045
+ '0x81c2c92e47edaee6',
147046
+ '0x92722c851482353b',
147047
+ '0xa2bfe8a14cf10364',
147048
+ '0xa81a664bbc423001',
147049
+ '0xc24b8b70d0f89791',
147050
+ '0xc76c51a30654be30',
147051
+ '0xd192e819d6ef5218',
147052
+ '0xd69906245565a910',
147053
+ '0xf40e35855771202a',
147054
+ '0x106aa07032bbd1b8',
147055
+ '0x19a4c116b8d2d0c8',
147056
+ '0x1e376c085141ab53',
147057
+ '0x2748774cdf8eeb99',
147058
+ '0x34b0bcb5e19b48a8',
147059
+ '0x391c0cb3c5c95a63',
147060
+ '0x4ed8aa4ae3418acb',
147061
+ '0x5b9cca4f7763e373',
147062
+ '0x682e6ff3d6b2b8a3',
147063
+ '0x748f82ee5defb2fc',
147064
+ '0x78a5636f43172f60',
147065
+ '0x84c87814a1f0ab72',
147066
+ '0x8cc702081a6439ec',
147067
+ '0x90befffa23631e28',
147068
+ '0xa4506cebde82bde9',
147069
+ '0xbef9a3f7b2c67915',
147070
+ '0xc67178f2e372532b',
147071
+ '0xca273eceea26619c',
147072
+ '0xd186b8c721c0c207',
147073
+ '0xeada7dd6cde0eb1e',
147074
+ '0xf57d4f7fee6ed178',
147075
+ '0x06f067aa72176fba',
147076
+ '0x0a637dc5a2c898a6',
147077
+ '0x113f9804bef90dae',
147078
+ '0x1b710b35131c471b',
147079
+ '0x28db77f523047d84',
147080
+ '0x32caab7b40c72493',
147081
+ '0x3c9ebe0a15c9bebc',
147082
+ '0x431d67c49c100d4c',
147083
+ '0x4cc5d4becb3e42b6',
147084
+ '0x597f299cfc657e2a',
147085
+ '0x5fcb6fab3ad6faec',
147086
+ '0x6c44198c4a475817'
147087
+ ].map((n)=>BigInt(n))))();
147088
+ // Temporary buffer, not used to store anything between runs
147089
+ const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
147090
+ const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
147091
+ class SHA512 extends HashMD {
147092
+ // prettier-ignore
147093
+ get() {
147094
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
147095
+ return [
147096
+ Ah,
147097
+ Al,
147098
+ Bh,
147099
+ Bl,
147100
+ Ch,
147101
+ Cl,
147102
+ Dh,
147103
+ Dl,
147104
+ Eh,
147105
+ El,
147106
+ Fh,
147107
+ Fl,
147108
+ Gh,
147109
+ Gl,
147110
+ Hh,
147111
+ Hl
147112
+ ];
147755
147113
  }
147756
- }
147757
- update(t) {
147758
- return this.P.update(t), this;
147759
- }
147760
- getHash(t, n) {
147761
- return this.P.getHash(t, n);
147762
- }
147763
- setHMACKey(t, n, e) {
147764
- this.P.setHMACKey(t, n, e);
147765
- }
147766
- getHMAC(t, n) {
147767
- return this.P.getHMAC(t, n);
147768
- }
147769
- }
147114
+ // prettier-ignore
147115
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
147116
+ this.Ah = Ah | 0;
147117
+ this.Al = Al | 0;
147118
+ this.Bh = Bh | 0;
147119
+ this.Bl = Bl | 0;
147120
+ this.Ch = Ch | 0;
147121
+ this.Cl = Cl | 0;
147122
+ this.Dh = Dh | 0;
147123
+ this.Dl = Dl | 0;
147124
+ this.Eh = Eh | 0;
147125
+ this.El = El | 0;
147126
+ this.Fh = Fh | 0;
147127
+ this.Fl = Fl | 0;
147128
+ this.Gh = Gh | 0;
147129
+ this.Gl = Gl | 0;
147130
+ this.Hh = Hh | 0;
147131
+ this.Hl = Hl | 0;
147132
+ }
147133
+ process(view, offset) {
147134
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
147135
+ for(let i = 0; i < 16; i++, offset += 4){
147136
+ SHA512_W_H[i] = view.getUint32(offset);
147137
+ SHA512_W_L[i] = view.getUint32(offset += 4);
147138
+ }
147139
+ for(let i = 16; i < 80; i++){
147140
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
147141
+ const W15h = SHA512_W_H[i - 15] | 0;
147142
+ const W15l = SHA512_W_L[i - 15] | 0;
147143
+ const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
147144
+ const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
147145
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
147146
+ const W2h = SHA512_W_H[i - 2] | 0;
147147
+ const W2l = SHA512_W_L[i - 2] | 0;
147148
+ const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
147149
+ const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
147150
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
147151
+ const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
147152
+ const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
147153
+ SHA512_W_H[i] = SUMh | 0;
147154
+ SHA512_W_L[i] = SUMl | 0;
147155
+ }
147156
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
147157
+ // Compression function main loop, 80 rounds
147158
+ for(let i = 0; i < 80; i++){
147159
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
147160
+ const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
147161
+ const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
147162
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
147163
+ const CHIh = Eh & Fh ^ ~Eh & Gh;
147164
+ const CHIl = El & Fl ^ ~El & Gl;
147165
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
147166
+ // prettier-ignore
147167
+ const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
147168
+ const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
147169
+ const T1l = T1ll | 0;
147170
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
147171
+ const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
147172
+ const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
147173
+ const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
147174
+ const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
147175
+ Hh = Gh | 0;
147176
+ Hl = Gl | 0;
147177
+ Gh = Fh | 0;
147178
+ Gl = Fl | 0;
147179
+ Fh = Eh | 0;
147180
+ Fl = El | 0;
147181
+ ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
147182
+ Dh = Ch | 0;
147183
+ Dl = Cl | 0;
147184
+ Ch = Bh | 0;
147185
+ Cl = Bl | 0;
147186
+ Bh = Ah | 0;
147187
+ Bl = Al | 0;
147188
+ const All = u64.add3L(T1l, sigma0l, MAJl);
147189
+ Ah = u64.add3H(All, T1h, sigma0h, MAJh);
147190
+ Al = All | 0;
147191
+ }
147192
+ // Add the compressed chunk to the current hash value
147193
+ ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
147194
+ ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
147195
+ ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
147196
+ ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
147197
+ ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
147198
+ ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
147199
+ ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
147200
+ ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
147201
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
147202
+ }
147203
+ roundClean() {
147204
+ SHA512_W_H.fill(0);
147205
+ SHA512_W_L.fill(0);
147206
+ }
147207
+ destroy() {
147208
+ this.buffer.fill(0);
147209
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
147210
+ }
147211
+ constructor(){
147212
+ super(128, 64, 16, false);
147213
+ // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.
147214
+ // Also looks cleaner and easier to verify with spec.
147215
+ // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
147216
+ // h -- high 32 bits, l -- low 32 bits
147217
+ this.Ah = 0x6a09e667 | 0;
147218
+ this.Al = 0xf3bcc908 | 0;
147219
+ this.Bh = 0xbb67ae85 | 0;
147220
+ this.Bl = 0x84caa73b | 0;
147221
+ this.Ch = 0x3c6ef372 | 0;
147222
+ this.Cl = 0xfe94f82b | 0;
147223
+ this.Dh = 0xa54ff53a | 0;
147224
+ this.Dl = 0x5f1d36f1 | 0;
147225
+ this.Eh = 0x510e527f | 0;
147226
+ this.El = 0xade682d1 | 0;
147227
+ this.Fh = 0x9b05688c | 0;
147228
+ this.Fl = 0x2b3e6c1f | 0;
147229
+ this.Gh = 0x1f83d9ab | 0;
147230
+ this.Gl = 0xfb41bd6b | 0;
147231
+ this.Hh = 0x5be0cd19 | 0;
147232
+ this.Hl = 0x137e2179 | 0;
147233
+ }
147234
+ }
147235
+ class SHA384 extends SHA512 {
147236
+ constructor(){
147237
+ super();
147238
+ // h -- high 32 bits, l -- low 32 bits
147239
+ this.Ah = 0xcbbb9d5d | 0;
147240
+ this.Al = 0xc1059ed8 | 0;
147241
+ this.Bh = 0x629a292a | 0;
147242
+ this.Bl = 0x367cd507 | 0;
147243
+ this.Ch = 0x9159015a | 0;
147244
+ this.Cl = 0x3070dd17 | 0;
147245
+ this.Dh = 0x152fecd8 | 0;
147246
+ this.Dl = 0xf70e5939 | 0;
147247
+ this.Eh = 0x67332667 | 0;
147248
+ this.El = 0xffc00b31 | 0;
147249
+ this.Fh = 0x8eb44a87 | 0;
147250
+ this.Fl = 0x68581511 | 0;
147251
+ this.Gh = 0xdb0c2e0d | 0;
147252
+ this.Gl = 0x64f98fa7 | 0;
147253
+ this.Hh = 0x47b5481d | 0;
147254
+ this.Hl = 0xbefa4fa4 | 0;
147255
+ this.outputLen = 48;
147256
+ }
147257
+ }
147258
+ const sha512 = /* @__PURE__ */ wrapConstructor(()=>new SHA512());
147259
+ const sha384 = /* @__PURE__ */ wrapConstructor(()=>new SHA384());
147260
+
147261
+ // SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
147262
+ // It's called a sponge function.
147263
+ // Various per round constants calculations
147264
+ const SHA3_PI = [];
147265
+ const SHA3_ROTL = [];
147266
+ const _SHA3_IOTA = [];
147267
+ const _0n = /* @__PURE__ */ BigInt(0);
147268
+ const _1n = /* @__PURE__ */ BigInt(1);
147269
+ const _2n = /* @__PURE__ */ BigInt(2);
147270
+ const _7n = /* @__PURE__ */ BigInt(7);
147271
+ const _256n = /* @__PURE__ */ BigInt(256);
147272
+ const _0x71n = /* @__PURE__ */ BigInt(0x71);
147273
+ for(let round = 0, R = _1n, x = 1, y = 0; round < 24; round++){
147274
+ // Pi
147275
+ [x, y] = [
147276
+ y,
147277
+ (2 * x + 3 * y) % 5
147278
+ ];
147279
+ SHA3_PI.push(2 * (5 * y + x));
147280
+ // Rotational
147281
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
147282
+ // Iota
147283
+ let t = _0n;
147284
+ for(let j = 0; j < 7; j++){
147285
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
147286
+ if (R & _2n) t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
147287
+ }
147288
+ _SHA3_IOTA.push(t);
147289
+ }
147290
+ const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
147291
+ // Left rotation (without 0, 32, 64)
147292
+ const rotlH = (h, l, s)=>s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
147293
+ const rotlL = (h, l, s)=>s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
147294
+ // Same as keccakf1600, but allows to skip some rounds
147295
+ function keccakP(s, rounds = 24) {
147296
+ const B = new Uint32Array(5 * 2);
147297
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
147298
+ for(let round = 24 - rounds; round < 24; round++){
147299
+ // Theta θ
147300
+ for(let x = 0; x < 10; x++)B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
147301
+ for(let x = 0; x < 10; x += 2){
147302
+ const idx1 = (x + 8) % 10;
147303
+ const idx0 = (x + 2) % 10;
147304
+ const B0 = B[idx0];
147305
+ const B1 = B[idx0 + 1];
147306
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
147307
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
147308
+ for(let y = 0; y < 50; y += 10){
147309
+ s[x + y] ^= Th;
147310
+ s[x + y + 1] ^= Tl;
147311
+ }
147312
+ }
147313
+ // Rho (ρ) and Pi (π)
147314
+ let curH = s[2];
147315
+ let curL = s[3];
147316
+ for(let t = 0; t < 24; t++){
147317
+ const shift = SHA3_ROTL[t];
147318
+ const Th = rotlH(curH, curL, shift);
147319
+ const Tl = rotlL(curH, curL, shift);
147320
+ const PI = SHA3_PI[t];
147321
+ curH = s[PI];
147322
+ curL = s[PI + 1];
147323
+ s[PI] = Th;
147324
+ s[PI + 1] = Tl;
147325
+ }
147326
+ // Chi (χ)
147327
+ for(let y = 0; y < 50; y += 10){
147328
+ for(let x = 0; x < 10; x++)B[x] = s[y + x];
147329
+ for(let x = 0; x < 10; x++)s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
147330
+ }
147331
+ // Iota (ι)
147332
+ s[0] ^= SHA3_IOTA_H[round];
147333
+ s[1] ^= SHA3_IOTA_L[round];
147334
+ }
147335
+ B.fill(0);
147336
+ }
147337
+ class Keccak extends Hash {
147338
+ keccak() {
147339
+ if (!isLE) byteSwap32(this.state32);
147340
+ keccakP(this.state32, this.rounds);
147341
+ if (!isLE) byteSwap32(this.state32);
147342
+ this.posOut = 0;
147343
+ this.pos = 0;
147344
+ }
147345
+ update(data) {
147346
+ exists(this);
147347
+ const { blockLen, state } = this;
147348
+ data = toBytes(data);
147349
+ const len = data.length;
147350
+ for(let pos = 0; pos < len;){
147351
+ const take = Math.min(blockLen - this.pos, len - pos);
147352
+ for(let i = 0; i < take; i++)state[this.pos++] ^= data[pos++];
147353
+ if (this.pos === blockLen) this.keccak();
147354
+ }
147355
+ return this;
147356
+ }
147357
+ finish() {
147358
+ if (this.finished) return;
147359
+ this.finished = true;
147360
+ const { state, suffix, pos, blockLen } = this;
147361
+ // Do the padding
147362
+ state[pos] ^= suffix;
147363
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
147364
+ state[blockLen - 1] ^= 0x80;
147365
+ this.keccak();
147366
+ }
147367
+ writeInto(out) {
147368
+ exists(this, false);
147369
+ bytes(out);
147370
+ this.finish();
147371
+ const bufferOut = this.state;
147372
+ const { blockLen } = this;
147373
+ for(let pos = 0, len = out.length; pos < len;){
147374
+ if (this.posOut >= blockLen) this.keccak();
147375
+ const take = Math.min(blockLen - this.posOut, len - pos);
147376
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
147377
+ this.posOut += take;
147378
+ pos += take;
147379
+ }
147380
+ return out;
147381
+ }
147382
+ xofInto(out) {
147383
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
147384
+ if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
147385
+ return this.writeInto(out);
147386
+ }
147387
+ xof(bytes) {
147388
+ number(bytes);
147389
+ return this.xofInto(new Uint8Array(bytes));
147390
+ }
147391
+ digestInto(out) {
147392
+ output(out, this);
147393
+ if (this.finished) throw new Error('digest() was already called');
147394
+ this.writeInto(out);
147395
+ this.destroy();
147396
+ return out;
147397
+ }
147398
+ digest() {
147399
+ return this.digestInto(new Uint8Array(this.outputLen));
147400
+ }
147401
+ destroy() {
147402
+ this.destroyed = true;
147403
+ this.state.fill(0);
147404
+ }
147405
+ _cloneInto(to) {
147406
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
147407
+ to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
147408
+ to.state32.set(this.state32);
147409
+ to.pos = this.pos;
147410
+ to.posOut = this.posOut;
147411
+ to.finished = this.finished;
147412
+ to.rounds = rounds;
147413
+ // Suffix can change in cSHAKE
147414
+ to.suffix = suffix;
147415
+ to.outputLen = outputLen;
147416
+ to.enableXOF = enableXOF;
147417
+ to.destroyed = this.destroyed;
147418
+ return to;
147419
+ }
147420
+ // NOTE: we accept arguments in bytes instead of bits here.
147421
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24){
147422
+ super();
147423
+ this.blockLen = blockLen;
147424
+ this.suffix = suffix;
147425
+ this.outputLen = outputLen;
147426
+ this.enableXOF = enableXOF;
147427
+ this.rounds = rounds;
147428
+ this.pos = 0;
147429
+ this.posOut = 0;
147430
+ this.finished = false;
147431
+ this.destroyed = false;
147432
+ // Can be passed from user as dkLen
147433
+ number(outputLen);
147434
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
147435
+ if (0 >= this.blockLen || this.blockLen >= 200) throw new Error('Sha3 supports only keccak-f1600 function');
147436
+ this.state = new Uint8Array(200);
147437
+ this.state32 = u32(this.state);
147438
+ }
147439
+ }
147440
+ const gen = (suffix, blockLen, outputLen)=>wrapConstructor(()=>new Keccak(blockLen, suffix, outputLen));
147441
+ const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);
147442
+ /**
147443
+ * SHA3-256 hash function
147444
+ * @param message - that would be hashed
147445
+ */ const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);
147446
+ const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);
147447
+ const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
147770
147448
 
147771
147449
  /**
147772
147450
  * "globalThis" ponyfill.
147773
147451
  * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
147774
147452
  * @type {Object.<string, *>}
147775
- */
147776
- const globalScope = (() => {
147777
- if (typeof globalThis === "object") return globalThis;else {
147778
- Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
147779
- get() {
147780
- return this;
147781
- },
147782
- configurable: true
147783
- });
147784
- try {
147785
- // @ts-ignore
147786
- // eslint-disable-next-line no-undef
147787
- if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
147788
- } finally {
147789
- // @ts-ignore
147790
- delete Object.prototype.__GLOBALTHIS__;
147453
+ */ const globalScope = (()=>{
147454
+ if (typeof globalThis === "object") return globalThis;
147455
+ else {
147456
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
147457
+ get () {
147458
+ return this;
147459
+ },
147460
+ configurable: true
147461
+ });
147462
+ try {
147463
+ // @ts-ignore
147464
+ // eslint-disable-next-line no-undef
147465
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
147466
+ } finally{
147467
+ // @ts-ignore
147468
+ delete Object.prototype.__GLOBALTHIS__;
147469
+ }
147791
147470
  }
147792
- }
147793
-
147794
- // Still unable to determine "globalThis", fall back to a naive method.
147795
- if (typeof self !== "undefined") return self;else if (typeof window !== "undefined") return window;else if (typeof global !== "undefined") return global;
147796
- return undefined;
147471
+ // Still unable to determine "globalThis", fall back to a naive method.
147472
+ if (typeof self !== "undefined") return self;
147473
+ else if (typeof window !== "undefined") return window;
147474
+ else if (typeof global !== "undefined") return global;
147475
+ return undefined;
147797
147476
  })();
147798
147477
 
147799
147478
  /**
147800
- * OpenSSL to jsSHA algorithms map.
147801
- * @type {Object.<string, "SHA-1"|"SHA-224"|"SHA-256"|"SHA-384"|"SHA-512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512">}
147802
- */
147803
- const OPENSSL_JSSHA_ALGO_MAP = {
147804
- SHA1: "SHA-1",
147805
- SHA224: "SHA-224",
147806
- SHA256: "SHA-256",
147807
- SHA384: "SHA-384",
147808
- SHA512: "SHA-512",
147809
- "SHA3-224": "SHA3-224",
147810
- "SHA3-256": "SHA3-256",
147811
- "SHA3-384": "SHA3-384",
147812
- "SHA3-512": "SHA3-512"
147479
+ * OpenSSL-Noble hashes map.
147480
+ * @type {Object.<string, sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512>}
147481
+ */ const OPENSSL_NOBLE_HASHES = {
147482
+ SHA1: sha1,
147483
+ SHA224: sha224,
147484
+ SHA256: sha256,
147485
+ SHA384: sha384,
147486
+ SHA512: sha512,
147487
+ "SHA3-224": sha3_224,
147488
+ "SHA3-256": sha3_256,
147489
+ "SHA3-384": sha3_384,
147490
+ "SHA3-512": sha3_512
147813
147491
  };
147814
-
147815
147492
  /**
147816
147493
  * Calculates an HMAC digest.
147817
147494
  * In Node.js, the command "openssl list -digest-algorithms" displays the available digest algorithms.
147818
147495
  * @param {string} algorithm Algorithm.
147819
- * @param {ArrayBuffer} key Key.
147820
- * @param {ArrayBuffer} message Message.
147821
- * @returns {ArrayBuffer} Digest.
147822
- */
147823
- const hmacDigest = (algorithm, key, message) => {
147824
- {
147825
- const variant = OPENSSL_JSSHA_ALGO_MAP[algorithm.toUpperCase()];
147826
- if (typeof variant === "undefined") {
147827
- throw new TypeError("Unknown hash function");
147496
+ * @param {Uint8Array} key Key.
147497
+ * @param {Uint8Array} message Message.
147498
+ * @returns {Uint8Array} Digest.
147499
+ */ const hmacDigest = (algorithm, key, message)=>{
147500
+ if (hmac) {
147501
+ const hash = OPENSSL_NOBLE_HASHES[algorithm.toUpperCase()];
147502
+ if (!hash) throw new TypeError("Unknown hash function");
147503
+ return hmac(hash, key, message);
147504
+ } else {
147505
+ throw new Error("Missing HMAC function");
147828
147506
  }
147829
- const hmac = new ht(variant, "ARRAYBUFFER");
147830
- hmac.setHMACKey(key, "ARRAYBUFFER");
147831
- hmac.update(message);
147832
- return hmac.getHMAC("ARRAYBUFFER");
147833
- }
147834
147507
  };
147835
147508
 
147836
147509
  /**
147837
147510
  * RFC 4648 base32 alphabet without pad.
147838
147511
  * @type {string}
147839
- */
147840
- const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
147841
-
147512
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
147842
147513
  /**
147843
- * Converts a base32 string to an ArrayBuffer (RFC 4648).
147514
+ * Converts a base32 string to an Uint8Array (RFC 4648).
147844
147515
  * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
147845
147516
  * @param {string} str Base32 string.
147846
- * @returns {ArrayBuffer} ArrayBuffer.
147847
- */
147848
- const base32ToBuf = str => {
147849
- // Canonicalize to all upper case and remove padding if it exists.
147850
- let end = str.length;
147851
- while (str[end - 1] === "=") --end;
147852
- const cstr = (end < str.length ? str.substring(0, end) : str).toUpperCase();
147853
- const buf = new ArrayBuffer(cstr.length * 5 / 8 | 0);
147854
- const arr = new Uint8Array(buf);
147855
- let bits = 0;
147856
- let value = 0;
147857
- let index = 0;
147858
- for (let i = 0; i < cstr.length; i++) {
147859
- const idx = ALPHABET.indexOf(cstr[i]);
147860
- if (idx === -1) throw new TypeError(`Invalid character found: ${cstr[i]}`);
147861
- value = value << 5 | idx;
147862
- bits += 5;
147863
- if (bits >= 8) {
147864
- bits -= 8;
147865
- arr[index++] = value >>> bits;
147517
+ * @returns {Uint8Array} Uint8Array.
147518
+ */ const base32Decode = (str)=>{
147519
+ // Canonicalize to all upper case and remove padding if it exists.
147520
+ let end = str.length;
147521
+ while(str[end - 1] === "=")--end;
147522
+ const cstr = (end < str.length ? str.substring(0, end) : str).toUpperCase();
147523
+ const buf = new ArrayBuffer(cstr.length * 5 / 8 | 0);
147524
+ const arr = new Uint8Array(buf);
147525
+ let bits = 0;
147526
+ let value = 0;
147527
+ let index = 0;
147528
+ for(let i = 0; i < cstr.length; i++){
147529
+ const idx = ALPHABET.indexOf(cstr[i]);
147530
+ if (idx === -1) throw new TypeError(`Invalid character found: ${cstr[i]}`);
147531
+ value = value << 5 | idx;
147532
+ bits += 5;
147533
+ if (bits >= 8) {
147534
+ bits -= 8;
147535
+ arr[index++] = value >>> bits;
147536
+ }
147866
147537
  }
147867
- }
147868
- return buf;
147538
+ return arr;
147869
147539
  };
147870
-
147871
147540
  /**
147872
- * Converts an ArrayBuffer to a base32 string (RFC 4648).
147541
+ * Converts an Uint8Array to a base32 string (RFC 4648).
147873
147542
  * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
147874
- * @param {ArrayBuffer} buf ArrayBuffer.
147543
+ * @param {Uint8Array} arr Uint8Array.
147875
147544
  * @returns {string} Base32 string.
147876
- */
147877
- const base32FromBuf = buf => {
147878
- const arr = new Uint8Array(buf);
147879
- let bits = 0;
147880
- let value = 0;
147881
- let str = "";
147882
- for (let i = 0; i < arr.length; i++) {
147883
- value = value << 8 | arr[i];
147884
- bits += 8;
147885
- while (bits >= 5) {
147886
- str += ALPHABET[value >>> bits - 5 & 31];
147887
- bits -= 5;
147888
- }
147889
- }
147890
- if (bits > 0) {
147891
- str += ALPHABET[value << 5 - bits & 31];
147892
- }
147893
- return str;
147545
+ */ const base32Encode = (arr)=>{
147546
+ let bits = 0;
147547
+ let value = 0;
147548
+ let str = "";
147549
+ for(let i = 0; i < arr.length; i++){
147550
+ value = value << 8 | arr[i];
147551
+ bits += 8;
147552
+ while(bits >= 5){
147553
+ str += ALPHABET[value >>> bits - 5 & 31];
147554
+ bits -= 5;
147555
+ }
147556
+ }
147557
+ if (bits > 0) {
147558
+ str += ALPHABET[value << 5 - bits & 31];
147559
+ }
147560
+ return str;
147894
147561
  };
147895
147562
 
147896
147563
  /**
147897
- * Converts a hexadecimal string to an ArrayBuffer.
147564
+ * Converts a hexadecimal string to an Uint8Array.
147898
147565
  * @param {string} str Hexadecimal string.
147899
- * @returns {ArrayBuffer} ArrayBuffer.
147900
- */
147901
- const hexToBuf = str => {
147902
- const buf = new ArrayBuffer(str.length / 2);
147903
- const arr = new Uint8Array(buf);
147904
- for (let i = 0; i < str.length; i += 2) {
147905
- arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
147906
- }
147907
- return buf;
147566
+ * @returns {Uint8Array} Uint8Array.
147567
+ */ const hexDecode = (str)=>{
147568
+ const buf = new ArrayBuffer(str.length / 2);
147569
+ const arr = new Uint8Array(buf);
147570
+ for(let i = 0; i < str.length; i += 2){
147571
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
147572
+ }
147573
+ return arr;
147908
147574
  };
147909
-
147910
147575
  /**
147911
- * Converts an ArrayBuffer to a hexadecimal string.
147912
- * @param {ArrayBuffer} buf ArrayBuffer.
147576
+ * Converts an Uint8Array to a hexadecimal string.
147577
+ * @param {Uint8Array} arr Uint8Array.
147913
147578
  * @returns {string} Hexadecimal string.
147914
- */
147915
- const hexFromBuf = buf => {
147916
- const arr = new Uint8Array(buf);
147917
- let str = "";
147918
- for (let i = 0; i < arr.length; i++) {
147919
- const hex = arr[i].toString(16);
147920
- if (hex.length === 1) str += "0";
147921
- str += hex;
147922
- }
147923
- return str.toUpperCase();
147579
+ */ const hexEncode = (arr)=>{
147580
+ let str = "";
147581
+ for(let i = 0; i < arr.length; i++){
147582
+ const hex = arr[i].toString(16);
147583
+ if (hex.length === 1) str += "0";
147584
+ str += hex;
147585
+ }
147586
+ return str.toUpperCase();
147924
147587
  };
147925
147588
 
147926
147589
  /**
147927
- * Converts a Latin-1 string to an ArrayBuffer.
147590
+ * Converts a Latin-1 string to an Uint8Array.
147928
147591
  * @param {string} str Latin-1 string.
147929
- * @returns {ArrayBuffer} ArrayBuffer.
147930
- */
147931
- const latin1ToBuf = str => {
147932
- const buf = new ArrayBuffer(str.length);
147933
- const arr = new Uint8Array(buf);
147934
- for (let i = 0; i < str.length; i++) {
147935
- arr[i] = str.charCodeAt(i) & 0xff;
147936
- }
147937
- return buf;
147592
+ * @returns {Uint8Array} Uint8Array.
147593
+ */ const latin1Decode = (str)=>{
147594
+ const buf = new ArrayBuffer(str.length);
147595
+ const arr = new Uint8Array(buf);
147596
+ for(let i = 0; i < str.length; i++){
147597
+ arr[i] = str.charCodeAt(i) & 0xff;
147598
+ }
147599
+ return arr;
147938
147600
  };
147939
-
147940
147601
  /**
147941
- * Converts an ArrayBuffer to a Latin-1 string.
147942
- * @param {ArrayBuffer} buf ArrayBuffer.
147602
+ * Converts an Uint8Array to a Latin-1 string.
147603
+ * @param {Uint8Array} arr Uint8Array.
147943
147604
  * @returns {string} Latin-1 string.
147944
- */
147945
- const latin1FromBuf = buf => {
147946
- const arr = new Uint8Array(buf);
147947
- let str = "";
147948
- for (let i = 0; i < arr.length; i++) {
147949
- str += String.fromCharCode(arr[i]);
147950
- }
147951
- return str;
147605
+ */ const latin1Encode = (arr)=>{
147606
+ let str = "";
147607
+ for(let i = 0; i < arr.length; i++){
147608
+ str += String.fromCharCode(arr[i]);
147609
+ }
147610
+ return str;
147952
147611
  };
147953
147612
 
147954
147613
  /**
147955
147614
  * TextEncoder instance.
147956
147615
  * @type {TextEncoder|null}
147957
- */
147958
- const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder("utf-8") : null;
147959
-
147616
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
147960
147617
  /**
147961
147618
  * TextDecoder instance.
147962
147619
  * @type {TextDecoder|null}
147963
- */
147964
- const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder("utf-8") : null;
147965
-
147620
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
147966
147621
  /**
147967
- * Converts an UTF-8 string to an ArrayBuffer.
147622
+ * Converts an UTF-8 string to an Uint8Array.
147968
147623
  * @param {string} str String.
147969
- * @returns {ArrayBuffer} ArrayBuffer.
147970
- */
147971
- const utf8ToBuf = str => {
147972
- if (!ENCODER) {
147973
- throw new Error("Encoding API not available");
147974
- }
147975
- return ENCODER.encode(str).buffer;
147624
+ * @returns {Uint8Array} Uint8Array.
147625
+ */ const utf8Decode = (str)=>{
147626
+ if (!ENCODER) {
147627
+ throw new Error("Encoding API not available");
147628
+ }
147629
+ return ENCODER.encode(str);
147976
147630
  };
147977
-
147978
147631
  /**
147979
- * Converts an ArrayBuffer to an UTF-8 string.
147980
- * @param {ArrayBuffer} buf ArrayBuffer.
147632
+ * Converts an Uint8Array to an UTF-8 string.
147633
+ * @param {Uint8Array} arr Uint8Array.
147981
147634
  * @returns {string} String.
147982
- */
147983
- const utf8FromBuf = buf => {
147984
- if (!DECODER) {
147985
- throw new Error("Encoding API not available");
147986
- }
147987
- return DECODER.decode(buf);
147635
+ */ const utf8Encode = (arr)=>{
147636
+ if (!DECODER) {
147637
+ throw new Error("Encoding API not available");
147638
+ }
147639
+ return DECODER.decode(arr);
147988
147640
  };
147989
147641
 
147990
147642
  /**
147991
147643
  * Returns random bytes.
147992
147644
  * @param {number} size Size.
147993
- * @returns {ArrayBuffer} Random bytes.
147994
- */
147995
- const randomBytes = size => {
147996
- {
147997
- if (!globalScope.crypto?.getRandomValues) {
147998
- throw new Error("Cryptography API not available");
147645
+ * @returns {Uint8Array} Random bytes.
147646
+ */ const randomBytes = (size)=>{
147647
+ {
147648
+ if (!globalScope.crypto?.getRandomValues) {
147649
+ throw new Error("Cryptography API not available");
147650
+ }
147651
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
147999
147652
  }
148000
- return globalScope.crypto.getRandomValues(new Uint8Array(size)).buffer;
148001
- }
148002
147653
  };
148003
147654
 
148004
147655
  /**
148005
147656
  * OTP secret key.
148006
- */
148007
- class Secret {
148008
- /**
148009
- * Creates a secret key object.
148010
- * @param {Object} [config] Configuration options.
148011
- * @param {ArrayBuffer} [config.buffer=randomBytes] Secret key.
148012
- * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
148013
- */
148014
- constructor({
148015
- buffer,
148016
- size = 20
148017
- } = {}) {
147657
+ */ class Secret {
148018
147658
  /**
148019
- * Secret key.
148020
- * @type {ArrayBuffer}
148021
- */
148022
- this.buffer = typeof buffer === "undefined" ? randomBytes(size) : buffer;
148023
- }
148024
-
148025
- /**
148026
147659
  * Converts a Latin-1 string to a Secret object.
148027
147660
  * @param {string} str Latin-1 string.
148028
147661
  * @returns {Secret} Secret object.
148029
- */
148030
- static fromLatin1(str) {
148031
- return new Secret({
148032
- buffer: latin1ToBuf(str)
148033
- });
148034
- }
148035
-
148036
- /**
147662
+ */ static fromLatin1(str) {
147663
+ return new Secret({
147664
+ buffer: latin1Decode(str).buffer
147665
+ });
147666
+ }
147667
+ /**
148037
147668
  * Converts an UTF-8 string to a Secret object.
148038
147669
  * @param {string} str UTF-8 string.
148039
147670
  * @returns {Secret} Secret object.
148040
- */
148041
- static fromUTF8(str) {
148042
- return new Secret({
148043
- buffer: utf8ToBuf(str)
148044
- });
148045
- }
148046
-
148047
- /**
147671
+ */ static fromUTF8(str) {
147672
+ return new Secret({
147673
+ buffer: utf8Decode(str).buffer
147674
+ });
147675
+ }
147676
+ /**
148048
147677
  * Converts a base32 string to a Secret object.
148049
147678
  * @param {string} str Base32 string.
148050
147679
  * @returns {Secret} Secret object.
148051
- */
148052
- static fromBase32(str) {
148053
- return new Secret({
148054
- buffer: base32ToBuf(str)
148055
- });
148056
- }
148057
-
148058
- /**
147680
+ */ static fromBase32(str) {
147681
+ return new Secret({
147682
+ buffer: base32Decode(str).buffer
147683
+ });
147684
+ }
147685
+ /**
148059
147686
  * Converts a hexadecimal string to a Secret object.
148060
147687
  * @param {string} str Hexadecimal string.
148061
147688
  * @returns {Secret} Secret object.
148062
- */
148063
- static fromHex(str) {
148064
- return new Secret({
148065
- buffer: hexToBuf(str)
148066
- });
148067
- }
148068
-
148069
- /**
147689
+ */ static fromHex(str) {
147690
+ return new Secret({
147691
+ buffer: hexDecode(str).buffer
147692
+ });
147693
+ }
147694
+ /**
147695
+ * Secret key buffer.
147696
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
147697
+ * @type {ArrayBufferLike}
147698
+ */ get buffer() {
147699
+ return this.bytes.buffer;
147700
+ }
147701
+ /**
148070
147702
  * Latin-1 string representation of secret key.
148071
147703
  * @type {string}
148072
- */
148073
- get latin1() {
148074
- Object.defineProperty(this, "latin1", {
148075
- enumerable: true,
148076
- value: latin1FromBuf(this.buffer)
148077
- });
148078
- return this.latin1;
148079
- }
148080
-
148081
- /**
147704
+ */ get latin1() {
147705
+ Object.defineProperty(this, "latin1", {
147706
+ enumerable: true,
147707
+ writable: false,
147708
+ configurable: false,
147709
+ value: latin1Encode(this.bytes)
147710
+ });
147711
+ return this.latin1;
147712
+ }
147713
+ /**
148082
147714
  * UTF-8 string representation of secret key.
148083
147715
  * @type {string}
148084
- */
148085
- get utf8() {
148086
- Object.defineProperty(this, "utf8", {
148087
- enumerable: true,
148088
- value: utf8FromBuf(this.buffer)
148089
- });
148090
- return this.utf8;
148091
- }
148092
-
148093
- /**
147716
+ */ get utf8() {
147717
+ Object.defineProperty(this, "utf8", {
147718
+ enumerable: true,
147719
+ writable: false,
147720
+ configurable: false,
147721
+ value: utf8Encode(this.bytes)
147722
+ });
147723
+ return this.utf8;
147724
+ }
147725
+ /**
148094
147726
  * Base32 string representation of secret key.
148095
147727
  * @type {string}
148096
- */
148097
- get base32() {
148098
- Object.defineProperty(this, "base32", {
148099
- enumerable: true,
148100
- value: base32FromBuf(this.buffer)
148101
- });
148102
- return this.base32;
148103
- }
148104
-
148105
- /**
147728
+ */ get base32() {
147729
+ Object.defineProperty(this, "base32", {
147730
+ enumerable: true,
147731
+ writable: false,
147732
+ configurable: false,
147733
+ value: base32Encode(this.bytes)
147734
+ });
147735
+ return this.base32;
147736
+ }
147737
+ /**
148106
147738
  * Hexadecimal string representation of secret key.
148107
147739
  * @type {string}
148108
- */
148109
- get hex() {
148110
- Object.defineProperty(this, "hex", {
148111
- enumerable: true,
148112
- value: hexFromBuf(this.buffer)
148113
- });
148114
- return this.hex;
148115
- }
147740
+ */ get hex() {
147741
+ Object.defineProperty(this, "hex", {
147742
+ enumerable: true,
147743
+ writable: false,
147744
+ configurable: false,
147745
+ value: hexEncode(this.bytes)
147746
+ });
147747
+ return this.hex;
147748
+ }
147749
+ /**
147750
+ * Creates a secret key object.
147751
+ * @param {Object} [config] Configuration options.
147752
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
147753
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
147754
+ */ constructor({ buffer, size = 20 } = {}){
147755
+ /**
147756
+ * Secret key.
147757
+ * @type {Uint8Array}
147758
+ * @readonly
147759
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
147760
+ // Prevent the "bytes" property from being modified.
147761
+ Object.defineProperty(this, "bytes", {
147762
+ enumerable: true,
147763
+ writable: false,
147764
+ configurable: false,
147765
+ value: this.bytes
147766
+ });
147767
+ }
148116
147768
  }
148117
147769
 
148118
147770
  /**
@@ -148120,27 +147772,25 @@ class Secret {
148120
147772
  * @param {string} a String a.
148121
147773
  * @param {string} b String b.
148122
147774
  * @returns {boolean} Equality result.
148123
- */
148124
- const timingSafeEqual = (a, b) => {
148125
- {
148126
- if (a.length !== b.length) {
148127
- throw new TypeError("Input strings must have the same length");
148128
- }
148129
- let i = -1;
148130
- let out = 0;
148131
- while (++i < a.length) {
148132
- out |= a.charCodeAt(i) ^ b.charCodeAt(i);
147775
+ */ const timingSafeEqual = (a, b)=>{
147776
+ {
147777
+ if (a.length !== b.length) {
147778
+ throw new TypeError("Input strings must have the same length");
147779
+ }
147780
+ let i = -1;
147781
+ let out = 0;
147782
+ while(++i < a.length){
147783
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
147784
+ }
147785
+ return out === 0;
148133
147786
  }
148134
- return out === 0;
148135
- }
148136
147787
  };
148137
147788
 
148138
147789
  /**
148139
147790
  * HOTP: An HMAC-based One-time Password Algorithm.
148140
147791
  * @see [RFC 4226](https://tools.ietf.org/html/rfc4226)
148141
- */
148142
- class HOTP {
148143
- /**
147792
+ */ class HOTP {
147793
+ /**
148144
147794
  * Default configuration.
148145
147795
  * @type {{
148146
147796
  * issuer: string,
@@ -148151,77 +147801,18 @@ class HOTP {
148151
147801
  * counter: number
148152
147802
  * window: number
148153
147803
  * }}
148154
- */
148155
- static get defaults() {
148156
- return {
148157
- issuer: "",
148158
- label: "OTPAuth",
148159
- issuerInLabel: true,
148160
- algorithm: "SHA1",
148161
- digits: 6,
148162
- counter: 0,
148163
- window: 1
148164
- };
148165
- }
148166
-
148167
- /**
148168
- * Creates an HOTP object.
148169
- * @param {Object} [config] Configuration options.
148170
- * @param {string} [config.issuer=''] Account provider.
148171
- * @param {string} [config.label='OTPAuth'] Account label.
148172
- * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
148173
- * @param {Secret|string} [config.secret=Secret] Secret key.
148174
- * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
148175
- * @param {number} [config.digits=6] Token length.
148176
- * @param {number} [config.counter=0] Initial counter value.
148177
- */
148178
- constructor({
148179
- issuer = HOTP.defaults.issuer,
148180
- label = HOTP.defaults.label,
148181
- issuerInLabel = HOTP.defaults.issuerInLabel,
148182
- secret = new Secret(),
148183
- algorithm = HOTP.defaults.algorithm,
148184
- digits = HOTP.defaults.digits,
148185
- counter = HOTP.defaults.counter
148186
- } = {}) {
148187
- /**
148188
- * Account provider.
148189
- * @type {string}
148190
- */
148191
- this.issuer = issuer;
148192
- /**
148193
- * Account label.
148194
- * @type {string}
148195
- */
148196
- this.label = label;
148197
- /**
148198
- * Include issuer prefix in label.
148199
- * @type {boolean}
148200
- */
148201
- this.issuerInLabel = issuerInLabel;
148202
- /**
148203
- * Secret key.
148204
- * @type {Secret}
148205
- */
148206
- this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
148207
- /**
148208
- * HMAC hashing algorithm.
148209
- * @type {string}
148210
- */
148211
- this.algorithm = algorithm.toUpperCase();
148212
- /**
148213
- * Token length.
148214
- * @type {number}
148215
- */
148216
- this.digits = digits;
147804
+ */ static get defaults() {
147805
+ return {
147806
+ issuer: "",
147807
+ label: "OTPAuth",
147808
+ issuerInLabel: true,
147809
+ algorithm: "SHA1",
147810
+ digits: 6,
147811
+ counter: 0,
147812
+ window: 1
147813
+ };
147814
+ }
148217
147815
  /**
148218
- * Initial counter value.
148219
- * @type {number}
148220
- */
148221
- this.counter = counter;
148222
- }
148223
-
148224
- /**
148225
147816
  * Generates an HOTP token.
148226
147817
  * @param {Object} config Configuration options.
148227
147818
  * @param {Secret} config.secret Secret key.
@@ -148229,37 +147820,26 @@ class HOTP {
148229
147820
  * @param {number} [config.digits=6] Token length.
148230
147821
  * @param {number} [config.counter=0] Counter value.
148231
147822
  * @returns {string} Token.
148232
- */
148233
- static generate({
148234
- secret,
148235
- algorithm = HOTP.defaults.algorithm,
148236
- digits = HOTP.defaults.digits,
148237
- counter = HOTP.defaults.counter
148238
- }) {
148239
- const digest = new Uint8Array(hmacDigest(algorithm, secret.buffer, uintToBuf(counter)));
148240
- const offset = digest[digest.byteLength - 1] & 15;
148241
- const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
148242
- return otp.toString().padStart(digits, "0");
148243
- }
148244
-
148245
- /**
147823
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter }) {
147824
+ const digest = hmacDigest(algorithm, secret.bytes, uintDecode(counter));
147825
+ const offset = digest[digest.byteLength - 1] & 15;
147826
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
147827
+ return otp.toString().padStart(digits, "0");
147828
+ }
147829
+ /**
148246
147830
  * Generates an HOTP token.
148247
147831
  * @param {Object} [config] Configuration options.
148248
147832
  * @param {number} [config.counter=this.counter++] Counter value.
148249
147833
  * @returns {string} Token.
148250
- */
148251
- generate({
148252
- counter = this.counter++
148253
- } = {}) {
148254
- return HOTP.generate({
148255
- secret: this.secret,
148256
- algorithm: this.algorithm,
148257
- digits: this.digits,
148258
- counter
148259
- });
148260
- }
148261
-
148262
- /**
147834
+ */ generate({ counter = this.counter++ } = {}) {
147835
+ return HOTP.generate({
147836
+ secret: this.secret,
147837
+ algorithm: this.algorithm,
147838
+ digits: this.digits,
147839
+ counter
147840
+ });
147841
+ }
147842
+ /**
148263
147843
  * Validates an HOTP token.
148264
147844
  * @param {Object} config Configuration options.
148265
147845
  * @param {string} config.token Token value.
@@ -148269,103 +147849,56 @@ class HOTP {
148269
147849
  * @param {number} [config.counter=0] Counter value.
148270
147850
  * @param {number} [config.window=1] Window of counter values to test.
148271
147851
  * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
148272
- */
148273
- static validate({
148274
- token,
148275
- secret,
148276
- algorithm,
148277
- digits,
148278
- counter = HOTP.defaults.counter,
148279
- window = HOTP.defaults.window
148280
- }) {
148281
- // Return early if the token length does not match the digit number.
148282
- if (token.length !== digits) return null;
148283
- let delta = null;
148284
- const check = ( /** @type {number} */i) => {
148285
- const generatedToken = HOTP.generate({
148286
- secret,
148287
- algorithm,
148288
- digits,
148289
- counter: i
148290
- });
148291
- if (timingSafeEqual(token, generatedToken)) {
148292
- delta = i - counter;
148293
- }
148294
- };
148295
- check(counter);
148296
- for (let i = 1; i <= window && delta === null; ++i) {
148297
- check(counter - i);
148298
- if (delta !== null) break;
148299
- check(counter + i);
148300
- if (delta !== null) break;
147852
+ */ static validate({ token, secret, algorithm, digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window }) {
147853
+ // Return early if the token length does not match the digit number.
147854
+ if (token.length !== digits) return null;
147855
+ let delta = null;
147856
+ const check = (/** @type {number} */ i)=>{
147857
+ const generatedToken = HOTP.generate({
147858
+ secret,
147859
+ algorithm,
147860
+ digits,
147861
+ counter: i
147862
+ });
147863
+ if (timingSafeEqual(token, generatedToken)) {
147864
+ delta = i - counter;
147865
+ }
147866
+ };
147867
+ check(counter);
147868
+ for(let i = 1; i <= window && delta === null; ++i){
147869
+ check(counter - i);
147870
+ if (delta !== null) break;
147871
+ check(counter + i);
147872
+ if (delta !== null) break;
147873
+ }
147874
+ return delta;
148301
147875
  }
148302
- return delta;
148303
- }
148304
-
148305
- /**
147876
+ /**
148306
147877
  * Validates an HOTP token.
148307
147878
  * @param {Object} config Configuration options.
148308
147879
  * @param {string} config.token Token value.
148309
147880
  * @param {number} [config.counter=this.counter] Counter value.
148310
147881
  * @param {number} [config.window=1] Window of counter values to test.
148311
147882
  * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
148312
- */
148313
- validate({
148314
- token,
148315
- counter = this.counter,
148316
- window
148317
- }) {
148318
- return HOTP.validate({
148319
- token,
148320
- secret: this.secret,
148321
- algorithm: this.algorithm,
148322
- digits: this.digits,
148323
- counter,
148324
- window
148325
- });
148326
- }
148327
-
148328
- /**
147883
+ */ validate({ token, counter = this.counter, window }) {
147884
+ return HOTP.validate({
147885
+ token,
147886
+ secret: this.secret,
147887
+ algorithm: this.algorithm,
147888
+ digits: this.digits,
147889
+ counter,
147890
+ window
147891
+ });
147892
+ }
147893
+ /**
148329
147894
  * Returns a Google Authenticator key URI.
148330
147895
  * @returns {string} URI.
148331
- */
148332
- toString() {
148333
- const e = encodeURIComponent;
148334
- return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
148335
- }
148336
- }
148337
-
148338
- /**
148339
- * TOTP: Time-Based One-Time Password Algorithm.
148340
- * @see [RFC 6238](https://tools.ietf.org/html/rfc6238)
148341
- */
148342
- class TOTP {
148343
- /**
148344
- * Default configuration.
148345
- * @type {{
148346
- * issuer: string,
148347
- * label: string,
148348
- * issuerInLabel: boolean,
148349
- * algorithm: string,
148350
- * digits: number,
148351
- * period: number
148352
- * window: number
148353
- * }}
148354
- */
148355
- static get defaults() {
148356
- return {
148357
- issuer: "",
148358
- label: "OTPAuth",
148359
- issuerInLabel: true,
148360
- algorithm: "SHA1",
148361
- digits: 6,
148362
- period: 30,
148363
- window: 1
148364
- };
148365
- }
148366
-
148367
- /**
148368
- * Creates a TOTP object.
147896
+ */ toString() {
147897
+ const e = encodeURIComponent;
147898
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
147899
+ }
147900
+ /**
147901
+ * Creates an HOTP object.
148369
147902
  * @param {Object} [config] Configuration options.
148370
147903
  * @param {string} [config.issuer=''] Account provider.
148371
147904
  * @param {string} [config.label='OTPAuth'] Account label.
@@ -148373,55 +147906,66 @@ class TOTP {
148373
147906
  * @param {Secret|string} [config.secret=Secret] Secret key.
148374
147907
  * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
148375
147908
  * @param {number} [config.digits=6] Token length.
148376
- * @param {number} [config.period=30] Token time-step duration.
148377
- */
148378
- constructor({
148379
- issuer = TOTP.defaults.issuer,
148380
- label = TOTP.defaults.label,
148381
- issuerInLabel = TOTP.defaults.issuerInLabel,
148382
- secret = new Secret(),
148383
- algorithm = TOTP.defaults.algorithm,
148384
- digits = TOTP.defaults.digits,
148385
- period = TOTP.defaults.period
148386
- } = {}) {
148387
- /**
147909
+ * @param {number} [config.counter=0] Initial counter value.
147910
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter } = {}){
147911
+ /**
148388
147912
  * Account provider.
148389
147913
  * @type {string}
148390
- */
148391
- this.issuer = issuer;
148392
- /**
147914
+ */ this.issuer = issuer;
147915
+ /**
148393
147916
  * Account label.
148394
147917
  * @type {string}
148395
- */
148396
- this.label = label;
148397
- /**
147918
+ */ this.label = label;
147919
+ /**
148398
147920
  * Include issuer prefix in label.
148399
147921
  * @type {boolean}
148400
- */
148401
- this.issuerInLabel = issuerInLabel;
148402
- /**
147922
+ */ this.issuerInLabel = issuerInLabel;
147923
+ /**
148403
147924
  * Secret key.
148404
147925
  * @type {Secret}
148405
- */
148406
- this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
148407
- /**
147926
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
147927
+ /**
148408
147928
  * HMAC hashing algorithm.
148409
147929
  * @type {string}
148410
- */
148411
- this.algorithm = algorithm.toUpperCase();
148412
- /**
147930
+ */ this.algorithm = algorithm.toUpperCase();
147931
+ /**
148413
147932
  * Token length.
148414
147933
  * @type {number}
148415
- */
148416
- this.digits = digits;
148417
- /**
148418
- * Token time-step duration.
147934
+ */ this.digits = digits;
147935
+ /**
147936
+ * Initial counter value.
148419
147937
  * @type {number}
148420
- */
148421
- this.period = period;
148422
- }
147938
+ */ this.counter = counter;
147939
+ }
147940
+ }
148423
147941
 
148424
- /**
147942
+ /**
147943
+ * TOTP: Time-Based One-Time Password Algorithm.
147944
+ * @see [RFC 6238](https://tools.ietf.org/html/rfc6238)
147945
+ */ class TOTP {
147946
+ /**
147947
+ * Default configuration.
147948
+ * @type {{
147949
+ * issuer: string,
147950
+ * label: string,
147951
+ * issuerInLabel: boolean,
147952
+ * algorithm: string,
147953
+ * digits: number,
147954
+ * period: number
147955
+ * window: number
147956
+ * }}
147957
+ */ static get defaults() {
147958
+ return {
147959
+ issuer: "",
147960
+ label: "OTPAuth",
147961
+ issuerInLabel: true,
147962
+ algorithm: "SHA1",
147963
+ digits: 6,
147964
+ period: 30,
147965
+ window: 1
147966
+ };
147967
+ }
147968
+ /**
148425
147969
  * Generates a TOTP token.
148426
147970
  * @param {Object} config Configuration options.
148427
147971
  * @param {Secret} config.secret Secret key.
@@ -148430,41 +147974,29 @@ class TOTP {
148430
147974
  * @param {number} [config.period=30] Token time-step duration.
148431
147975
  * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
148432
147976
  * @returns {string} Token.
148433
- */
148434
- static generate({
148435
- secret,
148436
- algorithm,
148437
- digits,
148438
- period = TOTP.defaults.period,
148439
- timestamp = Date.now()
148440
- }) {
148441
- return HOTP.generate({
148442
- secret,
148443
- algorithm,
148444
- digits,
148445
- counter: Math.floor(timestamp / 1000 / period)
148446
- });
148447
- }
148448
-
148449
- /**
147977
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now() }) {
147978
+ return HOTP.generate({
147979
+ secret,
147980
+ algorithm,
147981
+ digits,
147982
+ counter: Math.floor(timestamp / 1000 / period)
147983
+ });
147984
+ }
147985
+ /**
148450
147986
  * Generates a TOTP token.
148451
147987
  * @param {Object} [config] Configuration options.
148452
147988
  * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
148453
147989
  * @returns {string} Token.
148454
- */
148455
- generate({
148456
- timestamp = Date.now()
148457
- } = {}) {
148458
- return TOTP.generate({
148459
- secret: this.secret,
148460
- algorithm: this.algorithm,
148461
- digits: this.digits,
148462
- period: this.period,
148463
- timestamp
148464
- });
148465
- }
148466
-
148467
- /**
147990
+ */ generate({ timestamp = Date.now() } = {}) {
147991
+ return TOTP.generate({
147992
+ secret: this.secret,
147993
+ algorithm: this.algorithm,
147994
+ digits: this.digits,
147995
+ period: this.period,
147996
+ timestamp
147997
+ });
147998
+ }
147999
+ /**
148468
148000
  * Validates a TOTP token.
148469
148001
  * @param {Object} config Configuration options.
148470
148002
  * @param {string} config.token Token value.
@@ -148475,58 +148007,81 @@ class TOTP {
148475
148007
  * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
148476
148008
  * @param {number} [config.window=1] Window of counter values to test.
148477
148009
  * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
148478
- */
148479
- static validate({
148480
- token,
148481
- secret,
148482
- algorithm,
148483
- digits,
148484
- period = TOTP.defaults.period,
148485
- timestamp = Date.now(),
148486
- window
148487
- }) {
148488
- return HOTP.validate({
148489
- token,
148490
- secret,
148491
- algorithm,
148492
- digits,
148493
- counter: Math.floor(timestamp / 1000 / period),
148494
- window
148495
- });
148496
- }
148497
-
148498
- /**
148010
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window }) {
148011
+ return HOTP.validate({
148012
+ token,
148013
+ secret,
148014
+ algorithm,
148015
+ digits,
148016
+ counter: Math.floor(timestamp / 1000 / period),
148017
+ window
148018
+ });
148019
+ }
148020
+ /**
148499
148021
  * Validates a TOTP token.
148500
148022
  * @param {Object} config Configuration options.
148501
148023
  * @param {string} config.token Token value.
148502
148024
  * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
148503
148025
  * @param {number} [config.window=1] Window of counter values to test.
148504
148026
  * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
148505
- */
148506
- validate({
148507
- token,
148508
- timestamp,
148509
- window
148510
- }) {
148511
- return TOTP.validate({
148512
- token,
148513
- secret: this.secret,
148514
- algorithm: this.algorithm,
148515
- digits: this.digits,
148516
- period: this.period,
148517
- timestamp,
148518
- window
148519
- });
148520
- }
148521
-
148522
- /**
148027
+ */ validate({ token, timestamp, window }) {
148028
+ return TOTP.validate({
148029
+ token,
148030
+ secret: this.secret,
148031
+ algorithm: this.algorithm,
148032
+ digits: this.digits,
148033
+ period: this.period,
148034
+ timestamp,
148035
+ window
148036
+ });
148037
+ }
148038
+ /**
148523
148039
  * Returns a Google Authenticator key URI.
148524
148040
  * @returns {string} URI.
148525
- */
148526
- toString() {
148527
- const e = encodeURIComponent;
148528
- return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
148529
- }
148041
+ */ toString() {
148042
+ const e = encodeURIComponent;
148043
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
148044
+ }
148045
+ /**
148046
+ * Creates a TOTP object.
148047
+ * @param {Object} [config] Configuration options.
148048
+ * @param {string} [config.issuer=''] Account provider.
148049
+ * @param {string} [config.label='OTPAuth'] Account label.
148050
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
148051
+ * @param {Secret|string} [config.secret=Secret] Secret key.
148052
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
148053
+ * @param {number} [config.digits=6] Token length.
148054
+ * @param {number} [config.period=30] Token time-step duration.
148055
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period } = {}){
148056
+ /**
148057
+ * Account provider.
148058
+ * @type {string}
148059
+ */ this.issuer = issuer;
148060
+ /**
148061
+ * Account label.
148062
+ * @type {string}
148063
+ */ this.label = label;
148064
+ /**
148065
+ * Include issuer prefix in label.
148066
+ * @type {boolean}
148067
+ */ this.issuerInLabel = issuerInLabel;
148068
+ /**
148069
+ * Secret key.
148070
+ * @type {Secret}
148071
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
148072
+ /**
148073
+ * HMAC hashing algorithm.
148074
+ * @type {string}
148075
+ */ this.algorithm = algorithm.toUpperCase();
148076
+ /**
148077
+ * Token length.
148078
+ * @type {number}
148079
+ */ this.digits = digits;
148080
+ /**
148081
+ * Token time-step duration.
148082
+ * @type {number}
148083
+ */ this.period = period;
148084
+ }
148530
148085
  }
148531
148086
 
148532
148087
  const initializeTotp = ({ issuer, secret, }) => {
@@ -148699,7 +148254,7 @@ var require$$4 = {
148699
148254
 
148700
148255
  const fs = fs__default;
148701
148256
  const path = Path__default;
148702
- const os = require$$0$3;
148257
+ const os = require$$0$2;
148703
148258
  const crypto = require$$3$2;
148704
148259
  const packageJson = require$$4;
148705
148260
 
@@ -149243,5 +148798,5 @@ const definePlaywrightConfig = (overrides) => {
149243
148798
  });
149244
148799
  };
149245
148800
 
149246
- export { API_ROUTES, ATTACHMENT_DELETION_TOASTR_MESSAGE, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_PICKER_LABEL, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
148801
+ export { API_ROUTES, ATTACHMENT_DELETION_TOASTR_MESSAGE, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, ENVIRONMENT, EXPANDED_FONT_SIZE, EditorPage, EmbedBase, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, ImageUploader, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_TEXT_MODIFIER_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PLURAL, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SidebarSection, SlackPage, TAGS_SELECTORS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THIRD_PARTY_ROUTES, TOASTR_MESSAGES, TagsPage, TeamMembers, USER_AGENTS, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, currencyUtils, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, filterUtils, generateRandomBypassEmail, generateStagingData, getByDataQA, getGlobalUserState, getImagePathAndName, getListCount, headerUtils, hexToRGB, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
149247
148802
  //# sourceMappingURL=index.js.map