@inboxsdk/core 2.2.18 → 2.2.20

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/inboxsdk.js CHANGED
@@ -371,7 +371,7 @@ function isNotNil(value) {
371
371
 
372
372
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- SDK_VERSION is injected by webpack
373
373
  ///@ts-ignore
374
- const BUILD_VERSION = "2.2.18-1784839996724-a8a6fe2c9e69b0e7";
374
+ const BUILD_VERSION = "2.2.20-1787183471518-8065a08149d763a3";
375
375
  if (false) {}
376
376
 
377
377
  /***/ }),
@@ -2711,7 +2711,7 @@ options.insert = htmlElement => {
2711
2711
  htmlElement.setAttribute('data-inboxsdk-version',
2712
2712
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
2713
2713
  ///@ts-ignore
2714
- "2.2.18-1784839996724-a8a6fe2c9e69b0e7");
2714
+ "2.2.20-1787183471518-8065a08149d763a3");
2715
2715
  document.head.append(htmlElement);
2716
2716
  };
2717
2717
  options.domAPI = (styleDomAPI_default());
@@ -6349,8 +6349,7 @@ class GmailComposeView {
6349
6349
  }
6350
6350
  }
6351
6351
  setTitleBarColor(color) {
6352
- // Gmail A/B-renames the `Ht` token; fall back to a structural selector.
6353
- const buttonParent = this.#element.querySelector('.nH.Hy.aXJ table.cf.Ht td.Hm') || this.#element.querySelector('.nH.Hy.aXJ table.cf td.Hm');
6352
+ const buttonParent = this.#driver.selectors.querySelectorByKey(this.#element, 'composeView.titleBarTd');
6354
6353
  if (!buttonParent) {
6355
6354
  // cosmetic; log and skip rather than throw
6356
6355
  this.#driver.getLogger().error(new Error('setTitleBarColor: could not find compose title bar'));
@@ -6372,9 +6371,7 @@ class GmailComposeView {
6372
6371
  if (this.isInlineReplyForm()) {
6373
6372
  throw new Error('setTitleBarText() is not supported on inline compose views');
6374
6373
  }
6375
-
6376
- // Gmail A/B-renames the `Ht` token; fall back to a structural selector.
6377
- const titleBarTable = this.#element.querySelector('.nH.Hy.aXJ table.cf.Ht') || this.#element.querySelector('.nH.Hy.aXJ table.cf');
6374
+ const titleBarTable = this.#driver.selectors.querySelectorByKey(this.#element, 'composeView.titleBarTable');
6378
6375
  if (!titleBarTable) {
6379
6376
  // cosmetic; log and skip rather than throw
6380
6377
  this.#driver.getLogger().error(new Error('setTitleBarText: could not find compose title bar'));
@@ -10380,7 +10377,7 @@ options.insert = htmlElement => {
10380
10377
  htmlElement.setAttribute('data-inboxsdk-version',
10381
10378
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10382
10379
  ///@ts-ignore
10383
- "2.2.18-1784839996724-a8a6fe2c9e69b0e7");
10380
+ "2.2.20-1787183471518-8065a08149d763a3");
10384
10381
  document.head.append(htmlElement);
10385
10382
  };
10386
10383
  options.domAPI = (styleDomAPI_default());
@@ -10887,8 +10884,6 @@ class PersistentQueue {
10887
10884
  }
10888
10885
  // EXTERNAL MODULE: ./src/platform-implementation-js/lib/dom/make-mutation-observer-stream.ts
10889
10886
  var make_mutation_observer_stream = __webpack_require__(5938);
10890
- // EXTERNAL MODULE: ./node_modules/ext-corb-workaround/dist/src/index.js
10891
- var src = __webpack_require__(9482);
10892
10887
  // EXTERNAL MODULE: ./src/platform-implementation-js/lib/isStreakAppId.ts
10893
10888
  var isStreakAppId = __webpack_require__(8579);
10894
10889
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/lib/logger.ts
@@ -10901,7 +10896,6 @@ var isStreakAppId = __webpack_require__(8579);
10901
10896
 
10902
10897
 
10903
10898
 
10904
-
10905
10899
  // Yeah, this module is a singleton with some shared state. This is just for
10906
10900
  // logging convenience. Other modules should avoid doing this!
10907
10901
  const _extensionAppIds = [];
@@ -11276,9 +11270,7 @@ async function retrieveNewEventsAccessToken() {
11276
11270
  const {
11277
11271
  text
11278
11272
  } = await (0,ajax/* default */.A)({
11279
- url: 'https://api.inboxsdk.com/api/v2/events/oauth',
11280
- // Work around CORB for extensions that have permissions to inboxsdk.com
11281
- XMLHttpRequest: (0,src/* getXMLHttpRequest */.np)()
11273
+ url: 'https://api.inboxsdk.com/api/v2/events/oauth'
11282
11274
  });
11283
11275
  const accessToken = JSON.parse(text);
11284
11276
  if (isTimestampExpired(accessToken.expirationDate)) {
@@ -11524,7 +11516,7 @@ if (!globalThis.__InboxSDKImpLoader) {
11524
11516
  await onready;
11525
11517
  const {
11526
11518
  makePlatformImplementation
11527
- } = await Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 3948));
11519
+ } = await Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 7064));
11528
11520
  return makePlatformImplementation(appId, opts, {
11529
11521
  piMainStarted,
11530
11522
  piLoadStarted,
@@ -11673,7 +11665,7 @@ class Keyboard {
11673
11665
 
11674
11666
  /***/ }),
11675
11667
 
11676
- /***/ 3948:
11668
+ /***/ 7064:
11677
11669
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
11678
11670
 
11679
11671
  "use strict";
@@ -12892,11 +12884,11 @@ class GmailMessageView {
12892
12884
  throw new Error('tried to get message contents before message is loaded');
12893
12885
  }
12894
12886
  try {
12895
- return (0,querySelectorOrFail/* default */.A)(this.#element, 'div.ii.gt');
12887
+ return this.#driver.selectors.querySelectorByKeyOrFail(this.#element, 'messageView.body');
12896
12888
  } catch (err) {
12897
- // Keep old fallback selector until we're confident of the new one.
12889
+ // The registry does not report its own misses yet, so keep logging here.
12898
12890
  this.#driver.getLogger().error(err);
12899
- return (0,querySelectorOrFail/* default */.A)(this.#element, '.adP');
12891
+ throw err;
12900
12892
  }
12901
12893
  }
12902
12894
  isElementInQuotedArea(element) {
@@ -12905,7 +12897,7 @@ class GmailMessageView {
12905
12897
  getSender() {
12906
12898
  let sender = this.#sender;
12907
12899
  if (sender) return sender;
12908
- const senderSpan = (0,querySelectorOrFail/* default */.A)(this.#element, 'td.gF span[email]');
12900
+ const senderSpan = this.#driver.selectors.querySelectorByKeyOrFail(this.#element, 'messageView.senderSpan');
12909
12901
  const emailAddress = senderSpan.getAttribute('email');
12910
12902
  if (!emailAddress) throw new Error('Could not find email address');
12911
12903
  sender = this.#sender = {
@@ -12950,7 +12942,7 @@ class GmailMessageView {
12950
12942
  return recipients;
12951
12943
  }
12952
12944
  getDateString() {
12953
- return (0,querySelectorOrFail/* default */.A)(this.#element, '.ads .gK .g3').title;
12945
+ return this.#driver.selectors.querySelectorByKeyOrFail(this.#element, 'messageView.dateElement').title;
12954
12946
  }
12955
12947
  async getDate() {
12956
12948
  const threadID = this.#threadViewDriver.getInternalID();
@@ -12996,15 +12988,12 @@ class GmailMessageView {
12996
12988
  if (this.getViewState() !== 'EXPANDED') {
12997
12989
  return null;
12998
12990
  }
12999
- return this.#element.querySelector('tr.acZ div.T-I.J-J5-Ji.aap.L3[role=button][aria-haspopup]');
12991
+ return this.#driver.selectors.querySelectorByKey(this.#element, 'messageView.moreButton');
13000
12992
  }
13001
12993
  #getOpenMoreMenu() {
13002
- const selector_2022_11_23 = 'td > div.nH.a98.iY > div.nH .aHU .b7.J-M[aria-haspopup=true]';
13003
- const selector_2023_11_16 = 'div.nH.a98.iY > div.nH .aHU .b7.J-M[aria-haspopup=true]';
13004
- const maybeMoreMenu = document.body.querySelector(selector_2023_11_16) || document.body.querySelector(selector_2022_11_23);
13005
12994
  // This will find any message's open more menu! The caller needs to make
13006
12995
  // sure it belongs to this message!
13007
- return maybeMoreMenu || document.body.querySelector('td > div.nH.if > div.nH.aHU div.b7.J-M[aria-haspopup=true]');
12996
+ return this.#driver.selectors.querySelectorByKey(document.body, 'messageView.openMoreMenu');
13008
12997
  }
13009
12998
  #closeActiveEmailMenu() {
13010
12999
  const moreButton = this.#getMoreButton();
@@ -13075,7 +13064,7 @@ class GmailMessageView {
13075
13064
  if (!messageId) throw new Error('message id attribute with no value, wtf?');
13076
13065
  return messageId;
13077
13066
  }
13078
- const messageEl = this.#element.querySelector('div.ii.gt');
13067
+ const messageEl = this.#driver.selectors.querySelectorByKey(this.#element, 'messageView.legacyIdBody');
13079
13068
  if (!messageEl) {
13080
13069
  const err = new Error('Could not find message id element');
13081
13070
  this.#driver.getLogger().error(err, {
@@ -14454,7 +14443,7 @@ class GmailThreadView {
14454
14443
  hiddenNoticeElement.appendChild(appNoticeContainerElement);
14455
14444
  }
14456
14445
  getSubject() {
14457
- var subjectElement = this.#element.querySelector('.ha h2');
14446
+ const subjectElement = this.#driver.selectors.querySelectorByKey(this.#element, 'threadView.subject');
14458
14447
  if (!subjectElement) {
14459
14448
  return '';
14460
14449
  }
@@ -14478,7 +14467,7 @@ class GmailThreadView {
14478
14467
  // Follows a similar structure to getThreadIDAsync, but gives up if async work is needed
14479
14468
  getThreadID() {
14480
14469
  if (this.#threadID) return this.#threadID;
14481
- const idElement = this.#element.querySelector('[data-legacy-thread-id]');
14470
+ const idElement = this.#driver.selectors.querySelectorByKey(this.#element, 'threadView.idElement');
14482
14471
  if (!idElement) throw new Error('threadID element not found');
14483
14472
 
14484
14473
  // the string value can be 'undefined'
@@ -14514,7 +14503,7 @@ class GmailThreadView {
14514
14503
  }
14515
14504
  async getThreadIDAsync() {
14516
14505
  if (this.#threadID) return this.#threadID;
14517
- const idElement = this.#element.querySelector('[data-legacy-thread-id]');
14506
+ const idElement = this.#driver.selectors.querySelectorByKey(this.#element, 'threadView.idElement');
14518
14507
  if (!idElement) throw new Error('threadID element not found');
14519
14508
 
14520
14509
  // the string value can be 'undefined'
@@ -15142,7 +15131,7 @@ options.insert = htmlElement => {
15142
15131
  htmlElement.setAttribute('data-inboxsdk-version',
15143
15132
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
15144
15133
  ///@ts-ignore
15145
- "2.2.18-1784839996724-a8a6fe2c9e69b0e7");
15134
+ "2.2.20-1787183471518-8065a08149d763a3");
15146
15135
  document.head.append(htmlElement);
15147
15136
  };
15148
15137
  options.domAPI = (styleDomAPI_default());
@@ -19908,7 +19897,7 @@ mole_view_module_options.insert = htmlElement => {
19908
19897
  htmlElement.setAttribute('data-inboxsdk-version',
19909
19898
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19910
19899
  ///@ts-ignore
19911
- "2.2.18-1784839996724-a8a6fe2c9e69b0e7");
19900
+ "2.2.20-1787183471518-8065a08149d763a3");
19912
19901
  document.head.append(htmlElement);
19913
19902
  };
19914
19903
  mole_view_module_options.domAPI = (styleDomAPI_default());
@@ -20724,6 +20713,8 @@ class GmailRouteProcessor {
20724
20713
  category: this.NativeRouteIDs.LABEL,
20725
20714
  search: this.NativeRouteIDs.SEARCH,
20726
20715
  'advanced-search': this.NativeRouteIDs.SEARCH,
20716
+ // Generated by selecting 'Filter messages like these' on a thread
20717
+ 'create-filter': this.NativeRouteIDs.SEARCH,
20727
20718
  trash: this.NativeRouteIDs.TRASH,
20728
20719
  spam: this.NativeRouteIDs.SPAM,
20729
20720
  apps: this.NativeRouteIDs.SEARCH,
@@ -24240,6 +24231,209 @@ function parseListPeopleByKnownIdResponse(data) {
24240
24231
  }
24241
24232
  return response;
24242
24233
  }
24234
+ ;// CONCATENATED MODULE: ./src/platform-implementation-js/dom-driver/gmail/selectors.ts
24235
+ /**
24236
+ * Bundled Gmail selector registry.
24237
+ *
24238
+ * Each key maps to an ORDERED list of candidates, tried one at a time until one
24239
+ * matches. An extension can supply overrides to this registry, which are PREPENDED
24240
+ * to the bundled chain.
24241
+ *
24242
+ * Selectors must be ordered by preference (which selector must be tried first),
24243
+ * not in chronological order.
24244
+ *
24245
+ * Never join a chain into one comma-separated selector: `querySelector('a, b')` picks
24246
+ * the first match in document order, which ignores this ranking.
24247
+ */
24248
+ const GMAIL_SELECTORS = {
24249
+ /**
24250
+ * The compose title-bar table, resolved against the compose root.
24251
+ *
24252
+ * The `Ht`-less rung matches a superset of the `Ht` one, so it must stay BELOW it:
24253
+ * above, it would win always and the specific rung would never run.
24254
+ */
24255
+ 'composeView.titleBarTable': ['.nH.Hy.aXJ table.cf.Ht', '.nH.Hy.aXJ table.cf'],
24256
+ /**
24257
+ * The title-bar cell holding the compose window buttons — inside the table above,
24258
+ * but resolved against the same compose root.
24259
+ */
24260
+ 'composeView.titleBarTd': ['.nH.Hy.aXJ table.cf.Ht td.Hm', '.nH.Hy.aXJ table.cf td.Hm'],
24261
+ /**
24262
+ * Body of an open message.
24263
+ * Root: message element.
24264
+ */
24265
+ 'messageView.body': ['div.ii.gt', '.adP'],
24266
+ /**
24267
+ * Message body carrying the legacy `m<hex>` id class. Narrower than
24268
+ * `messageView.body` on purpose — the `.adP` rung does not carry that class.
24269
+ * Root: message element.
24270
+ */
24271
+ 'messageView.legacyIdBody': ['div.ii.gt'],
24272
+ /**
24273
+ * Element carrying the thread's id attributes.
24274
+ * Root: thread element.
24275
+ */
24276
+ 'threadView.idElement': ['[data-legacy-thread-id]'],
24277
+ /**
24278
+ * A message's open "more actions" menu. Gmail renders it outside
24279
+ * the message, so a match may belong to another message.
24280
+ * Root: `document.body`.
24281
+ */
24282
+ 'messageView.openMoreMenu': [
24283
+ // 2023-11-16 thread-view redesign
24284
+ 'div.nH.a98.iY > div.nH .aHU .b7.J-M[aria-haspopup=true]',
24285
+ // 2022-11-23, same shape under an extra `td >`
24286
+ 'td > div.nH.a98.iY > div.nH .aHU .b7.J-M[aria-haspopup=true]',
24287
+ // pre-2023 `.if` layout
24288
+ 'td > div.nH.if > div.nH.aHU div.b7.J-M[aria-haspopup=true]'],
24289
+ /**
24290
+ * The "more actions" button that opens `messageView.openMoreMenu`.
24291
+ * Only present while the message is expanded.
24292
+ * Root: message element.
24293
+ */
24294
+ 'messageView.moreButton': ['tr.acZ div.T-I.J-J5-Ji.aap.L3[role=button][aria-haspopup]'],
24295
+ /**
24296
+ * The sender's span in a message header; carries the `email` and `name`
24297
+ * attributes the contact is built from.
24298
+ * Root: message element.
24299
+ */
24300
+ 'messageView.senderSpan': ['td.gF span[email]'],
24301
+ /**
24302
+ * The message's date element; the full date is read from its `title`,
24303
+ * not its text.
24304
+ * Root: message element.
24305
+ */
24306
+ 'messageView.dateElement': ['.ads .gK .g3'],
24307
+ /**
24308
+ * The thread's subject heading. Read for its text, or walked child by child
24309
+ * when it contains emoji images.
24310
+ * Root: thread element.
24311
+ */
24312
+ 'threadView.subject': ['.ha h2']
24313
+ };
24314
+
24315
+ /** Resolved candidates for every key. The merge builds new lists. */
24316
+
24317
+ /** Shape of the `selectors` object in a remote config. */
24318
+ // EXTERNAL MODULE: ./node_modules/lodash/uniq.js
24319
+ var uniq = __webpack_require__(1285);
24320
+ var uniq_default = /*#__PURE__*/__webpack_require__.n(uniq);
24321
+ ;// CONCATENATED MODULE: ./src/platform-implementation-js/lib/dom/mergeSelectorOverrides.ts
24322
+
24323
+
24324
+ /**
24325
+ * Unmounted fragment, used to validate CSS selectors.
24326
+ */
24327
+ let validationRoot;
24328
+
24329
+ /**
24330
+ * Check whether the given selector is valid.
24331
+ */
24332
+ function isValidSelector(selector) {
24333
+ if (!validationRoot) {
24334
+ validationRoot = document.createDocumentFragment();
24335
+ }
24336
+ try {
24337
+ validationRoot.querySelector(selector);
24338
+ return true;
24339
+ } catch {
24340
+ return false;
24341
+ }
24342
+ }
24343
+
24344
+ /** Called for each dropped candidate: silent to the user, loud to the operator. */
24345
+
24346
+ /**
24347
+ * Merges two selector registry objects (defaults and overrides),
24348
+ * filtering out invalid selectors from the overrides. If found,
24349
+ * it prepends the valid overrides to the defaults.
24350
+ *
24351
+ * @example
24352
+ * ```ts
24353
+ * mergeSelectorOverrides(
24354
+ * { 'composeView.someKey': ['.foo'] },
24355
+ * { 'composeView.someKey': ['.bar', 'invalid selector'] }
24356
+ * );
24357
+ * // { 'composeView.someKey': ['.bar', '.foo'] }
24358
+ * ```
24359
+ */
24360
+ function mergeSelectorOverrides(defaults, overrides, onInvalid) {
24361
+ const merged = {};
24362
+ for (const key of Object.keys(defaults)) {
24363
+ const extra = (overrides[key] ?? []).filter(selector => {
24364
+ if (isValidSelector(selector)) {
24365
+ return true;
24366
+ }
24367
+ onInvalid?.(key, selector);
24368
+ return false;
24369
+ });
24370
+ merged[key] = uniq_default()([...extra, ...defaults[key]]);
24371
+ }
24372
+ return merged;
24373
+ }
24374
+ ;// CONCATENATED MODULE: ./src/platform-implementation-js/lib/dom/selectorRegistry.ts
24375
+
24376
+
24377
+
24378
+ /**
24379
+ * Install overrides into the bundled defaults, filtering out invalid
24380
+ * selectors. If there are any errors merging the overrides, we fallback
24381
+ * to the SDK bundled defaults.
24382
+ */
24383
+ function mergeOrFallBack(_ref) {
24384
+ let {
24385
+ overrides,
24386
+ onInvalidSelector
24387
+ } = _ref;
24388
+ if (!overrides) {
24389
+ return GMAIL_SELECTORS;
24390
+ }
24391
+ try {
24392
+ return mergeSelectorOverrides(GMAIL_SELECTORS, overrides, onInvalidSelector);
24393
+ } catch {
24394
+ return GMAIL_SELECTORS;
24395
+ }
24396
+ }
24397
+
24398
+ /**
24399
+ * Resolves named keys to elements, trying each of the key's candidates in
24400
+ * order. Owned by the GmailDriver, so each InboxSDK instance resolves against
24401
+ * its own candidates and a registry is never read before it is built.
24402
+ */
24403
+ class SelectorRegistry {
24404
+ #candidates;
24405
+ constructor() {
24406
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24407
+ this.#candidates = mergeOrFallBack(options);
24408
+ }
24409
+
24410
+ /**
24411
+ * Resolve a registry key against `el`, returning null on a miss. Use this
24412
+ * method if you want to degrade functionality when a selector is missing,
24413
+ * instead of throwing an error.
24414
+ */
24415
+ querySelectorByKey(el, key) {
24416
+ // Try each candidate in order, returning the first match (null otherwise).
24417
+ for (const candidateSelector of this.#candidates[key]) {
24418
+ const found = el.querySelector(candidateSelector);
24419
+ if (found) {
24420
+ return found;
24421
+ }
24422
+ }
24423
+ return null;
24424
+ }
24425
+
24426
+ /**
24427
+ * Resolve a registry key against `el`, but throws if no candidate matches.
24428
+ */
24429
+ querySelectorByKeyOrFail(el, key) {
24430
+ const found = this.querySelectorByKey(el, key);
24431
+ if (!found) {
24432
+ throw new querySelectorOrFail/* SelectorError */.a(`${key} (${this.#candidates[key].join(' || ')})`);
24433
+ }
24434
+ return found;
24435
+ }
24436
+ }
24243
24437
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/dom-driver/gmail/gmail-driver.ts
24244
24438
 
24245
24439
 
@@ -24299,6 +24493,7 @@ function parseListPeopleByKnownIdResponse(data) {
24299
24493
 
24300
24494
 
24301
24495
 
24496
+
24302
24497
 
24303
24498
 
24304
24499
  /**
@@ -24315,6 +24510,8 @@ class GmailDriver {
24315
24510
  #logger;
24316
24511
  #opts;
24317
24512
  #envData;
24513
+ /** Resolves selector keys against the bundled defaults plus any overrides. */
24514
+
24318
24515
  #customRouteIDs = new Set();
24319
24516
  #customListRouteIDs = new Map();
24320
24517
  #customListSearchStringsToRouteIds = new Map();
@@ -24350,6 +24547,10 @@ class GmailDriver {
24350
24547
  this.#logger = logger;
24351
24548
  this.#opts = opts;
24352
24549
  this.#envData = envData;
24550
+ this.selectors = new SelectorRegistry({
24551
+ overrides: opts.selectorOverrides,
24552
+ onInvalidSelector: opts.onInvalidSelector
24553
+ });
24353
24554
  this.#page = (0,makePageParserTree/* default */.A)(this, document);
24354
24555
  this.#stopper.onValue(() => this.#page.dump());
24355
24556
 
@@ -32309,7 +32510,7 @@ module.exports = function (element, useCapture) {
32309
32510
  return self;
32310
32511
  };
32311
32512
 
32312
- module.exports.prototype.bind = __webpack_require__(4830);
32513
+ module.exports.prototype.bind = __webpack_require__(2449);
32313
32514
  module.exports.prototype.bindMultiple = __webpack_require__(9829);
32314
32515
  module.exports.prototype.trigger = __webpack_require__(9240);
32315
32516
  module.exports.prototype.reset = __webpack_require__(8967);
@@ -32366,7 +32567,7 @@ module.exports = function (useCapture) {
32366
32567
 
32367
32568
  /***/ }),
32368
32569
 
32369
- /***/ 4830:
32570
+ /***/ 2449:
32370
32571
  /***/ ((module) => {
32371
32572
 
32372
32573
  "use strict";
@@ -39310,325 +39511,6 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
39310
39511
  }
39311
39512
 
39312
39513
 
39313
- /***/ }),
39314
-
39315
- /***/ 9482:
39316
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
39317
-
39318
- "use strict";
39319
- var __webpack_unused_export__;
39320
-
39321
-
39322
- var _interopRequireDefault = __webpack_require__(1654);
39323
-
39324
- __webpack_unused_export__ = ({
39325
- value: true
39326
- });
39327
- __webpack_unused_export__ = exports.np = void 0;
39328
-
39329
- var _classCallCheck2 = _interopRequireDefault(__webpack_require__(9131));
39330
-
39331
- var _createClass2 = _interopRequireDefault(__webpack_require__(8463));
39332
-
39333
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(5985));
39334
-
39335
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(6583));
39336
-
39337
- var _once = _interopRequireDefault(__webpack_require__(8921));
39338
-
39339
- var _moduleId = __webpack_require__(917);
39340
-
39341
- var _transferrables = _interopRequireDefault(__webpack_require__(5440));
39342
-
39343
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
39344
-
39345
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39346
-
39347
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39348
-
39349
- var getXMLHttpRequest = (0, _once["default"])(function () {
39350
- // Make sure we communicate to the injected script that's paired with
39351
- // this instance of this module. This is necessary in case there are
39352
- // multiple javascript bundles with this package executing at once in the
39353
- // same page.
39354
- var instancesById = {};
39355
- var channel = new MessageChannel();
39356
- var port = channel.port1;
39357
- port.addEventListener('message', function (event) {
39358
- var _event$data = event.data,
39359
- id = _event$data.id,
39360
- type = _event$data.type;
39361
- var xhr = instancesById[id];
39362
-
39363
- switch (type) {
39364
- case 'COMPLETE':
39365
- {
39366
- var _event$data2 = event.data,
39367
- headers = _event$data2.headers,
39368
- readyState = _event$data2.readyState,
39369
- status = _event$data2.status,
39370
- statusText = _event$data2.statusText,
39371
- response = _event$data2.response,
39372
- responseText = _event$data2.responseText,
39373
- responseURL = _event$data2.responseURL;
39374
- var headersObj = {};
39375
- headers.split('\r\n').forEach(function (line) {
39376
- var _line$split = line.split(':'),
39377
- _line$split2 = (0, _slicedToArray2["default"])(_line$split, 2),
39378
- name = _line$split2[0],
39379
- value = _line$split2[1];
39380
-
39381
- if (name && value) {
39382
- headersObj[name.toLowerCase().trim()] = value.trim();
39383
- }
39384
- });
39385
- xhr._headers = headers;
39386
- xhr._headersObj = headersObj;
39387
- xhr.status = status;
39388
- xhr.statusText = statusText;
39389
- xhr.readyState = readyState;
39390
- xhr.response = response;
39391
- xhr.responseText = responseText;
39392
- xhr.responseURL = responseURL;
39393
- delete instancesById[id];
39394
-
39395
- var _loop = function _loop() {
39396
- var event = _arr[_i];
39397
- var eventObj = {
39398
- name: event,
39399
- target: xhr
39400
- };
39401
- var handlers = Object.prototype.hasOwnProperty.call(xhr._eventListeners, event) ? xhr._eventListeners[event] : [];
39402
- handlers.forEach(function (handler) {
39403
- return handler(eventObj);
39404
- });
39405
-
39406
- if (xhr['on' + event]) {
39407
- xhr['on' + event](eventObj);
39408
- }
39409
- };
39410
-
39411
- for (var _i = 0, _arr = ['load', 'loadend', 'readystatechange']; _i < _arr.length; _i++) {
39412
- _loop();
39413
- }
39414
-
39415
- break;
39416
- }
39417
-
39418
- default:
39419
- {
39420
- // eslint-disable-next-line no-console
39421
- console.error('ext-corb-workaround: Unknown event in content script:', event);
39422
- }
39423
- }
39424
- });
39425
- port.addEventListener('messageerror', function (event) {
39426
- // eslint-disable-next-line no-console
39427
- console.error('ext-corb-workaround: Unknown error in content script:', event);
39428
- });
39429
- port.start();
39430
- window.postMessage({
39431
- type: 'ext-corb-workaround_port',
39432
- moduleId: _moduleId.moduleId,
39433
- port: channel.port2
39434
- }, document.location.origin, [channel.port2]);
39435
- var nextFreeId = 0;
39436
-
39437
- var CORBWorkaroundXMLHttpRequest = /*#__PURE__*/function () {
39438
- function CORBWorkaroundXMLHttpRequest() {
39439
- var _this = this;
39440
-
39441
- (0, _classCallCheck2["default"])(this, CORBWorkaroundXMLHttpRequest);
39442
- (0, _defineProperty2["default"])(this, "UNSENT", 0);
39443
- (0, _defineProperty2["default"])(this, "OPENED", 1);
39444
- (0, _defineProperty2["default"])(this, "HEADERS_RECEIVED", 2);
39445
- (0, _defineProperty2["default"])(this, "LOADING", 3);
39446
- (0, _defineProperty2["default"])(this, "DONE", 4);
39447
- (0, _defineProperty2["default"])(this, "_id", nextFreeId++);
39448
- (0, _defineProperty2["default"])(this, "_eventListeners", {});
39449
- (0, _defineProperty2["default"])(this, "_headersObj", {});
39450
- (0, _defineProperty2["default"])(this, "status", 0);
39451
- (0, _defineProperty2["default"])(this, "statusText", '');
39452
- (0, _defineProperty2["default"])(this, "readyState", 0);
39453
- (0, _defineProperty2["default"])(this, "response", '');
39454
- (0, _defineProperty2["default"])(this, "responseText", '');
39455
- (0, _defineProperty2["default"])(this, "responseURL", '');
39456
- (0, _defineProperty2["default"])(this, "_headers", '');
39457
- (0, _defineProperty2["default"])(this, "responseType", void 0);
39458
- (0, _defineProperty2["default"])(this, "withCredentials", void 0);
39459
- (0, _defineProperty2["default"])(this, "setRequestHeader", void 0);
39460
- (0, _defineProperty2["default"])(this, "open", void 0);
39461
- (0, _defineProperty2["default"])(this, "send", void 0);
39462
- (0, _defineProperty2["default"])(this, "abort", void 0);
39463
- var id = this._id;
39464
- instancesById[id] = this;
39465
- port.postMessage({
39466
- type: 'NEW_XHR',
39467
- id: id
39468
- });
39469
-
39470
- var _iterator = _createForOfIteratorHelper(['responseType', 'withCredentials']),
39471
- _step;
39472
-
39473
- try {
39474
- var _loop2 = function _loop2() {
39475
- var prop = _step.value;
39476
- var value = undefined;
39477
- Object.defineProperty(_this, prop, {
39478
- get: function get() {
39479
- return value;
39480
- },
39481
- set: function set(newValue) {
39482
- value = newValue;
39483
- port.postMessage({
39484
- type: 'SET',
39485
- id: id,
39486
- prop: prop,
39487
- value: newValue
39488
- });
39489
- }
39490
- });
39491
- };
39492
-
39493
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
39494
- _loop2();
39495
- }
39496
- } catch (err) {
39497
- _iterator.e(err);
39498
- } finally {
39499
- _iterator.f();
39500
- }
39501
-
39502
- var _iterator2 = _createForOfIteratorHelper(['setRequestHeader', 'open', 'send', 'abort']),
39503
- _step2;
39504
-
39505
- try {
39506
- var _loop3 = function _loop3() {
39507
- var method = _step2.value;
39508
-
39509
- _this[method] = function () {
39510
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39511
- args[_key] = arguments[_key];
39512
- }
39513
-
39514
- port.postMessage({
39515
- type: 'CALL',
39516
- id: id,
39517
- method: method,
39518
- args: args
39519
- }, (0, _transferrables["default"])(args));
39520
- };
39521
- };
39522
-
39523
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
39524
- _loop3();
39525
- }
39526
- } catch (err) {
39527
- _iterator2.e(err);
39528
- } finally {
39529
- _iterator2.f();
39530
- }
39531
- }
39532
-
39533
- (0, _createClass2["default"])(CORBWorkaroundXMLHttpRequest, [{
39534
- key: "getAllResponseHeaders",
39535
- value: function getAllResponseHeaders() {
39536
- return this._headers;
39537
- }
39538
- }, {
39539
- key: "getResponseHeader",
39540
- value: function getResponseHeader(header) {
39541
- header = header.toLowerCase();
39542
-
39543
- if (Object.prototype.hasOwnProperty.call(this._headersObj, header)) {
39544
- return this._headersObj[header];
39545
- }
39546
- }
39547
- }, {
39548
- key: "addEventListener",
39549
- value: function addEventListener(event, handler) {
39550
- if (!Object.prototype.hasOwnProperty.call(this._eventListeners, event)) {
39551
- this._eventListeners[event] = [];
39552
- }
39553
-
39554
- this._eventListeners[event].push(handler);
39555
- }
39556
- }, {
39557
- key: "removeEventListener",
39558
- value: function removeEventListener(event, handler) {
39559
- if (Object.prototype.hasOwnProperty.call(this._eventListeners, event)) {
39560
- this._eventListeners[event] = this._eventListeners[event].filter(function (_handler) {
39561
- return handler !== _handler;
39562
- });
39563
- }
39564
- }
39565
- }]);
39566
- return CORBWorkaroundXMLHttpRequest;
39567
- }();
39568
-
39569
- (0, _defineProperty2["default"])(CORBWorkaroundXMLHttpRequest, "UNSENT", 0);
39570
- (0, _defineProperty2["default"])(CORBWorkaroundXMLHttpRequest, "OPENED", 1);
39571
- (0, _defineProperty2["default"])(CORBWorkaroundXMLHttpRequest, "HEADERS_RECEIVED", 2);
39572
- (0, _defineProperty2["default"])(CORBWorkaroundXMLHttpRequest, "LOADING", 3);
39573
- (0, _defineProperty2["default"])(CORBWorkaroundXMLHttpRequest, "DONE", 4);
39574
- return CORBWorkaroundXMLHttpRequest;
39575
- }); // TODO add replacement fetch too?
39576
-
39577
- exports.np = getXMLHttpRequest;
39578
- var installGlobally = (0, _once["default"])(function () {
39579
- window.XMLHttpRequest = getXMLHttpRequest();
39580
- });
39581
- __webpack_unused_export__ = installGlobally;
39582
-
39583
-
39584
- /***/ }),
39585
-
39586
- /***/ 917:
39587
- /***/ ((__unused_webpack_module, exports) => {
39588
-
39589
- "use strict";
39590
-
39591
-
39592
- Object.defineProperty(exports, "__esModule", ({
39593
- value: true
39594
- }));
39595
- exports.moduleId = void 0;
39596
- var moduleId = '1f24 e53a';
39597
- exports.moduleId = moduleId;
39598
-
39599
-
39600
- /***/ }),
39601
-
39602
- /***/ 5440:
39603
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
39604
-
39605
- "use strict";
39606
-
39607
-
39608
- var _interopRequireDefault = __webpack_require__(1654);
39609
-
39610
- Object.defineProperty(exports, "__esModule", ({
39611
- value: true
39612
- }));
39613
- exports["default"] = transferrables;
39614
-
39615
- var _typeof2 = _interopRequireDefault(__webpack_require__(2990));
39616
-
39617
- function transferrables(list) {
39618
- return list.map(function (value) {
39619
- if (value && (0, _typeof2["default"])(value) === 'object' && value.__proto__) {
39620
- if (value.__proto__.constructor.name === 'ArrayBuffer') {
39621
- return value;
39622
- }
39623
-
39624
- if (value.__proto__.__proto__ && value.__proto__.__proto__.constructor.name === 'TypedArray') {
39625
- return value.buffer;
39626
- }
39627
- }
39628
- }).filter(Boolean);
39629
- }
39630
-
39631
-
39632
39514
  /***/ }),
39633
39515
 
39634
39516
  /***/ 5215: