@bigbinary/neeto-playwright-commons 1.8.35 → 1.8.37

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.cjs.js CHANGED
@@ -171,8 +171,10 @@ const skipTest = {
171
171
  const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
172
172
  // trims and replaces multiple whitespace characters in a string with a single space
173
173
  const squish = (text) => text.trim().replace(/\s+/g, " ");
174
+ const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
174
175
 
175
176
  const COMMON_SELECTORS = {
177
+ copyButton: "copy-button",
176
178
  spinner: ".neeto-ui-spinner",
177
179
  subheaderText: "subheader-left",
178
180
  alertTitle: "alert-title",
@@ -187,6 +189,7 @@ const COMMON_SELECTORS = {
187
189
  paneHeader: "pane-header",
188
190
  profileSidebar: "profile-section",
189
191
  selectOption: (label) => `${hyphenize(label)}-select-option`,
192
+ radioLabel: (embedLabel) => `${hyphenize(embedLabel)}-radio-label`,
190
193
  toastMessage: "toastr-message-container",
191
194
  toastCloseButton: "toastr-close-button",
192
195
  windowAlert: "#alert-box",
@@ -242,9 +245,13 @@ function getDefaultExportFromCjs (x) {
242
245
  }
243
246
 
244
247
  function getAugmentedNamespace(n) {
248
+ if (n.__esModule) return n;
245
249
  var f = n.default;
246
250
  if (typeof f == "function") {
247
- var a = function () {
251
+ var a = function a () {
252
+ if (this instanceof a) {
253
+ return Reflect.construct(f, arguments, this.constructor);
254
+ }
248
255
  return f.apply(this, arguments);
249
256
  };
250
257
  a.prototype = f.prototype;
@@ -925,6 +932,8 @@ var setFunctionLength = function setFunctionLength(fn, length) {
925
932
  return fn;
926
933
  };
927
934
 
935
+ callBind$1.exports;
936
+
928
937
  (function (module) {
929
938
 
930
939
  var bind = functionBind;
@@ -968,12 +977,14 @@ var setFunctionLength = function setFunctionLength(fn, length) {
968
977
  $defineProperty(module.exports, 'apply', { value: applyBind });
969
978
  } else {
970
979
  module.exports.apply = applyBind;
971
- }
980
+ }
972
981
  } (callBind$1));
973
982
 
983
+ var callBindExports = callBind$1.exports;
984
+
974
985
  var GetIntrinsic$1 = getIntrinsic;
975
986
 
976
- var callBind = callBind$1.exports;
987
+ var callBind = callBindExports;
977
988
 
978
989
  var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
979
990
 
@@ -2500,6 +2511,8 @@ var lib$7 = {
2500
2511
  stringify: stringify$5
2501
2512
  };
2502
2513
 
2514
+ var qs$1 = /*@__PURE__*/getDefaultExportFromCjs(lib$7);
2515
+
2503
2516
  class CustomCommands {
2504
2517
  constructor(page, request, baseURL = process.env.BASE_URL) {
2505
2518
  this.interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
@@ -2566,7 +2579,7 @@ class CustomCommands {
2566
2579
  };
2567
2580
  const formattedUrl = ramda.isEmpty(params)
2568
2581
  ? url
2569
- : `${url}?${lib$7.stringify(params, {
2582
+ : `${url}?${qs$1.stringify(params, {
2570
2583
  arrayFormat: "brackets",
2571
2584
  })}`;
2572
2585
  return await this.request[method](formattedUrl, requestOptions);
@@ -3129,6 +3142,7 @@ function requireCommon$1 () {
3129
3142
  }
3130
3143
 
3131
3144
  /* eslint-env browser */
3145
+ browser$1.exports;
3132
3146
 
3133
3147
  var hasRequiredBrowser;
3134
3148
 
@@ -3402,8 +3416,8 @@ function requireBrowser () {
3402
3416
  } catch (error) {
3403
3417
  return '[UnexpectedJSONParseError]: ' + error.message;
3404
3418
  }
3405
- };
3406
- } (browser$1, browser$1.exports));
3419
+ };
3420
+ } (browser$1, browser$1.exports));
3407
3421
  return browser$1.exports;
3408
3422
  }
3409
3423
 
@@ -3571,6 +3585,7 @@ function requireSupportsColor () {
3571
3585
  /**
3572
3586
  * Module dependencies.
3573
3587
  */
3588
+ node.exports;
3574
3589
 
3575
3590
  var hasRequiredNode;
3576
3591
 
@@ -3836,8 +3851,8 @@ function requireNode () {
3836
3851
  formatters.O = function (v) {
3837
3852
  this.inspectOpts.colors = this.useColors;
3838
3853
  return util.inspect(v, this.inspectOpts);
3839
- };
3840
- } (node, node.exports));
3854
+ };
3855
+ } (node, node.exports));
3841
3856
  return node.exports;
3842
3857
  }
3843
3858
 
@@ -3846,15 +3861,14 @@ function requireNode () {
3846
3861
  * treat as a browser.
3847
3862
  */
3848
3863
 
3849
- (function (module) {
3850
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3851
- module.exports = requireBrowser();
3852
- } else {
3853
- module.exports = requireNode();
3854
- }
3855
- } (src$1));
3864
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3865
+ src$1.exports = requireBrowser();
3866
+ } else {
3867
+ src$1.exports = requireNode();
3868
+ }
3856
3869
 
3857
- var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(src$1.exports);
3870
+ var srcExports = src$1.exports;
3871
+ var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
3858
3872
 
3859
3873
  /*!
3860
3874
  * playwright-extra v4.3.5 by berstend
@@ -5449,10 +5463,16 @@ class StealthPlugin extends PuppeteerExtraPlugin {
5449
5463
  const defaultExport = opts => new StealthPlugin(opts);
5450
5464
  var puppeteerExtraPluginStealth = defaultExport;
5451
5465
 
5466
+ // const moduleExport = defaultExport
5467
+ // moduleExport.StealthPlugin = StealthPlugin
5468
+ // module.exports = moduleExport
5469
+
5470
+ var stealth$1 = /*@__PURE__*/getDefaultExportFromCjs(puppeteerExtraPluginStealth);
5471
+
5452
5472
  var stealth = test$1.test.extend({
5453
5473
  browser: async ({ browser }, use) => {
5454
5474
  await browser.close();
5455
- chromium.use(puppeteerExtraPluginStealth());
5475
+ chromium.use(stealth$1());
5456
5476
  const stealthBrowser = await chromium.launch();
5457
5477
  await use(stealthBrowser);
5458
5478
  await stealthBrowser.close();
@@ -5971,7 +5991,7 @@ var utils$k = {};
5971
5991
  };
5972
5992
  flat(args);
5973
5993
  return result;
5974
- };
5994
+ };
5975
5995
  } (utils$k));
5976
5996
 
5977
5997
  const utils$j = utils$k;
@@ -7278,8 +7298,6 @@ braces$1.create = (input, options = {}) => {
7278
7298
 
7279
7299
  var braces_1 = braces$1;
7280
7300
 
7281
- var picomatch$2 = {exports: {}};
7282
-
7283
7301
  var utils$g = {};
7284
7302
 
7285
7303
  const path$8 = Path__default["default"];
@@ -7523,7 +7541,7 @@ var constants$b = {
7523
7541
  output = `(?:^(?!${output}).*$)`;
7524
7542
  }
7525
7543
  return output;
7526
- };
7544
+ };
7527
7545
  } (utils$g));
7528
7546
 
7529
7547
  const utils$f = utils$g;
@@ -9035,9 +9053,9 @@ const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
9035
9053
  * @api public
9036
9054
  */
9037
9055
 
9038
- const picomatch$1 = (glob, options, returnState = false) => {
9056
+ const picomatch$2 = (glob, options, returnState = false) => {
9039
9057
  if (Array.isArray(glob)) {
9040
- const fns = glob.map(input => picomatch$1(input, options, returnState));
9058
+ const fns = glob.map(input => picomatch$2(input, options, returnState));
9041
9059
  const arrayMatcher = str => {
9042
9060
  for (const isMatch of fns) {
9043
9061
  const state = isMatch(str);
@@ -9057,8 +9075,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
9057
9075
  const opts = options || {};
9058
9076
  const posix = utils$d.isWindows(options);
9059
9077
  const regex = isState
9060
- ? picomatch$1.compileRe(glob, options)
9061
- : picomatch$1.makeRe(glob, options, false, true);
9078
+ ? picomatch$2.compileRe(glob, options)
9079
+ : picomatch$2.makeRe(glob, options, false, true);
9062
9080
 
9063
9081
  const state = regex.state;
9064
9082
  delete regex.state;
@@ -9066,11 +9084,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
9066
9084
  let isIgnored = () => false;
9067
9085
  if (opts.ignore) {
9068
9086
  const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
9069
- isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
9087
+ isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
9070
9088
  }
9071
9089
 
9072
9090
  const matcher = (input, returnObject = false) => {
9073
- const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
9091
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, { glob, posix });
9074
9092
  const result = { glob, state, regex, posix, input, output, match, isMatch };
9075
9093
 
9076
9094
  if (typeof opts.onResult === 'function') {
@@ -9120,7 +9138,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
9120
9138
  * @api public
9121
9139
  */
9122
9140
 
9123
- picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9141
+ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
9124
9142
  if (typeof input !== 'string') {
9125
9143
  throw new TypeError('Expected input to be a string');
9126
9144
  }
@@ -9141,7 +9159,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9141
9159
 
9142
9160
  if (match === false || opts.capture === true) {
9143
9161
  if (opts.matchBase === true || opts.basename === true) {
9144
- match = picomatch$1.matchBase(input, regex, options, posix);
9162
+ match = picomatch$2.matchBase(input, regex, options, posix);
9145
9163
  } else {
9146
9164
  match = regex.exec(output);
9147
9165
  }
@@ -9164,8 +9182,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9164
9182
  * @api public
9165
9183
  */
9166
9184
 
9167
- picomatch$1.matchBase = (input, glob, options, posix = utils$d.isWindows(options)) => {
9168
- const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
9185
+ picomatch$2.matchBase = (input, glob, options, posix = utils$d.isWindows(options)) => {
9186
+ const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
9169
9187
  return regex.test(path$7.basename(input));
9170
9188
  };
9171
9189
 
@@ -9186,7 +9204,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils$d.isWindows(options
9186
9204
  * @api public
9187
9205
  */
9188
9206
 
9189
- picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
9207
+ picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
9190
9208
 
9191
9209
  /**
9192
9210
  * Parse a glob pattern to create the source string for a regular
@@ -9202,8 +9220,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
9202
9220
  * @api public
9203
9221
  */
9204
9222
 
9205
- picomatch$1.parse = (pattern, options) => {
9206
- if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
9223
+ picomatch$2.parse = (pattern, options) => {
9224
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
9207
9225
  return parse$2(pattern, { ...options, fastpaths: false });
9208
9226
  };
9209
9227
 
@@ -9234,7 +9252,7 @@ picomatch$1.parse = (pattern, options) => {
9234
9252
  * @api public
9235
9253
  */
9236
9254
 
9237
- picomatch$1.scan = (input, options) => scan$1(input, options);
9255
+ picomatch$2.scan = (input, options) => scan$1(input, options);
9238
9256
 
9239
9257
  /**
9240
9258
  * Compile a regular expression from the `state` object returned by the
@@ -9248,7 +9266,7 @@ picomatch$1.scan = (input, options) => scan$1(input, options);
9248
9266
  * @api public
9249
9267
  */
9250
9268
 
9251
- picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
9269
+ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
9252
9270
  if (returnOutput === true) {
9253
9271
  return state.output;
9254
9272
  }
@@ -9262,7 +9280,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
9262
9280
  source = `^(?!${source}).*$`;
9263
9281
  }
9264
9282
 
9265
- const regex = picomatch$1.toRegex(source, options);
9283
+ const regex = picomatch$2.toRegex(source, options);
9266
9284
  if (returnState === true) {
9267
9285
  regex.state = state;
9268
9286
  }
@@ -9289,7 +9307,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
9289
9307
  * @api public
9290
9308
  */
9291
9309
 
9292
- picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
9310
+ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
9293
9311
  if (!input || typeof input !== 'string') {
9294
9312
  throw new TypeError('Expected a non-empty string');
9295
9313
  }
@@ -9304,7 +9322,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
9304
9322
  parsed = parse$2(input, options);
9305
9323
  }
9306
9324
 
9307
- return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
9325
+ return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
9308
9326
  };
9309
9327
 
9310
9328
  /**
@@ -9324,7 +9342,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
9324
9342
  * @api public
9325
9343
  */
9326
9344
 
9327
- picomatch$1.toRegex = (source, options) => {
9345
+ picomatch$2.toRegex = (source, options) => {
9328
9346
  try {
9329
9347
  const opts = options || {};
9330
9348
  return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
@@ -9339,22 +9357,19 @@ picomatch$1.toRegex = (source, options) => {
9339
9357
  * @return {Object}
9340
9358
  */
9341
9359
 
9342
- picomatch$1.constants = constants$9;
9360
+ picomatch$2.constants = constants$9;
9343
9361
 
9344
9362
  /**
9345
9363
  * Expose "picomatch"
9346
9364
  */
9347
9365
 
9348
- var picomatch_1 = picomatch$1;
9366
+ var picomatch_1 = picomatch$2;
9349
9367
 
9350
- (function (module) {
9351
-
9352
- module.exports = picomatch_1;
9353
- } (picomatch$2));
9368
+ var picomatch$1 = picomatch_1;
9354
9369
 
9355
9370
  const util$7 = require$$0__default["default"];
9356
9371
  const braces = braces_1;
9357
- const picomatch = picomatch$2.exports;
9372
+ const picomatch = picomatch$1;
9358
9373
  const utils$c = utils$g;
9359
9374
  const isEmptyString = val => val === '' || val === './';
9360
9375
 
@@ -10408,7 +10423,7 @@ var fs$a = {};
10408
10423
  }
10409
10424
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
10410
10425
  }
10411
- exports.createFileSystemAdapter = createFileSystemAdapter;
10426
+ exports.createFileSystemAdapter = createFileSystemAdapter;
10412
10427
  } (fs$a));
10413
10428
 
10414
10429
  Object.defineProperty(settings$3, "__esModule", { value: true });
@@ -10761,7 +10776,7 @@ var fs$6 = {};
10761
10776
  }
10762
10777
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
10763
10778
  }
10764
- exports.createFileSystemAdapter = createFileSystemAdapter;
10779
+ exports.createFileSystemAdapter = createFileSystemAdapter;
10765
10780
  } (fs$6));
10766
10781
 
10767
10782
  Object.defineProperty(settings$2, "__esModule", { value: true });
@@ -11137,6 +11152,8 @@ function queueAsPromised (context, worker, concurrency) {
11137
11152
  queue.exports = fastqueue;
11138
11153
  queue.exports.promise = queueAsPromised;
11139
11154
 
11155
+ var queueExports = queue.exports;
11156
+
11140
11157
  var common$4 = {};
11141
11158
 
11142
11159
  Object.defineProperty(common$4, "__esModule", { value: true });
@@ -11186,7 +11203,7 @@ reader$1.default = Reader$1;
11186
11203
  Object.defineProperty(async$4, "__esModule", { value: true });
11187
11204
  const events_1 = require$$0__default$2["default"];
11188
11205
  const fsScandir$2 = out$2;
11189
- const fastq = queue.exports;
11206
+ const fastq = queueExports;
11190
11207
  const common$2 = common$4;
11191
11208
  const reader_1$4 = reader$1;
11192
11209
  class AsyncReader extends reader_1$4.default {
@@ -12109,7 +12126,7 @@ var settings = {};
12109
12126
  return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
12110
12127
  }
12111
12128
  }
12112
- exports.default = Settings;
12129
+ exports.default = Settings;
12113
12130
  } (settings));
12114
12131
 
12115
12132
  const taskManager = tasks;
@@ -12293,6 +12310,210 @@ const i18nFixture = {
12293
12310
  },
12294
12311
  };
12295
12312
 
12313
+ const EMBED_SELECTORS = {
12314
+ iframe: (appName) => `#${appName}-iframe`,
12315
+ modal: (appName) => `#${appName}-modal`,
12316
+ close: (appName) => `#close-${appName}`,
12317
+ loader: (appName) => `#${appName}-loader`,
12318
+ inlineHeightInput: "inline-height-input-field",
12319
+ inlineWidthInput: "inline-width-input-field",
12320
+ inlineElementIdInput: "inline-element-id-input-field",
12321
+ codeBlock: "code-block",
12322
+ previewTab: "preview-tab",
12323
+ htmlTab: "html-tab",
12324
+ buttonTextInput: "button-text-input-field",
12325
+ buttonPositionSelectContainer: "button-position-select-value-container",
12326
+ buttonPositionSelectMenu: "button-position-select-menu",
12327
+ buttonColorLabel: "button-color-label",
12328
+ buttonTextColorLabel: "button-text-color-label",
12329
+ colorPickerTarget: "color-picker-target",
12330
+ colorpickerEditableInput: "colorpicker-editable-input",
12331
+ showIconCheckbox: "show-icon-checkbox",
12332
+ elementIdInput: "element-id-input-field",
12333
+ previewElementPopupButton: "preview-element-popup-button",
12334
+ };
12335
+
12336
+ const basicHTMLContent = (content) => `
12337
+ <!DOCTYPE html>
12338
+ <html lang="en">
12339
+ <head>
12340
+ <meta charset="UTF-8" />
12341
+ <meta name="viewport" content="width=device-width" />
12342
+ </head>
12343
+ <body>
12344
+ ${content}
12345
+ </body>
12346
+ </html>`;
12347
+ const hexToRGB = (hex) => {
12348
+ let r = "", g = "", b = "";
12349
+ if (hex.length === 4) {
12350
+ r = `0x${hex[1]}${hex[1]}`;
12351
+ g = `0x${hex[2]}${hex[2]}`;
12352
+ b = `0x${hex[3]}${hex[3]}`;
12353
+ }
12354
+ else if (hex.length === 7) {
12355
+ r = `0x${hex[1]}${hex[2]}`;
12356
+ g = `0x${hex[3]}${hex[4]}`;
12357
+ b = `0x${hex[5]}${hex[6]}`;
12358
+ }
12359
+ return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
12360
+ };
12361
+
12362
+ class EmbedBase {
12363
+ constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
12364
+ this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
12365
+ this.embedTestPage = await this.context.newPage();
12366
+ this.embedTestPageType = embedType;
12367
+ const fileContent = basicHTMLContent(this.embedTestPageType === "elementClick"
12368
+ ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
12369
+ : embedCode);
12370
+ this.filePath = `tmp/${faker.faker.word.noun()}.html`;
12371
+ fs$d.writeFileSync(this.filePath, fileContent, "utf8");
12372
+ await this.embedTestPage.goto(`file://${Path__default["default"].resolve(this.filePath)}`);
12373
+ await this.embedTestPage.waitForLoadState("load");
12374
+ this.embeddedFrame = this.embedTestPage.frameLocator(this.embedTestPageType === "inline"
12375
+ ? "iframe"
12376
+ : EMBED_SELECTORS.iframe(this.appName));
12377
+ return this.embedTestPage;
12378
+ };
12379
+ this.closeEmbedModalAndPage = async () => {
12380
+ if (this.embedTestPageType !== "inline") {
12381
+ await this.embedTestPage
12382
+ .locator(EMBED_SELECTORS.close(this.appName))
12383
+ .click();
12384
+ await test$1.expect(this.embedTestPage.locator(EMBED_SELECTORS.modal(this.appName))).toBeHidden();
12385
+ }
12386
+ await this.embedTestPage.close();
12387
+ await this.context.close();
12388
+ fs$d.unlinkSync(this.filePath);
12389
+ };
12390
+ this.clickOnPopupButton = async (popUpButtonSelectorOptions) => {
12391
+ const popUpButton = this.embedTestPage.getByRole(this.embedTestPageType === "floatingPopup" ? "button" : "link", popUpButtonSelectorOptions);
12392
+ await test$1.expect(popUpButton).toBeVisible();
12393
+ await popUpButton.click();
12394
+ await test$1.expect(this.embedTestPage.locator(EMBED_SELECTORS.loader(this.appName))).toBeHidden({
12395
+ timeout: 10000,
12396
+ });
12397
+ };
12398
+ this.copyEmbedScript = async ({ embedLabel }) => {
12399
+ await this.page
12400
+ .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
12401
+ .check();
12402
+ await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
12403
+ return await this.page.evaluate(() => navigator.clipboard.readText());
12404
+ };
12405
+ this.selectEmbedType = async (embedLabel) => {
12406
+ await this.page.getByTestId(EMBED_SELECTORS.htmlTab).click();
12407
+ await this.page
12408
+ .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
12409
+ .check();
12410
+ };
12411
+ this.verifyInlineCustomization = async ({ headingTestId, inlineEmbedInterceptParams, customizationOptions, }) => {
12412
+ const embedHeightPercentage = `${customizationOptions.embedHeight}%`;
12413
+ const embedWidthPercentage = `${customizationOptions.embedWidth}%`;
12414
+ await this.page
12415
+ .getByTestId(EMBED_SELECTORS.inlineHeightInput)
12416
+ .fill(customizationOptions.embedHeight);
12417
+ await this.page
12418
+ .getByTestId(EMBED_SELECTORS.inlineWidthInput)
12419
+ .fill(customizationOptions.embedWidth);
12420
+ await this.page
12421
+ .getByTestId(EMBED_SELECTORS.inlineElementIdInput)
12422
+ .fill(customizationOptions.embedDivContainerId);
12423
+ await this.expectMultipleTextsInCodeblock([
12424
+ RegExp(`<div .* id="${customizationOptions.embedDivContainerId}">`),
12425
+ `elementSelector: "#${customizationOptions.embedDivContainerId}"`,
12426
+ `height: "${embedHeightPercentage}"`,
12427
+ `width: "${embedWidthPercentage}"`,
12428
+ ]);
12429
+ const inlineEmbedPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses(inlineEmbedInterceptParams);
12430
+ await this.previewTab.click();
12431
+ await inlineEmbedPromise;
12432
+ const iframe = this.page.locator("iframe");
12433
+ await iframe.waitFor({ state: "visible" });
12434
+ await test$1.expect(this.page.frameLocator("iframe").getByTestId(headingTestId)).toBeVisible({ timeout: 10000 });
12435
+ const iframeHeight = await iframe.evaluate(node => node.getAttribute("height"));
12436
+ const iframeWidth = await iframe.evaluate(node => node.getAttribute("width"));
12437
+ test$1.expect(iframeHeight).toStrictEqual(embedHeightPercentage);
12438
+ test$1.expect(iframeWidth).toStrictEqual(embedWidthPercentage);
12439
+ };
12440
+ this.verifyFloatingPopupCustomization = async (customizationOptions) => {
12441
+ await this.page
12442
+ .getByTestId(EMBED_SELECTORS.buttonTextInput)
12443
+ .fill(customizationOptions.buttonText);
12444
+ await this.page
12445
+ .getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)
12446
+ .click();
12447
+ await this.page
12448
+ .getByTestId(EMBED_SELECTORS.buttonPositionSelectMenu)
12449
+ .getByText(customizationOptions.buttonPosition)
12450
+ .click();
12451
+ await test$1.expect(this.page.getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)).toContainText(customizationOptions.buttonPosition);
12452
+ const buttonColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonColorLabel);
12453
+ await buttonColorLabel
12454
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12455
+ .click();
12456
+ await this.page
12457
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
12458
+ .getByRole("textbox")
12459
+ .fill(customizationOptions.buttonColorHex);
12460
+ const buttonTextColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonTextColorLabel);
12461
+ // This additional click is to close the previously opened color picker for buttonColor.
12462
+ await buttonTextColorLabel
12463
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12464
+ .click();
12465
+ await buttonTextColorLabel
12466
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12467
+ .click();
12468
+ await this.page
12469
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
12470
+ .getByRole("textbox")
12471
+ .fill(customizationOptions.buttonTextColorHex);
12472
+ await this.page.getByTestId(EMBED_SELECTORS.showIconCheckbox).click();
12473
+ await this.expectMultipleTextsInCodeblock([
12474
+ `btnColor: "${customizationOptions.buttonColorHex}"`,
12475
+ `btnTextColor: "${customizationOptions.buttonTextColorHex}"`,
12476
+ `btnPosition: "${toCamelCase(customizationOptions.buttonPosition)}"`,
12477
+ `btnText: "${customizationOptions.buttonText}"`,
12478
+ "showIcon: false",
12479
+ ]);
12480
+ await this.previewTab.click();
12481
+ const floatingButton = this.page.getByRole("button", {
12482
+ name: customizationOptions.buttonText,
12483
+ });
12484
+ await test$1.expect(floatingButton).toHaveCSS("color", hexToRGB(customizationOptions.buttonTextColorHex));
12485
+ await test$1.expect(floatingButton).toHaveCSS("background-color", hexToRGB(customizationOptions.buttonColorHex));
12486
+ const classRegExp = customizationOptions.buttonPosition
12487
+ .toLocaleLowerCase()
12488
+ .replace(" ", ".*");
12489
+ await test$1.expect(floatingButton).toHaveClass(RegExp(classRegExp));
12490
+ await test$1.expect(floatingButton.locator("svg")).toBeHidden();
12491
+ };
12492
+ this.verifyElementClickCustomization = async (customizationOptions) => {
12493
+ await this.page
12494
+ .getByTestId(EMBED_SELECTORS.elementIdInput)
12495
+ .fill(customizationOptions.customId);
12496
+ await test$1.expect(this.codeBlock).toContainText(`elementSelector: "#${customizationOptions.customId}"`);
12497
+ await this.previewTab.click();
12498
+ await test$1.expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible();
12499
+ await test$1.expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible();
12500
+ };
12501
+ this.expectMultipleTextsInCodeblock = async (containTextOptions) => {
12502
+ const codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
12503
+ for (const containTextOption of containTextOptions) {
12504
+ await test$1.expect(codeBlock).toContainText(containTextOption);
12505
+ }
12506
+ };
12507
+ this.context = context;
12508
+ this.page = page;
12509
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
12510
+ this.appName = appName;
12511
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
12512
+ this.codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
12513
+ this.previewTab = this.page.getByTestId(EMBED_SELECTORS.previewTab);
12514
+ }
12515
+ }
12516
+
12296
12517
  const BASE_URL = "/api/v1";
