lwc 2.29.0 → 2.30.0

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.
Files changed (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +319 -683
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +319 -683
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +201 -624
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1138 -2843
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +892 -2428
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +319 -683
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +201 -624
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1138 -2843
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +892 -2428
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +204 -584
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +204 -584
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +99 -323
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +99 -323
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +98 -316
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +483 -1220
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +470 -1187
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +99 -323
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +98 -316
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +483 -1220
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +470 -1187
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
  29. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service.js +13 -68
  31. package/dist/wire-service/iife/es5/wire-service_debug.js +13 -68
  32. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  33. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  34. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es5/wire-service.js +13 -68
  36. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -68
  37. package/package.json +7 -7
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
302
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
303
303
  */
304
304
  // Increment whenever the LWC template compiler changes
305
- const LWC_VERSION = "2.29.0";
305
+ const LWC_VERSION = "2.30.0";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.29.0 */
307
+ /** version: 2.30.0 */
308
308
 
309
309
  /**
310
310
  * Copyright (C) 2018 salesforce.com, inc.
@@ -386,7 +386,7 @@ var LWC = (function (exports) {
386
386
  patch$1(propName);
387
387
  }
388
388
  }
389
- /** version: 2.29.0 */
389
+ /** version: 2.30.0 */
390
390
 
391
391
  /**
392
392
  * Copyright (C) 2018 salesforce.com, inc.
@@ -466,7 +466,7 @@ var LWC = (function (exports) {
466
466
  setFeatureFlag(name, value);
467
467
  }
468
468
  }
469
- /** version: 2.29.0 */
469
+ /** version: 2.30.0 */
470
470
 
471
471
  /*
472
472
  * Copyright (c) 2018, salesforce.com, inc.
@@ -474,16 +474,14 @@ var LWC = (function (exports) {
474
474
  * SPDX-License-Identifier: MIT
475
475
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
476
476
  */
477
+ // Only used in LWC's Karma tests
477
478
  // @ts-ignore
478
-
479
479
  if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
480
480
  window.addEventListener('test-dummy-flag', () => {
481
481
  let hasFlag = false;
482
-
483
482
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
484
483
  hasFlag = true;
485
484
  }
486
-
487
485
  window.dispatchEvent(new CustomEvent('has-dummy-flag', {
488
486
  detail: {
489
487
  package: '@lwc/engine-dom',
@@ -501,16 +499,14 @@ var LWC = (function (exports) {
501
499
  * SPDX-License-Identifier: MIT
502
500
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
503
501
  */
502
+ // Only used in LWC's Karma tests
504
503
  // @ts-ignore
505
-
506
504
  if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
507
505
  window.addEventListener('test-dummy-flag', () => {
508
506
  let hasFlag = false;
509
-
510
507
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
511
508
  hasFlag = true;
512
509
  }
513
-
514
510
  window.dispatchEvent(new CustomEvent('has-dummy-flag', {
515
511
  detail: {
516
512
  package: '@lwc/engine-core',
@@ -1736,7 +1732,7 @@ var LWC = (function (exports) {
1736
1732
  // Gracefully degrade if not able to locate the global object
1737
1733
  return {};
1738
1734
  }
1739
- function init() {
1735
+ function init$1() {
1740
1736
  /* istanbul ignore if */
1741
1737
  if (process.env.NODE_ENV === 'production') {
1742
1738
  // this method should never leak to prod
@@ -1754,7 +1750,7 @@ var LWC = (function (exports) {
1754
1750
 
1755
1751
  /* istanbul ignore else */
1756
1752
  if (process.env.NODE_ENV !== 'production') {
1757
- init();
1753
+ init$1();
1758
1754
  }
1759
1755
  function defaultValueIsObservable(value) {
1760
1756
  // intentionally checking for null
@@ -2344,39 +2340,31 @@ var LWC = (function (exports) {
2344
2340
  if (process.env.NODE_ENV !== 'production') {
2345
2341
  assert.fail(`@api decorator can only be used as a decorator function.`);
2346
2342
  }
2347
-
2348
2343
  throw new Error();
2349
2344
  }
2350
2345
  function createPublicPropertyDescriptor(key) {
2351
2346
  return {
2352
2347
  get() {
2353
2348
  const vm = getAssociatedVM(this);
2354
-
2355
2349
  if (isBeingConstructed(vm)) {
2356
2350
  if (process.env.NODE_ENV !== 'production') {
2357
2351
  logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
2358
2352
  }
2359
-
2360
2353
  return;
2361
2354
  }
2362
-
2363
2355
  componentValueObserved(vm, key);
2364
2356
  return vm.cmpProps[key];
2365
2357
  },
2366
-
2367
2358
  set(newValue) {
2368
2359
  const vm = getAssociatedVM(this);
2369
-
2370
2360
  if (process.env.NODE_ENV !== 'production') {
2371
2361
  const vmBeingRendered = getVMBeingRendered();
2372
2362
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2373
2363
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2374
2364
  }
2375
-
2376
2365
  vm.cmpProps[key] = newValue;
2377
2366
  componentValueMutated(vm, key);
2378
2367
  },
2379
-
2380
2368
  enumerable: true,
2381
2369
  configurable: true
2382
2370
  };
@@ -2388,46 +2376,37 @@ var LWC = (function (exports) {
2388
2376
  enumerable,
2389
2377
  configurable
2390
2378
  } = descriptor;
2391
-
2392
2379
  if (!isFunction$1(get)) {
2393
2380
  if (process.env.NODE_ENV !== 'production') {
2394
2381
  assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2395
2382
  }
2396
-
2397
2383
  throw new Error();
2398
2384
  }
2399
-
2400
2385
  return {
2401
2386
  get() {
2402
2387
  if (process.env.NODE_ENV !== 'production') {
2403
2388
  // Assert that the this value is an actual Component with an associated VM.
2404
2389
  getAssociatedVM(this);
2405
2390
  }
2406
-
2407
2391
  return get.call(this);
2408
2392
  },
2409
-
2410
2393
  set(newValue) {
2411
2394
  const vm = getAssociatedVM(this);
2412
-
2413
2395
  if (process.env.NODE_ENV !== 'production') {
2414
2396
  const vmBeingRendered = getVMBeingRendered();
2415
2397
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2416
2398
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2417
2399
  }
2418
-
2419
2400
  if (set) {
2420
2401
  if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2421
2402
  let ro = vm.oar[key];
2422
-
2423
2403
  if (isUndefined$1(ro)) {
2424
2404
  ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
2425
- } // every time we invoke this setter from outside (through this wrapper setter)
2405
+ }
2406
+ // every time we invoke this setter from outside (through this wrapper setter)
2426
2407
  // we should reset the value and then debounce just in case there is a pending
2427
2408
  // invocation the next tick that is not longer relevant since the value is changing
2428
2409
  // from outside.
2429
-
2430
-
2431
2410
  ro.reset(newValue);
2432
2411
  ro.observe(() => {
2433
2412
  set.call(this, newValue);
@@ -2439,7 +2418,6 @@ var LWC = (function (exports) {
2439
2418
  assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
2440
2419
  }
2441
2420
  },
2442
-
2443
2421
  enumerable,
2444
2422
  configurable
2445
2423
  };
@@ -3404,11 +3382,9 @@ var LWC = (function (exports) {
3404
3382
  * SPDX-License-Identifier: MIT
3405
3383
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3406
3384
  */
3407
-
3408
3385
  function makeHostToken(token) {
3409
3386
  return `${token}-host`;
3410
3387
  }
3411
-
3412
3388
  function createInlineStyleVNode(content) {
3413
3389
  return api.h('style', {
3414
3390
  key: 'style',
@@ -3417,7 +3393,6 @@ var LWC = (function (exports) {
3417
3393
  }
3418
3394
  }, [api.t(content)]);
3419
3395
  }
3420
-
3421
3396
  function updateStylesheetToken(vm, template) {
3422
3397
  const {
3423
3398
  elm,
@@ -3434,112 +3409,81 @@ var LWC = (function (exports) {
3434
3409
  stylesheets: newStylesheets,
3435
3410
  stylesheetToken: newStylesheetToken
3436
3411
  } = template;
3437
- const isSyntheticShadow = renderMode === 1
3438
- /* RenderMode.Shadow */
3439
- && shadowMode === 1
3440
- /* ShadowMode.Synthetic */
3441
- ;
3412
+ const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3442
3413
  const {
3443
3414
  hasScopedStyles
3444
3415
  } = context;
3445
3416
  let newToken;
3446
3417
  let newHasTokenInClass;
3447
- let newHasTokenInAttribute; // Reset the styling token applied to the host element.
3448
-
3418
+ let newHasTokenInAttribute;
3419
+ // Reset the styling token applied to the host element.
3449
3420
  const {
3450
3421
  stylesheetToken: oldToken,
3451
3422
  hasTokenInClass: oldHasTokenInClass,
3452
3423
  hasTokenInAttribute: oldHasTokenInAttribute
3453
3424
  } = context;
3454
-
3455
3425
  if (!isUndefined$1(oldToken)) {
3456
3426
  if (oldHasTokenInClass) {
3457
3427
  getClassList(elm).remove(makeHostToken(oldToken));
3458
3428
  }
3459
-
3460
3429
  if (oldHasTokenInAttribute) {
3461
3430
  removeAttribute(elm, makeHostToken(oldToken));
3462
3431
  }
3463
- } // Apply the new template styling token to the host element, if the new template has any
3432
+ }
3433
+ // Apply the new template styling token to the host element, if the new template has any
3464
3434
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3465
-
3466
-
3467
3435
  if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3468
3436
  newToken = newStylesheetToken;
3469
- } // Set the new styling token on the host element
3470
-
3471
-
3437
+ }
3438
+ // Set the new styling token on the host element
3472
3439
  if (!isUndefined$1(newToken)) {
3473
3440
  if (hasScopedStyles) {
3474
3441
  getClassList(elm).add(makeHostToken(newToken));
3475
3442
  newHasTokenInClass = true;
3476
3443
  }
3477
-
3478
3444
  if (isSyntheticShadow) {
3479
3445
  setAttribute(elm, makeHostToken(newToken), '');
3480
3446
  newHasTokenInAttribute = true;
3481
3447
  }
3482
- } // Update the styling tokens present on the context object.
3483
-
3484
-
3448
+ }
3449
+ // Update the styling tokens present on the context object.
3485
3450
  context.stylesheetToken = newToken;
3486
3451
  context.hasTokenInClass = newHasTokenInClass;
3487
3452
  context.hasTokenInAttribute = newHasTokenInAttribute;
3488
3453
  }
3489
-
3490
3454
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3491
3455
  const content = [];
3492
3456
  let root;
3493
-
3494
3457
  for (let i = 0; i < stylesheets.length; i++) {
3495
3458
  let stylesheet = stylesheets[i];
3496
-
3497
3459
  if (isArray$1(stylesheet)) {
3498
3460
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3499
3461
  } else {
3500
3462
  if (process.env.NODE_ENV !== 'production') {
3501
3463
  // Check for compiler version mismatch in dev mode only
3502
- checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
3464
+ checkVersionMismatch(stylesheet, 'stylesheet');
3465
+ // in dev-mode, we support hot swapping of stylesheet, which means that
3503
3466
  // the component instance might be attempting to use an old version of
3504
3467
  // the stylesheet, while internally, we have a replacement for it.
3505
-
3506
3468
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3507
3469
  }
3508
-
3509
3470
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3510
-
3511
3471
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
3512
- if (!isScopedCss && vm.renderMode === 0
3513
- /* RenderMode.Light */
3514
- ) {
3472
+ if (!isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
3515
3473
  logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
3516
3474
  continue;
3517
3475
  }
3518
- } // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3519
-
3520
-
3521
- const scopeToken = isScopedCss || vm.shadowMode === 1
3522
- /* ShadowMode.Synthetic */
3523
- && vm.renderMode === 1
3524
- /* RenderMode.Shadow */
3525
- ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3476
+ }
3477
+ // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3478
+ const scopeToken = isScopedCss || vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */ ? stylesheetToken : undefined;
3479
+ // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3526
3480
  // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3527
-
3528
- const useActualHostSelector = vm.renderMode === 0
3529
- /* RenderMode.Light */
3530
- ? !isScopedCss : vm.shadowMode === 0
3531
- /* ShadowMode.Native */
3532
- ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3481
+ const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : vm.shadowMode === 0 /* ShadowMode.Native */;
3482
+ // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3533
3483
  // we use an attribute selector on the host to simulate :dir().
3534
-
3535
3484
  let useNativeDirPseudoclass;
3536
-
3537
- if (vm.renderMode === 1
3538
- /* RenderMode.Shadow */
3539
- ) {
3540
- useNativeDirPseudoclass = vm.shadowMode === 0
3541
- /* ShadowMode.Native */
3542
- ;
3485
+ if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3486
+ useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3543
3487
  } else {
3544
3488
  // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3545
3489
  // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
@@ -3547,48 +3491,36 @@ var LWC = (function (exports) {
3547
3491
  // Only calculate the root once as necessary
3548
3492
  root = getNearestShadowComponent(vm);
3549
3493
  }
3550
-
3551
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
3552
- /* ShadowMode.Native */
3553
- ;
3494
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3554
3495
  }
3555
3496
 
3556
3497
  ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3557
3498
  }
3558
3499
  }
3559
-
3560
3500
  return content;
3561
3501
  }
3562
-
3563
3502
  function getStylesheetsContent(vm, template) {
3564
3503
  const {
3565
3504
  stylesheets,
3566
3505
  stylesheetToken
3567
3506
  } = template;
3568
3507
  let content = [];
3569
-
3570
3508
  if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3571
3509
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3572
3510
  }
3573
-
3574
3511
  return content;
3575
- } // It might be worth caching this to avoid doing the lookup repeatedly, but
3512
+ }
3513
+ // It might be worth caching this to avoid doing the lookup repeatedly, but
3576
3514
  // perf testing has not shown it to be a huge improvement yet:
3577
3515
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3578
-
3579
3516
  function getNearestShadowComponent(vm) {
3580
3517
  let owner = vm;
3581
-
3582
3518
  while (!isNull(owner)) {
3583
- if (owner.renderMode === 1
3584
- /* RenderMode.Shadow */
3585
- ) {
3519
+ if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3586
3520
  return owner;
3587
3521
  }
3588
-
3589
3522
  owner = owner.owner;
3590
3523
  }
3591
-
3592
3524
  return owner;
3593
3525
  }
3594
3526
  /**
@@ -3596,8 +3528,6 @@ var LWC = (function (exports) {
3596
3528
  * this returns the unique token for that scoped stylesheet. Otherwise
3597
3529
  * it returns null.
3598
3530
  */
3599
-
3600
-
3601
3531
  function getScopeTokenClass(owner) {
3602
3532
  const {
3603
3533
  cmpTemplate,
@@ -3611,7 +3541,6 @@ var LWC = (function (exports) {
3611
3541
  *
3612
3542
  * A host style token is applied to the component if scoped styles are used.
3613
3543
  */
3614
-
3615
3544
  function getStylesheetTokenHost(vnode) {
3616
3545
  const {
3617
3546
  template
@@ -3621,21 +3550,15 @@ var LWC = (function (exports) {
3621
3550
  } = template;
3622
3551
  return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
3623
3552
  }
3624
-
3625
3553
  function getNearestNativeShadowComponent(vm) {
3626
3554
  const owner = getNearestShadowComponent(vm);
3627
-
3628
- if (!isNull(owner) && owner.shadowMode === 1
3629
- /* ShadowMode.Synthetic */
3630
- ) {
3555
+ if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
3631
3556
  // Synthetic-within-native is impossible. So if the nearest shadow component is
3632
3557
  // synthetic, we know we won't find a native component if we go any further.
3633
3558
  return null;
3634
3559
  }
3635
-
3636
3560
  return owner;
3637
3561
  }
3638
-
3639
3562
  function createStylesheet(vm, stylesheets) {
3640
3563
  const {
3641
3564
  renderMode,
@@ -3644,12 +3567,7 @@ var LWC = (function (exports) {
3644
3567
  insertStylesheet
3645
3568
  }
3646
3569
  } = vm;
3647
-
3648
- if (renderMode === 1
3649
- /* RenderMode.Shadow */
3650
- && shadowMode === 1
3651
- /* ShadowMode.Synthetic */
3652
- ) {
3570
+ if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3653
3571
  for (let i = 0; i < stylesheets.length; i++) {
3654
3572
  insertStylesheet(stylesheets[i]);
3655
3573
  }
@@ -3661,15 +3579,13 @@ var LWC = (function (exports) {
3661
3579
  return ArrayMap.call(stylesheets, createInlineStyleVNode);
3662
3580
  } else {
3663
3581
  // native shadow or light DOM, DOM renderer
3664
- const root = getNearestNativeShadowComponent(vm); // null root means a global style
3665
-
3582
+ const root = getNearestNativeShadowComponent(vm);
3583
+ // null root means a global style
3666
3584
  const target = isNull(root) ? undefined : root.shadowRoot;
3667
-
3668
3585
  for (let i = 0; i < stylesheets.length; i++) {
3669
3586
  insertStylesheet(stylesheets[i], target);
3670
3587
  }
3671
3588
  }
3672
-
3673
3589
  return null;
3674
3590
  }
3675
3591
 
@@ -3955,14 +3871,11 @@ var LWC = (function (exports) {
3955
3871
  updateStaticChildren(c1, c2, parent, renderer);
3956
3872
  }
3957
3873
  }
3958
-
3959
3874
  function patch(n1, n2, parent, renderer) {
3960
3875
  var _a, _b;
3961
-
3962
3876
  if (n1 === n2) {
3963
3877
  return;
3964
3878
  }
3965
-
3966
3879
  if (process.env.NODE_ENV !== 'production') {
3967
3880
  if (!isSameVnode(n1, n2)) {
3968
3881
  throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
@@ -3974,103 +3887,63 @@ var LWC = (function (exports) {
3974
3887
  }));
3975
3888
  }
3976
3889
  }
3977
-
3978
3890
  switch (n2.type) {
3979
- case 0
3980
- /* VNodeType.Text */
3981
- :
3891
+ case 0 /* VNodeType.Text */:
3982
3892
  // VText has no special capability, fallback to the owner's renderer
3983
3893
  patchText(n1, n2, renderer);
3984
3894
  break;
3985
-
3986
- case 1
3987
- /* VNodeType.Comment */
3988
- :
3895
+ case 1 /* VNodeType.Comment */:
3989
3896
  // VComment has no special capability, fallback to the owner's renderer
3990
3897
  patchComment(n1, n2, renderer);
3991
3898
  break;
3992
-
3993
- case 4
3994
- /* VNodeType.Static */
3995
- :
3899
+ case 4 /* VNodeType.Static */:
3996
3900
  n2.elm = n1.elm;
3997
3901
  break;
3998
-
3999
- case 5
4000
- /* VNodeType.Fragment */
4001
- :
3902
+ case 5 /* VNodeType.Fragment */:
4002
3903
  patchFragment(n1, n2, parent, renderer);
4003
3904
  break;
4004
-
4005
- case 2
4006
- /* VNodeType.Element */
4007
- :
3905
+ case 2 /* VNodeType.Element */:
4008
3906
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
4009
3907
  break;
4010
-
4011
- case 3
4012
- /* VNodeType.CustomElement */
4013
- :
3908
+ case 3 /* VNodeType.CustomElement */:
4014
3909
  patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4015
3910
  break;
4016
3911
  }
4017
3912
  }
4018
-
4019
3913
  function mount(node, parent, renderer, anchor) {
4020
3914
  var _a, _b;
4021
-
4022
3915
  switch (node.type) {
4023
- case 0
4024
- /* VNodeType.Text */
4025
- :
3916
+ case 0 /* VNodeType.Text */:
4026
3917
  // VText has no special capability, fallback to the owner's renderer
4027
3918
  mountText(node, parent, anchor, renderer);
4028
3919
  break;
4029
-
4030
- case 1
4031
- /* VNodeType.Comment */
4032
- :
3920
+ case 1 /* VNodeType.Comment */:
4033
3921
  // VComment has no special capability, fallback to the owner's renderer
4034
3922
  mountComment(node, parent, anchor, renderer);
4035
3923
  break;
4036
-
4037
- case 4
4038
- /* VNodeType.Static */
4039
- :
3924
+ case 4 /* VNodeType.Static */:
4040
3925
  // VStatic cannot have a custom renderer associated to them, using owner's renderer
4041
3926
  mountStatic(node, parent, anchor, renderer);
4042
3927
  break;
4043
-
4044
- case 5
4045
- /* VNodeType.Fragment */
4046
- :
3928
+ case 5 /* VNodeType.Fragment */:
4047
3929
  mountFragment(node, parent, anchor, renderer);
4048
3930
  break;
4049
-
4050
- case 2
4051
- /* VNodeType.Element */
4052
- :
3931
+ case 2 /* VNodeType.Element */:
4053
3932
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
4054
3933
  mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
4055
3934
  break;
4056
-
4057
- case 3
4058
- /* VNodeType.CustomElement */
4059
- :
3935
+ case 3 /* VNodeType.CustomElement */:
4060
3936
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
4061
3937
  mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
4062
3938
  break;
4063
3939
  }
4064
3940
  }
4065
-
4066
3941
  function patchText(n1, n2, renderer) {
4067
3942
  n2.elm = n1.elm;
4068
-
4069
3943
  if (n2.text !== n1.text) {
4070
3944
  updateTextContent(n2, renderer);
4071
3945
  }
4072
3946
  }
4073
-
4074
3947
  function mountText(vnode, parent, anchor, renderer) {
4075
3948
  const {
4076
3949
  owner
@@ -4082,16 +3955,14 @@ var LWC = (function (exports) {
4082
3955
  linkNodeToShadow(textNode, owner, renderer);
4083
3956
  insertNode(textNode, parent, anchor, renderer);
4084
3957
  }
4085
-
4086
3958
  function patchComment(n1, n2, renderer) {
4087
- n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3959
+ n2.elm = n1.elm;
3960
+ // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
4088
3961
  // it is the case today.
4089
-
4090
3962
  if (n2.text !== n1.text) {
4091
3963
  updateTextContent(n2, renderer);
4092
3964
  }
4093
3965
  }
4094
-
4095
3966
  function mountComment(vnode, parent, anchor, renderer) {
4096
3967
  const {
4097
3968
  owner
@@ -4103,32 +3974,27 @@ var LWC = (function (exports) {
4103
3974
  linkNodeToShadow(commentNode, owner, renderer);
4104
3975
  insertNode(commentNode, parent, anchor, renderer);
4105
3976
  }
4106
-
4107
3977
  function mountFragment(vnode, parent, anchor, renderer) {
4108
3978
  const {
4109
3979
  children
4110
3980
  } = vnode;
4111
- mountVNodes(children, parent, renderer, anchor); // children of a fragment will always have at least the two delimiters.
4112
-
3981
+ mountVNodes(children, parent, renderer, anchor);
3982
+ // children of a fragment will always have at least the two delimiters.
4113
3983
  vnode.elm = children[children.length - 1].elm;
4114
3984
  }
4115
-
4116
3985
  function patchFragment(n1, n2, parent, renderer) {
4117
3986
  const {
4118
3987
  children,
4119
3988
  stable
4120
3989
  } = n2;
4121
-
4122
3990
  if (stable) {
4123
3991
  updateStaticChildren(n1.children, children, parent, renderer);
4124
3992
  } else {
4125
3993
  updateDynamicChildren(n1.children, children, parent, renderer);
4126
- } // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
4127
-
4128
-
3994
+ }
3995
+ // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
4129
3996
  n2.elm = children[children.length - 1].elm;
4130
3997
  }
4131
-
4132
3998
  function mountElement(vnode, parent, anchor, renderer) {
4133
3999
  const {
4134
4000
  sel,
@@ -4150,13 +4016,11 @@ var LWC = (function (exports) {
4150
4016
  insertNode(elm, parent, anchor, renderer);
4151
4017
  mountVNodes(vnode.children, elm, renderer, null);
4152
4018
  }
4153
-
4154
4019
  function patchElement(n1, n2, renderer) {
4155
4020
  const elm = n2.elm = n1.elm;
4156
4021
  patchElementPropsAndAttrs$1(n1, n2, renderer);
4157
4022
  patchChildren(n1.children, n2.children, elm, renderer);
4158
4023
  }
4159
-
4160
4024
  function mountStatic(vnode, parent, anchor, renderer) {
4161
4025
  const {
4162
4026
  owner
@@ -4167,26 +4031,19 @@ var LWC = (function (exports) {
4167
4031
  } = renderer;
4168
4032
  const elm = vnode.elm = cloneNode(vnode.fragment, true);
4169
4033
  linkNodeToShadow(elm, owner, renderer);
4170
- applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4171
-
4034
+ applyElementRestrictions(elm, vnode);
4035
+ // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4172
4036
  const {
4173
4037
  renderMode,
4174
4038
  shadowMode
4175
4039
  } = owner;
4176
-
4177
4040
  if (isSyntheticShadowDefined) {
4178
- if (shadowMode === 1
4179
- /* ShadowMode.Synthetic */
4180
- || renderMode === 0
4181
- /* RenderMode.Light */
4182
- ) {
4041
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4183
4042
  elm[KEY__SHADOW_STATIC] = true;
4184
4043
  }
4185
4044
  }
4186
-
4187
4045
  insertNode(elm, parent, anchor, renderer);
4188
4046
  }
4189
-
4190
4047
  function mountCustomElement(vnode, parent, anchor, renderer) {
4191
4048
  const {
4192
4049
  sel,
@@ -4201,67 +4058,53 @@ var LWC = (function (exports) {
4201
4058
  * mechanism that only passes that argument if the constructor is known to be
4202
4059
  * an upgradable custom element.
4203
4060
  */
4204
-
4205
4061
  let vm;
4206
-
4207
4062
  const upgradeCallback = elm => {
4208
4063
  // the custom element from the registry is expecting an upgrade callback
4209
4064
  vm = createViewModelHook(elm, vnode, renderer);
4210
4065
  };
4211
-
4212
4066
  const connectedCallback = elm => {
4213
4067
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4214
4068
  connectRootElement(elm);
4215
4069
  }
4216
4070
  };
4217
-
4218
4071
  const disconnectedCallback = elm => {
4219
4072
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4220
4073
  disconnectRootElement(elm);
4221
4074
  }
4222
- }; // Should never get a tag with upper case letter at this point; the compiler
4075
+ };
4076
+ // Should never get a tag with upper case letter at this point; the compiler
4223
4077
  // should produce only tags with lowercase letters. However, the Java
4224
4078
  // compiler may generate tagnames with uppercase letters so - for backwards
4225
4079
  // compatibility, we lower case the tagname here.
4226
-
4227
-
4228
4080
  const normalizedTagname = sel.toLowerCase();
4229
4081
  const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
4230
4082
  vnode.elm = elm;
4231
4083
  vnode.vm = vm;
4232
4084
  linkNodeToShadow(elm, owner, renderer);
4233
4085
  applyStyleScoping(elm, owner, renderer);
4234
-
4235
4086
  if (vm) {
4236
4087
  allocateChildren(vnode, vm);
4237
4088
  }
4238
-
4239
4089
  patchElementPropsAndAttrs$1(null, vnode, renderer);
4240
4090
  insertNode(elm, parent, anchor, renderer);
4241
-
4242
4091
  if (vm) {
4243
4092
  {
4244
4093
  if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4245
4094
  if (process.env.NODE_ENV !== 'production') {
4246
4095
  // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4247
4096
  // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
4248
- assert.isTrue(vm.state === 0
4249
- /* VMState.created */
4250
- , `${vm} cannot be recycled.`);
4097
+ assert.isTrue(vm.state === 0 /* VMState.created */, `${vm} cannot be recycled.`);
4251
4098
  }
4252
-
4253
4099
  runConnectedCallback(vm);
4254
4100
  }
4255
4101
  }
4256
4102
  }
4257
-
4258
4103
  mountVNodes(vnode.children, elm, renderer, null);
4259
-
4260
4104
  if (vm) {
4261
4105
  appendVM(vm);
4262
4106
  }
4263
4107
  }
4264
-
4265
4108
  function patchCustomElement(n1, n2, parent, renderer) {
4266
4109
  if (n1.ctor !== n2.ctor) {
4267
4110
  // If the constructor, unmount the current component and mount a new one using the new
@@ -4274,17 +4117,14 @@ var LWC = (function (exports) {
4274
4117
  const elm = n2.elm = n1.elm;
4275
4118
  const vm = n2.vm = n1.vm;
4276
4119
  patchElementPropsAndAttrs$1(n1, n2, renderer);
4277
-
4278
4120
  if (!isUndefined$1(vm)) {
4279
4121
  // in fallback mode, the allocation will always set children to
4280
4122
  // empty and delegate the real allocation to the slot elements
4281
4123
  allocateChildren(n2, vm);
4282
- } // in fallback mode, the children will be always empty, so, nothing
4124
+ }
4125
+ // in fallback mode, the children will be always empty, so, nothing
4283
4126
  // will happen, but in native, it does allocate the light dom
4284
-
4285
-
4286
4127
  patchChildren(n1.children, n2.children, elm, renderer);
4287
-
4288
4128
  if (!isUndefined$1(vm)) {
4289
4129
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
4290
4130
  // this is important to preserve the top to bottom synchronous rendering phase.
@@ -4292,29 +4132,24 @@ var LWC = (function (exports) {
4292
4132
  }
4293
4133
  }
4294
4134
  }
4295
-
4296
4135
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
4297
4136
  for (; start < end; ++start) {
4298
4137
  const vnode = vnodes[start];
4299
-
4300
4138
  if (isVNode(vnode)) {
4301
4139
  mount(vnode, parent, renderer, anchor);
4302
4140
  }
4303
4141
  }
4304
4142
  }
4305
-
4306
4143
  function unmount(vnode, parent, renderer, doRemove = false) {
4307
4144
  const {
4308
4145
  type,
4309
4146
  elm,
4310
4147
  sel
4311
- } = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
4148
+ } = vnode;
4149
+ // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
4312
4150
  // subtree root, is the only element worth unmounting from the subtree.
4313
-
4314
4151
  if (doRemove) {
4315
- if (type === 5
4316
- /* VNodeType.Fragment */
4317
- ) {
4152
+ if (type === 5 /* VNodeType.Fragment */) {
4318
4153
  unmountVNodes(vnode.children, parent, renderer, doRemove);
4319
4154
  } else {
4320
4155
  // The vnode might or might not have a data.renderer associated to it
@@ -4322,51 +4157,39 @@ var LWC = (function (exports) {
4322
4157
  removeNode(elm, parent, renderer);
4323
4158
  }
4324
4159
  }
4325
-
4326
4160
  switch (type) {
4327
- case 2
4328
- /* VNodeType.Element */
4329
- :
4161
+ case 2 /* VNodeType.Element */:
4330
4162
  {
4331
4163
  // Slot content is removed to trigger slotchange event when removing slot.
4332
4164
  // Only required for synthetic shadow.
4333
- const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
4334
- /* ShadowMode.Synthetic */
4335
- ;
4165
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
4336
4166
  unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
4337
4167
  break;
4338
4168
  }
4339
-
4340
- case 3
4341
- /* VNodeType.CustomElement */
4342
- :
4169
+ case 3 /* VNodeType.CustomElement */:
4343
4170
  {
4344
4171
  const {
4345
4172
  vm
4346
- } = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
4173
+ } = vnode;
4174
+ // No need to unmount the children here, `removeVM` will take care of removing the
4347
4175
  // children.
4348
-
4349
4176
  if (!isUndefined$1(vm)) {
4350
4177
  removeVM(vm);
4351
4178
  }
4352
4179
  }
4353
4180
  }
4354
4181
  }
4355
-
4356
4182
  function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
4357
4183
  for (; start < end; ++start) {
4358
4184
  const ch = vnodes[start];
4359
-
4360
4185
  if (isVNode(ch)) {
4361
4186
  unmount(ch, parent, renderer, doRemove);
4362
4187
  }
4363
4188
  }
4364
4189
  }
4365
-
4366
4190
  function isVNode(vnode) {
4367
4191
  return vnode != null;
4368
4192
  }
4369
-
4370
4193
  function linkNodeToShadow(elm, owner, renderer) {
4371
4194
  const {
4372
4195
  renderRoot,
@@ -4375,19 +4198,14 @@ var LWC = (function (exports) {
4375
4198
  } = owner;
4376
4199
  const {
4377
4200
  isSyntheticShadowDefined
4378
- } = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
4379
-
4201
+ } = renderer;
4202
+ // TODO [#1164]: this should eventually be done by the polyfill directly
4380
4203
  if (isSyntheticShadowDefined) {
4381
- if (shadowMode === 1
4382
- /* ShadowMode.Synthetic */
4383
- || renderMode === 0
4384
- /* RenderMode.Light */
4385
- ) {
4204
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4386
4205
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
4387
4206
  }
4388
4207
  }
4389
4208
  }
4390
-
4391
4209
  function updateTextContent(vnode, renderer) {
4392
4210
  const {
4393
4211
  elm,
@@ -4396,120 +4214,87 @@ var LWC = (function (exports) {
4396
4214
  const {
4397
4215
  setText
4398
4216
  } = renderer;
4399
-
4400
4217
  if (process.env.NODE_ENV !== 'production') {
4401
4218
  unlockDomMutation();
4402
4219
  }
4403
-
4404
4220
  setText(elm, text);
4405
-
4406
4221
  if (process.env.NODE_ENV !== 'production') {
4407
4222
  lockDomMutation();
4408
4223
  }
4409
4224
  }
4410
-
4411
4225
  function insertNode(node, parent, anchor, renderer) {
4412
4226
  if (process.env.NODE_ENV !== 'production') {
4413
4227
  unlockDomMutation();
4414
4228
  }
4415
-
4416
4229
  renderer.insert(node, parent, anchor);
4417
-
4418
4230
  if (process.env.NODE_ENV !== 'production') {
4419
4231
  lockDomMutation();
4420
4232
  }
4421
4233
  }
4422
-
4423
4234
  function removeNode(node, parent, renderer) {
4424
4235
  if (process.env.NODE_ENV !== 'production') {
4425
4236
  unlockDomMutation();
4426
4237
  }
4427
-
4428
4238
  renderer.remove(node, parent);
4429
-
4430
4239
  if (process.env.NODE_ENV !== 'production') {
4431
4240
  lockDomMutation();
4432
4241
  }
4433
4242
  }
4434
-
4435
4243
  function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4436
4244
  if (isNull(oldVnode)) {
4437
4245
  applyEventListeners(vnode, renderer);
4438
4246
  applyStaticClassAttribute(vnode, renderer);
4439
4247
  applyStaticStyleAttribute(vnode, renderer);
4440
- } // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4248
+ }
4249
+ // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4441
4250
  // value is set before type=radio.
4442
-
4443
-
4444
4251
  patchClassAttribute(oldVnode, vnode, renderer);
4445
4252
  patchStyleAttribute(oldVnode, vnode, renderer);
4446
4253
  patchAttributes(oldVnode, vnode, renderer);
4447
4254
  patchProps(oldVnode, vnode, renderer);
4448
4255
  }
4449
-
4450
4256
  function applyStyleScoping(elm, owner, renderer) {
4451
4257
  // Set the class name for `*.scoped.css` style scoping.
4452
4258
  const scopeToken = getScopeTokenClass(owner);
4453
-
4454
4259
  if (!isNull(scopeToken)) {
4455
4260
  const {
4456
4261
  getClassList
4457
- } = renderer; // TODO [#2762]: this dot notation with add is probably problematic
4262
+ } = renderer;
4263
+ // TODO [#2762]: this dot notation with add is probably problematic
4458
4264
  // probably we should have a renderer api for just the add operation
4459
-
4460
4265
  getClassList(elm).add(scopeToken);
4461
- } // Set property element for synthetic shadow DOM style scoping.
4462
-
4463
-
4266
+ }
4267
+ // Set property element for synthetic shadow DOM style scoping.
4464
4268
  const {
4465
4269
  stylesheetToken: syntheticToken
4466
4270
  } = owner.context;
4467
-
4468
- if (owner.shadowMode === 1
4469
- /* ShadowMode.Synthetic */
4470
- && !isUndefined$1(syntheticToken)) {
4271
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4471
4272
  elm.$shadowToken$ = syntheticToken;
4472
4273
  }
4473
4274
  }
4474
-
4475
4275
  function applyDomManual(elm, vnode) {
4476
4276
  var _a;
4477
-
4478
4277
  const {
4479
4278
  owner,
4480
4279
  data: {
4481
4280
  context
4482
4281
  }
4483
4282
  } = vnode;
4484
-
4485
- if (owner.shadowMode === 1
4486
- /* ShadowMode.Synthetic */
4487
- && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
4488
- /* LwcDomMode.Manual */
4489
- ) {
4283
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
4490
4284
  elm.$domManual$ = true;
4491
4285
  }
4492
4286
  }
4493
-
4494
4287
  function applyElementRestrictions(elm, vnode) {
4495
4288
  var _a, _b;
4496
-
4497
4289
  if (process.env.NODE_ENV !== 'production') {
4498
- const isPortal = vnode.type === 2
4499
- /* VNodeType.Element */
4500
- && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
4501
- /* LwcDomMode.Manual */
4502
- ;
4503
- const isLight = vnode.owner.renderMode === 0
4504
- /* RenderMode.Light */
4505
- ;
4290
+ const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4291
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4506
4292
  patchElementWithRestrictions(elm, {
4507
4293
  isPortal,
4508
4294
  isLight
4509
4295
  });
4510
4296
  }
4511
4297
  }
4512
-
4513
4298
  function allocateChildren(vnode, vm) {
4514
4299
  // A component with slots will re-render because:
4515
4300
  // 1- There is a change of the internal state.
@@ -4527,41 +4312,31 @@ var LWC = (function (exports) {
4527
4312
  renderMode,
4528
4313
  shadowMode
4529
4314
  } = vm;
4530
-
4531
4315
  if (process.env.NODE_ENV !== 'production') {
4532
4316
  // If any of the children being allocated is a scoped slot fragment, make sure the receiving
4533
4317
  // component is a light DOM component. This is mainly to validate light dom parent running
4534
4318
  // in native shadow mode.
4535
- if (renderMode !== 0
4536
- /* RenderMode.Light */
4537
- && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4319
+ if (renderMode !== 0 /* RenderMode.Light */ && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4538
4320
  logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
4539
4321
  }
4540
4322
  }
4541
-
4542
- if (shadowMode === 1
4543
- /* ShadowMode.Synthetic */
4544
- || renderMode === 0
4545
- /* RenderMode.Light */
4546
- ) {
4323
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4547
4324
  // slow path
4548
- allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
4549
-
4550
- vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4551
-
4325
+ allocateInSlot(vm, children, vnode.owner);
4326
+ // save the allocated children in case this vnode is reused.
4327
+ vnode.aChildren = children;
4328
+ // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4552
4329
  vnode.children = EmptyArray;
4553
4330
  }
4554
4331
  }
4555
-
4556
4332
  function createViewModelHook(elm, vnode, renderer) {
4557
- let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
4333
+ let vm = getAssociatedVMIfPresent(elm);
4334
+ // There is a possibility that a custom element is registered under tagName, in which case, the
4558
4335
  // initialization is already carry on, and there is nothing else to do here since this hook is
4559
4336
  // called right after invoking `document.createElement`.
4560
-
4561
4337
  if (!isUndefined$1(vm)) {
4562
4338
  return vm;
4563
4339
  }
4564
-
4565
4340
  const {
4566
4341
  sel,
4567
4342
  mode,
@@ -4573,48 +4348,37 @@ var LWC = (function (exports) {
4573
4348
  owner,
4574
4349
  tagName: sel
4575
4350
  });
4576
-
4577
4351
  if (process.env.NODE_ENV !== 'production') {
4578
4352
  assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
4579
4353
  }
4580
-
4581
4354
  return vm;
4582
4355
  }
4583
4356
  /**
4584
4357
  * Collects all slots into a SlotSet, traversing through VFragment Nodes
4585
4358
  */
4586
-
4587
-
4588
4359
  function collectSlots(vm, children, cmpSlotsMapping) {
4589
4360
  var _a, _b;
4590
-
4591
4361
  for (let i = 0, len = children.length; i < len; i += 1) {
4592
4362
  const vnode = children[i];
4593
-
4594
4363
  if (isNull(vnode)) {
4595
4364
  continue;
4596
- } // Dive further iff the content is wrapped in a VFragment
4597
-
4598
-
4365
+ }
4366
+ // Dive further iff the content is wrapped in a VFragment
4599
4367
  if (isVFragment(vnode)) {
4600
4368
  // Remove the text delimiter nodes to avoid overriding default slot content
4601
4369
  collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4602
4370
  continue;
4603
4371
  }
4604
-
4605
4372
  let slotName = '';
4606
-
4607
4373
  if (isVBaseElement(vnode)) {
4608
4374
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
4609
4375
  } else if (isVScopedSlotFragment(vnode)) {
4610
4376
  slotName = vnode.slotName;
4611
4377
  }
4612
-
4613
4378
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4614
4379
  ArrayPush$1.call(vnodes, vnode);
4615
4380
  }
4616
4381
  }
4617
-
4618
4382
  function allocateInSlot(vm, children, owner) {
4619
4383
  const {
4620
4384
  cmpSlots: {
@@ -4627,28 +4391,22 @@ var LWC = (function (exports) {
4627
4391
  owner,
4628
4392
  slotAssignments: cmpSlotsMapping
4629
4393
  };
4630
-
4631
4394
  if (isFalse(vm.isDirty)) {
4632
4395
  // We need to determine if the old allocation is really different from the new one
4633
4396
  // and mark the vm as dirty
4634
4397
  const oldKeys = keys(oldSlotsMapping);
4635
-
4636
4398
  if (oldKeys.length !== keys(cmpSlotsMapping).length) {
4637
4399
  markComponentAsDirty(vm);
4638
4400
  return;
4639
4401
  }
4640
-
4641
4402
  for (let i = 0, len = oldKeys.length; i < len; i += 1) {
4642
4403
  const key = oldKeys[i];
4643
-
4644
4404
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4645
4405
  markComponentAsDirty(vm);
4646
4406
  return;
4647
4407
  }
4648
-
4649
4408
  const oldVNodes = oldSlotsMapping[key];
4650
4409
  const vnodes = cmpSlotsMapping[key];
4651
-
4652
4410
  for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4653
4411
  if (oldVNodes[j] !== vnodes[j]) {
4654
4412
  markComponentAsDirty(vm);
@@ -4657,40 +4415,33 @@ var LWC = (function (exports) {
4657
4415
  }
4658
4416
  }
4659
4417
  }
4660
- } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4661
-
4662
-
4663
- const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
4418
+ }
4419
+ // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4420
+ const FromIteration = new WeakMap();
4421
+ // dynamic children means it was generated by an iteration
4664
4422
  // in a template, and will require a more complex diffing algo.
4665
-
4666
4423
  function markAsDynamicChildren(children) {
4667
4424
  FromIteration.set(children, 1);
4668
4425
  }
4669
-
4670
4426
  function hasDynamicChildren(children) {
4671
4427
  return FromIteration.has(children);
4672
4428
  }
4673
-
4674
4429
  function createKeyToOldIdx(children, beginIdx, endIdx) {
4675
- const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
4676
-
4430
+ const map = {};
4431
+ // TODO [#1637]: simplify this by assuming that all vnodes has keys
4677
4432
  for (let j = beginIdx; j <= endIdx; ++j) {
4678
4433
  const ch = children[j];
4679
-
4680
4434
  if (isVNode(ch)) {
4681
4435
  const {
4682
4436
  key
4683
4437
  } = ch;
4684
-
4685
4438
  if (key !== undefined) {
4686
4439
  map[key] = j;
4687
4440
  }
4688
4441
  }
4689
4442
  }
4690
-
4691
4443
  return map;
4692
4444
  }
4693
-
4694
4445
  function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4695
4446
  let oldStartIdx = 0;
4696
4447
  let newStartIdx = 0;
@@ -4706,7 +4457,6 @@ var LWC = (function (exports) {
4706
4457
  let elmToMove;
4707
4458
  let before;
4708
4459
  let clonedOldCh = false;
4709
-
4710
4460
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
4711
4461
  if (!isVNode(oldStartVnode)) {
4712
4462
  oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
@@ -4740,54 +4490,46 @@ var LWC = (function (exports) {
4740
4490
  if (oldKeyToIdx === undefined) {
4741
4491
  oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
4742
4492
  }
4743
-
4744
4493
  idxInOld = oldKeyToIdx[newStartVnode.key];
4745
-
4746
4494
  if (isUndefined$1(idxInOld)) {
4747
4495
  // New element
4748
4496
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4749
4497
  newStartVnode = newCh[++newStartIdx];
4750
4498
  } else {
4751
4499
  elmToMove = oldCh[idxInOld];
4752
-
4753
4500
  if (isVNode(elmToMove)) {
4754
4501
  if (elmToMove.sel !== newStartVnode.sel) {
4755
4502
  // New element
4756
4503
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4757
4504
  } else {
4758
- patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
4505
+ patch(elmToMove, newStartVnode, parent, renderer);
4506
+ // Delete the old child, but copy the array since it is read-only.
4759
4507
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4760
4508
  // so we only care about the `oldCh` object inside this function.
4761
4509
  // To avoid cloning over and over again, we check `clonedOldCh`
4762
4510
  // and only clone once.
4763
-
4764
4511
  if (!clonedOldCh) {
4765
4512
  clonedOldCh = true;
4766
4513
  oldCh = [...oldCh];
4767
- } // We've already cloned at least once, so it's no longer read-only
4768
-
4769
-
4514
+ }
4515
+ // We've already cloned at least once, so it's no longer read-only
4770
4516
  oldCh[idxInOld] = undefined;
4771
4517
  insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4772
4518
  }
4773
4519
  }
4774
-
4775
4520
  newStartVnode = newCh[++newStartIdx];
4776
4521
  }
4777
4522
  }
4778
4523
  }
4779
-
4780
4524
  if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
4781
4525
  if (oldStartIdx > oldEndIdx) {
4782
4526
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4783
4527
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4784
4528
  let i = newEndIdx;
4785
4529
  let n;
4786
-
4787
4530
  do {
4788
4531
  n = newCh[++i];
4789
4532
  } while (!isVNode(n) && i < newChEnd);
4790
-
4791
4533
  before = isVNode(n) ? n.elm : null;
4792
4534
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4793
4535
  } else {
@@ -4795,32 +4537,26 @@ var LWC = (function (exports) {
4795
4537
  }
4796
4538
  }
4797
4539
  }
4798
-
4799
4540
  function updateStaticChildren(c1, c2, parent, renderer) {
4800
4541
  const c1Length = c1.length;
4801
4542
  const c2Length = c2.length;
4802
-
4803
4543
  if (c1Length === 0) {
4804
4544
  // the old list is empty, we can directly insert anything new
4805
4545
  mountVNodes(c2, parent, renderer, null);
4806
4546
  return;
4807
4547
  }
4808
-
4809
4548
  if (c2Length === 0) {
4810
4549
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4811
4550
  // this is the case in which the dynamic children of an if-directive should be removed
4812
4551
  unmountVNodes(c1, parent, renderer, true);
4813
4552
  return;
4814
- } // if the old list is not empty, the new list MUST have the same
4553
+ }
4554
+ // if the old list is not empty, the new list MUST have the same
4815
4555
  // amount of nodes, that's why we call this static children
4816
-
4817
-
4818
4556
  let anchor = null;
4819
-
4820
4557
  for (let i = c2Length - 1; i >= 0; i -= 1) {
4821
4558
  const n1 = c1[i];
4822
4559
  const n2 = c2[i];
4823
-
4824
4560
  if (n2 !== n1) {
4825
4561
  if (isVNode(n1)) {
4826
4562
  if (isVNode(n2)) {
@@ -5810,42 +5546,30 @@ var LWC = (function (exports) {
5810
5546
  */
5811
5547
  let idx = 0;
5812
5548
  /** The internal slot used to associate different objects the engine manipulates with the VM */
5813
-
5814
5549
  const ViewModelReflection = new WeakMap();
5815
-
5816
5550
  function callHook(cmp, fn, args = []) {
5817
5551
  return fn.apply(cmp, args);
5818
5552
  }
5819
-
5820
5553
  function setHook(cmp, prop, newValue) {
5821
5554
  cmp[prop] = newValue;
5822
5555
  }
5823
-
5824
5556
  function getHook(cmp, prop) {
5825
5557
  return cmp[prop];
5826
5558
  }
5827
-
5828
5559
  function rerenderVM(vm) {
5829
5560
  rehydrate(vm);
5830
5561
  }
5831
5562
  function connectRootElement(elm) {
5832
5563
  const vm = getAssociatedVM(elm);
5833
- logGlobalOperationStart(7
5834
- /* OperationId.GlobalHydrate */
5835
- , vm); // Usually means moving the element from one place to another, which is observable via
5564
+ logGlobalOperationStart(7 /* OperationId.GlobalHydrate */, vm);
5565
+ // Usually means moving the element from one place to another, which is observable via
5836
5566
  // life-cycle hooks.
5837
-
5838
- if (vm.state === 1
5839
- /* VMState.connected */
5840
- ) {
5567
+ if (vm.state === 1 /* VMState.connected */) {
5841
5568
  disconnectRootElement(elm);
5842
5569
  }
5843
-
5844
5570
  runConnectedCallback(vm);
5845
5571
  rehydrate(vm);
5846
- logGlobalOperationEnd(7
5847
- /* OperationId.GlobalHydrate */
5848
- , vm);
5572
+ logGlobalOperationEnd(7 /* OperationId.GlobalHydrate */, vm);
5849
5573
  }
5850
5574
  function disconnectRootElement(elm) {
5851
5575
  const vm = getAssociatedVM(elm);
@@ -5853,65 +5577,48 @@ var LWC = (function (exports) {
5853
5577
  }
5854
5578
  function appendVM(vm) {
5855
5579
  rehydrate(vm);
5856
- } // just in case the component comes back, with this we guarantee re-rendering it
5580
+ }
5581
+ // just in case the component comes back, with this we guarantee re-rendering it
5857
5582
  // while preventing any attempt to rehydration until after reinsertion.
5858
-
5859
5583
  function resetComponentStateWhenRemoved(vm) {
5860
5584
  const {
5861
5585
  state
5862
5586
  } = vm;
5863
-
5864
- if (state !== 2
5865
- /* VMState.disconnected */
5866
- ) {
5587
+ if (state !== 2 /* VMState.disconnected */) {
5867
5588
  const {
5868
5589
  oar,
5869
5590
  tro
5870
- } = vm; // Making sure that any observing record will not trigger the rehydrated on this vm
5871
-
5872
- tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5873
-
5591
+ } = vm;
5592
+ // Making sure that any observing record will not trigger the rehydrated on this vm
5593
+ tro.reset();
5594
+ // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5874
5595
  for (const key in oar) {
5875
5596
  oar[key].reset();
5876
5597
  }
5877
-
5878
- runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5879
-
5598
+ runDisconnectedCallback(vm);
5599
+ // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5880
5600
  runChildNodesDisconnectedCallback(vm);
5881
5601
  runLightChildNodesDisconnectedCallback(vm);
5882
5602
  }
5883
-
5884
5603
  if (process.env.NODE_ENV !== 'production') {
5885
5604
  removeActiveVM(vm);
5886
5605
  }
5887
- } // this method is triggered by the diffing algo only when a vnode from the
5606
+ }
5607
+ // this method is triggered by the diffing algo only when a vnode from the
5888
5608
  // old vnode.children is removed from the DOM.
5889
-
5890
-
5891
5609
  function removeVM(vm) {
5892
5610
  if (process.env.NODE_ENV !== 'production') {
5893
- assert.isTrue(vm.state === 1
5894
- /* VMState.connected */
5895
- || vm.state === 2
5896
- /* VMState.disconnected */
5897
- , `${vm} must have been connected.`);
5611
+ assert.isTrue(vm.state === 1 /* VMState.connected */ || vm.state === 2 /* VMState.disconnected */, `${vm} must have been connected.`);
5898
5612
  }
5899
-
5900
5613
  resetComponentStateWhenRemoved(vm);
5901
5614
  }
5902
-
5903
5615
  function getNearestShadowAncestor(vm) {
5904
5616
  let ancestor = vm.owner;
5905
-
5906
- while (!isNull(ancestor) && ancestor.renderMode === 0
5907
- /* RenderMode.Light */
5908
- ) {
5617
+ while (!isNull(ancestor) && ancestor.renderMode === 0 /* RenderMode.Light */) {
5909
5618
  ancestor = ancestor.owner;
5910
5619
  }
5911
-
5912
5620
  return ancestor;
5913
5621
  }
5914
-
5915
5622
  function createVM(elm, ctor, renderer, options) {
5916
5623
  const {
5917
5624
  mode,
@@ -5924,9 +5631,7 @@ var LWC = (function (exports) {
5924
5631
  elm,
5925
5632
  def,
5926
5633
  idx: idx++,
5927
- state: 0
5928
- /* VMState.created */
5929
- ,
5634
+ state: 0 /* VMState.created */,
5930
5635
  isScheduled: false,
5931
5636
  isDirty: true,
5932
5637
  tagName,
@@ -5968,31 +5673,27 @@ var LWC = (function (exports) {
5968
5673
  getHook,
5969
5674
  renderer
5970
5675
  };
5676
+ if (process.env.NODE_ENV !== 'production') {
5677
+ vm.debugInfo = create(null);
5678
+ }
5971
5679
  vm.shadowMode = computeShadowMode(vm, renderer);
5972
5680
  vm.tro = getTemplateReactiveObserver(vm);
5973
-
5974
5681
  if (process.env.NODE_ENV !== 'production') {
5975
5682
  vm.toString = () => {
5976
5683
  return `[object:vm ${def.name} (${vm.idx})]`;
5977
5684
  };
5978
-
5979
5685
  if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
5980
- vm.shadowMode = 0
5981
- /* ShadowMode.Native */
5982
- ;
5686
+ vm.shadowMode = 0 /* ShadowMode.Native */;
5983
5687
  }
5984
- } // Create component instance associated to the vm and the element.
5985
-
5986
-
5987
- invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
5988
-
5688
+ }
5689
+ // Create component instance associated to the vm and the element.
5690
+ invokeComponentConstructor(vm, def.ctor);
5691
+ // Initializing the wire decorator per instance only when really needed
5989
5692
  if (hasWireAdapters(vm)) {
5990
5693
  installWireAdapters(vm);
5991
5694
  }
5992
-
5993
5695
  return vm;
5994
5696
  }
5995
-
5996
5697
  function computeShadowMode(vm, renderer) {
5997
5698
  const {
5998
5699
  def
@@ -6002,136 +5703,98 @@ var LWC = (function (exports) {
6002
5703
  isNativeShadowDefined
6003
5704
  } = renderer;
6004
5705
  let shadowMode;
6005
-
6006
5706
  if (isSyntheticShadowDefined) {
6007
- if (def.renderMode === 0
6008
- /* RenderMode.Light */
6009
- ) {
5707
+ if (def.renderMode === 0 /* RenderMode.Light */) {
6010
5708
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
6011
5709
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
6012
- shadowMode = 0
6013
- /* ShadowMode.Native */
6014
- ;
5710
+ shadowMode = 0 /* ShadowMode.Native */;
6015
5711
  } else if (isNativeShadowDefined) {
6016
5712
  // Not combined with above condition because @lwc/features only supports identifiers in
6017
5713
  // the if-condition.
6018
5714
  if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6019
- if (def.shadowSupportMode === "any"
6020
- /* ShadowSupportMode.Any */
6021
- ) {
6022
- shadowMode = 0
6023
- /* ShadowMode.Native */
6024
- ;
5715
+ if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
5716
+ shadowMode = 0 /* ShadowMode.Native */;
6025
5717
  } else {
6026
5718
  const shadowAncestor = getNearestShadowAncestor(vm);
6027
-
6028
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
6029
- /* ShadowMode.Native */
6030
- ) {
5719
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6031
5720
  // Transitive support for native Shadow DOM. A component in native mode
6032
5721
  // transitively opts all of its descendants into native.
6033
- shadowMode = 0
6034
- /* ShadowMode.Native */
6035
- ;
5722
+ shadowMode = 0 /* ShadowMode.Native */;
6036
5723
  } else {
6037
5724
  // Synthetic if neither this component nor any of its ancestors are configured
6038
5725
  // to be native.
6039
- shadowMode = 1
6040
- /* ShadowMode.Synthetic */
6041
- ;
5726
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6042
5727
  }
6043
5728
  }
6044
5729
  } else {
6045
- shadowMode = 1
6046
- /* ShadowMode.Synthetic */
6047
- ;
5730
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6048
5731
  }
6049
5732
  } else {
6050
5733
  // Synthetic if there is no native Shadow DOM support.
6051
- shadowMode = 1
6052
- /* ShadowMode.Synthetic */
6053
- ;
5734
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6054
5735
  }
6055
5736
  } else {
6056
5737
  // Native if the synthetic shadow polyfill is unavailable.
6057
- shadowMode = 0
6058
- /* ShadowMode.Native */
6059
- ;
5738
+ shadowMode = 0 /* ShadowMode.Native */;
6060
5739
  }
6061
5740
 
6062
5741
  return shadowMode;
6063
5742
  }
6064
-
6065
5743
  function assertIsVM(obj) {
6066
5744
  if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
6067
5745
  throw new TypeError(`${obj} is not a VM.`);
6068
5746
  }
6069
5747
  }
6070
-
6071
5748
  function associateVM(obj, vm) {
6072
5749
  ViewModelReflection.set(obj, vm);
6073
5750
  }
6074
5751
  function getAssociatedVM(obj) {
6075
5752
  const vm = ViewModelReflection.get(obj);
6076
-
6077
5753
  if (process.env.NODE_ENV !== 'production') {
6078
5754
  assertIsVM(vm);
6079
5755
  }
6080
-
6081
5756
  return vm;
6082
5757
  }
6083
5758
  function getAssociatedVMIfPresent(obj) {
6084
5759
  const maybeVm = ViewModelReflection.get(obj);
6085
-
6086
5760
  if (process.env.NODE_ENV !== 'production') {
6087
5761
  if (!isUndefined$1(maybeVm)) {
6088
5762
  assertIsVM(maybeVm);
6089
5763
  }
6090
5764
  }
6091
-
6092
5765
  return maybeVm;
6093
5766
  }
6094
-
6095
5767
  function rehydrate(vm) {
6096
5768
  if (isTrue(vm.isDirty)) {
6097
5769
  const children = renderComponent(vm);
6098
5770
  patchShadowRoot(vm, children);
6099
5771
  }
6100
5772
  }
6101
-
6102
5773
  function patchShadowRoot(vm, newCh) {
6103
5774
  const {
6104
5775
  renderRoot,
6105
5776
  children: oldCh,
6106
5777
  renderer
6107
- } = vm; // caching the new children collection
6108
-
5778
+ } = vm;
5779
+ // caching the new children collection
6109
5780
  vm.children = newCh;
6110
-
6111
5781
  if (newCh.length > 0 || oldCh.length > 0) {
6112
5782
  // patch function mutates vnodes by adding the element reference,
6113
5783
  // however, if patching fails it contains partial changes.
6114
5784
  if (oldCh !== newCh) {
6115
5785
  runWithBoundaryProtection(vm, vm, () => {
6116
5786
  // pre
6117
- logOperationStart(2
6118
- /* OperationId.Patch */
6119
- , vm);
5787
+ logOperationStart(2 /* OperationId.Patch */, vm);
6120
5788
  }, () => {
6121
5789
  // job
6122
5790
  patchChildren(oldCh, newCh, renderRoot, renderer);
6123
5791
  }, () => {
6124
5792
  // post
6125
- logOperationEnd(2
6126
- /* OperationId.Patch */
6127
- , vm);
5793
+ logOperationEnd(2 /* OperationId.Patch */, vm);
6128
5794
  });
6129
5795
  }
6130
5796
  }
6131
-
6132
- if (vm.state === 1
6133
- /* VMState.connected */
6134
- ) {
5797
+ if (vm.state === 1 /* VMState.connected */) {
6135
5798
  // If the element is connected, that means connectedCallback was already issued, and
6136
5799
  // any successive rendering should finish with the call to renderedCallback, otherwise
6137
5800
  // the connectedCallback will take care of calling it in the right order at the end of
@@ -6139,49 +5802,34 @@ var LWC = (function (exports) {
6139
5802
  runRenderedCallback(vm);
6140
5803
  }
6141
5804
  }
6142
-
6143
5805
  function runRenderedCallback(vm) {
6144
5806
  const {
6145
5807
  def: {
6146
5808
  renderedCallback
6147
5809
  }
6148
5810
  } = vm;
6149
-
6150
5811
  const {
6151
5812
  rendered
6152
5813
  } = Services;
6153
-
6154
5814
  if (rendered) {
6155
5815
  invokeServiceHook(vm, rendered);
6156
5816
  }
6157
-
6158
5817
  if (!isUndefined$1(renderedCallback)) {
6159
- logOperationStart(4
6160
- /* OperationId.RenderedCallback */
6161
- , vm);
5818
+ logOperationStart(4 /* OperationId.RenderedCallback */, vm);
6162
5819
  invokeComponentCallback(vm, renderedCallback);
6163
- logOperationEnd(4
6164
- /* OperationId.RenderedCallback */
6165
- , vm);
5820
+ logOperationEnd(4 /* OperationId.RenderedCallback */, vm);
6166
5821
  }
6167
5822
  }
6168
5823
  let rehydrateQueue = [];
6169
-
6170
5824
  function flushRehydrationQueue() {
6171
- logGlobalOperationStart(8
6172
- /* OperationId.GlobalRehydrate */
6173
- );
6174
-
5825
+ logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
6175
5826
  if (process.env.NODE_ENV !== 'production') {
6176
5827
  assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
6177
5828
  }
6178
-
6179
5829
  const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);
6180
5830
  rehydrateQueue = []; // reset to a new queue
6181
-
6182
5831
  for (let i = 0, len = vms.length; i < len; i += 1) {
6183
5832
  const vm = vms[i];
6184
-
6185
5833
  try {
6186
5834
  rehydrate(vm);
6187
5835
  } catch (error) {
@@ -6190,78 +5838,54 @@ var LWC = (function (exports) {
6190
5838
  if (rehydrateQueue.length === 0) {
6191
5839
  addCallbackToNextTick(flushRehydrationQueue);
6192
5840
  }
6193
-
6194
5841
  ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
6195
- } // we need to end the measure before throwing.
6196
-
6197
-
6198
- logGlobalOperationEnd(8
6199
- /* OperationId.GlobalRehydrate */
6200
- ); // re-throwing the original error will break the current tick, but since the next tick is
5842
+ }
5843
+ // we need to end the measure before throwing.
5844
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
5845
+ // re-throwing the original error will break the current tick, but since the next tick is
6201
5846
  // already scheduled, it should continue patching the rest.
6202
-
6203
5847
  throw error; // eslint-disable-line no-unsafe-finally
6204
5848
  }
6205
5849
  }
6206
5850
 
6207
- logGlobalOperationEnd(8
6208
- /* OperationId.GlobalRehydrate */
6209
- );
5851
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
6210
5852
  }
6211
5853
 
6212
5854
  function runConnectedCallback(vm) {
6213
5855
  const {
6214
5856
  state
6215
5857
  } = vm;
6216
-
6217
- if (state === 1
6218
- /* VMState.connected */
6219
- ) {
5858
+ if (state === 1 /* VMState.connected */) {
6220
5859
  return; // nothing to do since it was already connected
6221
5860
  }
6222
5861
 
6223
- vm.state = 1
6224
- /* VMState.connected */
6225
- ; // reporting connection
6226
-
5862
+ vm.state = 1 /* VMState.connected */;
5863
+ // reporting connection
6227
5864
  const {
6228
5865
  connected
6229
5866
  } = Services;
6230
-
6231
5867
  if (connected) {
6232
5868
  invokeServiceHook(vm, connected);
6233
5869
  }
6234
-
6235
5870
  if (hasWireAdapters(vm)) {
6236
5871
  connectWireAdapters(vm);
6237
5872
  }
6238
-
6239
5873
  const {
6240
5874
  connectedCallback
6241
5875
  } = vm.def;
6242
-
6243
5876
  if (!isUndefined$1(connectedCallback)) {
6244
- logOperationStart(3
6245
- /* OperationId.ConnectedCallback */
6246
- , vm);
5877
+ logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
6247
5878
  invokeComponentCallback(vm, connectedCallback);
6248
- logOperationEnd(3
6249
- /* OperationId.ConnectedCallback */
6250
- , vm);
5879
+ logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
6251
5880
  }
6252
5881
  }
6253
-
6254
5882
  function hasWireAdapters(vm) {
6255
5883
  return getOwnPropertyNames$1(vm.def.wire).length > 0;
6256
5884
  }
6257
-
6258
5885
  function runDisconnectedCallback(vm) {
6259
5886
  if (process.env.NODE_ENV !== 'production') {
6260
- assert.isTrue(vm.state !== 2
6261
- /* VMState.disconnected */
6262
- , `${vm} must be inserted.`);
5887
+ assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
6263
5888
  }
6264
-
6265
5889
  if (isFalse(vm.isDirty)) {
6266
5890
  // this guarantees that if the component is reused/reinserted,
6267
5891
  // it will be re-rendered because we are disconnecting the reactivity
@@ -6269,67 +5893,54 @@ var LWC = (function (exports) {
6269
5893
  // of disconnected components.
6270
5894
  vm.isDirty = true;
6271
5895
  }
6272
-
6273
- vm.state = 2
6274
- /* VMState.disconnected */
6275
- ; // reporting disconnection
6276
-
5896
+ vm.state = 2 /* VMState.disconnected */;
5897
+ // reporting disconnection
6277
5898
  const {
6278
5899
  disconnected
6279
5900
  } = Services;
6280
-
6281
5901
  if (disconnected) {
6282
5902
  invokeServiceHook(vm, disconnected);
6283
5903
  }
6284
-
6285
5904
  if (hasWireAdapters(vm)) {
6286
5905
  disconnectWireAdapters(vm);
6287
5906
  }
6288
-
6289
5907
  const {
6290
5908
  disconnectedCallback
6291
5909
  } = vm.def;
6292
-
6293
5910
  if (!isUndefined$1(disconnectedCallback)) {
6294
- logOperationStart(5
6295
- /* OperationId.DisconnectedCallback */
6296
- , vm);
5911
+ logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
6297
5912
  invokeComponentCallback(vm, disconnectedCallback);
6298
- logOperationEnd(5
6299
- /* OperationId.DisconnectedCallback */
6300
- , vm);
5913
+ logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
6301
5914
  }
6302
5915
  }
6303
-
6304
5916
  function runChildNodesDisconnectedCallback(vm) {
6305
5917
  const {
6306
5918
  velements: vCustomElementCollection
6307
- } = vm; // Reporting disconnection for every child in inverse order since they are
5919
+ } = vm;
5920
+ // Reporting disconnection for every child in inverse order since they are
6308
5921
  // inserted in reserved order.
6309
-
6310
5922
  for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
6311
5923
  const {
6312
5924
  elm
6313
- } = vCustomElementCollection[i]; // There are two cases where the element could be undefined:
5925
+ } = vCustomElementCollection[i];
5926
+ // There are two cases where the element could be undefined:
6314
5927
  // * when there is an error during the construction phase, and an error
6315
5928
  // boundary picks it, there is a possibility that the VCustomElement
6316
5929
  // is not properly initialized, and therefore is should be ignored.
6317
5930
  // * when slotted custom element is not used by the element where it is
6318
5931
  // slotted into it, as a result, the custom element was never
6319
5932
  // initialized.
6320
-
6321
5933
  if (!isUndefined$1(elm)) {
6322
- const childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
5934
+ const childVM = getAssociatedVMIfPresent(elm);
5935
+ // The VM associated with the element might be associated undefined
6323
5936
  // in the case where the VM failed in the middle of its creation,
6324
5937
  // eg: constructor throwing before invoking super().
6325
-
6326
5938
  if (!isUndefined$1(childVM)) {
6327
5939
  resetComponentStateWhenRemoved(childVM);
6328
5940
  }
6329
5941
  }
6330
5942
  }
6331
5943
  }
6332
-
6333
5944
  function runLightChildNodesDisconnectedCallback(vm) {
6334
5945
  const {
6335
5946
  aChildren: adoptedChildren
@@ -6343,23 +5954,15 @@ var LWC = (function (exports) {
6343
5954
  * custom element itself will trigger the removal of anything slotted or anything
6344
5955
  * defined on its shadow.
6345
5956
  */
6346
-
6347
-
6348
5957
  function recursivelyDisconnectChildren(vnodes) {
6349
5958
  for (let i = 0, len = vnodes.length; i < len; i += 1) {
6350
5959
  const vnode = vnodes[i];
6351
-
6352
5960
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6353
5961
  switch (vnode.type) {
6354
- case 2
6355
- /* VNodeType.Element */
6356
- :
5962
+ case 2 /* VNodeType.Element */:
6357
5963
  recursivelyDisconnectChildren(vnode.children);
6358
5964
  break;
6359
-
6360
- case 3
6361
- /* VNodeType.CustomElement */
6362
- :
5965
+ case 3 /* VNodeType.CustomElement */:
6363
5966
  {
6364
5967
  const vm = getAssociatedVM(vnode.elm);
6365
5968
  resetComponentStateWhenRemoved(vm);
@@ -6368,12 +5971,11 @@ var LWC = (function (exports) {
6368
5971
  }
6369
5972
  }
6370
5973
  }
6371
- } // This is a super optimized mechanism to remove the content of the root node (shadow root
5974
+ }
5975
+ // This is a super optimized mechanism to remove the content of the root node (shadow root
6372
5976
  // for shadow DOM components and the root element itself for light DOM) without having to go
6373
5977
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
6374
5978
  // children VNodes might not be representing the current state of the DOM.
6375
-
6376
-
6377
5979
  function resetComponentRoot(vm) {
6378
5980
  const {
6379
5981
  children,
@@ -6382,15 +5984,12 @@ var LWC = (function (exports) {
6382
5984
  remove
6383
5985
  }
6384
5986
  } = vm;
6385
-
6386
5987
  for (let i = 0, len = children.length; i < len; i++) {
6387
5988
  const child = children[i];
6388
-
6389
5989
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6390
5990
  remove(child.elm, renderRoot);
6391
5991
  }
6392
5992
  }
6393
-
6394
5993
  vm.children = EmptyArray;
6395
5994
  runChildNodesDisconnectedCallback(vm);
6396
5995
  vm.velements = EmptyArray;
@@ -6399,58 +5998,43 @@ var LWC = (function (exports) {
6399
5998
  if (isTrue(vm.isScheduled)) {
6400
5999
  return;
6401
6000
  }
6402
-
6403
6001
  vm.isScheduled = true;
6404
-
6405
6002
  if (rehydrateQueue.length === 0) {
6406
6003
  addCallbackToNextTick(flushRehydrationQueue);
6407
6004
  }
6408
-
6409
6005
  ArrayPush$1.call(rehydrateQueue, vm);
6410
6006
  }
6411
-
6412
6007
  function getErrorBoundaryVM(vm) {
6413
6008
  let currentVm = vm;
6414
-
6415
6009
  while (!isNull(currentVm)) {
6416
6010
  if (!isUndefined$1(currentVm.def.errorCallback)) {
6417
6011
  return currentVm;
6418
6012
  }
6419
-
6420
6013
  currentVm = currentVm.owner;
6421
6014
  }
6422
6015
  }
6423
-
6424
6016
  function runWithBoundaryProtection(vm, owner, pre, job, post) {
6425
6017
  let error;
6426
6018
  pre();
6427
-
6428
6019
  try {
6429
6020
  job();
6430
6021
  } catch (e) {
6431
6022
  error = Object(e);
6432
6023
  } finally {
6433
6024
  post();
6434
-
6435
6025
  if (!isUndefined$1(error)) {
6436
6026
  addErrorComponentStack(vm, error);
6437
6027
  const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
6438
-
6439
6028
  if (isUndefined$1(errorBoundaryVm)) {
6440
6029
  throw error; // eslint-disable-line no-unsafe-finally
6441
6030
  }
6442
6031
 
6443
6032
  resetComponentRoot(vm); // remove offenders
6444
-
6445
- logOperationStart(6
6446
- /* OperationId.ErrorCallback */
6447
- , vm); // error boundaries must have an ErrorCallback
6448
-
6033
+ logOperationStart(6 /* OperationId.ErrorCallback */, vm);
6034
+ // error boundaries must have an ErrorCallback
6449
6035
  const errorCallback = errorBoundaryVm.def.errorCallback;
6450
6036
  invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
6451
- logOperationEnd(6
6452
- /* OperationId.ErrorCallback */
6453
- , vm);
6037
+ logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
6454
6038
  }
6455
6039
  }
6456
6040
  }
@@ -6464,7 +6048,6 @@ var LWC = (function (exports) {
6464
6048
  // content of the shadowRoot, this way we can guarantee that all children
6465
6049
  // elements will be throw away, and new instances will be created.
6466
6050
  vm.cmpTemplate = () => [];
6467
-
6468
6051
  if (isFalse(vm.isDirty)) {
6469
6052
  // forcing the vm to rehydrate in the next tick
6470
6053
  markComponentAsDirty(vm);
@@ -6480,6 +6063,7 @@ var LWC = (function (exports) {
6480
6063
  */
6481
6064
  const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
6482
6065
  const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
6066
+ const WIRE_DEBUG_ENTRY = '@wire';
6483
6067
  const WireMetaMap = new Map();
6484
6068
  class WireContextRegistrationEvent extends CustomEvent {
6485
6069
  constructor(adapterToken, {
@@ -6499,15 +6083,12 @@ var LWC = (function (exports) {
6499
6083
  }
6500
6084
  });
6501
6085
  }
6502
-
6503
6086
  }
6504
-
6505
6087
  function createFieldDataCallback(vm, name) {
6506
6088
  return value => {
6507
6089
  updateComponentValue(vm, name, value);
6508
6090
  };
6509
6091
  }
6510
-
6511
6092
  function createMethodDataCallback(vm, method) {
6512
6093
  return value => {
6513
6094
  // dispatching new value into the wired method
@@ -6517,45 +6098,40 @@ var LWC = (function (exports) {
6517
6098
  }, noop);
6518
6099
  };
6519
6100
  }
6520
-
6521
6101
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6522
- let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
6523
-
6102
+ let hasPendingConfig = false;
6103
+ // creating the reactive observer for reactive params when needed
6524
6104
  const ro = createReactiveObserver(() => {
6525
6105
  if (hasPendingConfig === false) {
6526
- hasPendingConfig = true; // collect new config in the micro-task
6527
-
6106
+ hasPendingConfig = true;
6107
+ // collect new config in the micro-task
6528
6108
  Promise.resolve().then(() => {
6529
- hasPendingConfig = false; // resetting current reactive params
6530
-
6531
- ro.reset(); // dispatching a new config due to a change in the configuration
6532
-
6109
+ hasPendingConfig = false;
6110
+ // resetting current reactive params
6111
+ ro.reset();
6112
+ // dispatching a new config due to a change in the configuration
6533
6113
  computeConfigAndUpdate();
6534
6114
  });
6535
6115
  }
6536
6116
  });
6537
-
6538
6117
  const computeConfigAndUpdate = () => {
6539
6118
  let config;
6540
- ro.observe(() => config = configCallback(component)); // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
6119
+ ro.observe(() => config = configCallback(component));
6120
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
6541
6121
  // TODO: dev-mode validation of config based on the adapter.configSchema
6542
6122
  // @ts-ignore it is assigned in the observe() callback
6543
-
6544
6123
  callbackWhenConfigIsReady(config);
6545
6124
  };
6546
-
6547
6125
  return {
6548
6126
  computeConfigAndUpdate,
6549
6127
  ro
6550
6128
  };
6551
6129
  }
6552
-
6553
6130
  function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6554
6131
  const {
6555
6132
  adapter
6556
6133
  } = wireDef;
6557
6134
  const adapterContextToken = getAdapterToken(adapter);
6558
-
6559
6135
  if (isUndefined$1(adapterContextToken)) {
6560
6136
  return; // no provider found, nothing to be done
6561
6137
  }
@@ -6569,8 +6145,8 @@ var LWC = (function (exports) {
6569
6145
  renderer: {
6570
6146
  dispatchEvent
6571
6147
  }
6572
- } = vm; // waiting for the component to be connected to formally request the context via the token
6573
-
6148
+ } = vm;
6149
+ // waiting for the component to be connected to formally request the context via the token
6574
6150
  ArrayPush$1.call(wiredConnecting, () => {
6575
6151
  // This event is responsible for connecting the host element with another
6576
6152
  // element in the composed path that is providing contextual data. The provider
@@ -6583,18 +6159,15 @@ var LWC = (function (exports) {
6583
6159
  // TODO: dev-mode validation of config based on the adapter.contextSchema
6584
6160
  callbackWhenContextIsReady(newContext);
6585
6161
  },
6586
-
6587
6162
  setDisconnectedCallback(disconnectCallback) {
6588
6163
  // adds this callback into the disconnect bucket so it gets disconnected from parent
6589
6164
  // the the element hosting the wire is disconnected
6590
6165
  ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
6591
6166
  }
6592
-
6593
6167
  });
6594
6168
  dispatchEvent(elm, contextRegistrationEvent);
6595
6169
  });
6596
6170
  }
6597
-
6598
6171
  function createConnector(vm, name, wireDef) {
6599
6172
  const {
6600
6173
  method,
@@ -6602,10 +6175,27 @@ var LWC = (function (exports) {
6602
6175
  configCallback,
6603
6176
  dynamic
6604
6177
  } = wireDef;
6605
- const dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
6178
+ let debugInfo;
6179
+ if (process.env.NODE_ENV !== 'production') {
6180
+ const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
6181
+ debugInfo = create(null);
6182
+ debugInfo.wasDataProvisionedForConfig = false;
6183
+ vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
6184
+ }
6185
+ const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
6186
+ const dataCallback = value => {
6187
+ if (process.env.NODE_ENV !== 'production') {
6188
+ debugInfo.data = value;
6189
+ // Note: most of the time, the data provided is for the current config, but there may be
6190
+ // some conditions in which it does not, ex:
6191
+ // race conditions in a poor network while the adapter does not cancel a previous request.
6192
+ debugInfo.wasDataProvisionedForConfig = true;
6193
+ }
6194
+ fieldOrMethodCallback(value);
6195
+ };
6606
6196
  let context;
6607
- let connector; // Workaround to pass the component element associated to this wire adapter instance.
6608
-
6197
+ let connector;
6198
+ // Workaround to pass the component element associated to this wire adapter instance.
6609
6199
  defineProperty(dataCallback, DeprecatedWiredElementHost, {
6610
6200
  value: vm.elm
6611
6201
  });
@@ -6616,41 +6206,41 @@ var LWC = (function (exports) {
6616
6206
  // job
6617
6207
  connector = new adapter(dataCallback);
6618
6208
  }, noop);
6619
-
6620
6209
  const updateConnectorConfig = config => {
6621
6210
  // every time the config is recomputed due to tracking,
6622
6211
  // this callback will be invoked with the new computed config
6623
6212
  runWithBoundaryProtection(vm, vm, noop, () => {
6624
6213
  // job
6214
+ if (process.env.NODE_ENV !== 'production') {
6215
+ debugInfo.config = config;
6216
+ debugInfo.context = context;
6217
+ debugInfo.wasDataProvisionedForConfig = false;
6218
+ }
6625
6219
  connector.update(config, context);
6626
6220
  }, noop);
6627
- }; // Computes the current wire config and calls the update method on the wire adapter.
6221
+ };
6222
+ // Computes the current wire config and calls the update method on the wire adapter.
6628
6223
  // If it has params, we will need to observe changes in the next tick.
6629
-
6630
-
6631
6224
  const {
6632
6225
  computeConfigAndUpdate,
6633
6226
  ro
6634
- } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig); // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
6635
-
6227
+ } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
6228
+ // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
6636
6229
  if (!isUndefined$1(adapter.contextSchema)) {
6637
6230
  createContextWatcher(vm, wireDef, newContext => {
6638
6231
  // every time the context is pushed into this component,
6639
6232
  // this callback will be invoked with the new computed context
6640
6233
  if (context !== newContext) {
6641
- context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
6234
+ context = newContext;
6235
+ // Note: when new context arrives, the config will be recomputed and pushed along side the new
6642
6236
  // context, this is to preserve the identity characteristics, config should not have identity
6643
6237
  // (ever), while context can have identity
6644
-
6645
- if (vm.state === 1
6646
- /* VMState.connected */
6647
- ) {
6238
+ if (vm.state === 1 /* VMState.connected */) {
6648
6239
  computeConfigAndUpdate();
6649
6240
  }
6650
6241
  }
6651
6242
  });
6652
6243
  }
6653
-
6654
6244
  return {
6655
6245
  // @ts-ignore the boundary protection executes sync, connector is always defined
6656
6246
  connector,
@@ -6658,7 +6248,6 @@ var LWC = (function (exports) {
6658
6248
  resetConfigWatcher: () => ro.reset()
6659
6249
  };
6660
6250
  }
6661
-
6662
6251
  const AdapterToTokenMap = new Map();
6663
6252
  function getAdapterToken(adapter) {
6664
6253
  return AdapterToTokenMap.get(adapter);
@@ -6671,7 +6260,6 @@ var LWC = (function (exports) {
6671
6260
  if (adapter.adapter) {
6672
6261
  adapter = adapter.adapter;
6673
6262
  }
6674
-
6675
6263
  const method = descriptor.value;
6676
6264
  const def = {
6677
6265
  adapter,
@@ -6686,7 +6274,6 @@ var LWC = (function (exports) {
6686
6274
  if (adapter.adapter) {
6687
6275
  adapter = adapter.adapter;
6688
6276
  }
6689
-
6690
6277
  const def = {
6691
6278
  adapter,
6692
6279
  configCallback,
@@ -6701,17 +6288,15 @@ var LWC = (function (exports) {
6701
6288
  wire
6702
6289
  }
6703
6290
  } = vm;
6291
+ vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
6704
6292
  const wiredConnecting = context.wiredConnecting = [];
6705
6293
  const wiredDisconnecting = context.wiredDisconnecting = [];
6706
-
6707
6294
  for (const fieldNameOrMethod in wire) {
6708
6295
  const descriptor = wire[fieldNameOrMethod];
6709
6296
  const wireDef = WireMetaMap.get(descriptor);
6710
-
6711
6297
  if (process.env.NODE_ENV !== 'production') {
6712
6298
  assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
6713
6299
  }
6714
-
6715
6300
  if (!isUndefined$1(wireDef)) {
6716
6301
  const {
6717
6302
  connector,
@@ -6721,14 +6306,12 @@ var LWC = (function (exports) {
6721
6306
  const hasDynamicParams = wireDef.dynamic.length > 0;
6722
6307
  ArrayPush$1.call(wiredConnecting, () => {
6723
6308
  connector.connect();
6724
-
6725
6309
  if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
6726
6310
  if (hasDynamicParams) {
6727
6311
  Promise.resolve().then(computeConfigAndUpdate);
6728
6312
  return;
6729
6313
  }
6730
6314
  }
6731
-
6732
6315
  computeConfigAndUpdate();
6733
6316
  });
6734
6317
  ArrayPush$1.call(wiredDisconnecting, () => {
@@ -6742,7 +6325,6 @@ var LWC = (function (exports) {
6742
6325
  const {
6743
6326
  wiredConnecting
6744
6327
  } = vm.context;
6745
-
6746
6328
  for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
6747
6329
  wiredConnecting[i]();
6748
6330
  }
@@ -7356,7 +6938,87 @@ var LWC = (function (exports) {
7356
6938
  }
7357
6939
  return ctor;
7358
6940
  }
7359
- /* version: 2.29.0 */
6941
+ /* version: 2.30.0 */
6942
+
6943
+ /*
6944
+ * Copyright (c) 2018, salesforce.com, inc.
6945
+ * All rights reserved.
6946
+ * SPDX-License-Identifier: MIT
6947
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6948
+ */
6949
+ /**
6950
+ * Displays the header for a custom element.
6951
+ *
6952
+ * @param ce the custom element
6953
+ * @param componentInstance component instance associated with the custom element.
6954
+ */
6955
+ function getHeaderForCustomElement(ce, componentInstance) {
6956
+ // [element]
6957
+ // LWC component instance: [vm.component]
6958
+ return [
6959
+ 'div',
6960
+ {},
6961
+ ['object', { object: ce, config: { skip: true } }],
6962
+ [
6963
+ 'div',
6964
+ {},
6965
+ ['span', { style: 'margin: 0 5px; color: red' }, 'LWC:'],
6966
+ ['object', { object: componentInstance }],
6967
+ ],
6968
+ ];
6969
+ }
6970
+ function getHeaderForComponentInstance(componentInstance, debugInfo) {
6971
+ if (keys(debugInfo).length === 0) {
6972
+ // there is no debug information, no need to customize this component instance
6973
+ return null;
6974
+ }
6975
+ // [component]
6976
+ // Debug information: [vm.debugInfo]
6977
+ return [
6978
+ 'div',
6979
+ {},
6980
+ ['object', { object: componentInstance, config: { skip: true } }],
6981
+ [
6982
+ 'div',
6983
+ {},
6984
+ ['span', { style: 'margin: 0 5px; color: red' }, 'Debug:'],
6985
+ ['object', { object: debugInfo }],
6986
+ ],
6987
+ ];
6988
+ }
6989
+ const LightningElementFormatter = {
6990
+ name: 'LightningElementFormatter',
6991
+ header(obj, config) {
6992
+ const vm = getAssociatedVMIfPresent(obj);
6993
+ if (!isUndefined$1(vm) && (isUndefined$1(config) || !config.skip)) {
6994
+ if (obj instanceof HTMLElement) {
6995
+ return getHeaderForCustomElement(obj, vm.component);
6996
+ }
6997
+ else {
6998
+ return getHeaderForComponentInstance(obj, vm.debugInfo);
6999
+ }
7000
+ }
7001
+ return null;
7002
+ },
7003
+ hasBody() {
7004
+ return false;
7005
+ },
7006
+ };
7007
+
7008
+ /*
7009
+ * Copyright (c) 2018, salesforce.com, inc.
7010
+ * All rights reserved.
7011
+ * SPDX-License-Identifier: MIT
7012
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7013
+ */
7014
+ function init() {
7015
+ const devtoolsFormatters = _globalThis.devtoolsFormatters || [];
7016
+ ArrayPush$1.call(devtoolsFormatters, LightningElementFormatter);
7017
+ _globalThis.devtoolsFormatters = devtoolsFormatters;
7018
+ }
7019
+ if (process.env.NODE_ENV !== 'production') {
7020
+ init();
7021
+ }
7360
7022
 
7361
7023
  /*
7362
7024
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8055,10 +7717,10 @@ var LWC = (function (exports) {
8055
7717
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8056
7718
  */
8057
7719
  let createScopedConstructor;
8058
- let CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
7720
+ let CachedHTMLElement;
7721
+ // We only call `createScopedRegistry()` if the browser supports custom elements and
8059
7722
  // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
8060
7723
  // or we're in a legacy browser.
8061
-
8062
7724
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8063
7725
  if (hasCustomElements) {
8064
7726
  // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
@@ -8072,7 +7734,8 @@ var LWC = (function (exports) {
8072
7734
  // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
8073
7735
  //
8074
7736
  // To reduce the risk of this, it's safer to patch the registry eagerly.
8075
- createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
7737
+ createScopedConstructor = createScopedRegistry();
7738
+ // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
8076
7739
  // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
8077
7740
  // because the HTMLElement prototypes are mixed up.
8078
7741
  //
@@ -8080,14 +7743,12 @@ var LWC = (function (exports) {
8080
7743
  // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
8081
7744
  // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
8082
7745
  // Caching avoids this problem.
8083
-
8084
7746
  CachedHTMLElement = window.HTMLElement;
8085
7747
  }
8086
- } // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
7748
+ }
7749
+ // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
8087
7750
  // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
8088
7751
  // multiple times per tag name.
8089
-
8090
-
8091
7752
  const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
8092
7753
  // TODO [#2972]: this class should expose observedAttributes as necessary
8093
7754
  return class UserConstructor extends HTMLElementToExtend {
@@ -8095,24 +7756,19 @@ var LWC = (function (exports) {
8095
7756
  super();
8096
7757
  upgradeCallback(this);
8097
7758
  }
8098
-
8099
7759
  connectedCallback() {
8100
7760
  connectedCallback(this);
8101
7761
  }
8102
-
8103
7762
  disconnectedCallback() {
8104
7763
  disconnectedCallback(this);
8105
7764
  }
8106
-
8107
7765
  };
8108
7766
  };
8109
-
8110
7767
  function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
8111
7768
  if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
8112
7769
  // This error should be impossible to hit
8113
7770
  throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
8114
7771
  }
8115
-
8116
7772
  const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
8117
7773
  const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
8118
7774
  return new ScopedConstructor(UserConstructor);
@@ -8137,9 +7793,7 @@ var LWC = (function (exports) {
8137
7793
  * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
8138
7794
  * because it must patch the global `customElements` and `HTMLElement` objects.
8139
7795
  */
8140
-
8141
7796
  let createCustomElement;
8142
-
8143
7797
  if (hasCustomElements) {
8144
7798
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8145
7799
  createCustomElement = createCustomElementScoped;
@@ -8212,7 +7866,7 @@ var LWC = (function (exports) {
8212
7866
  function isNull(obj) {
8213
7867
  return obj === null;
8214
7868
  }
8215
- /** version: 2.29.0 */
7869
+ /** version: 2.30.0 */
8216
7870
 
8217
7871
  /*
8218
7872
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8601,23 +8255,19 @@ var LWC = (function (exports) {
8601
8255
  * SPDX-License-Identifier: MIT
8602
8256
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8603
8257
  */
8258
+ // TODO [#2472]: Remove this workaround when appropriate.
8604
8259
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
8605
-
8606
8260
  const _Node$1 = Node;
8607
8261
  const ConnectingSlot = new WeakMap();
8608
8262
  const DisconnectingSlot = new WeakMap();
8609
-
8610
8263
  function callNodeSlot(node, slot) {
8611
8264
  if (process.env.NODE_ENV !== 'production') {
8612
8265
  assert.isTrue(node, `callNodeSlot() should not be called for a non-object`);
8613
8266
  }
8614
-
8615
8267
  const fn = slot.get(node);
8616
-
8617
8268
  if (!isUndefined$1(fn)) {
8618
8269
  fn(node);
8619
8270
  }
8620
-
8621
8271
  return node; // for convenience
8622
8272
  }
8623
8273
 
@@ -8635,24 +8285,20 @@ var LWC = (function (exports) {
8635
8285
  const appendedNode = appendChild.call(this, newChild);
8636
8286
  return callNodeSlot(appendedNode, ConnectingSlot);
8637
8287
  },
8638
-
8639
8288
  insertBefore(newChild, referenceNode) {
8640
8289
  const insertedNode = insertBefore.call(this, newChild, referenceNode);
8641
8290
  return callNodeSlot(insertedNode, ConnectingSlot);
8642
8291
  },
8643
-
8644
8292
  removeChild(oldChild) {
8645
8293
  const removedNode = removeChild.call(this, oldChild);
8646
8294
  return callNodeSlot(removedNode, DisconnectingSlot);
8647
8295
  },
8648
-
8649
8296
  replaceChild(newChild, oldChild) {
8650
8297
  const replacedNode = replaceChild.call(this, newChild, oldChild);
8651
8298
  callNodeSlot(replacedNode, DisconnectingSlot);
8652
8299
  callNodeSlot(newChild, ConnectingSlot);
8653
8300
  return replacedNode;
8654
8301
  }
8655
-
8656
8302
  });
8657
8303
  }
8658
8304
  /**
@@ -8666,59 +8312,49 @@ var LWC = (function (exports) {
8666
8312
  * const el = createElement('x-foo', { is: FooCtor });
8667
8313
  * ```
8668
8314
  */
8669
-
8670
-
8671
8315
  function createElement(sel, options) {
8672
8316
  if (!isObject(options) || isNull(options)) {
8673
8317
  throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
8674
8318
  }
8675
-
8676
8319
  const Ctor = options.is;
8677
-
8678
8320
  if (!isFunction$1(Ctor)) {
8679
8321
  throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
8680
8322
  }
8681
-
8682
8323
  const {
8683
8324
  createCustomElement
8684
- } = renderer; // tagName must be all lowercase, unfortunately, we have legacy code that is
8325
+ } = renderer;
8326
+ // tagName must be all lowercase, unfortunately, we have legacy code that is
8685
8327
  // passing `sel` as a camel-case, which makes them invalid custom elements name
8686
8328
  // the following line guarantees that this does not leaks beyond this point.
8687
-
8688
- const tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
8689
-
8329
+ const tagName = StringToLowerCase.call(sel);
8330
+ // the custom element from the registry is expecting an upgrade callback
8690
8331
  /**
8691
8332
  * Note: if the upgradable constructor does not expect, or throw when we new it
8692
8333
  * with a callback as the first argument, we could implement a more advanced
8693
8334
  * mechanism that only passes that argument if the constructor is known to be
8694
8335
  * an upgradable custom element.
8695
8336
  */
8696
-
8697
8337
  const upgradeCallback = elm => {
8698
8338
  createVM(elm, Ctor, renderer, {
8699
8339
  tagName,
8700
8340
  mode: options.mode !== 'closed' ? 'open' : 'closed',
8701
8341
  owner: null
8702
8342
  });
8703
-
8704
8343
  if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8705
8344
  ConnectingSlot.set(elm, connectRootElement);
8706
8345
  DisconnectingSlot.set(elm, disconnectRootElement);
8707
8346
  }
8708
8347
  };
8709
-
8710
8348
  const connectedCallback = elm => {
8711
8349
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8712
8350
  connectRootElement(elm);
8713
8351
  }
8714
8352
  };
8715
-
8716
8353
  const disconnectedCallback = elm => {
8717
8354
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
8718
8355
  disconnectRootElement(elm);
8719
8356
  }
8720
8357
  };
8721
-
8722
8358
  const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
8723
8359
  return element;
8724
8360
  }
@@ -8791,7 +8427,7 @@ var LWC = (function (exports) {
8791
8427
  });
8792
8428
  freeze(LightningElement);
8793
8429
  seal(LightningElement.prototype);
8794
- /* version: 2.29.0 */
8430
+ /* version: 2.30.0 */
8795
8431
 
8796
8432
  exports.LightningElement = LightningElement;
8797
8433
  exports.__unstable__ProfilerControl = profilerControl;