@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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import test$1, { expect, test as test$2, defineConfig, devices } from '@playwright/test';
2
2
  import { execSync } from 'child_process';
3
3
  import * as fs$d from 'fs';
4
- import fs__default, { readFileSync } from 'fs';
4
+ import fs__default, { writeFileSync as writeFileSync$1, unlinkSync, readFileSync } from 'fs';
5
5
  import { not, isEmpty as isEmpty$1, isNil, isNotNil, mergeDeepLeft, mergeAll } from 'ramda';
6
6
  import require$$0$2 from 'util';
7
7
  import { faker } from '@faker-js/faker';
@@ -125,8 +125,10 @@ const skipTest = {
125
125
  const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
126
126
  // trims and replaces multiple whitespace characters in a string with a single space
127
127
  const squish = (text) => text.trim().replace(/\s+/g, " ");
128
+ const toCamelCase = (string) => string.toLowerCase().replace(/( \w)/g, letter => letter[1].toUpperCase());
128
129
 
129
130
  const COMMON_SELECTORS = {
131
+ copyButton: "copy-button",
130
132
  spinner: ".neeto-ui-spinner",
131
133
  subheaderText: "subheader-left",
132
134
  alertTitle: "alert-title",
@@ -141,6 +143,7 @@ const COMMON_SELECTORS = {
141
143
  paneHeader: "pane-header",
142
144
  profileSidebar: "profile-section",
143
145
  selectOption: (label) => `${hyphenize(label)}-select-option`,
146
+ radioLabel: (embedLabel) => `${hyphenize(embedLabel)}-radio-label`,
144
147
  toastMessage: "toastr-message-container",
145
148
  toastCloseButton: "toastr-close-button",
146
149
  windowAlert: "#alert-box",
@@ -196,9 +199,13 @@ function getDefaultExportFromCjs (x) {
196
199
  }
197
200
 
198
201
  function getAugmentedNamespace(n) {
202
+ if (n.__esModule) return n;
199
203
  var f = n.default;
200
204
  if (typeof f == "function") {
201
- var a = function () {
205
+ var a = function a () {
206
+ if (this instanceof a) {
207
+ return Reflect.construct(f, arguments, this.constructor);
208
+ }
202
209
  return f.apply(this, arguments);
203
210
  };
204
211
  a.prototype = f.prototype;
@@ -879,6 +886,8 @@ var setFunctionLength = function setFunctionLength(fn, length) {
879
886
  return fn;
880
887
  };
881
888
 
889
+ callBind$1.exports;
890
+
882
891
  (function (module) {
883
892
 
884
893
  var bind = functionBind;
@@ -922,12 +931,14 @@ var setFunctionLength = function setFunctionLength(fn, length) {
922
931
  $defineProperty(module.exports, 'apply', { value: applyBind });
923
932
  } else {
924
933
  module.exports.apply = applyBind;
925
- }
934
+ }
926
935
  } (callBind$1));
927
936
 
937
+ var callBindExports = callBind$1.exports;
938
+
928
939
  var GetIntrinsic$1 = getIntrinsic;
929
940
 
930
- var callBind = callBind$1.exports;
941
+ var callBind = callBindExports;
931
942
 
932
943
  var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
933
944
 
@@ -2454,6 +2465,8 @@ var lib$7 = {
2454
2465
  stringify: stringify$5
2455
2466
  };
2456
2467
 
2468
+ var qs$1 = /*@__PURE__*/getDefaultExportFromCjs(lib$7);
2469
+
2457
2470
  class CustomCommands {
2458
2471
  constructor(page, request, baseURL = process.env.BASE_URL) {
2459
2472
  this.interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
@@ -2520,7 +2533,7 @@ class CustomCommands {
2520
2533
  };
2521
2534
  const formattedUrl = isEmpty$1(params)
2522
2535
  ? url
2523
- : `${url}?${lib$7.stringify(params, {
2536
+ : `${url}?${qs$1.stringify(params, {
2524
2537
  arrayFormat: "brackets",
2525
2538
  })}`;
2526
2539
  return await this.request[method](formattedUrl, requestOptions);
@@ -3083,6 +3096,7 @@ function requireCommon$1 () {
3083
3096
  }
3084
3097
 
3085
3098
  /* eslint-env browser */
3099
+ browser$1.exports;
3086
3100
 
3087
3101
  var hasRequiredBrowser;
3088
3102
 
@@ -3356,8 +3370,8 @@ function requireBrowser () {
3356
3370
  } catch (error) {
3357
3371
  return '[UnexpectedJSONParseError]: ' + error.message;
3358
3372
  }
3359
- };
3360
- } (browser$1, browser$1.exports));
3373
+ };
3374
+ } (browser$1, browser$1.exports));
3361
3375
  return browser$1.exports;
3362
3376
  }
3363
3377
 
@@ -3525,6 +3539,7 @@ function requireSupportsColor () {
3525
3539
  /**
3526
3540
  * Module dependencies.
3527
3541
  */
3542
+ node.exports;
3528
3543
 
3529
3544
  var hasRequiredNode;
3530
3545
 
@@ -3790,8 +3805,8 @@ function requireNode () {
3790
3805
  formatters.O = function (v) {
3791
3806
  this.inspectOpts.colors = this.useColors;
3792
3807
  return util.inspect(v, this.inspectOpts);
3793
- };
3794
- } (node, node.exports));
3808
+ };
3809
+ } (node, node.exports));
3795
3810
  return node.exports;
3796
3811
  }
3797
3812
 
@@ -3800,15 +3815,14 @@ function requireNode () {
3800
3815
  * treat as a browser.
3801
3816
  */
3802
3817
 
3803
- (function (module) {
3804
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3805
- module.exports = requireBrowser();
3806
- } else {
3807
- module.exports = requireNode();
3808
- }
3809
- } (src$1));
3818
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3819
+ src$1.exports = requireBrowser();
3820
+ } else {
3821
+ src$1.exports = requireNode();
3822
+ }
3810
3823
 
3811
- var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(src$1.exports);
3824
+ var srcExports = src$1.exports;
3825
+ var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
3812
3826
 
3813
3827
  /*!
3814
3828
  * playwright-extra v4.3.5 by berstend
@@ -5403,10 +5417,16 @@ class StealthPlugin extends PuppeteerExtraPlugin {
5403
5417
  const defaultExport = opts => new StealthPlugin(opts);
5404
5418
  var puppeteerExtraPluginStealth = defaultExport;
5405
5419
 
5420
+ // const moduleExport = defaultExport
5421
+ // moduleExport.StealthPlugin = StealthPlugin
5422
+ // module.exports = moduleExport
5423
+
5424
+ var stealth$1 = /*@__PURE__*/getDefaultExportFromCjs(puppeteerExtraPluginStealth);
5425
+
5406
5426
  var stealth = test$2.extend({
5407
5427
  browser: async ({ browser }, use) => {
5408
5428
  await browser.close();
5409
- chromium.use(puppeteerExtraPluginStealth());
5429
+ chromium.use(stealth$1());
5410
5430
  const stealthBrowser = await chromium.launch();
5411
5431
  await use(stealthBrowser);
5412
5432
  await stealthBrowser.close();
@@ -5925,7 +5945,7 @@ var utils$k = {};
5925
5945
  };
5926
5946
  flat(args);
5927
5947
  return result;
5928
- };
5948
+ };
5929
5949
  } (utils$k));
5930
5950
 
5931
5951
  const utils$j = utils$k;
@@ -7232,8 +7252,6 @@ braces$1.create = (input, options = {}) => {
7232
7252
 
7233
7253
  var braces_1 = braces$1;
7234
7254
 
7235
- var picomatch$2 = {exports: {}};
7236
-
7237
7255
  var utils$g = {};
7238
7256
 
7239
7257
  const path$8 = Path;
@@ -7477,7 +7495,7 @@ var constants$b = {
7477
7495
  output = `(?:^(?!${output}).*$)`;
7478
7496
  }
7479
7497
  return output;
7480
- };
7498
+ };
7481
7499
  } (utils$g));
7482
7500
 
7483
7501
  const utils$f = utils$g;
@@ -8989,9 +9007,9 @@ const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
8989
9007
  * @api public
8990
9008
  */
8991
9009
 
8992
- const picomatch$1 = (glob, options, returnState = false) => {
9010
+ const picomatch$2 = (glob, options, returnState = false) => {
8993
9011
  if (Array.isArray(glob)) {
8994
- const fns = glob.map(input => picomatch$1(input, options, returnState));
9012
+ const fns = glob.map(input => picomatch$2(input, options, returnState));
8995
9013
  const arrayMatcher = str => {
8996
9014
  for (const isMatch of fns) {
8997
9015
  const state = isMatch(str);
@@ -9011,8 +9029,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
9011
9029
  const opts = options || {};
9012
9030
  const posix = utils$d.isWindows(options);
9013
9031
  const regex = isState
9014
- ? picomatch$1.compileRe(glob, options)
9015
- : picomatch$1.makeRe(glob, options, false, true);
9032
+ ? picomatch$2.compileRe(glob, options)
9033
+ : picomatch$2.makeRe(glob, options, false, true);
9016
9034
 
9017
9035
  const state = regex.state;
9018
9036
  delete regex.state;
@@ -9020,11 +9038,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
9020
9038
  let isIgnored = () => false;
9021
9039
  if (opts.ignore) {
9022
9040
  const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
9023
- isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
9041
+ isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
9024
9042
  }
9025
9043
 
9026
9044
  const matcher = (input, returnObject = false) => {
9027
- const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
9045
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, { glob, posix });
9028
9046
  const result = { glob, state, regex, posix, input, output, match, isMatch };
9029
9047
 
9030
9048
  if (typeof opts.onResult === 'function') {
@@ -9074,7 +9092,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
9074
9092
  * @api public
9075
9093
  */
9076
9094
 
9077
- picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9095
+ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
9078
9096
  if (typeof input !== 'string') {
9079
9097
  throw new TypeError('Expected input to be a string');
9080
9098
  }
@@ -9095,7 +9113,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9095
9113
 
9096
9114
  if (match === false || opts.capture === true) {
9097
9115
  if (opts.matchBase === true || opts.basename === true) {
9098
- match = picomatch$1.matchBase(input, regex, options, posix);
9116
+ match = picomatch$2.matchBase(input, regex, options, posix);
9099
9117
  } else {
9100
9118
  match = regex.exec(output);
9101
9119
  }
@@ -9118,8 +9136,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
9118
9136
  * @api public
9119
9137
  */
9120
9138
 
9121
- picomatch$1.matchBase = (input, glob, options, posix = utils$d.isWindows(options)) => {
9122
- const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
9139
+ picomatch$2.matchBase = (input, glob, options, posix = utils$d.isWindows(options)) => {
9140
+ const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
9123
9141
  return regex.test(path$7.basename(input));
9124
9142
  };
9125
9143
 
@@ -9140,7 +9158,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils$d.isWindows(options
9140
9158
  * @api public
9141
9159
  */
9142
9160
 
9143
- picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
9161
+ picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
9144
9162
 
9145
9163
  /**
9146
9164
  * Parse a glob pattern to create the source string for a regular
@@ -9156,8 +9174,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
9156
9174
  * @api public
9157
9175
  */
9158
9176
 
9159
- picomatch$1.parse = (pattern, options) => {
9160
- if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
9177
+ picomatch$2.parse = (pattern, options) => {
9178
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
9161
9179
  return parse$2(pattern, { ...options, fastpaths: false });
9162
9180
  };
9163
9181
 
@@ -9188,7 +9206,7 @@ picomatch$1.parse = (pattern, options) => {
9188
9206
  * @api public
9189
9207
  */
9190
9208
 
9191
- picomatch$1.scan = (input, options) => scan$1(input, options);
9209
+ picomatch$2.scan = (input, options) => scan$1(input, options);
9192
9210
 
9193
9211
  /**
9194
9212
  * Compile a regular expression from the `state` object returned by the
@@ -9202,7 +9220,7 @@ picomatch$1.scan = (input, options) => scan$1(input, options);
9202
9220
  * @api public
9203
9221
  */
9204
9222
 
9205
- picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
9223
+ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
9206
9224
  if (returnOutput === true) {
9207
9225
  return state.output;
9208
9226
  }
@@ -9216,7 +9234,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
9216
9234
  source = `^(?!${source}).*$`;
9217
9235
  }
9218
9236
 
9219
- const regex = picomatch$1.toRegex(source, options);
9237
+ const regex = picomatch$2.toRegex(source, options);
9220
9238
  if (returnState === true) {
9221
9239
  regex.state = state;
9222
9240
  }
@@ -9243,7 +9261,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
9243
9261
  * @api public
9244
9262
  */
9245
9263
 
9246
- picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
9264
+ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
9247
9265
  if (!input || typeof input !== 'string') {
9248
9266
  throw new TypeError('Expected a non-empty string');
9249
9267
  }
@@ -9258,7 +9276,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
9258
9276
  parsed = parse$2(input, options);
9259
9277
  }
9260
9278
 
9261
- return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
9279
+ return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
9262
9280
  };
9263
9281
 
9264
9282
  /**
@@ -9278,7 +9296,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
9278
9296
  * @api public
9279
9297
  */
9280
9298
 
9281
- picomatch$1.toRegex = (source, options) => {
9299
+ picomatch$2.toRegex = (source, options) => {
9282
9300
  try {
9283
9301
  const opts = options || {};
9284
9302
  return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
@@ -9293,22 +9311,19 @@ picomatch$1.toRegex = (source, options) => {
9293
9311
  * @return {Object}
9294
9312
  */
9295
9313
 
9296
- picomatch$1.constants = constants$9;
9314
+ picomatch$2.constants = constants$9;
9297
9315
 
9298
9316
  /**
9299
9317
  * Expose "picomatch"
9300
9318
  */
9301
9319
 
9302
- var picomatch_1 = picomatch$1;
9320
+ var picomatch_1 = picomatch$2;
9303
9321
 
9304
- (function (module) {
9305
-
9306
- module.exports = picomatch_1;
9307
- } (picomatch$2));
9322
+ var picomatch$1 = picomatch_1;
9308
9323
 
9309
9324
  const util$7 = require$$0$2;
9310
9325
  const braces = braces_1;
9311
- const picomatch = picomatch$2.exports;
9326
+ const picomatch = picomatch$1;
9312
9327
  const utils$c = utils$g;
9313
9328
  const isEmptyString = val => val === '' || val === './';
9314
9329
 
@@ -10362,7 +10377,7 @@ var fs$a = {};
10362
10377
  }
10363
10378
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
10364
10379
  }
10365
- exports.createFileSystemAdapter = createFileSystemAdapter;
10380
+ exports.createFileSystemAdapter = createFileSystemAdapter;
10366
10381
  } (fs$a));
10367
10382
 
10368
10383
  Object.defineProperty(settings$3, "__esModule", { value: true });
@@ -10715,7 +10730,7 @@ var fs$6 = {};
10715
10730
  }
10716
10731
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
10717
10732
  }
10718
- exports.createFileSystemAdapter = createFileSystemAdapter;
10733
+ exports.createFileSystemAdapter = createFileSystemAdapter;
10719
10734
  } (fs$6));
10720
10735
 
10721
10736
  Object.defineProperty(settings$2, "__esModule", { value: true });
@@ -11091,6 +11106,8 @@ function queueAsPromised (context, worker, concurrency) {
11091
11106
  queue.exports = fastqueue;
11092
11107
  queue.exports.promise = queueAsPromised;
11093
11108
 
11109
+ var queueExports = queue.exports;
11110
+
11094
11111
  var common$4 = {};
11095
11112
 
11096
11113
  Object.defineProperty(common$4, "__esModule", { value: true });
@@ -11140,7 +11157,7 @@ reader$1.default = Reader$1;
11140
11157
  Object.defineProperty(async$4, "__esModule", { value: true });
11141
11158
  const events_1 = require$$0$4;
11142
11159
  const fsScandir$2 = out$2;
11143
- const fastq = queue.exports;
11160
+ const fastq = queueExports;
11144
11161
  const common$2 = common$4;
11145
11162
  const reader_1$4 = reader$1;
11146
11163
  class AsyncReader extends reader_1$4.default {
@@ -12063,7 +12080,7 @@ var settings = {};
12063
12080
  return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
12064
12081
  }
12065
12082
  }
12066
- exports.default = Settings;
12083
+ exports.default = Settings;
12067
12084
  } (settings));
12068
12085
 
12069
12086
  const taskManager = tasks;
@@ -12247,6 +12264,210 @@ const i18nFixture = {
12247
12264
  },
12248
12265
  };
12249
12266
 
12267
+ const EMBED_SELECTORS = {
12268
+ iframe: (appName) => `#${appName}-iframe`,
12269
+ modal: (appName) => `#${appName}-modal`,
12270
+ close: (appName) => `#close-${appName}`,
12271
+ loader: (appName) => `#${appName}-loader`,
12272
+ inlineHeightInput: "inline-height-input-field",
12273
+ inlineWidthInput: "inline-width-input-field",
12274
+ inlineElementIdInput: "inline-element-id-input-field",
12275
+ codeBlock: "code-block",
12276
+ previewTab: "preview-tab",
12277
+ htmlTab: "html-tab",
12278
+ buttonTextInput: "button-text-input-field",
12279
+ buttonPositionSelectContainer: "button-position-select-value-container",
12280
+ buttonPositionSelectMenu: "button-position-select-menu",
12281
+ buttonColorLabel: "button-color-label",
12282
+ buttonTextColorLabel: "button-text-color-label",
12283
+ colorPickerTarget: "color-picker-target",
12284
+ colorpickerEditableInput: "colorpicker-editable-input",
12285
+ showIconCheckbox: "show-icon-checkbox",
12286
+ elementIdInput: "element-id-input-field",
12287
+ previewElementPopupButton: "preview-element-popup-button",
12288
+ };
12289
+
12290
+ const basicHTMLContent = (content) => `
12291
+ <!DOCTYPE html>
12292
+ <html lang="en">
12293
+ <head>
12294
+ <meta charset="UTF-8" />
12295
+ <meta name="viewport" content="width=device-width" />
12296
+ </head>
12297
+ <body>
12298
+ ${content}
12299
+ </body>
12300
+ </html>`;
12301
+ const hexToRGB = (hex) => {
12302
+ let r = "", g = "", b = "";
12303
+ if (hex.length === 4) {
12304
+ r = `0x${hex[1]}${hex[1]}`;
12305
+ g = `0x${hex[2]}${hex[2]}`;
12306
+ b = `0x${hex[3]}${hex[3]}`;
12307
+ }
12308
+ else if (hex.length === 7) {
12309
+ r = `0x${hex[1]}${hex[2]}`;
12310
+ g = `0x${hex[3]}${hex[4]}`;
12311
+ b = `0x${hex[5]}${hex[6]}`;
12312
+ }
12313
+ return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
12314
+ };
12315
+
12316
+ class EmbedBase {
12317
+ constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
12318
+ this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
12319
+ this.embedTestPage = await this.context.newPage();
12320
+ this.embedTestPageType = embedType;
12321
+ const fileContent = basicHTMLContent(this.embedTestPageType === "elementClick"
12322
+ ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
12323
+ : embedCode);
12324
+ this.filePath = `tmp/${faker.word.noun()}.html`;
12325
+ writeFileSync$1(this.filePath, fileContent, "utf8");
12326
+ await this.embedTestPage.goto(`file://${Path.resolve(this.filePath)}`);
12327
+ await this.embedTestPage.waitForLoadState("load");
12328
+ this.embeddedFrame = this.embedTestPage.frameLocator(this.embedTestPageType === "inline"
12329
+ ? "iframe"
12330
+ : EMBED_SELECTORS.iframe(this.appName));
12331
+ return this.embedTestPage;
12332
+ };
12333
+ this.closeEmbedModalAndPage = async () => {
12334
+ if (this.embedTestPageType !== "inline") {
12335
+ await this.embedTestPage
12336
+ .locator(EMBED_SELECTORS.close(this.appName))
12337
+ .click();
12338
+ await expect(this.embedTestPage.locator(EMBED_SELECTORS.modal(this.appName))).toBeHidden();
12339
+ }
12340
+ await this.embedTestPage.close();
12341
+ await this.context.close();
12342
+ unlinkSync(this.filePath);
12343
+ };
12344
+ this.clickOnPopupButton = async (popUpButtonSelectorOptions) => {
12345
+ const popUpButton = this.embedTestPage.getByRole(this.embedTestPageType === "floatingPopup" ? "button" : "link", popUpButtonSelectorOptions);
12346
+ await expect(popUpButton).toBeVisible();
12347
+ await popUpButton.click();
12348
+ await expect(this.embedTestPage.locator(EMBED_SELECTORS.loader(this.appName))).toBeHidden({
12349
+ timeout: 10000,
12350
+ });
12351
+ };
12352
+ this.copyEmbedScript = async ({ embedLabel }) => {
12353
+ await this.page
12354
+ .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
12355
+ .check();
12356
+ await this.page.getByTestId(COMMON_SELECTORS.copyButton).click();
12357
+ return await this.page.evaluate(() => navigator.clipboard.readText());
12358
+ };
12359
+ this.selectEmbedType = async (embedLabel) => {
12360
+ await this.page.getByTestId(EMBED_SELECTORS.htmlTab).click();
12361
+ await this.page
12362
+ .getByTestId(COMMON_SELECTORS.radioLabel(embedLabel))
12363
+ .check();
12364
+ };
12365
+ this.verifyInlineCustomization = async ({ headingTestId, inlineEmbedInterceptParams, customizationOptions, }) => {
12366
+ const embedHeightPercentage = `${customizationOptions.embedHeight}%`;
12367
+ const embedWidthPercentage = `${customizationOptions.embedWidth}%`;
12368
+ await this.page
12369
+ .getByTestId(EMBED_SELECTORS.inlineHeightInput)
12370
+ .fill(customizationOptions.embedHeight);
12371
+ await this.page
12372
+ .getByTestId(EMBED_SELECTORS.inlineWidthInput)
12373
+ .fill(customizationOptions.embedWidth);
12374
+ await this.page
12375
+ .getByTestId(EMBED_SELECTORS.inlineElementIdInput)
12376
+ .fill(customizationOptions.embedDivContainerId);
12377
+ await this.expectMultipleTextsInCodeblock([
12378
+ RegExp(`<div .* id="${customizationOptions.embedDivContainerId}">`),
12379
+ `elementSelector: "#${customizationOptions.embedDivContainerId}"`,
12380
+ `height: "${embedHeightPercentage}"`,
12381
+ `width: "${embedWidthPercentage}"`,
12382
+ ]);
12383
+ const inlineEmbedPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses(inlineEmbedInterceptParams);
12384
+ await this.previewTab.click();
12385
+ await inlineEmbedPromise;
12386
+ const iframe = this.page.locator("iframe");
12387
+ await iframe.waitFor({ state: "visible" });
12388
+ await expect(this.page.frameLocator("iframe").getByTestId(headingTestId)).toBeVisible({ timeout: 10000 });
12389
+ const iframeHeight = await iframe.evaluate(node => node.getAttribute("height"));
12390
+ const iframeWidth = await iframe.evaluate(node => node.getAttribute("width"));
12391
+ expect(iframeHeight).toStrictEqual(embedHeightPercentage);
12392
+ expect(iframeWidth).toStrictEqual(embedWidthPercentage);
12393
+ };
12394
+ this.verifyFloatingPopupCustomization = async (customizationOptions) => {
12395
+ await this.page
12396
+ .getByTestId(EMBED_SELECTORS.buttonTextInput)
12397
+ .fill(customizationOptions.buttonText);
12398
+ await this.page
12399
+ .getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)
12400
+ .click();
12401
+ await this.page
12402
+ .getByTestId(EMBED_SELECTORS.buttonPositionSelectMenu)
12403
+ .getByText(customizationOptions.buttonPosition)
12404
+ .click();
12405
+ await expect(this.page.getByTestId(EMBED_SELECTORS.buttonPositionSelectContainer)).toContainText(customizationOptions.buttonPosition);
12406
+ const buttonColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonColorLabel);
12407
+ await buttonColorLabel
12408
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12409
+ .click();
12410
+ await this.page
12411
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
12412
+ .getByRole("textbox")
12413
+ .fill(customizationOptions.buttonColorHex);
12414
+ const buttonTextColorLabel = this.page.getByTestId(EMBED_SELECTORS.buttonTextColorLabel);
12415
+ // This additional click is to close the previously opened color picker for buttonColor.
12416
+ await buttonTextColorLabel
12417
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12418
+ .click();
12419
+ await buttonTextColorLabel
12420
+ .getByTestId(EMBED_SELECTORS.colorPickerTarget)
12421
+ .click();
12422
+ await this.page
12423
+ .getByTestId(EMBED_SELECTORS.colorpickerEditableInput)
12424
+ .getByRole("textbox")
12425
+ .fill(customizationOptions.buttonTextColorHex);
12426
+ await this.page.getByTestId(EMBED_SELECTORS.showIconCheckbox).click();
12427
+ await this.expectMultipleTextsInCodeblock([
12428
+ `btnColor: "${customizationOptions.buttonColorHex}"`,
12429
+ `btnTextColor: "${customizationOptions.buttonTextColorHex}"`,
12430
+ `btnPosition: "${toCamelCase(customizationOptions.buttonPosition)}"`,
12431
+ `btnText: "${customizationOptions.buttonText}"`,
12432
+ "showIcon: false",
12433
+ ]);
12434
+ await this.previewTab.click();
12435
+ const floatingButton = this.page.getByRole("button", {
12436
+ name: customizationOptions.buttonText,
12437
+ });
12438
+ await expect(floatingButton).toHaveCSS("color", hexToRGB(customizationOptions.buttonTextColorHex));
12439
+ await expect(floatingButton).toHaveCSS("background-color", hexToRGB(customizationOptions.buttonColorHex));
12440
+ const classRegExp = customizationOptions.buttonPosition
12441
+ .toLocaleLowerCase()
12442
+ .replace(" ", ".*");
12443
+ await expect(floatingButton).toHaveClass(RegExp(classRegExp));
12444
+ await expect(floatingButton.locator("svg")).toBeHidden();
12445
+ };
12446
+ this.verifyElementClickCustomization = async (customizationOptions) => {
12447
+ await this.page
12448
+ .getByTestId(EMBED_SELECTORS.elementIdInput)
12449
+ .fill(customizationOptions.customId);
12450
+ await expect(this.codeBlock).toContainText(`elementSelector: "#${customizationOptions.customId}"`);
12451
+ await this.previewTab.click();
12452
+ await expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible();
12453
+ await expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible();
12454
+ };
12455
+ this.expectMultipleTextsInCodeblock = async (containTextOptions) => {
12456
+ const codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
12457
+ for (const containTextOption of containTextOptions) {
12458
+ await expect(codeBlock).toContainText(containTextOption);
12459
+ }
12460
+ };
12461
+ this.context = context;
12462
+ this.page = page;
12463
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
12464
+ this.appName = appName;
12465
+ this.t = getI18nInstance().t;
12466
+ this.codeBlock = this.page.getByTestId(EMBED_SELECTORS.codeBlock);
12467
+ this.previewTab = this.page.getByTestId(EMBED_SELECTORS.previewTab);
12468
+ }
12469
+ }
12470
+
12250
12471
  const BASE_URL = "/api/v1";
12251
12472
  const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
12252
12473
  const ROUTES = {
@@ -13453,6 +13674,8 @@ anyBase.HEX = '0123456789abcdef';
13453
13674
 
13454
13675
  var anyBase_1 = anyBase;
13455
13676
 
13677
+ var anyBase$1 = /*@__PURE__*/getDefaultExportFromCjs(anyBase_1);
13678
+
13456
13679
  var pixelmatch_1 = pixelmatch;
13457
13680
 
13458
13681
  function pixelmatch(img1, img2, output, width, height, options) {
@@ -13610,6 +13833,8 @@ function grayPixel(img, i) {
13610
13833
  return rgb2y(r, g, b);
13611
13834
  }
13612
13835
 
13836
+ var pixelMatch = /*@__PURE__*/getDefaultExportFromCjs(pixelmatch_1);
13837
+
13613
13838
  // This file is autogenerated. It's used to publish ESM to npm.
13614
13839
  function _typeof$1(obj) {
13615
13840
  "@babel/helpers - typeof";
@@ -14906,13 +15131,23 @@ ImagePHash.prototype.getHash = function (img) {
14906
15131
 
14907
15132
  // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
14908
15133
 
15134
+ /**
15135
+ Convert a 32-bit integer color value to an RGBA object.
15136
+ */
14909
15137
  function intToRGBA(i) {
14910
- const rgba = {};
14911
- rgba.r = Math.floor(i / Math.pow(256, 3));
14912
- rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
14913
- rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
14914
- 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));
14915
- return rgba;
15138
+ const a = i & 0xff;
15139
+ i >>>= 8;
15140
+ const b = i & 0xff;
15141
+ i >>>= 8;
15142
+ const g = i & 0xff;
15143
+ i >>>= 8;
15144
+ const r = i & 0xff;
15145
+ return {
15146
+ r,
15147
+ g,
15148
+ b,
15149
+ a
15150
+ };
14916
15151
  }
14917
15152
  const c$1 = [];
14918
15153
  function initCoefficients(size) {
@@ -15136,6 +15371,8 @@ conversions["RegExp"] = function (V, opts) {
15136
15371
 
15137
15372
  var utils = {exports: {}};
15138
15373
 
15374
+ utils.exports;
15375
+
15139
15376
  (function (module) {
15140
15377
 
15141
15378
  module.exports.mixin = function mixin(target, source) {
@@ -15154,9 +15391,11 @@ var utils = {exports: {}};
15154
15391
 
15155
15392
  module.exports.implForWrapper = function (wrapper) {
15156
15393
  return wrapper[module.exports.implSymbol];
15157
- };
15394
+ };
15158
15395
  } (utils));
15159
15396
 
15397
+ var utilsExports = utils.exports;
15398
+
15160
15399
  var URLImpl = {};
15161
15400
 
15162
15401
  var urlStateMachine = {exports: {}};
@@ -93006,6 +93245,8 @@ tr46.toUnicode = function(domain_name, useSTD3) {
93006
93245
 
93007
93246
  tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
93008
93247
 
93248
+ urlStateMachine.exports;
93249
+
93009
93250
  (function (module) {
93010
93251
  const punycode = require$$0$5;
93011
93252
  const tr46$1 = tr46;
@@ -94301,10 +94542,12 @@ tr46.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
94301
94542
 
94302
94543
  // We don't handle blobs, so this just delegates:
94303
94544
  return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
94304
- };
94545
+ };
94305
94546
  } (urlStateMachine));
94306
94547
 
94307
- const usm = urlStateMachine.exports;
94548
+ var urlStateMachineExports = urlStateMachine.exports;
94549
+
94550
+ const usm = urlStateMachineExports;
94308
94551
 
94309
94552
  URLImpl.implementation = class URLImpl {
94310
94553
  constructor(constructorArgs) {
@@ -94504,13 +94747,15 @@ URLImpl.implementation = class URLImpl {
94504
94747
  }
94505
94748
  };
94506
94749
 
94750
+ URL$2.exports;
94751
+
94507
94752
  (function (module) {
94508
94753
 
94509
94754
  const conversions = lib$6;
94510
- const utils$1 = utils.exports;
94755
+ const utils = utilsExports;
94511
94756
  const Impl = URLImpl;
94512
94757
 
94513
- const impl = utils$1.implSymbol;
94758
+ const impl = utils.implSymbol;
94514
94759
 
94515
94760
  function URL(url) {
94516
94761
  if (!this || this[impl] || !(this instanceof URL)) {
@@ -94691,25 +94936,27 @@ URLImpl.implementation = class URLImpl {
94691
94936
  privateData.wrapper = obj;
94692
94937
 
94693
94938
  obj[impl] = new Impl.implementation(constructorArgs, privateData);
94694
- obj[impl][utils$1.wrapperSymbol] = obj;
94939
+ obj[impl][utils.wrapperSymbol] = obj;
94695
94940
  },
94696
94941
  interface: URL,
94697
94942
  expose: {
94698
94943
  Window: { URL: URL },
94699
94944
  Worker: { URL: URL }
94700
94945
  }
94701
- };
94946
+ };
94702
94947
  } (URL$2));
94703
94948
 
94704
- publicApi.URL = URL$2.exports.interface;
94705
- publicApi.serializeURL = urlStateMachine.exports.serializeURL;
94706
- publicApi.serializeURLOrigin = urlStateMachine.exports.serializeURLOrigin;
94707
- publicApi.basicURLParse = urlStateMachine.exports.basicURLParse;
94708
- publicApi.setTheUsername = urlStateMachine.exports.setTheUsername;
94709
- publicApi.setThePassword = urlStateMachine.exports.setThePassword;
94710
- publicApi.serializeHost = urlStateMachine.exports.serializeHost;
94711
- publicApi.serializeInteger = urlStateMachine.exports.serializeInteger;
94712
- publicApi.parseURL = urlStateMachine.exports.parseURL;
94949
+ var URLExports = URL$2.exports;
94950
+
94951
+ publicApi.URL = URLExports.interface;
94952
+ publicApi.serializeURL = urlStateMachineExports.serializeURL;
94953
+ publicApi.serializeURLOrigin = urlStateMachineExports.serializeURLOrigin;
94954
+ publicApi.basicURLParse = urlStateMachineExports.basicURLParse;
94955
+ publicApi.setTheUsername = urlStateMachineExports.setTheUsername;
94956
+ publicApi.setThePassword = urlStateMachineExports.setThePassword;
94957
+ publicApi.serializeHost = urlStateMachineExports.serializeHost;
94958
+ publicApi.serializeInteger = urlStateMachineExports.serializeInteger;
94959
+ publicApi.parseURL = urlStateMachineExports.parseURL;
94713
94960
 
94714
94961
  // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
94715
94962
 
@@ -96489,6 +96736,8 @@ var lib$5 = /*#__PURE__*/Object.freeze({
96489
96736
 
96490
96737
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib$5);
96491
96738
 
96739
+ fetchNpmNode.exports;
96740
+
96492
96741
  (function (module) {
96493
96742
 
96494
96743
  var realFetch = require$$0;
@@ -96504,9 +96753,11 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib$5);
96504
96753
  commonjsGlobal.Response = realFetch.Response;
96505
96754
  commonjsGlobal.Headers = realFetch.Headers;
96506
96755
  commonjsGlobal.Request = realFetch.Request;
96507
- }
96756
+ }
96508
96757
  } (fetchNpmNode));
96509
96758
 
96759
+ fetchNpmNode.exports;
96760
+
96510
96761
  var request$1 = ((_ref, cb) => {
96511
96762
  let {
96512
96763
  url,
@@ -97020,7 +97271,7 @@ var EndOfFileStream = {};
97020
97271
  super(exports.defaultMessages);
97021
97272
  }
97022
97273
  }
97023
- exports.EndOfStreamError = EndOfStreamError;
97274
+ exports.EndOfStreamError = EndOfStreamError;
97024
97275
  } (EndOfFileStream));
97025
97276
 
97026
97277
  var StreamReader = {};
@@ -97174,7 +97425,7 @@ Deferred$1.Deferred = Deferred;
97174
97425
  }
97175
97426
  }
97176
97427
  }