12297
12518
  const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
12298
12519
  const ROUTES = {
@@ -13499,6 +13720,8 @@ anyBase.HEX = '0123456789abcdef';
13499
13720
 
13500
13721
  var anyBase_1 = anyBase;
13501
13722
 
13723
+ var anyBase$1 = /*@__PURE__*/getDefaultExportFromCjs(anyBase_1);
13724
+
13502
13725
  var pixelmatch_1 = pixelmatch;
13503
13726
 
13504
13727
  function pixelmatch(img1, img2, output, width, height, options) {
@@ -13656,6 +13879,8 @@ function grayPixel(img, i) {
13656
13879
  return rgb2y(r, g, b);
13657
13880
  }
13658
13881
 
13882
+ var pixelMatch = /*@__PURE__*/getDefaultExportFromCjs(pixelmatch_1);
13883
+
13659
13884
  // This file is autogenerated. It's used to publish ESM to npm.
13660
13885
  function _typeof$1(obj) {
13661
13886
  "@babel/helpers - typeof";
@@ -14952,13 +15177,23 @@ ImagePHash.prototype.getHash = function (img) {
14952
15177
 
14953
15178
  // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
14954
15179
 
15180
+ /**
15181
+ Convert a 32-bit integer color value to an RGBA object.
15182
+ */
14955
15183
  function intToRGBA(i) {
14956
- const rgba = {};
14957
- rgba.r = Math.floor(i / Math.pow(256, 3));
14958
- rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
14959
- rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
14960
- rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));
14961
- return rgba;
15184
+ const a = i & 0xff;
15185
+ i >>>= 8;
15186
+ const b = i & 0xff;
15187
+ i >>>= 8;
15188
+ const g = i & 0xff;
15189
+ i >>>= 8;
15190
+ const r = i & 0xff;
15191
+ return {
15192
+ r,
15193
+ g,
15194
+ b,
15195
+ a
15196
+ };
14962
15197
  }
14963
15198
  const c$1 = [];
14964
15199
  function initCoefficients(size) {
@@ -15182,6 +15417,8 @@ conversions["RegExp"] = function (V, opts) {
15182
15417
 
15183
15418
  var utils = {exports: {}};
15184
15419
 
15420
+ utils.exports;
15421
+
15185
15422
  (function (module) {
15186
15423
 
15187
15424
  module.exports.mixin = function mixin(target, source) {
@@ -15200,9 +15437,11 @@ var utils = {exports: {}};
15200
15437
 
15201
15438
  module.exports.implForWrapper = function (wrapper) {
15202
15439
  return wrapper[module.exports.implSymbol];
15203
- };
15440
+ };
15204
15441
  } (utils));
15205
15442
 
15443
+ var utilsExports = utils.exports;
15444
+
15206
15445
  var URLImpl = {};
15207
15446
 
15208
15447
  var urlStateMachine = {exports: {}};
@@ -93052,6 +93291,8 @@ tr46.toUnicode = function(domain_name, useSTD3) {
93052
93291
 
93053
93292
  tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
93054
93293
 
93294
+ urlStateMachine.exports;
93295
+
93055
93296
  (function (module) {
93056
93297
  const punycode = require$$0__default$3["default"];
93057
93298
  const tr46$1 = tr46;
@@ -94347,10 +94588,12 @@ tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
94347
94588
 
94348
94589
  // We don't handle blobs, so this just delegates:
94349
94590
  return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
94350
- };
94591
+ };
94351
94592
  } (urlStateMachine));
94352
94593
 
94353
- const usm = urlStateMachine.exports;
94594
+ var urlStateMachineExports = urlStateMachine.exports;
94595
+
94596
+ const usm = urlStateMachineExports;
94354
94597
 
94355
94598
  URLImpl.implementation = class URLImpl {
94356
94599
  constructor(constructorArgs) {
@@ -94550,13 +94793,15 @@ URLImpl.implementation = class URLImpl {
94550
94793
  }
94551
94794
  };
94552
94795
 
94796
+ URL$2.exports;
94797
+
94553
94798
  (function (module) {
94554
94799
 
94555
94800
  const conversions = lib$6;
94556
- const utils$1 = utils.exports;
94801
+ const utils = utilsExports;
94557
94802
  const Impl = URLImpl;
94558
94803
 
94559
- const impl = utils$1.implSymbol;
94804
+ const impl = utils.implSymbol;
94560
94805
 
94561
94806
  function URL(url) {
94562
94807
  if (!this || this[impl] || !(this instanceof URL)) {
@@ -94737,25 +94982,27 @@ URLImpl.implementation = class URLImpl {
94737
94982
  privateData.wrapper = obj;
94738
94983
 
94739
94984
  obj[impl] = new Impl.implementation(constructorArgs, privateData);
94740
- obj[impl][utils$1.wrapperSymbol] = obj;
94985
+ obj[impl][utils.wrapperSymbol] = obj;
94741
94986
  },
94742
94987
  interface: URL,
94743
94988
  expose: {
94744
94989
  Window: { URL: URL },
94745
94990
  Worker: { URL: URL }
94746
94991
  }
94747
- };
94992
+ };
94748
94993
  } (URL$2));
94749
94994
 
94750
- publicApi.URL = URL$2.exports.interface;
94751
- publicApi.serializeURL = urlStateMachine.exports.serializeURL;
94752
- publicApi.serializeURLOrigin = urlStateMachine.exports.serializeURLOrigin;
94753
- publicApi.basicURLParse = urlStateMachine.exports.basicURLParse;
94754
- publicApi.setTheUsername = urlStateMachine.exports.setTheUsername;
94755
- publicApi.setThePassword = urlStateMachine.exports.setThePassword;
94756
- publicApi.serializeHost = urlStateMachine.exports.serializeHost;
94757
- publicApi.serializeInteger = urlStateMachine.exports.serializeInteger;
94758
- publicApi.parseURL = urlStateMachine.exports.parseURL;
94995
+ var URLExports = URL$2.exports;
94996
+
94997
+ publicApi.URL = URLExports.interface;
94998
+ publicApi.serializeURL = urlStateMachineExports.serializeURL;
94999
+ publicApi.serializeURLOrigin = urlStateMachineExports.serializeURLOrigin;
95000
+ publicApi.basicURLParse = urlStateMachineExports.basicURLParse;
95001
+ publicApi.setTheUsername = urlStateMachineExports.setTheUsername;
95002
+ publicApi.setThePassword = urlStateMachineExports.setThePassword;
95003
+ publicApi.serializeHost = urlStateMachineExports.serializeHost;
95004
+ publicApi.serializeInteger = urlStateMachineExports.serializeInteger;
95005
+ publicApi.parseURL = urlStateMachineExports.parseURL;
94759
95006
 
94760
95007
  // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
94761
95008
 
@@ -96535,6 +96782,8 @@ var lib$5 = /*#__PURE__*/Object.freeze({
96535
96782
 
96536
96783
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib$5);
96537
96784
 
96785
+ fetchNpmNode.exports;
96786
+
96538
96787
  (function (module) {
96539
96788
 
96540
96789
  var realFetch = require$$0;
@@ -96550,9 +96799,11 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib$5);
96550
96799
  commonjsGlobal.Response = realFetch.Response;
96551
96800
  commonjsGlobal.Headers = realFetch.Headers;
96552
96801
  commonjsGlobal.Request = realFetch.Request;
96553
- }
96802
+ }
96554
96803
  } (fetchNpmNode));
96555
96804
 
96805
+ fetchNpmNode.exports;
96806
+
96556
96807
  var request$1 = ((_ref, cb) => {
96557
96808
  let {
96558
96809
  url,
@@ -97066,7 +97317,7 @@ var EndOfFileStream = {};
97066
97317
  super(exports.defaultMessages);
97067
97318
  }
97068
97319
  }
97069
- exports.EndOfStreamError = EndOfStreamError;
97320
+ exports.EndOfStreamError = EndOfStreamError;
97070
97321
  } (EndOfFileStream));
97071
97322
 
97072
97323
  var StreamReader = {};
@@ -97220,7 +97471,7 @@ Deferred$1.Deferred = Deferred;
97220
97471
  }
97221
97472
  }
97222
97473
  }
97223
- exports.StreamReader = StreamReader;
97474
+ exports.StreamReader = StreamReader;
97224
97475
  } (StreamReader));
97225
97476
 
97226
97477
  (function (exports) {
@@ -97229,7 +97480,7 @@ Deferred$1.Deferred = Deferred;
97229
97480
  var EndOfFileStream_1 = EndOfFileStream;
97230
97481
  Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_1.EndOfStreamError; } });
97231
97482
  var StreamReader_1 = StreamReader;
97232
- Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } });
97483
+ Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } });
97233
97484
  } (lib$3));
97234
97485
 
97235
97486
  Object.defineProperty(AbstractTokenizer$1, "__esModule", { value: true });
@@ -97519,7 +97770,7 @@ BufferTokenizer$1.BufferTokenizer = BufferTokenizer;
97519
97770
  function fromBuffer(uint8Array, fileInfo) {
97520
97771
  return new BufferTokenizer_1.BufferTokenizer(uint8Array, fileInfo);
97521
97772
  }
97522
- exports.fromBuffer = fromBuffer;
97773
+ exports.fromBuffer = fromBuffer;
97523
97774
  } (core$2));
97524
97775
 
97525
97776
  var FileTokenizer$1 = {};
@@ -97605,7 +97856,7 @@ FileTokenizer$1.fromFile = fromFile$1;
97605
97856
  }