97177
- exports.StreamReader = StreamReader;
97428
+ exports.StreamReader = StreamReader;
97178
97429
  } (StreamReader));
97179
97430
 
97180
97431
  (function (exports) {
@@ -97183,7 +97434,7 @@ Deferred$1.Deferred = Deferred;
97183
97434
  var EndOfFileStream_1 = EndOfFileStream;
97184
97435
  Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_1.EndOfStreamError; } });
97185
97436
  var StreamReader_1 = StreamReader;
97186
- Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } });
97437
+ Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } });
97187
97438
  } (lib$3));
97188
97439
 
97189
97440
  Object.defineProperty(AbstractTokenizer$1, "__esModule", { value: true });
@@ -97473,7 +97724,7 @@ BufferTokenizer$1.BufferTokenizer = BufferTokenizer;
97473
97724
  function fromBuffer(uint8Array, fileInfo) {
97474
97725
  return new BufferTokenizer_1.BufferTokenizer(uint8Array, fileInfo);
97475
97726
  }
97476
- exports.fromBuffer = fromBuffer;
97727
+ exports.fromBuffer = fromBuffer;
97477
97728
  } (core$2));
97478
97729
 
97479
97730
  var FileTokenizer$1 = {};
@@ -97559,7 +97810,7 @@ FileTokenizer$1.fromFile = fromFile$1;
97559
97810
  }