97606
97857
  return core.fromStream(stream, fileInfo);
97607
97858
  }
97608
- exports.fromStream = fromStream;
97859
+ exports.fromStream = fromStream;
97609
97860
  } (lib$4));
97610
97861
 
97611
97862
  var lib$2 = {};
@@ -98153,7 +98404,7 @@ ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {
98153
98404
  201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
98154
98405
  217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
98155
98406
  233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
98156
- 248, 249, 250, 251, 252, 253, 254, 255];
98407
+ 248, 249, 250, 251, 252, 253, 254, 255];
98157
98408
  } (lib$2));
98158
98409
 
98159
98410
  var util$6 = {};
@@ -99972,6 +100223,8 @@ Object.defineProperty(fileType, 'mimeTypes', {
99972
100223
 
99973
100224
  var fileType_1 = fileType;
99974
100225
 
100226
+ var FileType = /*@__PURE__*/getDefaultExportFromCjs(fileType_1);
100227
+
99975
100228
  /*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */
99976
100229
 
99977
100230
  var jpeg$2 = {
@@ -101273,8 +101526,10 @@ var exifParser = {
101273
101526
  }
101274
101527
  };
101275
101528
 
101529
+ var EXIFParser = /*@__PURE__*/getDefaultExportFromCjs(exifParser);
101530
+
101276
101531
  async function getMIMEFromBuffer(buffer, path) {
101277
- const fileTypeFromBuffer = await fileType_1.fromBuffer(buffer);
101532
+ const fileTypeFromBuffer = await FileType.fromBuffer(buffer);
101278
101533
  if (fileTypeFromBuffer) {
101279
101534
  // If fileType returns something for buffer, then return the mime given
101280
101535
  return fileTypeFromBuffer.mime;
@@ -101420,7 +101675,7 @@ async function parseBitmap(data, path, cb) {
101420
101675
  return cb.call(this, error, this);
101421
101676
  }
101422
101677
  try {
101423
- this._exif = exifParser.create(data).parse();
101678
+ this._exif = EXIFParser.create(data).parse();
101424
101679
  exifRotate(this); // EXIF data
101425
101680
  } catch (error) {
101426
101681
  /* meh */
@@ -101486,7 +101741,7 @@ const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
101486
101741
  // 0 and 1 do not exist as possible hash lengths
101487
101742
  const maxHashLength = [NaN, NaN];
101488
101743
  for (let i = 2; i < 65; i++) {
101489
- const maxHash = anyBase_1(anyBase_1.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
101744
+ const maxHash = anyBase$1(anyBase$1.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
101490
101745
  maxHashLength.push(maxHash.length);
101491
101746
  }
101492
101747
 
@@ -101959,7 +102214,7 @@ class Jimp$1 extends require$$0__default$2["default"] {
101959
102214
  return throwError.call(this, "base must be a number between 2 and 64", cb);
101960
102215
  }
101961
102216
  let hash = this.pHash();
101962
- hash = anyBase_1(anyBase_1.BIN, alphabet.slice(0, base))(hash);
102217
+ hash = anyBase$1(anyBase$1.BIN, alphabet.slice(0, base))(hash);
101963
102218
  while (hash.length < maxHashLength[base]) {
101964
102219
  hash = "0" + hash; // pad out with leading zeros
101965
102220
  }
@@ -102068,10 +102323,6 @@ class Jimp$1 extends require$$0__default$2["default"] {
102068
102323
  */
102069
102324
  getPixelColor(x, y, cb) {
102070
102325
  if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb);
102071
-
102072
- // round input
102073
- x = Math.round(x);
102074
- y = Math.round(y);
102075
102326
  const idx = this.getPixelIndex(x, y);
102076
102327
  const hex = this.bitmap.data.readUInt32BE(idx);
102077
102328
  if (isNodePattern(cb)) {
@@ -102089,10 +102340,6 @@ class Jimp$1 extends require$$0__default$2["default"] {
102089
102340
  */
102090
102341
  setPixelColor(hex, x, y, cb) {
102091
102342
  if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return throwError.call(this, "hex, x and y must be numbers", cb);
102092
-
102093
- // round input
102094
- x = Math.round(x);
102095
- y = Math.round(y);
102096
102343
  const idx = this.getPixelIndex(x, y);
102097
102344
  this.bitmap.data.writeUInt32BE(hex, idx);
102098
102345
  if (isNodePattern(cb)) {
@@ -102105,13 +102352,15 @@ class Jimp$1 extends require$$0__default$2["default"] {
102105
102352
  * @return {boolean} hasAlpha whether the image contains opaque pixels
102106
102353
  */
102107
102354
  hasAlpha() {
102108
- for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {
102109
- for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {
102110
- const idx = this.bitmap.width * yIndex + xIndex << 2;
102111
- const alpha = this.bitmap.data[idx + 3];
102112
- if (alpha !== 0xff) {
102113
- return true;
102114
- }
102355
+ const {
102356
+ width,
102357
+ height,
102358
+ data
102359
+ } = this.bitmap;
102360
+ const byteLen = width * height << 2;
102361
+ for (let idx = 3; idx < byteLen; idx += 4) {
102362
+ if (data[idx] !== 0xff) {
102363
+ return true;
102115
102364
  }
102116
102365
  }
102117
102366
  return false;
@@ -102211,11 +102460,16 @@ Jimp$1.rgbaToInt = function (r, g, b, a, cb) {
102211
102460
  if (a < 0 || a > 255) {
102212
102461
  return throwError.call(this, "a must be between 0 and 255", cb);
102213
102462
  }
102214
- r = Math.round(r);
102215
- b = Math.round(b);
102216
- g = Math.round(g);
102217
- a = Math.round(a);
102218
- const i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0);
102463
+ let i = r & 0xff;
102464
+ i <<= 8;
102465
+ i |= g & 0xff;
102466
+ i <<= 8;
102467
+ i |= b & 0xff;
102468
+ i <<= 8;
102469
+ i |= a & 0xff;
102470
+
102471
+ // Ensure sign is correct
102472
+ i >>>= 0;
102219
102473
  if (isNodePattern(cb)) {
102220
102474
  cb.call(this, null, i);
102221
102475
  }
@@ -102291,7 +102545,7 @@ Jimp$1.diff = function (img1, img2) {
102291
102545
  return throwError.call(this, "threshold must be a number between 0 and 1");
102292
102546
  }
102293
102547
  const diff = new Jimp$1(bmp1.width, bmp1.height, 0xffffffff);
102294
- const numDiffPixels = pixelmatch_1(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
102548
+ const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
102295
102549
  threshold
102296
102550
  });
102297
102551
  return {
@@ -103253,6 +103507,7 @@ var encoder$1 = {exports: {}};
103253
103507
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
103254
103508
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103255
103509
  */
103510
+ encoder$1.exports;
103256
103511
 
103257
103512
  (function (module) {
103258
103513
 
@@ -103998,10 +104253,13 @@ var encoder$1 = {exports: {}};
103998
104253
  }
103999
104254
  } (encoder$1));
104000
104255
 
104256
+ var encoderExports = encoder$1.exports;
104257
+
104001
104258
  var decoder$1 = {exports: {}};
104002
104259
 
104003
104260
  /* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
104004
104261
  /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
104262
+ decoder$1.exports;
104005
104263
 
104006
104264
  (function (module) {
104007
104265
  /*
@@ -105146,17 +105404,21 @@ var decoder$1 = {exports: {}};
105146
105404
  decoder.copyToImageData(image, opts.formatAsRGBA);
105147
105405
 
105148
105406
  return image;
105149
- }
105407
+ }
105150
105408
  } (decoder$1));
105151
105409
 
105152
- var encode$2 = encoder$1.exports,
105153
- decode$2 = decoder$1.exports;
105410
+ var decoderExports = decoder$1.exports;
105411
+
105412
+ var encode$2 = encoderExports,
105413
+ decode$2 = decoderExports;
105154
105414
 
105155
105415
  var jpegJs = {
105156
105416
  encode: encode$2,
105157
105417
  decode: decode$2
105158
105418
  };
105159
105419
 
105420
+ var JPEG = /*@__PURE__*/getDefaultExportFromCjs(jpegJs);
105421
+
105160
105422
  const MIME_TYPE$4 = "image/jpeg";
105161
105423
  var jpeg = (() => ({
105162
105424
  mime: {
@@ -105166,10 +105428,10 @@ var jpeg = (() => ({
105166
105428
  MIME_JPEG: MIME_TYPE$4
105167
105429
  },
105168
105430
  decoders: {
105169
- [MIME_TYPE$4]: jpegJs.decode
105431
+ [MIME_TYPE$4]: JPEG.decode
105170
105432
  },
105171
105433
  encoders: {
105172
- [MIME_TYPE$4]: image => jpegJs.encode(image.bitmap, image._quality).data
105434
+ [MIME_TYPE$4]: image => JPEG.encode(image.bitmap, image._quality).data
105173
105435
  },
105174
105436
  class: {
105175
105437
  // The quality to be used when saving JPEG images
@@ -105388,6 +105650,8 @@ ChunkStream$2.prototype._process = function () {
105388
105650
  }
105389
105651
  };
105390
105652
 
105653
+ var chunkstreamExports = chunkstream.exports;
105654
+
105391
105655
  var filterParseAsync = {exports: {}};
105392
105656
 
105393
105657
  var filterParse = {exports: {}};
@@ -105679,9 +105943,11 @@ Filter$2.prototype._reverseFilterLine = function (rawData) {
105679
105943
  }
105680
105944
  };
105681
105945
 
105946
+ var filterParseExports = filterParse.exports;
105947
+
105682
105948
  let util$4 = require$$0__default["default"];
105683
- let ChunkStream$1 = chunkstream.exports;
105684
- let Filter$1 = filterParse.exports;
105949
+ let ChunkStream$1 = chunkstreamExports;
105950
+ let Filter$1 = filterParseExports;
105685
105951
 
105686
105952
  let FilterAsync$1 = (filterParseAsync.exports = function (bitmapInfo) {
105687
105953
  ChunkStream$1.call(this);
@@ -105702,6 +105968,8 @@ let FilterAsync$1 = (filterParseAsync.exports = function (bitmapInfo) {
105702
105968
  });
105703
105969
  util$4.inherits(FilterAsync$1, ChunkStream$1);
105704
105970
 
105971
+ var filterParseAsyncExports = filterParseAsync.exports;
105972
+
105705
105973
  var parser$1 = {exports: {}};
105706
105974
 
105707
105975
  var constants$6 = {
@@ -105776,8 +106044,10 @@ CrcCalculator$1.crc32 = function (buf) {
105776
106044
  return crc ^ -1;
105777
106045
  };
105778
106046
 
106047
+ var crcExports = crc.exports;
106048
+
105779
106049
  let constants$5 = constants$6;
105780
- let CrcCalculator = crc.exports;
106050
+ let CrcCalculator = crcExports;
105781
106051
 
105782
106052
  let Parser$3 = (parser$1.exports = function (options, dependencies) {
105783
106053
  this._options = options;
@@ -106065,6 +106335,8 @@ Parser$3.prototype._parseIEND = function (data) {
106065
106335
  }
106066
106336
  };
106067
106337
 
106338
+ var parserExports = parser$1.exports;
106339
+
106068
106340
  var bitmapper$2 = {};
106069
106341
 
106070
106342
  let interlaceUtils = interlace;
@@ -106427,9 +106699,9 @@ var formatNormaliser$2 = function (indata, imageData, skipRescale = false) {
106427
106699
 
106428
106700
  let util$3 = require$$0__default["default"];
106429
106701
  let zlib$4 = zlib__default["default"];
106430
- let ChunkStream = chunkstream.exports;
106431
- let FilterAsync = filterParseAsync.exports;
106432
- let Parser$2 = parser$1.exports;
106702
+ let ChunkStream = chunkstreamExports;
106703
+ let FilterAsync = filterParseAsyncExports;
106704
+ let Parser$2 = parserExports;
106433
106705
  let bitmapper$1 = bitmapper$2;
106434
106706
  let formatNormaliser$1 = formatNormaliser$2;
106435
106707
 
@@ -106593,6 +106865,8 @@ ParserAsync.prototype._complete = function (filteredData) {
106593
106865
  this.emit("parsed", normalisedBitmapData);
106594
106866
  };
106595
106867
 
106868
+ var parserAsyncExports = parserAsync.exports;
106869
+
106596
106870
  var packerAsync = {exports: {}};
106597
106871
 
106598
106872
  var packer = {exports: {}};
@@ -106925,7 +107199,7 @@ var filterPack = function (pxData, width, height, options, bpp) {
106925
107199
  };
106926
107200
 
106927
107201
  let constants$3 = constants$6;
106928
- let CrcStream = crc.exports;
107202
+ let CrcStream = crcExports;
106929
107203
  let bitPacker = bitpacker;
106930
107204
  let filter = filterPack;
106931
107205
  let zlib$3 = zlib__default["default"];
@@ -107052,10 +107326,12 @@ Packer$3.prototype.packIEND = function () {
107052
107326
  return this._packChunk(constants$3.TYPE_IEND, null);
107053
107327
  };
107054
107328
 
107329
+ var packerExports = packer.exports;
107330
+
107055
107331
  let util$2 = require$$0__default["default"];
107056
107332
  let Stream$1 = Stream__default["default"];
107057
107333
  let constants$2 = constants$6;
107058
- let Packer$2 = packer.exports;
107334
+ let Packer$2 = packerExports;
107059
107335
 
107060
107336
  let PackerAsync = (packerAsync.exports = function (opt) {
107061
107337
  Stream$1.call(this);
@@ -107101,10 +107377,14 @@ PackerAsync.prototype.pack = function (data, width, height, gamma) {
107101
107377
  this._deflate.end(filteredData);
107102
107378
  };
107103
107379
 
107380
+ var packerAsyncExports = packerAsync.exports;
107381
+
107104
107382
  var pngSync = {};
107105
107383
 
107106
107384
  var syncInflate = {exports: {}};
107107
107385
 
107386
+ syncInflate.exports;
107387
+
107108
107388
  (function (module, exports) {
107109
107389
 
107110
107390
  let assert = require$$0__default$4["default"].ok;
@@ -107272,9 +107552,11 @@ var syncInflate = {exports: {}};
107272
107552
  module.exports = exports = inflateSync;
107273
107553
  exports.Inflate = Inflate;
107274
107554
  exports.createInflate = createInflate;
107275
- exports.inflateSync = inflateSync;
107555
+ exports.inflateSync = inflateSync;
107276
107556
  } (syncInflate, syncInflate.exports));
107277
107557
 
107558
+ var syncInflateExports = syncInflate.exports;
107559
+
107278
107560
  var syncReader = {exports: {}};
107279
107561
 
107280
107562
  let SyncReader$2 = (syncReader.exports = function (buffer) {
@@ -107321,10 +107603,12 @@ SyncReader$2.prototype.process = function () {
107321
107603
  }
107322
107604
  };
107323
107605
 
107606
+ var syncReaderExports = syncReader.exports;
107607
+
107324
107608
  var filterParseSync = {};
107325
107609
 
107326
- let SyncReader$1 = syncReader.exports;
107327
- let Filter = filterParse.exports;
107610
+ let SyncReader$1 = syncReaderExports;
107611
+ let Filter = filterParseExports;
107328
107612
 
107329
107613
  filterParseSync.process = function (inBuffer, bitmapInfo) {
107330
107614
  let outBuffers = [];
@@ -107345,13 +107629,13 @@ filterParseSync.process = function (inBuffer, bitmapInfo) {
107345
107629
 
107346
107630
  let hasSyncZlib$1 = true;
107347
107631
  let zlib$2 = zlib__default["default"];
107348
- let inflateSync = syncInflate.exports;
107632
+ let inflateSync = syncInflateExports;
107349
107633
  if (!zlib$2.deflateSync) {
107350
107634
  hasSyncZlib$1 = false;
107351
107635
  }
107352
- let SyncReader = syncReader.exports;
107636
+ let SyncReader = syncReaderExports;
107353
107637
  let FilterSync = filterParseSync;
107354
- let Parser$1 = parser$1.exports;
107638
+ let Parser$1 = parserExports;
107355
107639
  let bitmapper = bitmapper$2;
107356
107640
  let formatNormaliser = formatNormaliser$2;
107357
107641
 
@@ -107460,7 +107744,7 @@ if (!zlib$1.deflateSync) {
107460
107744
  hasSyncZlib = false;
107461
107745
  }
107462
107746
  let constants$1 = constants$6;
107463
- let Packer$1 = packer.exports;
107747
+ let Packer$1 = packerExports;
107464
107748
 
107465
107749
  var packerSync = function (metaData, opt) {
107466
107750
  if (!hasSyncZlib) {
@@ -107524,8 +107808,8 @@ var PNG_1;
107524
107808
 
107525
107809
  let util$1 = require$$0__default["default"];
107526
107810
  let Stream = Stream__default["default"];
107527
- let Parser = parserAsync.exports;
107528
- let Packer = packerAsync.exports;
107811
+ let Parser = parserAsyncExports;
107812
+ let Packer = packerAsyncExports;
107529
107813
  let PNGSync = pngSync;
107530
107814
 
107531
107815
  let PNG = (PNG_1 = function (options) {
@@ -108426,6 +108710,8 @@ var bmpJs = {
108426
108710
  decode: decode$1
108427
108711
  };
108428
108712
 
108713
+ var BMP = /*@__PURE__*/getDefaultExportFromCjs(bmpJs);
108714
+
108429
108715
  const MIME_TYPE$2 = "image/bmp";
108430
108716
  const MIME_TYPE_SECOND = "image/x-ms-bmp";
108431
108717
  function toAGBR(image) {
@@ -108454,8 +108740,8 @@ function fromAGBR(bitmap) {
108454
108740
  this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
108455
108741
  }).bitmap;
108456
108742
  }
108457
- const decode = data => fromAGBR(bmpJs.decode(data));
108458
- const encode = image => bmpJs.encode(toAGBR(image)).data;
108743
+ const decode = data => fromAGBR(BMP.decode(data));
108744
+ const encode = image => BMP.encode(toAGBR(image)).data;
108459
108745
  var bmp = (() => ({
108460
108746
  mime: {
108461
108747
  [MIME_TYPE$2]: ["bmp"]
@@ -108591,8 +108877,8 @@ function requireCommon () {
108591
108877
  }
108592
108878
  };
108593
108879
 
108594
- exports.setTyped(TYPED_OK);
108595
- } (common));
108880
+ exports.setTyped(TYPED_OK);
108881
+ } (common));
108596
108882
  return common;
108597
108883
  }
108598
108884
 
@@ -115396,6 +115682,8 @@ function requirePako () {
115396
115682
  return pako_1;
115397
115683
  }
115398
115684
 
115685
+ UTIF.exports;
115686
+
115399
115687
  (function (module) {
115400
115688
  (function(){
115401
115689
  var UTIF = {};
@@ -117032,10 +117320,11 @@ function requirePako () {
117032
117320
 
117033
117321
 
117034
117322
  })(UTIF, pako);
117035
- })();
117323
+ })();
117036
117324
  } (UTIF));
117037
117325
 
117038
- var utif = UTIF.exports;
117326
+ var UTIFExports = UTIF.exports;
117327
+ var utif = /*@__PURE__*/getDefaultExportFromCjs(UTIFExports);
117039
117328
 
117040
117329
  const MIME_TYPE$1 = "image/tiff";
117041
117330
  var tiff = (() => ({
@@ -121409,8 +121698,8 @@ function requireGifutil () {
121409
121698
  return resolve();
121410
121699
  });
121411
121700
  });
121412
- }
121413
- } (gifutil));
121701
+ }
121702
+ } (gifutil));
121414
121703
  return gifutil;
121415
121704
  }
121416
121705
 
@@ -129572,8 +129861,8 @@ function requireSax () {
129572
129861
  }
129573
129862
  }());
129574
129863
  }
129575
- })(exports);
129576
- } (sax));
129864
+ })(exports);
129865
+ } (sax));
129577
129866
  return sax;
129578
129867
  }
129579
129868
 
@@ -130030,8 +130319,8 @@ function requireParser () {
130030
130319
  return parser.parseStringPromise(str);
130031
130320
  };
130032
130321
 
130033
- }).call(commonjsGlobal);
130034
- } (parser));
130322
+ }).call(commonjsGlobal);
130323
+ } (parser));
130035
130324
  return parser;
130036
130325
  }