97560
97811
  return core.fromStream(stream, fileInfo);
97561
97812
  }
97562
- exports.fromStream = fromStream;
97813
+ exports.fromStream = fromStream;
97563
97814
  } (lib$4));
97564
97815
 
97565
97816
  var lib$2 = {};
@@ -98107,7 +98358,7 @@ ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {
98107
98358
  201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
98108
98359
  217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
98109
98360
  233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
98110
- 248, 249, 250, 251, 252, 253, 254, 255];
98361
+ 248, 249, 250, 251, 252, 253, 254, 255];
98111
98362
  } (lib$2));
98112
98363
 
98113
98364
  var util$6 = {};
@@ -99926,6 +100177,8 @@ Object.defineProperty(fileType, 'mimeTypes', {
99926
100177
 
99927
100178
  var fileType_1 = fileType;
99928
100179
 
100180
+ var FileType = /*@__PURE__*/getDefaultExportFromCjs(fileType_1);
100181
+
99929
100182
  /*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 */
99930
100183
 
99931
100184
  var jpeg$2 = {
@@ -101227,8 +101480,10 @@ var exifParser = {
101227
101480
  }
101228
101481
  };
101229
101482
 
101483
+ var EXIFParser = /*@__PURE__*/getDefaultExportFromCjs(exifParser);
101484
+
101230
101485
  async function getMIMEFromBuffer(buffer, path) {
101231
- const fileTypeFromBuffer = await fileType_1.fromBuffer(buffer);
101486
+ const fileTypeFromBuffer = await FileType.fromBuffer(buffer);
101232
101487
  if (fileTypeFromBuffer) {
101233
101488
  // If fileType returns something for buffer, then return the mime given
101234
101489
  return fileTypeFromBuffer.mime;
@@ -101374,7 +101629,7 @@ async function parseBitmap(data, path, cb) {
101374
101629
  return cb.call(this, error, this);
101375
101630
  }
101376
101631
  try {
101377
- this._exif = exifParser.create(data).parse();
101632
+ this._exif = EXIFParser.create(data).parse();
101378
101633
  exifRotate(this); // EXIF data
101379
101634
  } catch (error) {
101380
101635
  /* meh */
@@ -101440,7 +101695,7 @@ const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
101440
101695
  // 0 and 1 do not exist as possible hash lengths
101441
101696
  const maxHashLength = [NaN, NaN];
101442
101697
  for (let i = 2; i < 65; i++) {
101443
- const maxHash = anyBase_1(anyBase_1.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
101698
+ const maxHash = anyBase$1(anyBase$1.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
101444
101699
  maxHashLength.push(maxHash.length);
101445
101700
  }
101446
101701
 
@@ -101913,7 +102168,7 @@ class Jimp$1 extends require$$0$4 {
101913
102168
  return throwError.call(this, "base must be a number between 2 and 64", cb);
101914
102169
  }
101915
102170
  let hash = this.pHash();
101916
- hash = anyBase_1(anyBase_1.BIN, alphabet.slice(0, base))(hash);
102171
+ hash = anyBase$1(anyBase$1.BIN, alphabet.slice(0, base))(hash);
101917
102172
  while (hash.length < maxHashLength[base]) {
101918
102173
  hash = "0" + hash; // pad out with leading zeros
101919
102174
  }
@@ -102022,10 +102277,6 @@ class Jimp$1 extends require$$0$4 {
102022
102277
  */
102023
102278
  getPixelColor(x, y, cb) {
102024
102279
  if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb);
102025
-
102026
- // round input
102027
- x = Math.round(x);
102028
- y = Math.round(y);
102029
102280
  const idx = this.getPixelIndex(x, y);
102030
102281
  const hex = this.bitmap.data.readUInt32BE(idx);
102031
102282
  if (isNodePattern(cb)) {
@@ -102043,10 +102294,6 @@ class Jimp$1 extends require$$0$4 {
102043
102294
  */
102044
102295
  setPixelColor(hex, x, y, cb) {
102045
102296
  if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return throwError.call(this, "hex, x and y must be numbers", cb);
102046
-
102047
- // round input
102048
- x = Math.round(x);
102049
- y = Math.round(y);
102050
102297
  const idx = this.getPixelIndex(x, y);
102051
102298
  this.bitmap.data.writeUInt32BE(hex, idx);
102052
102299
  if (isNodePattern(cb)) {
@@ -102059,13 +102306,15 @@ class Jimp$1 extends require$$0$4 {
102059
102306
  * @return {boolean} hasAlpha whether the image contains opaque pixels
102060
102307
  */
102061
102308
  hasAlpha() {
102062
- for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {
102063
- for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {
102064
- const idx = this.bitmap.width * yIndex + xIndex << 2;
102065
- const alpha = this.bitmap.data[idx + 3];
102066
- if (alpha !== 0xff) {
102067
- return true;
102068
- }
102309
+ const {
102310
+ width,
102311
+ height,
102312
+ data
102313
+ } = this.bitmap;
102314
+ const byteLen = width * height << 2;
102315
+ for (let idx = 3; idx < byteLen; idx += 4) {
102316
+ if (data[idx] !== 0xff) {
102317
+ return true;
102069
102318
  }
102070
102319
  }
102071
102320
  return false;
@@ -102165,11 +102414,16 @@ Jimp$1.rgbaToInt = function (r, g, b, a, cb) {
102165
102414
  if (a < 0 || a > 255) {
102166
102415
  return throwError.call(this, "a must be between 0 and 255", cb);
102167
102416
  }
102168
- r = Math.round(r);
102169
- b = Math.round(b);
102170
- g = Math.round(g);
102171
- a = Math.round(a);
102172
- const i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0);
102417
+ let i = r & 0xff;
102418
+ i <<= 8;
102419
+ i |= g & 0xff;
102420
+ i <<= 8;
102421
+ i |= b & 0xff;
102422
+ i <<= 8;
102423
+ i |= a & 0xff;
102424
+
102425
+ // Ensure sign is correct
102426
+ i >>>= 0;
102173
102427
  if (isNodePattern(cb)) {
102174
102428
  cb.call(this, null, i);
102175
102429
  }
@@ -102245,7 +102499,7 @@ Jimp$1.diff = function (img1, img2) {
102245
102499
  return throwError.call(this, "threshold must be a number between 0 and 1");
102246
102500
  }
102247
102501
  const diff = new Jimp$1(bmp1.width, bmp1.height, 0xffffffff);
102248
- const numDiffPixels = pixelmatch_1(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
102502
+ const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
102249
102503
  threshold
102250
102504
  });
102251
102505
  return {
@@ -103207,6 +103461,7 @@ var encoder$1 = {exports: {}};
103207
103461
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
103208
103462
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103209
103463
  */
103464
+ encoder$1.exports;
103210
103465
 
103211
103466
  (function (module) {
103212
103467
 
@@ -103952,10 +104207,13 @@ var encoder$1 = {exports: {}};
103952
104207
  }
103953
104208
  } (encoder$1));
103954
104209
 
104210
+ var encoderExports = encoder$1.exports;
104211
+
103955
104212
  var decoder$1 = {exports: {}};
103956
104213
 
103957
104214
  /* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
103958
104215
  /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
104216
+ decoder$1.exports;
103959
104217
 
103960
104218
  (function (module) {
103961
104219
  /*
@@ -105100,17 +105358,21 @@ var decoder$1 = {exports: {}};
105100
105358
  decoder.copyToImageData(image, opts.formatAsRGBA);
105101
105359
 
105102
105360
  return image;
105103
- }
105361
+ }
105104
105362
  } (decoder$1));
105105
105363
 
105106
- var encode$2 = encoder$1.exports,
105107
- decode$2 = decoder$1.exports;
105364
+ var decoderExports = decoder$1.exports;
105365
+
105366
+ var encode$2 = encoderExports,
105367
+ decode$2 = decoderExports;
105108
105368
 
105109
105369
  var jpegJs = {
105110
105370
  encode: encode$2,
105111
105371
  decode: decode$2
105112
105372
  };
105113
105373
 
105374
+ var JPEG = /*@__PURE__*/getDefaultExportFromCjs(jpegJs);
105375
+
105114
105376
  const MIME_TYPE$4 = "image/jpeg";
105115
105377
  var jpeg = (() => ({
105116
105378
  mime: {
@@ -105120,10 +105382,10 @@ var jpeg = (() => ({
105120
105382
  MIME_JPEG: MIME_TYPE$4
105121
105383
  },
105122
105384
  decoders: {
105123
- [MIME_TYPE$4]: jpegJs.decode
105385
+ [MIME_TYPE$4]: JPEG.decode
105124
105386
  },
105125
105387
  encoders: {
105126
- [MIME_TYPE$4]: image => jpegJs.encode(image.bitmap, image._quality).data
105388
+ [MIME_TYPE$4]: image => JPEG.encode(image.bitmap, image._quality).data
105127
105389
  },
105128
105390
  class: {
105129
105391
  // The quality to be used when saving JPEG images
@@ -105342,6 +105604,8 @@ ChunkStream$2.prototype._process = function () {
105342
105604
  }
105343
105605
  };
105344
105606
 
105607
+ var chunkstreamExports = chunkstream.exports;
105608
+
105345
105609
  var filterParseAsync = {exports: {}};
105346
105610
 
105347
105611
  var filterParse = {exports: {}};
@@ -105633,9 +105897,11 @@ Filter$2.prototype._reverseFilterLine = function (rawData) {
105633
105897
  }
105634
105898
  };
105635
105899
 
105900
+ var filterParseExports = filterParse.exports;
105901
+
105636
105902
  let util$4 = require$$0$2;
105637
- let ChunkStream$1 = chunkstream.exports;
105638
- let Filter$1 = filterParse.exports;
105903
+ let ChunkStream$1 = chunkstreamExports;
105904
+ let Filter$1 = filterParseExports;
105639
105905
 
105640
105906
  let FilterAsync$1 = (filterParseAsync.exports = function (bitmapInfo) {
105641
105907
  ChunkStream$1.call(this);
@@ -105656,6 +105922,8 @@ let FilterAsync$1 = (filterParseAsync.exports = function (bitmapInfo) {
105656
105922
  });
105657
105923
  util$4.inherits(FilterAsync$1, ChunkStream$1);
105658
105924
 
105925
+ var filterParseAsyncExports = filterParseAsync.exports;
105926
+
105659
105927
  var parser$1 = {exports: {}};
105660
105928
 
105661
105929
  var constants$6 = {
@@ -105730,8 +105998,10 @@ CrcCalculator$1.crc32 = function (buf) {
105730
105998
  return crc ^ -1;
105731
105999
  };
105732
106000
 
106001
+ var crcExports = crc.exports;
106002
+
105733
106003
  let constants$5 = constants$6;
105734
- let CrcCalculator = crc.exports;
106004
+ let CrcCalculator = crcExports;
105735
106005
 
105736
106006
  let Parser$3 = (parser$1.exports = function (options, dependencies) {
105737
106007
  this._options = options;
@@ -106019,6 +106289,8 @@ Parser$3.prototype._parseIEND = function (data) {
106019
106289
  }
106020
106290
  };
106021
106291
 
106292
+ var parserExports = parser$1.exports;
106293
+
106022
106294
  var bitmapper$2 = {};
106023
106295
 
106024
106296
  let interlaceUtils = interlace;
@@ -106381,9 +106653,9 @@ var formatNormaliser$2 = function (indata, imageData, skipRescale = false) {
106381
106653
 
106382
106654
  let util$3 = require$$0$2;
106383
106655
  let zlib$4 = zlib$5;
106384
- let ChunkStream = chunkstream.exports;
106385
- let FilterAsync = filterParseAsync.exports;
106386
- let Parser$2 = parser$1.exports;
106656
+ let ChunkStream = chunkstreamExports;
106657
+ let FilterAsync = filterParseAsyncExports;
106658
+ let Parser$2 = parserExports;
106387
106659
  let bitmapper$1 = bitmapper$2;
106388
106660
  let formatNormaliser$1 = formatNormaliser$2;
106389
106661
 
@@ -106547,6 +106819,8 @@ ParserAsync.prototype._complete = function (filteredData) {
106547
106819
  this.emit("parsed", normalisedBitmapData);
106548
106820
  };
106549
106821
 
106822
+ var parserAsyncExports = parserAsync.exports;
106823
+
106550
106824
  var packerAsync = {exports: {}};
106551
106825
 
106552
106826
  var packer = {exports: {}};
@@ -106879,7 +107153,7 @@ var filterPack = function (pxData, width, height, options, bpp) {
106879
107153
  };
106880
107154
 
106881
107155
  let constants$3 = constants$6;
106882
- let CrcStream = crc.exports;
107156
+ let CrcStream = crcExports;
106883
107157
  let bitPacker = bitpacker;
106884
107158
  let filter = filterPack;
106885
107159
  let zlib$3 = zlib$5;
@@ -107006,10 +107280,12 @@ Packer$3.prototype.packIEND = function () {
107006
107280
  return this._packChunk(constants$3.TYPE_IEND, null);
107007
107281
  };
107008
107282
 
107283
+ var packerExports = packer.exports;
107284
+
107009
107285
  let util$2 = require$$0$2;
107010
107286
  let Stream$1 = Stream$4;
107011
107287
  let constants$2 = constants$6;
107012
- let Packer$2 = packer.exports;
107288
+ let Packer$2 = packerExports;
107013
107289
 
107014
107290
  let PackerAsync = (packerAsync.exports = function (opt) {
107015
107291
  Stream$1.call(this);
@@ -107055,10 +107331,14 @@ PackerAsync.prototype.pack = function (data, width, height, gamma) {
107055
107331
  this._deflate.end(filteredData);
107056
107332
  };
107057
107333
 
107334
+ var packerAsyncExports = packerAsync.exports;
107335
+
107058
107336
  var pngSync = {};
107059
107337
 
107060
107338
  var syncInflate = {exports: {}};
107061
107339
 
107340
+ syncInflate.exports;
107341
+
107062
107342
  (function (module, exports) {
107063
107343
 
107064
107344
  let assert = require$$0$6.ok;
@@ -107226,9 +107506,11 @@ var syncInflate = {exports: {}};
107226
107506
  module.exports = exports = inflateSync;
107227
107507
  exports.Inflate = Inflate;
107228
107508
  exports.createInflate = createInflate;
107229
- exports.inflateSync = inflateSync;
107509
+ exports.inflateSync = inflateSync;
107230
107510
  } (syncInflate, syncInflate.exports));
107231
107511
 
107512
+ var syncInflateExports = syncInflate.exports;
107513
+
107232
107514
  var syncReader = {exports: {}};
107233
107515
 
107234
107516
  let SyncReader$2 = (syncReader.exports = function (buffer) {
@@ -107275,10 +107557,12 @@ SyncReader$2.prototype.process = function () {
107275
107557
  }
107276
107558
  };
107277
107559
 
107560
+ var syncReaderExports = syncReader.exports;
107561
+
107278
107562
  var filterParseSync = {};
107279
107563
 
107280
- let SyncReader$1 = syncReader.exports;
107281
- let Filter = filterParse.exports;
107564
+ let SyncReader$1 = syncReaderExports;
107565
+ let Filter = filterParseExports;
107282
107566
 
107283
107567
  filterParseSync.process = function (inBuffer, bitmapInfo) {
107284
107568
  let outBuffers = [];
@@ -107299,13 +107583,13 @@ filterParseSync.process = function (inBuffer, bitmapInfo) {
107299
107583
 
107300
107584
  let hasSyncZlib$1 = true;
107301
107585
  let zlib$2 = zlib$5;
107302
- let inflateSync = syncInflate.exports;
107586
+ let inflateSync = syncInflateExports;
107303
107587
  if (!zlib$2.deflateSync) {
107304
107588
  hasSyncZlib$1 = false;
107305
107589
  }
107306
- let SyncReader = syncReader.exports;
107590
+ let SyncReader = syncReaderExports;
107307
107591
  let FilterSync = filterParseSync;
107308
- let Parser$1 = parser$1.exports;
107592
+ let Parser$1 = parserExports;
107309
107593
  let bitmapper = bitmapper$2;
107310
107594
  let formatNormaliser = formatNormaliser$2;
107311
107595
 
@@ -107414,7 +107698,7 @@ if (!zlib$1.deflateSync) {
107414
107698
  hasSyncZlib = false;
107415
107699
  }
107416
107700
  let constants$1 = constants$6;
107417
- let Packer$1 = packer.exports;
107701
+ let Packer$1 = packerExports;
107418
107702
 
107419
107703
  var packerSync = function (metaData, opt) {
107420
107704
  if (!hasSyncZlib) {
@@ -107478,8 +107762,8 @@ var PNG_1;
107478
107762
 
107479
107763
  let util$1 = require$$0$2;
107480
107764
  let Stream = Stream$4;
107481
- let Parser = parserAsync.exports;
107482
- let Packer = packerAsync.exports;
107765
+ let Parser = parserAsyncExports;
107766
+ let Packer = packerAsyncExports;
107483
107767
  let PNGSync = pngSync;
107484
107768
 
107485
107769
  let PNG = (PNG_1 = function (options) {
@@ -108380,6 +108664,8 @@ var bmpJs = {
108380
108664
  decode: decode$1
108381
108665
  };
108382
108666
 
108667
+ var BMP = /*@__PURE__*/getDefaultExportFromCjs(bmpJs);
108668
+
108383
108669
  const MIME_TYPE$2 = "image/bmp";
108384
108670
  const MIME_TYPE_SECOND = "image/x-ms-bmp";
108385
108671
  function toAGBR(image) {
@@ -108408,8 +108694,8 @@ function fromAGBR(bitmap) {
108408
108694
  this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
108409
108695
  }).bitmap;
108410
108696
  }
108411
- const decode = data => fromAGBR(bmpJs.decode(data));
108412
- const encode = image => bmpJs.encode(toAGBR(image)).data;
108697
+ const decode = data => fromAGBR(BMP.decode(data));
108698
+ const encode = image => BMP.encode(toAGBR(image)).data;
108413
108699
  var bmp = (() => ({
108414
108700
  mime: {
108415
108701
  [MIME_TYPE$2]: ["bmp"]
@@ -108545,8 +108831,8 @@ function requireCommon () {
108545
108831
  }
108546
108832
  };
108547
108833
 
108548
- exports.setTyped(TYPED_OK);
108549
- } (common));
108834
+ exports.setTyped(TYPED_OK);
108835
+ } (common));
108550
108836
  return common;
108551
108837
  }
108552
108838
 
@@ -115350,6 +115636,8 @@ function requirePako () {
115350
115636
  return pako_1;
115351
115637
  }
115352
115638
 
115639
+ UTIF.exports;
115640
+
115353
115641
  (function (module) {
115354
115642
  (function(){
115355
115643
  var UTIF = {};
@@ -116986,10 +117274,11 @@ function requirePako () {
116986
117274
 
116987
117275
 
116988
117276
  })(UTIF, pako);
116989
- })();
117277
+ })();
116990
117278
  } (UTIF));
116991
117279
 
116992
- var utif = UTIF.exports;
117280
+ var UTIFExports = UTIF.exports;
117281
+ var utif = /*@__PURE__*/getDefaultExportFromCjs(UTIFExports);
116993
117282
 
116994
117283
  const MIME_TYPE$1 = "image/tiff";
116995
117284
  var tiff = (() => ({
@@ -121363,8 +121652,8 @@ function requireGifutil () {
121363
121652
  return resolve();
121364
121653
  });
121365
121654
  });
121366
- }
121367
- } (gifutil));
121655
+ }
121656
+ } (gifutil));
121368
121657
  return gifutil;
121369
121658
  }
121370
121659
 
@@ -129526,8 +129815,8 @@ function requireSax () {
129526
129815
  }
129527
129816
  }());
129528
129817
  }
129529
- })(exports);
129530
- } (sax));
129818
+ })(exports);
129819
+ } (sax));
129531
129820
  return sax;
129532
129821
  }
129533
129822
 
@@ -129984,8 +130273,8 @@ function requireParser () {
129984
130273
  return parser.parseStringPromise(str);
129985
130274
  };
129986
130275
 
129987
- }).call(commonjsGlobal);
129988
- } (parser));
130276
+ }).call(commonjsGlobal);
130277
+ } (parser));
129989
130278
  return parser;
129990
130279
  }