130037
130326
 
@@ -133260,6 +133549,8 @@ var loadBmfont = function loadFont(opt, cb) {
133260
133549
  }
133261
133550
  };
133262
133551
 
133552
+ var bMFont = /*@__PURE__*/getDefaultExportFromCjs(loadBmfont);
133553
+
133263
133554
  function measureText(font, text) {
133264
133555
  let x = 0;
133265
133556
  for (let i = 0; i < text.length; i++) {
@@ -133271,21 +133562,21 @@ function measureText(font, text) {
133271
133562
  return x;
133272
133563
  }
133273
133564
  function splitLines(font, text, maxWidth) {
133274
- const words = text.split(" ");
133565
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
133275
133566
  const lines = [];
133276
133567
  let currentLine = [];
133277
133568
  let longestLine = 0;
133278
133569
  words.forEach(word => {
133279
133570
  const line = [...currentLine, word].join(" ");
133280
133571
  const length = measureText(font, line);
133281
- if (length <= maxWidth) {
133572
+ if (length <= maxWidth && !word.includes("\n")) {
133282
133573
  if (length > longestLine) {
133283
133574
  longestLine = length;
133284
133575
  }
133285
133576
  currentLine.push(word);
133286
133577
  } else {
133287
133578
  lines.push(currentLine);
133288
- currentLine = [word];
133579
+ currentLine = [word.replace("\n", "")];
133289
133580
  }
133290
133581
  });
133291
133582
  lines.push(currentLine);
@@ -133370,7 +133661,7 @@ var print = (() => ({
133370
133661
  cb = cb || function (err, font) {
133371
133662
  if (err) reject(err);else resolve(font);
133372
133663
  };
133373
- loadBmfont(file, (err, font) => {
133664
+ bMFont(file, (err, font) => {
133374
133665
  const chars = {};
133375
133666
  const kernings = {};
133376
133667
  if (err) {
@@ -134511,6 +134802,8 @@ var Jimp = configure({
134511
134802
 
134512
134803
  var jsQR$1 = {exports: {}};
134513
134804
 
134805
+ jsQR$1.exports;
134806
+
134514
134807
  (function (module, exports) {
134515
134808
  (function webpackUniversalModuleDefinition(root, factory) {
134516
134809
  module.exports = factory();
@@ -144580,10 +144873,11 @@ var jsQR$1 = {exports: {}};
144580
144873
 
144581
144874
  /***/ })
144582
144875
  /******/ ])["default"];
144583
- });
144584
- } (jsQR$1));
144876
+ });
144877
+ } (jsQR$1, jsQR$1.exports));
144585
144878
 
144586
- var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQR$1.exports);
144879
+ var jsQRExports = jsQR$1.exports;
144880
+ var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQRExports);
144587
144881
 
144588
144882
  const decodeQRCodeFromFile = async (filePath) => {
144589
144883
  let decodedString;
@@ -146142,7 +146436,7 @@ const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both"
146142
146436
  var main$2 = {exports: {}};
146143
146437
 
146144
146438
  var name = "dotenv";
146145
- var version$1 = "16.3.1";
146439
+ var version$1 = "16.4.5";
146146
146440
  var description = "Loads environment variables from .env file";
146147
146441
  var main$1 = "lib/main.js";
146148
146442
  var types = "lib/main.d.ts";
@@ -146166,6 +146460,7 @@ var scripts = {
146166
146460
  "lint-readme": "standard-markdown",
146167
146461
  pretest: "npm run lint && npm run dts-check",
146168
146462
  test: "tap tests/*.js --100 -Rspec",
146463
+ "test:coverage": "tap --coverage-report=lcov",
146169
146464
  prerelease: "npm test",
146170
146465
  release: "standard-version"
146171
146466
  };
@@ -146173,7 +146468,7 @@ var repository = {
146173
146468
  type: "git",
146174
146469
  url: "git://github.com/motdotla/dotenv.git"
146175
146470
  };
146176
- var funding = "https://github.com/motdotla/dotenv?sponsor=1";
146471
+ var funding = "https://dotenvx.com";
146177
146472
  var keywords = [
146178
146473
  "dotenv",
146179
146474
  "env",
@@ -146276,11 +146571,13 @@ function _parseVault (options) {
146276
146571
  // Parse .env.vault
146277
146572
  const result = DotenvModule.configDotenv({ path: vaultPath });
146278
146573
  if (!result.parsed) {
146279
- throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
146574
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
146575
+ err.code = 'MISSING_DATA';
146576
+ throw err
146280
146577
  }
146281
146578
 
146282
146579
  // handle scenario for comma separated keys - for use with key rotation
146283
- // example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
146580
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
146284
146581
  const keys = _dotenvKey(options).split(',');
146285
146582
  const length = keys.length;
146286
146583
 
@@ -146344,7 +146641,9 @@ function _instructions (result, dotenvKey) {
146344
146641
  uri = new URL(dotenvKey);
146345
146642
  } catch (error) {
146346
146643
  if (error.code === 'ERR_INVALID_URL') {
146347
- throw new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development')
146644
+ const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
146645
+ err.code = 'INVALID_DOTENV_KEY';
146646
+ throw err
146348
146647
  }
146349
146648
 
146350
146649
  throw error
@@ -146353,34 +146652,53 @@ function _instructions (result, dotenvKey) {
146353
146652
  // Get decrypt key
146354
146653
  const key = uri.password;
146355
146654
  if (!key) {
146356
- throw new Error('INVALID_DOTENV_KEY: Missing key part')
146655
+ const err = new Error('INVALID_DOTENV_KEY: Missing key part');
146656
+ err.code = 'INVALID_DOTENV_KEY';
146657
+ throw err
146357
146658
  }
146358
146659
 
146359
146660
  // Get environment
146360
146661
  const environment = uri.searchParams.get('environment');
146361
146662
  if (!environment) {
146362
- throw new Error('INVALID_DOTENV_KEY: Missing environment part')
146663
+ const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
146664
+ err.code = 'INVALID_DOTENV_KEY';
146665
+ throw err
146363
146666
  }
146364
146667
 
146365
146668
  // Get ciphertext payload
146366
146669
  const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
146367
146670
  const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
146368
146671
  if (!ciphertext) {
146369
- throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
146672
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
146673
+ err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
146674
+ throw err
146370
146675
  }
146371
146676
 
146372
146677
  return { ciphertext, key }
146373
146678
  }
146374
146679
 
146375
146680
  function _vaultPath (options) {
146376
- let dotenvPath = path.resolve(process.cwd(), '.env');
146681
+ let possibleVaultPath = null;
146377
146682
 
146378
146683
  if (options && options.path && options.path.length > 0) {
146379
- dotenvPath = options.path;
146684
+ if (Array.isArray(options.path)) {
146685
+ for (const filepath of options.path) {
146686
+ if (fs.existsSync(filepath)) {
146687
+ possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
146688
+ }
146689
+ }
146690
+ } else {
146691
+ possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
146692
+ }
146693
+ } else {
146694
+ possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
146695
+ }
146696
+
146697
+ if (fs.existsSync(possibleVaultPath)) {
146698
+ return possibleVaultPath
146380
146699
  }
146381
146700
 
146382
- // Locate .env.vault
146383
- return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
146701
+ return null
146384
146702
  }
146385
146703
 
146386
146704
  function _resolveHome (envPath) {
@@ -146403,51 +146721,73 @@ function _configVault (options) {
146403
146721
  }
146404
146722
 
146405
146723
  function configDotenv (options) {
146406
- let dotenvPath = path.resolve(process.cwd(), '.env');
146724
+ const dotenvPath = path.resolve(process.cwd(), '.env');
146407
146725
  let encoding = 'utf8';
146408
146726
  const debug = Boolean(options && options.debug);
146409
146727
 
146410
- if (options) {
146411
- if (options.path != null) {
146412
- dotenvPath = _resolveHome(options.path);
146728
+ if (options && options.encoding) {
146729
+ encoding = options.encoding;
146730
+ } else {
146731
+ if (debug) {
146732
+ _debug('No encoding is specified. UTF-8 is used by default');
146413
146733
  }
146414
- if (options.encoding != null) {
146415
- encoding = options.encoding;
146734
+ }
146735
+
146736
+ let optionPaths = [dotenvPath]; // default, look for .env
146737
+ if (options && options.path) {
146738
+ if (!Array.isArray(options.path)) {
146739
+ optionPaths = [_resolveHome(options.path)];
146740
+ } else {
146741
+ optionPaths = []; // reset default
146742
+ for (const filepath of options.path) {
146743
+ optionPaths.push(_resolveHome(filepath));
146744
+ }
146416
146745
  }
146417
146746
  }
146418
146747
 
146419
- try {
146420
- // Specifying an encoding returns a string instead of a buffer
146421
- const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
146748
+ // Build the parsed data in a temporary object (because we need to return it). Once we have the final
146749
+ // parsed data, we will combine it with process.env (or options.processEnv if provided).
146750
+ let lastError;
146751
+ const parsedAll = {};
146752
+ for (const path of optionPaths) {
146753
+ try {
146754
+ // Specifying an encoding returns a string instead of a buffer
146755
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
146422
146756
 
146423
- let processEnv = process.env;
146424
- if (options && options.processEnv != null) {
146425
- processEnv = options.processEnv;
146757
+ DotenvModule.populate(parsedAll, parsed, options);
146758
+ } catch (e) {
146759
+ if (debug) {
146760
+ _debug(`Failed to load ${path} ${e.message}`);
146761
+ }
146762
+ lastError = e;
146426
146763
  }
146764
+ }
146427
146765
 
146428
- DotenvModule.populate(processEnv, parsed, options);
146766
+ let processEnv = process.env;
146767
+ if (options && options.processEnv != null) {
146768
+ processEnv = options.processEnv;
146769
+ }
146429
146770
 
146430
- return { parsed }
146431
- } catch (e) {
146432
- if (debug) {
146433
- _debug(`Failed to load ${dotenvPath} ${e.message}`);
146434
- }
146771
+ DotenvModule.populate(processEnv, parsedAll, options);
146435
146772
 
146436
- return { error: e }
146773
+ if (lastError) {
146774
+ return { parsed: parsedAll, error: lastError }
146775
+ } else {
146776
+ return { parsed: parsedAll }
146437
146777
  }
146438
146778
  }
146439
146779
 
146440
146780
  // Populates process.env from .env file
146441
146781
  function config (options) {
146442
- const vaultPath = _vaultPath(options);
146443
-
146444
146782
  // fallback to original dotenv if DOTENV_KEY is not set
146445
146783
  if (_dotenvKey(options).length === 0) {
146446
146784
  return DotenvModule.configDotenv(options)
146447
146785
  }
146448
146786
 
146787
+ const vaultPath = _vaultPath(options);
146788
+
146449
146789
  // dotenvKey exists but .env.vault file does not exist
146450
- if (!fs.existsSync(vaultPath)) {
146790
+ if (!vaultPath) {
146451
146791
  _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
146452
146792
 
146453
146793
  return DotenvModule.configDotenv(options)
@@ -146460,9 +146800,9 @@ function decrypt (encrypted, keyStr) {
146460
146800
  const key = Buffer.from(keyStr.slice(-64), 'hex');
146461
146801
  let ciphertext = Buffer.from(encrypted, 'base64');
146462
146802
 
146463
- const nonce = ciphertext.slice(0, 12);
146464
- const authTag = ciphertext.slice(-16);
146465
- ciphertext = ciphertext.slice(12, -16);
146803
+ const nonce = ciphertext.subarray(0, 12);
146804
+ const authTag = ciphertext.subarray(-16);
146805
+ ciphertext = ciphertext.subarray(12, -16);
146466
146806
 
146467
146807
  try {
146468
146808
  const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
@@ -146474,14 +146814,14 @@ function decrypt (encrypted, keyStr) {
146474
146814
  const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
146475
146815
 
146476
146816
  if (isRange || invalidKeyLength) {
146477
- const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
146478
- throw new Error(msg)
146817
+ const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
146818
+ err.code = 'INVALID_DOTENV_KEY';
146819
+ throw err
146479
146820
  } else if (decryptionFailed) {
146480
- const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
146481
- throw new Error(msg)
146821
+ const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
146822
+ err.code = 'DECRYPTION_FAILED';
146823
+ throw err
146482
146824
  } else {
146483
- console.error('Error: ', error.code);
146484
- console.error('Error: ', error.message);
146485
146825
  throw error
146486
146826
  }
146487
146827
  }
@@ -146493,7 +146833,9 @@ function populate (processEnv, parsed, options = {}) {
146493
146833
  const override = Boolean(options && options.override);
146494
146834
 
146495
146835
  if (typeof parsed !== 'object') {
146496
- throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
146836
+ const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
146837
+ err.code = 'OBJECT_REQUIRED';
146838
+ throw err
146497
146839
  }
146498
146840
 
146499
146841
  // Set process.env
@@ -146536,82 +146878,94 @@ main$2.exports.populate = DotenvModule.populate;
146536
146878
 
146537
146879
  main$2.exports = DotenvModule;
146538
146880
 
146881
+ var mainExports = main$2.exports;
146882
+ var dotenv = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
146883
+
146539
146884
  var main = {};
146540
146885
 
146541
- // like String.prototype.search but returns the last index
146542
- function _searchLast (str, rgx) {
146543
- const matches = Array.from(str.matchAll(rgx));
146544
- return matches.length > 0 ? matches.slice(-1)[0].index : -1
146545
- }
146886
+ // * /
146887
+ // * (\\)? # is it escaped with a backslash?
146888
+ // * (\$) # literal $
146889
+ // * (?!\() # shouldnt be followed by parenthesis
146890
+ // * (\{?) # first brace wrap opening
146891
+ // * ([\w.]+) # key
146892
+ // * (?::-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))? # optional default nested 3 times
146893
+ // * (\}?) # last brace warp closing
146894
+ // * /xi
146546
146895
 
146547
- function _interpolate (envValue, environment, config) {
146548
- // find the last unescaped dollar sign in the
146549
- // value so that we can evaluate it
146550
- const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
146896
+ const DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;
146551
146897
 
146552
- // If we couldn't match any unescaped dollar sign
146553
- // let's return the string as is
146554
- if (lastUnescapedDollarSignIndex === -1) return envValue
146898
+ function _resolveEscapeSequences (value) {
146899
+ return value.replace(/\\\$/g, '$')
146900
+ }
146555
146901
 
146556
- // This is the right-most group of variables in the string
146557
- const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex);
146902
+ function interpolate (value, processEnv, parsed) {
146903
+ return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace) => {
146904
+ if (escaped === '\\') {
146905
+ return match.slice(1)
146906
+ } else {
146907
+ if (processEnv[key]) {
146908
+ if (processEnv[key] === parsed[key]) {
146909
+ return processEnv[key]
146910
+ } else {
146911
+ // scenario: PASSWORD_EXPAND_NESTED=${PASSWORD_EXPAND}
146912
+ return interpolate(processEnv[key], processEnv, parsed)
146913
+ }
146914
+ }
146558
146915
 
146559
- /**
146560
- * This finds the inner most variable/group divided
146561
- * by variable name and default value (if present)
146562
- * (
146563
- * (?!(?<=\\))\$ // only match dollar signs that are not escaped
146564
- * {? // optional opening curly brace
146565
- * ([\w]+) // match the variable name
146566
- * (?::-([^}\\]*))? // match an optional default value
146567
- * }? // optional closing curly brace
146568
- * )
146569
- */
146570
- const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
146571
- const match = rightMostGroup.match(matchGroup);
146572
-
146573
- if (match != null) {
146574
- const [, group, variableName, defaultValue] = match;
146575
-
146576
- return _interpolate(
146577
- envValue.replace(
146578
- group,
146579
- environment[variableName] ||
146580
- defaultValue ||
146581
- config.parsed[variableName] ||
146582
- ''
146583
- ),
146584
- environment,
146585
- config
146586
- )
146587
- }
146916
+ if (parsed[key]) {
146917
+ // avoid recursion from EXPAND_SELF=$EXPAND_SELF
146918
+ if (parsed[key] === value) {
146919
+ return parsed[key]
146920
+ } else {
146921
+ return interpolate(parsed[key], processEnv, parsed)
146922
+ }
146923
+ }
146588
146924
 
146589
- return envValue
146590
- }
146925
+ if (defaultValue) {
146926
+ if (defaultValue.startsWith('$')) {
146927
+ return interpolate(defaultValue, processEnv, parsed)
146928
+ } else {
146929
+ return defaultValue
146930
+ }
146931
+ }
146591
146932
 
146592
- function _resolveEscapeSequences (value) {
146593
- return value.replace(/\\\$/g, '$')
146933
+ return ''
146934
+ }
146935
+ })
146594
146936
  }
146595
146937
 
146596
- function expand (config) {
146597
- // if ignoring process.env, use a blank object
146598
- const environment = config.ignoreProcessEnv ? {} : process.env;
146938
+ function expand (options) {
146939
+ let processEnv = process.env;
146940
+ if (options && options.processEnv != null) {
146941
+ processEnv = options.processEnv;
146942
+ }
146943
+
146944
+ for (const key in options.parsed) {
146945
+ let value = options.parsed[key];
146599
146946
 
146600
- for (const configKey in config.parsed) {
146601
- const value = Object.prototype.hasOwnProperty.call(environment, configKey)
146602
- ? environment[configKey]
146603
- : config.parsed[configKey];
146947
+ const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key);
146948
+ if (inProcessEnv) {
146949
+ if (processEnv[key] === options.parsed[key]) {
146950
+ // assume was set to processEnv from the .env file if the values match and therefore interpolate
146951
+ value = interpolate(value, processEnv, options.parsed);
146952
+ } else {
146953
+ // do not interpolate - assume processEnv had the intended value even if containing a $.
146954
+ value = processEnv[key];
146955
+ }
146956
+ } else {
146957
+ // not inProcessEnv so assume interpolation for this .env key
146958
+ value = interpolate(value, processEnv, options.parsed);
146959
+ }
146604
146960
 
146605
- config.parsed[configKey] = _resolveEscapeSequences(
146606
- _interpolate(value, environment, config)
146607
- );
146961
+ options.parsed[key] = _resolveEscapeSequences(value);
146608
146962
  }
146609
146963
 
146610
- for (const processKey in config.parsed) {
146611
- environment[processKey] = config.parsed[processKey];
146964
+ for (const processKey in options.parsed) {
146965
+ processEnv[processKey] = options.parsed[processKey];
146612
146966
  }
146613
146967
 
146614
- return config
146968
+ return options
146615
146969
  }
146616
146970
 
146617
146971
  main.expand = expand;
@@ -146619,12 +146973,12 @@ main.expand = expand;
146619
146973
  // @ts-check
146620
146974
  var _a, _b;
146621
146975
  process.env.TEST_ENV = (_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : ENVIRONMENT.development;
146622
- const env = main$2.exports.config({
146976
+ const env = dotenv.config({
146623
146977
  path: `./e2e/config/.env.${process.env.TEST_ENV}`,
146624
146978
  });
146625
146979
  main.expand(env);
146626
146980
  if (fs__namespace.existsSync("./e2e/config/.env.local")) {
146627
- const localEnv = main$2.exports.config({
146981
+ const localEnv = dotenv.config({
146628
146982
  path: "./e2e/config/.env.local",
146629
146983
  });
146630
146984
  main.expand(localEnv);
@@ -146687,6 +147041,7 @@ exports.COMMON_SELECTORS = COMMON_SELECTORS;
146687
147041
  exports.CREDENTIALS = CREDENTIALS;
146688
147042
  exports.CustomCommands = CustomCommands;
146689
147043
  exports.ENVIRONMENT = ENVIRONMENT;
147044
+ exports.EmbedBase = EmbedBase;
146690
147045
  exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
146691
147046
  exports.HELP_CENTER_SELECTORS = HELP_CENTER_SELECTORS;
146692
147047
  exports.HelpAndProfilePage = HelpAndProfilePage;
@@ -146748,6 +147103,7 @@ exports.skipTest = skipTest;
146748
147103
  exports.squish = squish;
146749
147104
  exports.stealthTest = stealth;
146750
147105
  exports.tableUtils = tableUtils;
147106
+ exports.toCamelCase = toCamelCase;
146751
147107
  exports.updateCredentials = updateCredentials;
146752
147108
  exports.writeDataToFile = writeDataToFile;
146753
147109
  //# sourceMappingURL=index.cjs.js.map