129991
130280
 
@@ -133214,6 +133503,8 @@ var loadBmfont = function loadFont(opt, cb) {
133214
133503
  }
133215
133504
  };
133216
133505
 
133506
+ var bMFont = /*@__PURE__*/getDefaultExportFromCjs(loadBmfont);
133507
+
133217
133508
  function measureText(font, text) {
133218
133509
  let x = 0;
133219
133510
  for (let i = 0; i < text.length; i++) {
@@ -133225,21 +133516,21 @@ function measureText(font, text) {
133225
133516
  return x;
133226
133517
  }
133227
133518
  function splitLines(font, text, maxWidth) {
133228
- const words = text.split(" ");
133519
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
133229
133520
  const lines = [];
133230
133521
  let currentLine = [];
133231
133522
  let longestLine = 0;
133232
133523
  words.forEach(word => {
133233
133524
  const line = [...currentLine, word].join(" ");
133234
133525
  const length = measureText(font, line);
133235
- if (length <= maxWidth) {
133526
+ if (length <= maxWidth && !word.includes("\n")) {
133236
133527
  if (length > longestLine) {
133237
133528
  longestLine = length;
133238
133529
  }
133239
133530
  currentLine.push(word);
133240
133531
  } else {
133241
133532
  lines.push(currentLine);
133242
- currentLine = [word];
133533
+ currentLine = [word.replace("\n", "")];
133243
133534
  }
133244
133535
  });
133245
133536
  lines.push(currentLine);
@@ -133324,7 +133615,7 @@ var print = (() => ({
133324
133615
  cb = cb || function (err, font) {
133325
133616
  if (err) reject(err);else resolve(font);
133326
133617
  };
133327
- loadBmfont(file, (err, font) => {
133618
+ bMFont(file, (err, font) => {
133328
133619
  const chars = {};
133329
133620
  const kernings = {};
133330
133621
  if (err) {
@@ -134465,6 +134756,8 @@ var Jimp = configure({
134465
134756
 
134466
134757
  var jsQR$1 = {exports: {}};
134467
134758
 
134759
+ jsQR$1.exports;
134760
+
134468
134761
  (function (module, exports) {
134469
134762
  (function webpackUniversalModuleDefinition(root, factory) {
134470
134763
  module.exports = factory();
@@ -144534,10 +144827,11 @@ var jsQR$1 = {exports: {}};
144534
144827
 
144535
144828
  /***/ })
144536
144829
  /******/ ])["default"];
144537
- });
144538
- } (jsQR$1));
144830
+ });
144831
+ } (jsQR$1, jsQR$1.exports));
144539
144832
 
144540
- var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQR$1.exports);
144833
+ var jsQRExports = jsQR$1.exports;
144834
+ var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQRExports);
144541
144835
 
144542
144836
  const decodeQRCodeFromFile = async (filePath) => {
144543
144837
  let decodedString;
@@ -146096,7 +146390,7 @@ const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both"
146096
146390
  var main$2 = {exports: {}};
146097
146391
 
146098
146392
  var name = "dotenv";
146099
- var version$1 = "16.3.1";
146393
+ var version$1 = "16.4.5";
146100
146394
  var description = "Loads environment variables from .env file";
146101
146395
  var main$1 = "lib/main.js";
146102
146396
  var types = "lib/main.d.ts";
@@ -146120,6 +146414,7 @@ var scripts = {
146120
146414
  "lint-readme": "standard-markdown",
146121
146415
  pretest: "npm run lint && npm run dts-check",
146122
146416
  test: "tap tests/*.js --100 -Rspec",
146417
+ "test:coverage": "tap --coverage-report=lcov",
146123
146418
  prerelease: "npm test",
146124
146419
  release: "standard-version"
146125
146420
  };
@@ -146127,7 +146422,7 @@ var repository = {
146127
146422
  type: "git",
146128
146423
  url: "git://github.com/motdotla/dotenv.git"
146129
146424
  };
146130
- var funding = "https://github.com/motdotla/dotenv?sponsor=1";
146425
+ var funding = "https://dotenvx.com";
146131
146426
  var keywords = [
146132
146427
  "dotenv",
146133
146428
  "env",
@@ -146230,11 +146525,13 @@ function _parseVault (options) {
146230
146525
  // Parse .env.vault
146231
146526
  const result = DotenvModule.configDotenv({ path: vaultPath });
146232
146527
  if (!result.parsed) {
146233
- throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
146528
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
146529
+ err.code = 'MISSING_DATA';
146530
+ throw err
146234
146531
  }
146235
146532
 
146236
146533
  // handle scenario for comma separated keys - for use with key rotation
146237
- // example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
146534
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
146238
146535
  const keys = _dotenvKey(options).split(',');
146239
146536
  const length = keys.length;
146240
146537
 
@@ -146298,7 +146595,9 @@ function _instructions (result, dotenvKey) {
146298
146595
  uri = new URL(dotenvKey);
146299
146596
  } catch (error) {
146300
146597
  if (error.code === 'ERR_INVALID_URL') {
146301
- 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')
146598
+ 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');
146599
+ err.code = 'INVALID_DOTENV_KEY';
146600
+ throw err
146302
146601
  }
146303
146602
 
146304
146603
  throw error
@@ -146307,34 +146606,53 @@ function _instructions (result, dotenvKey) {
146307
146606
  // Get decrypt key
146308
146607
  const key = uri.password;
146309
146608
  if (!key) {
146310
- throw new Error('INVALID_DOTENV_KEY: Missing key part')
146609
+ const err = new Error('INVALID_DOTENV_KEY: Missing key part');
146610
+ err.code = 'INVALID_DOTENV_KEY';
146611
+ throw err
146311
146612
  }
146312
146613
 
146313
146614
  // Get environment
146314
146615
  const environment = uri.searchParams.get('environment');
146315
146616
  if (!environment) {
146316
- throw new Error('INVALID_DOTENV_KEY: Missing environment part')
146617
+ const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
146618
+ err.code = 'INVALID_DOTENV_KEY';
146619
+ throw err
146317
146620
  }
146318
146621
 
146319
146622
  // Get ciphertext payload
146320
146623
  const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
146321
146624
  const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
146322
146625
  if (!ciphertext) {
146323
- throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
146626
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
146627
+ err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
146628
+ throw err
146324
146629
  }
146325
146630
 
146326
146631
  return { ciphertext, key }
146327
146632
  }
146328
146633
 
146329
146634
  function _vaultPath (options) {
146330
- let dotenvPath = path.resolve(process.cwd(), '.env');
146635
+ let possibleVaultPath = null;
146331
146636
 
146332
146637
  if (options && options.path && options.path.length > 0) {
146333
- dotenvPath = options.path;
146638
+ if (Array.isArray(options.path)) {
146639
+ for (const filepath of options.path) {
146640
+ if (fs.existsSync(filepath)) {
146641
+ possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
146642
+ }
146643
+ }
146644
+ } else {
146645
+ possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
146646
+ }
146647
+ } else {
146648
+ possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
146649
+ }
146650
+
146651
+ if (fs.existsSync(possibleVaultPath)) {
146652
+ return possibleVaultPath
146334
146653
  }
146335
146654
 
146336
- // Locate .env.vault
146337
- return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
146655
+ return null
146338
146656
  }
146339
146657
 
146340
146658
  function _resolveHome (envPath) {
@@ -146357,51 +146675,73 @@ function _configVault (options) {
146357
146675
  }
146358
146676
 
146359
146677
  function configDotenv (options) {
146360
- let dotenvPath = path.resolve(process.cwd(), '.env');
146678
+ const dotenvPath = path.resolve(process.cwd(), '.env');
146361
146679
  let encoding = 'utf8';
146362
146680
  const debug = Boolean(options && options.debug);
146363
146681
 
146364
- if (options) {
146365
- if (options.path != null) {
146366
- dotenvPath = _resolveHome(options.path);
146682
+ if (options && options.encoding) {
146683
+ encoding = options.encoding;
146684
+ } else {
146685
+ if (debug) {
146686
+ _debug('No encoding is specified. UTF-8 is used by default');
146367
146687
  }
146368
- if (options.encoding != null) {
146369
- encoding = options.encoding;
146688
+ }
146689
+
146690
+ let optionPaths = [dotenvPath]; // default, look for .env
146691
+ if (options && options.path) {
146692
+ if (!Array.isArray(options.path)) {
146693
+ optionPaths = [_resolveHome(options.path)];
146694
+ } else {
146695
+ optionPaths = []; // reset default
146696
+ for (const filepath of options.path) {
146697
+ optionPaths.push(_resolveHome(filepath));
146698
+ }
146370
146699
  }
146371
146700
  }
146372
146701
 
146373
- try {
146374
- // Specifying an encoding returns a string instead of a buffer
146375
- const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
146702
+ // Build the parsed data in a temporary object (because we need to return it). Once we have the final
146703
+ // parsed data, we will combine it with process.env (or options.processEnv if provided).
146704
+ let lastError;
146705
+ const parsedAll = {};
146706
+ for (const path of optionPaths) {
146707
+ try {
146708
+ // Specifying an encoding returns a string instead of a buffer
146709
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
146376
146710
 
146377
- let processEnv = process.env;
146378
- if (options && options.processEnv != null) {
146379
- processEnv = options.processEnv;
146711
+ DotenvModule.populate(parsedAll, parsed, options);
146712
+ } catch (e) {
146713
+ if (debug) {
146714
+ _debug(`Failed to load ${path} ${e.message}`);
146715
+ }
146716
+ lastError = e;
146380
146717
  }
146718
+ }
146381
146719
 
146382
- DotenvModule.populate(processEnv, parsed, options);
146720
+ let processEnv = process.env;
146721
+ if (options && options.processEnv != null) {
146722
+ processEnv = options.processEnv;
146723
+ }
146383
146724
 
146384
- return { parsed }
146385
- } catch (e) {
146386
- if (debug) {
146387
- _debug(`Failed to load ${dotenvPath} ${e.message}`);
146388
- }
146725
+ DotenvModule.populate(processEnv, parsedAll, options);
146389
146726
 
146390
- return { error: e }
146727
+ if (lastError) {
146728
+ return { parsed: parsedAll, error: lastError }
146729
+ } else {
146730
+ return { parsed: parsedAll }
146391
146731
  }
146392
146732
  }
146393
146733
 
146394
146734
  // Populates process.env from .env file
146395
146735
  function config (options) {
146396
- const vaultPath = _vaultPath(options);
146397
-
146398
146736
  // fallback to original dotenv if DOTENV_KEY is not set
146399
146737
  if (_dotenvKey(options).length === 0) {
146400
146738
  return DotenvModule.configDotenv(options)
146401
146739
  }
146402
146740
 
146741
+ const vaultPath = _vaultPath(options);
146742
+
146403
146743
  // dotenvKey exists but .env.vault file does not exist
146404
- if (!fs.existsSync(vaultPath)) {
146744
+ if (!vaultPath) {
146405
146745
  _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
146406
146746
 
146407
146747
  return DotenvModule.configDotenv(options)
@@ -146414,9 +146754,9 @@ function decrypt (encrypted, keyStr) {
146414
146754
  const key = Buffer.from(keyStr.slice(-64), 'hex');
146415
146755
  let ciphertext = Buffer.from(encrypted, 'base64');
146416
146756
 
146417
- const nonce = ciphertext.slice(0, 12);
146418
- const authTag = ciphertext.slice(-16);
146419
- ciphertext = ciphertext.slice(12, -16);
146757
+ const nonce = ciphertext.subarray(0, 12);
146758
+ const authTag = ciphertext.subarray(-16);
146759
+ ciphertext = ciphertext.subarray(12, -16);
146420
146760
 
146421
146761
  try {
146422
146762
  const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
@@ -146428,14 +146768,14 @@ function decrypt (encrypted, keyStr) {
146428
146768
  const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
146429
146769
 
146430
146770
  if (isRange || invalidKeyLength) {
146431
- const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
146432
- throw new Error(msg)
146771
+ const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
146772
+ err.code = 'INVALID_DOTENV_KEY';
146773
+ throw err
146433
146774
  } else if (decryptionFailed) {
146434
- const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
146435
- throw new Error(msg)
146775
+ const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
146776
+ err.code = 'DECRYPTION_FAILED';
146777
+ throw err
146436
146778
  } else {
146437
- console.error('Error: ', error.code);
146438
- console.error('Error: ', error.message);
146439
146779
  throw error
146440
146780
  }
146441
146781
  }
@@ -146447,7 +146787,9 @@ function populate (processEnv, parsed, options = {}) {
146447
146787
  const override = Boolean(options && options.override);
146448
146788
 
146449
146789
  if (typeof parsed !== 'object') {
146450
- throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
146790
+ const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
146791
+ err.code = 'OBJECT_REQUIRED';
146792
+ throw err
146451
146793
  }
146452
146794
 
146453
146795
  // Set process.env
@@ -146490,82 +146832,94 @@ main$2.exports.populate = DotenvModule.populate;
146490
146832
 
146491
146833
  main$2.exports = DotenvModule;
146492
146834
 
146835
+ var mainExports = main$2.exports;
146836
+ var dotenv = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
146837
+
146493
146838
  var main = {};
146494
146839
 
146495
- // like String.prototype.search but returns the last index
146496
- function _searchLast (str, rgx) {
146497
- const matches = Array.from(str.matchAll(rgx));
146498
- return matches.length > 0 ? matches.slice(-1)[0].index : -1
146499
- }
146840
+ // * /
146841
+ // * (\\)? # is it escaped with a backslash?
146842
+ // * (\$) # literal $
146843
+ // * (?!\() # shouldnt be followed by parenthesis
146844
+ // * (\{?) # first brace wrap opening
146845
+ // * ([\w.]+) # key
146846
+ // * (?::-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))? # optional default nested 3 times
146847
+ // * (\}?) # last brace warp closing
146848
+ // * /xi
146500
146849
 
146501
- function _interpolate (envValue, environment, config) {
146502
- // find the last unescaped dollar sign in the
146503
- // value so that we can evaluate it
146504
- const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
146850
+ const DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;
146505
146851
 
146506
- // If we couldn't match any unescaped dollar sign
146507
- // let's return the string as is
146508
- if (lastUnescapedDollarSignIndex === -1) return envValue
146852
+ function _resolveEscapeSequences (value) {
146853
+ return value.replace(/\\\$/g, '$')
146854
+ }
146509
146855
 
146510
- // This is the right-most group of variables in the string
146511
- const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex);
146856
+ function interpolate (value, processEnv, parsed) {
146857
+ return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace) => {
146858
+ if (escaped === '\\') {
146859
+ return match.slice(1)
146860
+ } else {
146861
+ if (processEnv[key]) {
146862
+ if (processEnv[key] === parsed[key]) {
146863
+ return processEnv[key]
146864
+ } else {
146865
+ // scenario: PASSWORD_EXPAND_NESTED=${PASSWORD_EXPAND}
146866
+ return interpolate(processEnv[key], processEnv, parsed)
146867
+ }
146868
+ }
146512
146869
 
146513
- /**
146514
- * This finds the inner most variable/group divided
146515
- * by variable name and default value (if present)
146516
- * (
146517
- * (?!(?<=\\))\$ // only match dollar signs that are not escaped
146518
- * {? // optional opening curly brace
146519
- * ([\w]+) // match the variable name
146520
- * (?::-([^}\\]*))? // match an optional default value
146521
- * }? // optional closing curly brace
146522
- * )
146523
- */
146524
- const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
146525
- const match = rightMostGroup.match(matchGroup);
146526
-
146527
- if (match != null) {
146528
- const [, group, variableName, defaultValue] = match;
146529
-
146530
- return _interpolate(
146531
- envValue.replace(
146532
- group,
146533
- environment[variableName] ||
146534
- defaultValue ||
146535
- config.parsed[variableName] ||
146536
- ''
146537
- ),
146538
- environment,
146539
- config
146540
- )
146541
- }
146870
+ if (parsed[key]) {
146871
+ // avoid recursion from EXPAND_SELF=$EXPAND_SELF
146872
+ if (parsed[key] === value) {
146873
+ return parsed[key]
146874
+ } else {
146875
+ return interpolate(parsed[key], processEnv, parsed)
146876
+ }
146877
+ }
146542
146878
 
146543
- return envValue
146544
- }
146879
+ if (defaultValue) {
146880
+ if (defaultValue.startsWith('$')) {
146881
+ return interpolate(defaultValue, processEnv, parsed)
146882
+ } else {
146883
+ return defaultValue
146884
+ }
146885
+ }
146545
146886
 
146546
- function _resolveEscapeSequences (value) {
146547
- return value.replace(/\\\$/g, '$')
146887
+ return ''
146888
+ }
146889
+ })
146548
146890
  }
146549
146891
 
146550
- function expand (config) {
146551
- // if ignoring process.env, use a blank object
146552
- const environment = config.ignoreProcessEnv ? {} : process.env;
146892
+ function expand (options) {
146893
+ let processEnv = process.env;
146894
+ if (options && options.processEnv != null) {
146895
+ processEnv = options.processEnv;
146896
+ }
146897
+
146898
+ for (const key in options.parsed) {
146899
+ let value = options.parsed[key];
146553
146900
 
146554
- for (const configKey in config.parsed) {
146555
- const value = Object.prototype.hasOwnProperty.call(environment, configKey)
146556
- ? environment[configKey]
146557
- : config.parsed[configKey];
146901
+ const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key);
146902
+ if (inProcessEnv) {
146903
+ if (processEnv[key] === options.parsed[key]) {
146904
+ // assume was set to processEnv from the .env file if the values match and therefore interpolate
146905
+ value = interpolate(value, processEnv, options.parsed);
146906
+ } else {
146907
+ // do not interpolate - assume processEnv had the intended value even if containing a $.
146908
+ value = processEnv[key];
146909
+ }
146910
+ } else {
146911
+ // not inProcessEnv so assume interpolation for this .env key
146912
+ value = interpolate(value, processEnv, options.parsed);
146913
+ }
146558
146914
 
146559
- config.parsed[configKey] = _resolveEscapeSequences(
146560
- _interpolate(value, environment, config)
146561
- );
146915
+ options.parsed[key] = _resolveEscapeSequences(value);
146562
146916
  }
146563
146917
 
146564
- for (const processKey in config.parsed) {
146565
- environment[processKey] = config.parsed[processKey];
146918
+ for (const processKey in options.parsed) {
146919
+ processEnv[processKey] = options.parsed[processKey];
146566
146920
  }
146567
146921
 
146568
- return config
146922
+ return options
146569
146923
  }
146570
146924
 
146571
146925
  main.expand = expand;
@@ -146573,12 +146927,12 @@ main.expand = expand;
146573
146927
  // @ts-check
146574
146928
  var _a, _b;
146575
146929
  process.env.TEST_ENV = (_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : ENVIRONMENT.development;
146576
- const env = main$2.exports.config({
146930
+ const env = dotenv.config({
146577
146931
  path: `./e2e/config/.env.${process.env.TEST_ENV}`,
146578
146932
  });
146579
146933
  main.expand(env);
146580
146934
  if (fs$d.existsSync("./e2e/config/.env.local")) {
146581
- const localEnv = main$2.exports.config({
146935
+ const localEnv = dotenv.config({
146582
146936
  path: "./e2e/config/.env.local",
146583
146937
  });
146584
146938
  main.expand(localEnv);
@@ -146632,5 +146986,5 @@ const definePlaywrightConfig = (overrides) => {
146632
146986
  });
146633
146987
  };
146634
146988
 
146635
- export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, updateCredentials, writeDataToFile };
146989
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, EmbedBase, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, writeDataToFile };
146636
146990
  //# sourceMappingURL=index.js.map