@lwrjs/everywhere 0.22.12 → 0.22.13

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 (23) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/e2db3283c6dbc0903b2cf61cdefce644/config.js +12 -0
  2. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/{0_22_12 → 0_22_13}/s/d4022ae1b3a47f5bb62c600fd6b8f139/@lwrjs_app-service_amd-bootstrap_module_amd.js +5 -5
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_22_12 → 0_22_13}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_22_12 → 0_22_13}/s/c5c8bdc0e87baf3d6b68b0603d670664/lwr_init.js +20 -20
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_22_12/s/e5539130565e08d311bee05ff47797a5 → 0_22_13/s/14273a6a9acc9325957be8c0dad67c13}/lwr_loader.js +160 -9
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_22_12 → 0_22_13}/s/fb8c5dd340c69fdf7ded52d3eba633b9/lwr_metrics.js +1 -1
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_22_12 → 0_22_13}/s/9120455810adf1ca6b429479490a4b0d/lwr_preInit.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_22_12 → 0_22_13}/s/9f74c8370534ce02c6e7637abdcffedf/lwr_profiler.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/scheduler/v/{0_22_12 → 0_22_13}/s/fd3fe53248b540ca046ead92862ca496/lwr_scheduler.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_22_12 → 0_22_13}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_22_12 → 0_22_13}/lwr-error-shim.js +1 -1
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_22_12 → 0_22_13}/lwr-loader-shim.bundle.js +191 -19
  13. package/build/assets/amd/lwr-everywhere-debug.js +185 -15
  14. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  15. package/build/assets/amd/lwr-everywhere.js +185 -15
  16. package/build/assets/core/lwr-everywhere-debug.js +181 -11
  17. package/build/assets/core/lwr-everywhere-min.js +2 -2
  18. package/build/assets/core/lwr-everywhere.js +181 -11
  19. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  20. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  21. package/build/assets/esm/lwr-everywhere.js +1 -1
  22. package/package.json +6 -6
  23. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/ef04a79964a62c2d675f744778da4f9b/config.js +0 -12
@@ -52,7 +52,7 @@ function getConfiguration(options) {
52
52
  * SPDX-License-Identifier: MIT
53
53
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
54
54
  */
55
- /* LWR Module Loader v0.22.12 */
55
+ /* LWR Module Loader v0.22.13 */
56
56
  const templateRegex = /\{([0-9]+)\}/g;
57
57
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
58
  function templateString(template, args) {
@@ -484,11 +484,7 @@ class ImportMetadataResolver {
484
484
  return this.config.baseUrl || '';
485
485
  }
486
486
 
487
- registerImportMappings(newImportMetadata, rootSpecifiers) {
488
- if (!rootSpecifiers || rootSpecifiers.length === 0) {
489
- const imports = newImportMetadata ? JSON.stringify(newImportMetadata) : 'undefined';
490
- throw new LoaderError(BAD_IMPORT_METADATA, [imports, rootSpecifiers ? '[]' : 'undefined']);
491
- }
487
+ registerImportMappings(newImportMetadata, rootSpecifiers = []) {
492
488
  if (!newImportMetadata) {
493
489
  throw new LoaderError(BAD_IMPORT_METADATA, ['undefined', JSON.stringify(rootSpecifiers)]);
494
490
  }
@@ -498,6 +494,8 @@ class ImportMetadataResolver {
498
494
  JSON.stringify(rootSpecifiers),
499
495
  ]);
500
496
  }
497
+ // An empty rootSpecifiers list is valid for non-bootstrap registrations;
498
+ // any specifier not in the list receives isRoot: false.
501
499
  const index = newImportMetadata.index || {};
502
500
  for (const [uri, specifiers] of Object.entries(newImportMetadata.imports)) {
503
501
  specifiers.forEach((specifier) => {
@@ -520,6 +518,16 @@ class ImportMetadataResolver {
520
518
  }
521
519
  }
522
520
 
521
+ /**
522
+ * Returns the raw URI stored for a specifier, or `undefined` if not yet mapped.
523
+ * Used by the runtime `importMap()` path to detect cross-call duplicates while
524
+ * allowing truly idempotent re-registrations (same specifier, same URI) to pass
525
+ * through silently.
526
+ */
527
+ getMappingUri(specifier) {
528
+ return _optionalChain$1([this, 'access', _ => _.importURICache, 'access', _2 => _2.get, 'call', _3 => _3(specifier), 'optionalAccess', _4 => _4.uri]);
529
+ }
530
+
523
531
  // Get URL from the local cache or return undefiend
524
532
  getURI(specifier) {
525
533
  return this.importURICache && this.importURICache.has(specifier)
@@ -617,7 +625,7 @@ class ImportMetadataResolver {
617
625
  }
618
626
 
619
627
  async fetchNewMappings(specifier) {
620
- if (!hasSetTimeout || !_optionalChain$1([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.flags, 'optionalAccess', _3 => _3.batchMappings])) {
628
+ if (!hasSetTimeout || !_optionalChain$1([this, 'access', _5 => _5.config, 'optionalAccess', _6 => _6.flags, 'optionalAccess', _7 => _7.batchMappings])) {
621
629
  return this.fetchNewMappingsInner(specifier);
622
630
  }
623
631
 
@@ -1707,6 +1715,101 @@ function validateLoadSpecifier(
1707
1715
  }
1708
1716
  }
1709
1717
 
1718
+ /**
1719
+ * Ensures the update object key is a safe, loader-supported script URL (not a bare specifier).
1720
+ * Covers dangerous schemes and URL-key shape in one place.
1721
+ */
1722
+ function assertValidImportMapUrlKey(moduleScriptURL) {
1723
+ const lowerUri = moduleScriptURL.toLowerCase();
1724
+
1725
+ if (lowerUri.startsWith('blob:')) {
1726
+ throw new Error(`Cannot map ${moduleScriptURL} to blob: URL`);
1727
+ }
1728
+
1729
+ if (lowerUri.startsWith('data:')) {
1730
+ throw new Error(`Cannot map ${moduleScriptURL} to data: URL`);
1731
+ }
1732
+
1733
+ if (!/^[./]|^https?:/.test(moduleScriptURL)) {
1734
+ throw new Error(
1735
+ `LWR.importMap(): "${moduleScriptURL}" is not a valid URL key. Keys must be URL paths (e.g. "/path/to/module.js"), not module specifiers. Transitive specifier aliasing is not supported by this loader.`,
1736
+ );
1737
+ }
1738
+ }
1739
+
1740
+ /**
1741
+ * Validates an ImportMapUpdate and wraps it as ImportMetadata for the fingerprints loader.
1742
+ *
1743
+ * Does not apply legacy-style protected-specifier blocking; system modules are expected to be
1744
+ * defined at bootstrap, and `importMap` write-once semantics handle redundant runtime entries.
1745
+ *
1746
+ * Duplicate specifiers in the same update are de-duplicated silently (first occurrence wins).
1747
+ * An empty object is a silent no-op (returns null).
1748
+ */
1749
+ function validateAndWrapAsImportMetadata(update) {
1750
+ if (!update || typeof update !== 'object') {
1751
+ throw new Error('LWR.importMap() requires an object argument');
1752
+ }
1753
+
1754
+ const entries = Object.entries(update);
1755
+ if (entries.length === 0) {
1756
+ return null;
1757
+ }
1758
+
1759
+ const seenSpecifiers = new Set();
1760
+ const validatedImports = {};
1761
+
1762
+ for (const [moduleScriptURL, moduleNames] of entries) {
1763
+ if (!moduleScriptURL || typeof moduleScriptURL !== 'string') {
1764
+ throw new Error('moduleScriptURL must be a string');
1765
+ }
1766
+
1767
+ if (!Array.isArray(moduleNames)) {
1768
+ throw new Error('moduleNames must be an array');
1769
+ }
1770
+
1771
+ assertValidImportMapUrlKey(moduleScriptURL);
1772
+
1773
+ const validatedNames = [];
1774
+ for (const moduleName of moduleNames) {
1775
+ if (typeof moduleName !== 'string' || moduleName.length === 0) {
1776
+ throw new Error('Specifier must be a non-empty string');
1777
+ }
1778
+
1779
+ if (!seenSpecifiers.has(moduleName)) {
1780
+ seenSpecifiers.add(moduleName);
1781
+ validatedNames.push(moduleName);
1782
+ }
1783
+ }
1784
+
1785
+ if (validatedNames.length > 0) {
1786
+ validatedImports[moduleScriptURL] = validatedNames;
1787
+ }
1788
+ }
1789
+
1790
+ if (Object.keys(validatedImports).length === 0) {
1791
+ return null;
1792
+ }
1793
+
1794
+ return { imports: validatedImports };
1795
+ }
1796
+
1797
+ /**
1798
+ * Returns true when `update` carries the `ImportMetadata` shape (an `imports` object key),
1799
+ * signalling that it should be passed through to the resolver directly rather than treated
1800
+ * as a public-API `ImportMapUpdate`.
1801
+ */
1802
+ function isImportMetadata(update) {
1803
+ const candidate = update ;
1804
+ return (
1805
+ candidate !== null &&
1806
+ typeof candidate === 'object' &&
1807
+ 'imports' in candidate &&
1808
+ typeof candidate.imports === 'object' &&
1809
+ !Array.isArray(candidate.imports)
1810
+ );
1811
+ }
1812
+
1710
1813
  /**
1711
1814
  * The LWR loader is inspired and borrows from the algorithms and native browser principles of https://github.com/systemjs/systemjs
1712
1815
  */
@@ -1840,8 +1943,75 @@ class Loader {
1840
1943
  return this.registry.resolve(id, importer);
1841
1944
  }
1842
1945
 
1946
+ /**
1947
+ * Apply import map updates at runtime, or register bootstrap import mappings.
1948
+ *
1949
+ * **Runtime usage** (public API, consistent with `LWR.importMap()` on the legacy loader):
1950
+ * `importMap({ [moduleScriptURL]: [moduleName1, moduleName2, ...] })`
1951
+ * Validates the update and registers the new mappings dynamically.
1952
+ *
1953
+ * **Bootstrap / internal usage** (replaces `registerImportMappings`):
1954
+ * `importMap(importMetadata)` or `importMap(importMetadata, rootSpecifiers)`
1955
+ * Detected at runtime by the `ImportMetadata` shape (presence of an `imports` object).
1956
+ * This branch **does not** run `validateAndWrapAsImportMetadata` (URL-key checks /
1957
+ * runtime-payload dedupe). That is intentional: bootstrap must preserve
1958
+ * `index` fingerprints and use `ImportMetadataResolver.registerImportMappings` merge
1959
+ * semantics unchanged from the pre-`importMap` API.
1960
+ *
1961
+ * **Who may use this branch:** Platform/shim code with trusted config (see
1962
+ * `shim/shim.ts`, which calls `loader.importMap({ imports, index }, roots)`). The
1963
+ * public `LWR.importMap` wrapper only forwards the flat runtime update shape; any
1964
+ * code with a direct `Loader` reference could still pass an `ImportMetadata`-shaped
1965
+ * object — same trust boundary as calling `registerImportMappings` before.
1966
+ *
1967
+ * @param update - Runtime: `ImportMapUpdate` mapping script URLs to the module names they define.
1968
+ * Bootstrap: `ImportMetadata` with an `imports` object (and optional `index`).
1969
+ * @param rootSpecifiers - Bootstrap only: root module specifiers for the initial registration.
1970
+ * Optional — omit when the root specifiers are not known.
1971
+ */
1972
+ async importMap(update, rootSpecifiers) {
1973
+ if (isImportMetadata(update)) {
1974
+ this.registry.getImportMetadataResolver().registerImportMappings(update, rootSpecifiers);
1975
+ return;
1976
+ }
1977
+ const resolver = this.registry.getImportMetadataResolver();
1978
+ const importMetadata = validateAndWrapAsImportMetadata(update );
1979
+ if (!importMetadata) {
1980
+ return;
1981
+ }
1982
+
1983
+ const dedupedImports = {};
1984
+ for (const [uri, specifiers] of Object.entries(importMetadata.imports)) {
1985
+ const newSpecifiers = [];
1986
+ for (const specifier of specifiers) {
1987
+ const existingUri = resolver.getMappingUri(specifier);
1988
+ if (existingUri !== undefined) ; else {
1989
+ newSpecifiers.push(specifier);
1990
+ }
1991
+ }
1992
+ if (newSpecifiers.length > 0) {
1993
+ dedupedImports[uri] = newSpecifiers;
1994
+ }
1995
+ }
1996
+
1997
+ if (Object.keys(dedupedImports).length === 0) {
1998
+ return;
1999
+ }
2000
+
2001
+ const filtered = { imports: dedupedImports };
2002
+ const specs = Object.values(filtered.imports).flat();
2003
+ resolver.registerImportMappings(filtered, specs);
2004
+ }
2005
+
2006
+ /**
2007
+ * @deprecated Use `importMap(metadata, rootSpecifiers)` instead.
2008
+ */
1843
2009
  async registerImportMappings(mappings, rootSpecifiers) {
1844
- this.registry.getImportMetadataResolver().registerImportMappings(mappings, rootSpecifiers);
2010
+ if (hasConsole) {
2011
+ // eslint-disable-next-line lwr/no-unguarded-apis
2012
+ console.warn('registerImportMappings() is deprecated. Use importMap() instead.');
2013
+ }
2014
+ return this.importMap(mappings, rootSpecifiers);
1845
2015
  }
1846
2016
 
1847
2017
  /**
@@ -1879,12 +2049,12 @@ await loader.registerImportMappings({ imports, index }, [bootstrapModule]);
1879
2049
  (globalThis ).LWR = Object.freeze({ define: loader.define.bind(loader) });
1880
2050
 
1881
2051
  // Define preload modules (ie: ABS, vault, etc) BEFORE loading them
1882
- LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (function (exports, _0_22_12) {
2052
+ LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (function (exports, _0_22_13) {
1883
2053
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
1884
2054
 
1885
2055
  // Do an OAuthed fetch
1886
2056
  async function authFetch(url, accept = 'javascript') {
1887
- const authInfo = _0_22_12.getAuthInfo();
2057
+ const authInfo = _0_22_13.getAuthInfo();
1888
2058
  if (authInfo) {
1889
2059
  return fetch(url, {
1890
2060
  headers: {
@@ -1933,7 +2103,7 @@ LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (funct
1933
2103
  function authenticate(authInfo) {
1934
2104
  // Put OAuth info into the vault
1935
2105
  if (authInfo) {
1936
- _0_22_12.setAuthInfo(authInfo);
2106
+ _0_22_13.setAuthInfo(authInfo);
1937
2107
  }
1938
2108
  }
1939
2109
 
@@ -1,6 +1,6 @@
1
- function getConfiguration(e){const{format:t,server:r,apiVersion:o,apiPrefix:i,locale:n,bundle:s,debug:a}=e,l=new URL(import.meta.url),d=r||l.origin||"",c=`${i}/${o}`,p="0"+(n?`/l/${n}`:""),u="/bi/3_A,B,O,S,EG,JLMT,C,D,F,H,I,K,N,P,Q,R",h=s?`${d}${c}/bundle/${t}/${p}${u}-0/module/mi/`:`${d}${c}/module/${t}/${p}/mi/`,f=`lwr/everywhere${"esm"===t?"Esm":"Amd"}/v/0_0_1`,g=`${h}${encodeURIComponent(f)}/latest${a?"?debug":""}`,E={appId:"lwre",autoBoot:!0,bootstrapModule:f,baseUrl:d,imports:{[g]:[f]},index:{[f]:g},endpoints:{uris:{module:h,mapping:`${d}${c}/mapping/${t}/${p}${s?u:""}/mp/`}}};return a&&E.endpoints&&(E.endpoints.modifiers={debug:"true"}),E}globalThis.process={env:{NODE_ENV:"production"}};const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{0}"'});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process,hasProcessEnv=hasProcess&&process.env;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;function _optionalChain$1(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],n=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=n(r)):"call"!==i&&"optionalCall"!==i||(r=n(((...e)=>r.call(t,...e))),t=void 0)}return r}class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}__init4(){this.batchSpecifiers=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),ImportMetadataResolver.prototype.__init4.call(this),this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl||""}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],n=this.importURICache.get(e);if(n){const t=i||o,r=n.identity||n.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getURI(e){return this.importURICache&&this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const i=t[o],n=await i(e,{knownModules:r});if(n||void 0===n)return n}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if(!hasSetTimeout||!_optionalChain$1([this,"access",e=>e.config,"optionalAccess",e=>e.flags,"optionalAccess",e=>e.batchMappings]))return this.fetchNewMappingsInner(e);const t=()=>{const e=this.batchSpecifiers.join(",");return this.batchSpecifiers=[],clearTimeout(this.batchTimer),this.batchTimer=void 0,this.fetchNewMappingsInner(e)};return this.batchPromise&&0!==this.batchSpecifiers.length||(this.batchPromise=new Promise((e=>{this.batchTimer=setTimeout((()=>e(t())),0)}))),this.batchSpecifiers.push(e),this.batchPromise}async fetchNewMappingsInner(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
1
+ function getConfiguration(e){const{format:t,server:r,apiVersion:o,apiPrefix:i,locale:s,bundle:n,debug:a}=e,l=new URL(import.meta.url),d=r||l.origin||"",c=`${i}/${o}`,p="0"+(s?`/l/${s}`:""),u="/bi/3_A,B,O,S,EG,JLMT,C,D,F,H,I,K,N,P,Q,R",h=n?`${d}${c}/bundle/${t}/${p}${u}-0/module/mi/`:`${d}${c}/module/${t}/${p}/mi/`,f=`lwr/everywhere${"esm"===t?"Esm":"Amd"}/v/0_0_1`,g=`${h}${encodeURIComponent(f)}/latest${a?"?debug":""}`,E={appId:"lwre",autoBoot:!0,bootstrapModule:f,baseUrl:d,imports:{[g]:[f]},index:{[f]:g},endpoints:{uris:{module:h,mapping:`${d}${c}/mapping/${t}/${p}${n?u:""}/mp/`}}};return a&&E.endpoints&&(E.endpoints.modifiers={debug:"true"}),E}globalThis.process={env:{NODE_ENV:"production"}};const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{0}"'});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process,hasProcessEnv=hasProcess&&process.env;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,s=[];let n=-1;for(let e=0;e<i.length;e++)-1!==n?"/"===i[e]&&(s.push(i.slice(n,e+1)),n=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:n=e:(s.pop(),e+=2):n=e;return-1!==n&&s.push(i.slice(n)),t.slice(0,t.length-o.length)+s.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;function _optionalChain$1(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],s=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s(((...e)=>r.call(t,...e))),t=void 0)}return r}class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}__init4(){this.batchSpecifiers=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),ImportMetadataResolver.prototype.__init4.call(this),this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl||""}registerImportMappings(e,t=[]){if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],s=this.importURICache.get(e);if(s){const t=i||o,r=s.identity||s.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getMappingUri(e){return _optionalChain$1([this,"access",e=>e.importURICache,"access",e=>e.get,"call",t=>t(e),"optionalAccess",e=>e.uri])}getURI(e){return this.importURICache&&this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const i=t[o],s=await i(e,{knownModules:r});if(s||void 0===s)return s}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if(!hasSetTimeout||!_optionalChain$1([this,"access",e=>e.config,"optionalAccess",e=>e.flags,"optionalAccess",e=>e.batchMappings]))return this.fetchNewMappingsInner(e);const t=()=>{const e=this.batchSpecifiers.join(",");return this.batchSpecifiers=[],clearTimeout(this.batchTimer),this.batchTimer=void 0,this.fetchNewMappingsInner(e)};return this.batchPromise&&0!==this.batchSpecifiers.length||(this.batchPromise=new Promise((e=>{this.batchTimer=setTimeout((()=>e(t())),0)}))),this.batchSpecifiers.push(e),this.batchPromise}async fetchNewMappingsInner(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const s=e[t];try{if(null!==s({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
2
2
  /*!
3
3
  * Copyright (C) 2023 salesforce.com, inc.
4
4
  */
5
5
  const SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes,trustedTypePolicyRegistry={__proto__:null};function createDuplicateSafeTrustedTypesPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=trustedTypes.createPolicy(e,t)}function createDuplicateSafeFallbackPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createDuplicateSafeTrustedTypesPolicy:createDuplicateSafeFallbackPolicy,policyOptions={createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e};try{createPolicy("default",{createHTML:e=>e,createScript(e){if("null"===e||"undefined"===e)return e},createScriptURL:e=>e})}catch(e){}const trusted=createPolicy("trusted",policyOptions);
6
- /*! version: 0.26.4 */let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[`empty code for ${id}`]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw"production"!==process.env.NODE_ENV&&hasConsole&&console.error(e),new LoaderError(FAIL_LOAD,[`"${id}": ${e instanceof Error?e.message:String(e)}`])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[`"${id}": window error ${lastWindowError instanceof Error?lastWindowError.message:String(lastWindowError)}`]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const i=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(i)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),"production"!==process.env.NODE_ENV&&!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{__init(){this.isAppMounted=!1}constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),ModuleRegistry.prototype.__init4.call(this),this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this)),this.warnings={[MODULE_WARNING.MODULE_REDEFINE]:[],[MODULE_WARNING.MODULE_ALREADY_LOADED]:[],[MODULE_WARNING.ALIAS_UPDATE]:[]}}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),i=await this.getModuleRecord(o,e);return i.evaluated?i.module:(i.evaluationPromise||(i.evaluationPromise=this.topLevelEvaluation(i)),i.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,i=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(i,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),!this.isValidResolveResponse(s))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);i=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(i!==e){if(!o&&this.namedDefineRegistry.has(i))return i;e=i}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const i=this.resolver.resolveLocal(t);if(i){if(this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(i)||!this.aliases.has(t))return t}}return i}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return"production"!==process.env.NODE_ENV&&hasProcessEnv&&"true"!==process.env.MRT_HMR&&(this.warnings[MODULE_WARNING.MODULE_REDEFINE].includes(e)||this.warnings[MODULE_WARNING.MODULE_REDEFINE].push(e),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.MODULE_REDEFINE}: ${e}`)),void(this.lastDefine=o);const i={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i}registerExternalModules(e){e.map((e=>{if(this.namedDefineRegistry.has(e))"production"!==process.env.NODE_ENV&&(this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].includes(e)||this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].push(e),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.MODULE_ALREADY_LOADED}: ${e}`));else{let t,r;const o=new Promise(((o,i)=>{t=o,r=setTimeout((()=>{i(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),i={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,i)}}))}__init2(){this.namedDefineRegistry=new Map}__init3(){this.moduleRegistry=new Map}__init4(){this.aliases=new Map}getImportMetadataResolver(){return this.resolver}async getModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)if(isUrl(e)){const o=await r.instantiation,i=await this.resolve(t);if(isUrl(i)||o.name===i)return this.storeModuleAlias(t,i),r;{e=i;const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,i),r}}else if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}const o=this.getModuleDef(e,t),i=o.then((e=>{const t=(e.dependencies||[]).map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)})),n={id:e,originalId:t,module:Object.create(null),dependencyRecords:i,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,n),e!==t&&this.storeModuleAlias(t,e),i.then((()=>n))}storeModuleAlias(e,t){if(e!==t)if(this.aliases.has(e)){if("production"!==process.env.NODE_ENV&&hasConsole){const r=this.aliases.get(e);if(r!==t){const o=`${e}=>${r}, ${t}`;this.warnings[MODULE_WARNING.ALIAS_UPDATE].includes(o)||this.warnings[MODULE_WARNING.ALIAS_UPDATE].push(o),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.ALIAS_UPDATE}: ${o}`)}}}else this.aliases.set(e,t)}async getModuleDependencyRecord(e){let t=await this.resolve(e);if(isUrl(t)){const r=this.moduleRegistry.get(t);r&&!this.aliases.has(e)&&(await r.instantiation,t=await this.resolve(e))}return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return this.evaluateModule(e,{})}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:i}=await e.instantiation,n={},s=i?await Promise.all(i.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])}))):[];if(e.evaluated)return e.module;let a;try{a=o(...s)}catch(t){throw new LoaderError(EXPORTER_ERROR,[e.id,t.message||t])}void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const i=this.resolver.getBaseUrl(),n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,i),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(this.logMessage("warning",`${r} not found, falling back to the last loader.define call`),o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}getModuleWarnings(e=!1){return this.isAppMounted=e,this.warnings}logMessage(e,t){hasConsole&&"production"!==process.env.NODE_ENV&&("warning"==e?console.warn(t):console.log(t))}}function _nullishCoalesce(e,t){return null!=e?e:t()}function validateLoadSpecifier(e,t,r,o){const{LoaderError:i,NO_IMPORT_LWC:n,NO_IMPORT_LOADER:s,NO_IMPORT_TRANSPORT:a,NO_BLOB_IMPORT:l}=o;if("lwc"===e||e.startsWith("lwc/v/"))throw new i(n,[_nullishCoalesce(t,(()=>"unknown"))]);if(e===r||e.startsWith(`${r}/v/`))throw new i(s,[_nullishCoalesce(t,(()=>"unknown"))]);if("transport"===e||e.startsWith("transport/v/")||"webruntime/transport"===e||e.startsWith("webruntime/transport/v/"))throw new i(a,[_nullishCoalesce(t,(()=>"unknown"))]);if(e.toLowerCase().startsWith("blob:"))throw new i(l)}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r||!e.endpoints)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o,flags:e.flags||{}})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,i=t;"function"==typeof i&&(o=t,i=[]),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,o)}async load(e,t){return validateLoadSpecifier(e,t,"lwr/loader",{LoaderError:LoaderError,NO_IMPORT_LWC:NO_IMPORT_LWC,NO_IMPORT_LOADER:NO_IMPORT_LOADER,NO_IMPORT_TRANSPORT:NO_IMPORT_TRANSPORT,NO_BLOB_IMPORT:NO_BLOB_IMPORT}),this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}getModuleWarnings(e=!1){return this.registry.getModuleWarnings(e)}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],n=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=n(r)):"call"!==i&&"optionalCall"!==i||(r=n(((...e)=>r.call(t,...e))),t=void 0)}return r}const configOptions={format:"amd",apiVersion:"v57.0",apiPrefix:"/lwr",bundle:!0,debug:!1},configuration=getConfiguration(configOptions),{bootstrapModule:bootstrapModule,endpoints:endpoints,baseUrl:baseUrl,imports:imports,index:index}=configuration,loader=new Loader({endpoints:endpoints,baseUrl:baseUrl});loader.define("lwr/loader/v/0_0_1",["exports"],(e=>{Object.assign(e,{define:loader.define.bind(loader),load:loader.load.bind(loader)})})),await loader.registerImportMappings({imports:imports,index:index},[bootstrapModule]),globalThis.LWR=Object.freeze({define:loader.define.bind(loader)}),LWR.define("lwr/everywhereAmd/v/0_0_1",["exports","lwr/vault/v/0_0_1"],(function(e,t){async function r(e,r="javascript"){const o=t.getAuthInfo();return o?fetch(e,{headers:{Accept:`application/${r}`,Authorization:`Bearer ${o.access_token}`}}):null}e.authenticate=function(e){e&&t.setAuthInfo(e)},e.initAmd=function(e,t,o){t.match(/\/v5\d\.0\//)&&function(e,t,o){e.addLoaderPlugin({loadModule:async e=>r(e),loadMapping:async e=>{const o=await r(`${t}${encodeURIComponent(e)}`,"json");return o&&o.ok?o.json():null},resolveModule:e=>e&&!/\/v\/[^/]+?$/.test(e)?`${e}/v/${o}`:null})}(e,t,o)},Object.defineProperty(e,"__esModule",{value:!0})})),LWR.define("lwr/vault/v/0_0_1",["exports"],(function(e){let t;e.getAuthInfo=function(){return t},e.setAuthInfo=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})}));const{initAmd:initAmd,authenticate:authenticate}=await loader.load(bootstrapModule);async function createComponent(e,t,r={},o){const{createComponent:i}=await loader.load(bootstrapModule.replace("Amd",""));return i(e,t,r,o)}initAmd(loader.services,_optionalChain([endpoints,"optionalAccess",e=>e.uris,"access",e=>e.mapping]),"0_0_1");export{authenticate,createComponent};
6
+ /*! version: 0.26.4 */let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[`empty code for ${id}`]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw"production"!==process.env.NODE_ENV&&hasConsole&&console.error(e),new LoaderError(FAIL_LOAD,[`"${id}": ${e instanceof Error?e.message:String(e)}`])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[`"${id}": window error ${lastWindowError instanceof Error?lastWindowError.message:String(lastWindowError)}`]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const i=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(i)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),"production"!==process.env.NODE_ENV&&!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{__init(){this.isAppMounted=!1}constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),ModuleRegistry.prototype.__init4.call(this),this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this)),this.warnings={[MODULE_WARNING.MODULE_REDEFINE]:[],[MODULE_WARNING.MODULE_ALREADY_LOADED]:[],[MODULE_WARNING.ALIAS_UPDATE]:[]}}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),i=await this.getModuleRecord(o,e);return i.evaluated?i.module:(i.evaluationPromise||(i.evaluationPromise=this.topLevelEvaluation(i)),i.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,i=e;const s=this.resolveHook;if(s){for(let e=0;e<s.length;e++){const t=(0,s[e])(i,{parentUrl:r});let n;if((t||null===t)&&(n=isResponseAPromise(t)?await t:t),!this.isValidResolveResponse(n))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==n){if("string"==typeof n){if(resolveIfNotPlainOrUrl(n,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);i=n;continue}if(o=n&&n.url&&(resolveIfNotPlainOrUrl(n.url,r)||n.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(i!==e){if(!o&&this.namedDefineRegistry.has(i))return i;e=i}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const i=this.resolver.resolveLocal(t);if(i){if(this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(i)||!this.aliases.has(t))return t}}return i}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return"production"!==process.env.NODE_ENV&&hasProcessEnv&&"true"!==process.env.MRT_HMR&&(this.warnings[MODULE_WARNING.MODULE_REDEFINE].includes(e)||this.warnings[MODULE_WARNING.MODULE_REDEFINE].push(e),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.MODULE_REDEFINE}: ${e}`)),void(this.lastDefine=o);const i={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i}registerExternalModules(e){e.map((e=>{if(this.namedDefineRegistry.has(e))"production"!==process.env.NODE_ENV&&(this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].includes(e)||this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].push(e),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.MODULE_ALREADY_LOADED}: ${e}`));else{let t,r;const o=new Promise(((o,i)=>{t=o,r=setTimeout((()=>{i(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),i={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,i)}}))}__init2(){this.namedDefineRegistry=new Map}__init3(){this.moduleRegistry=new Map}__init4(){this.aliases=new Map}getImportMetadataResolver(){return this.resolver}async getModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)if(isUrl(e)){const o=await r.instantiation,i=await this.resolve(t);if(isUrl(i)||o.name===i)return this.storeModuleAlias(t,i),r;{e=i;const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,i),r}}else if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}const o=this.getModuleDef(e,t),i=o.then((e=>{const t=(e.dependencies||[]).map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)})),s={id:e,originalId:t,module:Object.create(null),dependencyRecords:i,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,s),e!==t&&this.storeModuleAlias(t,e),i.then((()=>s))}storeModuleAlias(e,t){if(e!==t)if(this.aliases.has(e)){if("production"!==process.env.NODE_ENV&&hasConsole){const r=this.aliases.get(e);if(r!==t){const o=`${e}=>${r}, ${t}`;this.warnings[MODULE_WARNING.ALIAS_UPDATE].includes(o)||this.warnings[MODULE_WARNING.ALIAS_UPDATE].push(o),this.isAppMounted&&this.logMessage("warning",`${MODULE_WARNING.ALIAS_UPDATE}: ${o}`)}}}else this.aliases.set(e,t)}async getModuleDependencyRecord(e){let t=await this.resolve(e);if(isUrl(t)){const r=this.moduleRegistry.get(t);r&&!this.aliases.has(e)&&(await r.instantiation,t=await this.resolve(e))}return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return this.evaluateModule(e,{})}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:i}=await e.instantiation,s={},n=i?await Promise.all(i.map((async e=>{if("exports"===e)return s;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])}))):[];if(e.evaluated)return e.module;let a;try{a=o(...n)}catch(t){throw new LoaderError(EXPORTER_ERROR,[e.id,t.message||t])}void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(s)&&Object.defineProperty(s,"__useDefault",{value:!0});const l=a||s;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const i=this.resolver.getBaseUrl(),s=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:s}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,i),s=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===s)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(s&&null!==s)return evaluateLoadHookResponse(s,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(this.logMessage("warning",`${r} not found, falling back to the last loader.define call`),o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:s}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:s}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}getModuleWarnings(e=!1){return this.isAppMounted=e,this.warnings}logMessage(e,t){hasConsole&&"production"!==process.env.NODE_ENV&&("warning"==e?console.warn(t):console.log(t))}}function _nullishCoalesce(e,t){return null!=e?e:t()}function validateLoadSpecifier(e,t,r,o){const{LoaderError:i,NO_IMPORT_LWC:s,NO_IMPORT_LOADER:n,NO_IMPORT_TRANSPORT:a,NO_BLOB_IMPORT:l}=o;if("lwc"===e||e.startsWith("lwc/v/"))throw new i(s,[_nullishCoalesce(t,(()=>"unknown"))]);if(e===r||e.startsWith(`${r}/v/`))throw new i(n,[_nullishCoalesce(t,(()=>"unknown"))]);if("transport"===e||e.startsWith("transport/v/")||"webruntime/transport"===e||e.startsWith("webruntime/transport/v/"))throw new i(a,[_nullishCoalesce(t,(()=>"unknown"))]);if(e.toLowerCase().startsWith("blob:"))throw new i(l)}function assertValidImportMapUrlKey(e){const t=e.toLowerCase();if(t.startsWith("blob:"))throw new Error(`Cannot map ${e} to blob: URL`);if(t.startsWith("data:"))throw new Error(`Cannot map ${e} to data: URL`);if(!/^[./]|^https?:/.test(e))throw new Error(`LWR.importMap(): "${e}" is not a valid URL key. Keys must be URL paths (e.g. "/path/to/module.js"), not module specifiers. Transitive specifier aliasing is not supported by this loader.`)}function validateAndWrapAsImportMetadata(e){if(!e||"object"!=typeof e)throw new Error("LWR.importMap() requires an object argument");const t=Object.entries(e);if(0===t.length)return null;const r=new Set,o={};for(const[e,i]of t){if(!e||"string"!=typeof e)throw new Error("moduleScriptURL must be a string");if(!Array.isArray(i))throw new Error("moduleNames must be an array");assertValidImportMapUrlKey(e);const t=[];for(const e of i){if("string"!=typeof e||0===e.length)throw new Error("Specifier must be a non-empty string");r.has(e)||(r.add(e),t.push(e))}t.length>0&&(o[e]=t)}return 0===Object.keys(o).length?null:{imports:o}}function isImportMetadata(e){const t=e;return null!==t&&"object"==typeof t&&"imports"in t&&"object"==typeof t.imports&&!Array.isArray(t.imports)}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r||!e.endpoints)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o,flags:e.flags||{}})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,i=t;"function"==typeof i&&(o=t,i=[]),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,o)}async load(e,t){return validateLoadSpecifier(e,t,"lwr/loader",{LoaderError:LoaderError,NO_IMPORT_LWC:NO_IMPORT_LWC,NO_IMPORT_LOADER:NO_IMPORT_LOADER,NO_IMPORT_TRANSPORT:NO_IMPORT_TRANSPORT,NO_BLOB_IMPORT:NO_BLOB_IMPORT}),this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async importMap(e,t){if(isImportMetadata(e))return void this.registry.getImportMetadataResolver().registerImportMappings(e,t);const r=this.registry.getImportMetadataResolver(),o=validateAndWrapAsImportMetadata(e);if(!o)return;const i={};for(const[e,t]of Object.entries(o.imports)){const o=[];for(const e of t){void 0!==r.getMappingUri(e)||o.push(e)}o.length>0&&(i[e]=o)}if(0===Object.keys(i).length)return;const s={imports:i},n=Object.values(s.imports).flat();r.registerImportMappings(s,n)}async registerImportMappings(e,t){return hasConsole&&console.warn("registerImportMappings() is deprecated. Use importMap() instead."),this.importMap(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}getModuleWarnings(e=!1){return this.registry.getModuleWarnings(e)}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],s=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=s(r)):"call"!==i&&"optionalCall"!==i||(r=s(((...e)=>r.call(t,...e))),t=void 0)}return r}const configOptions={format:"amd",apiVersion:"v57.0",apiPrefix:"/lwr",bundle:!0,debug:!1},configuration=getConfiguration(configOptions),{bootstrapModule:bootstrapModule,endpoints:endpoints,baseUrl:baseUrl,imports:imports,index:index}=configuration,loader=new Loader({endpoints:endpoints,baseUrl:baseUrl});loader.define("lwr/loader/v/0_0_1",["exports"],(e=>{Object.assign(e,{define:loader.define.bind(loader),load:loader.load.bind(loader)})})),await loader.registerImportMappings({imports:imports,index:index},[bootstrapModule]),globalThis.LWR=Object.freeze({define:loader.define.bind(loader)}),LWR.define("lwr/everywhereAmd/v/0_0_1",["exports","lwr/vault/v/0_0_1"],(function(e,t){async function r(e,r="javascript"){const o=t.getAuthInfo();return o?fetch(e,{headers:{Accept:`application/${r}`,Authorization:`Bearer ${o.access_token}`}}):null}e.authenticate=function(e){e&&t.setAuthInfo(e)},e.initAmd=function(e,t,o){t.match(/\/v5\d\.0\//)&&function(e,t,o){e.addLoaderPlugin({loadModule:async e=>r(e),loadMapping:async e=>{const o=await r(`${t}${encodeURIComponent(e)}`,"json");return o&&o.ok?o.json():null},resolveModule:e=>e&&!/\/v\/[^/]+?$/.test(e)?`${e}/v/${o}`:null})}(e,t,o)},Object.defineProperty(e,"__esModule",{value:!0})})),LWR.define("lwr/vault/v/0_0_1",["exports"],(function(e){let t;e.getAuthInfo=function(){return t},e.setAuthInfo=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})}));const{initAmd:initAmd,authenticate:authenticate}=await loader.load(bootstrapModule);async function createComponent(e,t,r={},o){const{createComponent:i}=await loader.load(bootstrapModule.replace("Amd",""));return i(e,t,r,o)}initAmd(loader.services,_optionalChain([endpoints,"optionalAccess",e=>e.uris,"access",e=>e.mapping]),"0_0_1");export{authenticate,createComponent};
@@ -52,7 +52,7 @@ function getConfiguration(options) {
52
52
  * SPDX-License-Identifier: MIT
53
53
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
54
54
  */
55
- /* LWR Module Loader v0.22.12 */
55
+ /* LWR Module Loader v0.22.13 */
56
56
  const templateRegex = /\{([0-9]+)\}/g;
57
57
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
58
  function templateString(template, args) {
@@ -484,11 +484,7 @@ class ImportMetadataResolver {
484
484
  return this.config.baseUrl || '';
485
485
  }
486
486
 
487
- registerImportMappings(newImportMetadata, rootSpecifiers) {
488
- if (!rootSpecifiers || rootSpecifiers.length === 0) {
489
- const imports = newImportMetadata ? JSON.stringify(newImportMetadata) : 'undefined';
490
- throw new LoaderError(BAD_IMPORT_METADATA, [imports, rootSpecifiers ? '[]' : 'undefined']);
491
- }
487
+ registerImportMappings(newImportMetadata, rootSpecifiers = []) {
492
488
  if (!newImportMetadata) {
493
489
  throw new LoaderError(BAD_IMPORT_METADATA, ['undefined', JSON.stringify(rootSpecifiers)]);
494
490
  }
@@ -498,6 +494,8 @@ class ImportMetadataResolver {
498
494
  JSON.stringify(rootSpecifiers),
499
495
  ]);
500
496
  }
497
+ // An empty rootSpecifiers list is valid for non-bootstrap registrations;
498
+ // any specifier not in the list receives isRoot: false.
501
499
  const index = newImportMetadata.index || {};
502
500
  for (const [uri, specifiers] of Object.entries(newImportMetadata.imports)) {
503
501
  specifiers.forEach((specifier) => {
@@ -520,6 +518,16 @@ class ImportMetadataResolver {
520
518
  }
521
519
  }
522
520
 
521
+ /**
522
+ * Returns the raw URI stored for a specifier, or `undefined` if not yet mapped.
523
+ * Used by the runtime `importMap()` path to detect cross-call duplicates while
524
+ * allowing truly idempotent re-registrations (same specifier, same URI) to pass
525
+ * through silently.
526
+ */
527
+ getMappingUri(specifier) {
528
+ return _optionalChain$1([this, 'access', _ => _.importURICache, 'access', _2 => _2.get, 'call', _3 => _3(specifier), 'optionalAccess', _4 => _4.uri]);
529
+ }
530
+
523
531
  // Get URL from the local cache or return undefiend
524
532
  getURI(specifier) {
525
533
  return this.importURICache && this.importURICache.has(specifier)
@@ -617,7 +625,7 @@ class ImportMetadataResolver {
617
625
  }
618
626
 
619
627
  async fetchNewMappings(specifier) {
620
- if (!hasSetTimeout || !_optionalChain$1([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.flags, 'optionalAccess', _3 => _3.batchMappings])) {
628
+ if (!hasSetTimeout || !_optionalChain$1([this, 'access', _5 => _5.config, 'optionalAccess', _6 => _6.flags, 'optionalAccess', _7 => _7.batchMappings])) {
621
629
  return this.fetchNewMappingsInner(specifier);
622
630
  }
623
631
 
@@ -1707,6 +1715,101 @@ function validateLoadSpecifier(
1707
1715
  }
1708
1716
  }
1709
1717
 
1718
+ /**
1719
+ * Ensures the update object key is a safe, loader-supported script URL (not a bare specifier).
1720
+ * Covers dangerous schemes and URL-key shape in one place.
1721
+ */
1722
+ function assertValidImportMapUrlKey(moduleScriptURL) {
1723
+ const lowerUri = moduleScriptURL.toLowerCase();
1724
+
1725
+ if (lowerUri.startsWith('blob:')) {
1726
+ throw new Error(`Cannot map ${moduleScriptURL} to blob: URL`);
1727
+ }
1728
+
1729
+ if (lowerUri.startsWith('data:')) {
1730
+ throw new Error(`Cannot map ${moduleScriptURL} to data: URL`);
1731
+ }
1732
+
1733
+ if (!/^[./]|^https?:/.test(moduleScriptURL)) {
1734
+ throw new Error(
1735
+ `LWR.importMap(): "${moduleScriptURL}" is not a valid URL key. Keys must be URL paths (e.g. "/path/to/module.js"), not module specifiers. Transitive specifier aliasing is not supported by this loader.`,
1736
+ );
1737
+ }
1738
+ }
1739
+
1740
+ /**
1741
+ * Validates an ImportMapUpdate and wraps it as ImportMetadata for the fingerprints loader.
1742
+ *
1743
+ * Does not apply legacy-style protected-specifier blocking; system modules are expected to be
1744
+ * defined at bootstrap, and `importMap` write-once semantics handle redundant runtime entries.
1745
+ *
1746
+ * Duplicate specifiers in the same update are de-duplicated silently (first occurrence wins).
1747
+ * An empty object is a silent no-op (returns null).
1748
+ */
1749
+ function validateAndWrapAsImportMetadata(update) {
1750
+ if (!update || typeof update !== 'object') {
1751
+ throw new Error('LWR.importMap() requires an object argument');
1752
+ }
1753
+
1754
+ const entries = Object.entries(update);
1755
+ if (entries.length === 0) {
1756
+ return null;
1757
+ }
1758
+
1759
+ const seenSpecifiers = new Set();
1760
+ const validatedImports = {};
1761
+
1762
+ for (const [moduleScriptURL, moduleNames] of entries) {
1763
+ if (!moduleScriptURL || typeof moduleScriptURL !== 'string') {
1764
+ throw new Error('moduleScriptURL must be a string');
1765
+ }
1766
+
1767
+ if (!Array.isArray(moduleNames)) {
1768
+ throw new Error('moduleNames must be an array');
1769
+ }
1770
+
1771
+ assertValidImportMapUrlKey(moduleScriptURL);
1772
+
1773
+ const validatedNames = [];
1774
+ for (const moduleName of moduleNames) {
1775
+ if (typeof moduleName !== 'string' || moduleName.length === 0) {
1776
+ throw new Error('Specifier must be a non-empty string');
1777
+ }
1778
+
1779
+ if (!seenSpecifiers.has(moduleName)) {
1780
+ seenSpecifiers.add(moduleName);
1781
+ validatedNames.push(moduleName);
1782
+ }
1783
+ }
1784
+
1785
+ if (validatedNames.length > 0) {
1786
+ validatedImports[moduleScriptURL] = validatedNames;
1787
+ }
1788
+ }
1789
+
1790
+ if (Object.keys(validatedImports).length === 0) {
1791
+ return null;
1792
+ }
1793
+
1794
+ return { imports: validatedImports };
1795
+ }
1796
+
1797
+ /**
1798
+ * Returns true when `update` carries the `ImportMetadata` shape (an `imports` object key),
1799
+ * signalling that it should be passed through to the resolver directly rather than treated
1800
+ * as a public-API `ImportMapUpdate`.
1801
+ */
1802
+ function isImportMetadata(update) {
1803
+ const candidate = update ;
1804
+ return (
1805
+ candidate !== null &&
1806
+ typeof candidate === 'object' &&
1807
+ 'imports' in candidate &&
1808
+ typeof candidate.imports === 'object' &&
1809
+ !Array.isArray(candidate.imports)
1810
+ );
1811
+ }
1812
+
1710
1813
  /**
1711
1814
  * The LWR loader is inspired and borrows from the algorithms and native browser principles of https://github.com/systemjs/systemjs
1712
1815
  */
@@ -1840,8 +1943,75 @@ class Loader {
1840
1943
  return this.registry.resolve(id, importer);
1841
1944
  }
1842
1945
 
1946
+ /**
1947
+ * Apply import map updates at runtime, or register bootstrap import mappings.
1948
+ *
1949
+ * **Runtime usage** (public API, consistent with `LWR.importMap()` on the legacy loader):
1950
+ * `importMap({ [moduleScriptURL]: [moduleName1, moduleName2, ...] })`
1951
+ * Validates the update and registers the new mappings dynamically.
1952
+ *
1953
+ * **Bootstrap / internal usage** (replaces `registerImportMappings`):
1954
+ * `importMap(importMetadata)` or `importMap(importMetadata, rootSpecifiers)`
1955
+ * Detected at runtime by the `ImportMetadata` shape (presence of an `imports` object).
1956
+ * This branch **does not** run `validateAndWrapAsImportMetadata` (URL-key checks /
1957
+ * runtime-payload dedupe). That is intentional: bootstrap must preserve
1958
+ * `index` fingerprints and use `ImportMetadataResolver.registerImportMappings` merge
1959
+ * semantics unchanged from the pre-`importMap` API.
1960
+ *
1961
+ * **Who may use this branch:** Platform/shim code with trusted config (see
1962
+ * `shim/shim.ts`, which calls `loader.importMap({ imports, index }, roots)`). The
1963
+ * public `LWR.importMap` wrapper only forwards the flat runtime update shape; any
1964
+ * code with a direct `Loader` reference could still pass an `ImportMetadata`-shaped
1965
+ * object — same trust boundary as calling `registerImportMappings` before.
1966
+ *
1967
+ * @param update - Runtime: `ImportMapUpdate` mapping script URLs to the module names they define.
1968
+ * Bootstrap: `ImportMetadata` with an `imports` object (and optional `index`).
1969
+ * @param rootSpecifiers - Bootstrap only: root module specifiers for the initial registration.
1970
+ * Optional — omit when the root specifiers are not known.
1971
+ */
1972
+ async importMap(update, rootSpecifiers) {
1973
+ if (isImportMetadata(update)) {
1974
+ this.registry.getImportMetadataResolver().registerImportMappings(update, rootSpecifiers);
1975
+ return;
1976
+ }
1977
+ const resolver = this.registry.getImportMetadataResolver();
1978
+ const importMetadata = validateAndWrapAsImportMetadata(update );
1979
+ if (!importMetadata) {
1980
+ return;
1981
+ }
1982
+
1983
+ const dedupedImports = {};
1984
+ for (const [uri, specifiers] of Object.entries(importMetadata.imports)) {
1985
+ const newSpecifiers = [];
1986
+ for (const specifier of specifiers) {
1987
+ const existingUri = resolver.getMappingUri(specifier);
1988
+ if (existingUri !== undefined) ; else {
1989
+ newSpecifiers.push(specifier);
1990
+ }
1991
+ }
1992
+ if (newSpecifiers.length > 0) {
1993
+ dedupedImports[uri] = newSpecifiers;
1994
+ }
1995
+ }
1996
+
1997
+ if (Object.keys(dedupedImports).length === 0) {
1998
+ return;
1999
+ }
2000
+
2001
+ const filtered = { imports: dedupedImports };
2002
+ const specs = Object.values(filtered.imports).flat();
2003
+ resolver.registerImportMappings(filtered, specs);
2004
+ }
2005
+
2006
+ /**
2007
+ * @deprecated Use `importMap(metadata, rootSpecifiers)` instead.
2008
+ */
1843
2009
  async registerImportMappings(mappings, rootSpecifiers) {
1844
- this.registry.getImportMetadataResolver().registerImportMappings(mappings, rootSpecifiers);
2010
+ if (hasConsole) {
2011
+ // eslint-disable-next-line lwr/no-unguarded-apis
2012
+ console.warn('registerImportMappings() is deprecated. Use importMap() instead.');
2013
+ }
2014
+ return this.importMap(mappings, rootSpecifiers);
1845
2015
  }
1846
2016
 
1847
2017
  /**
@@ -1879,12 +2049,12 @@ await loader.registerImportMappings({ imports, index }, [bootstrapModule]);
1879
2049
  (globalThis ).LWR = Object.freeze({ define: loader.define.bind(loader) });
1880
2050
 
1881
2051
  // Define preload modules (ie: ABS, vault, etc) BEFORE loading them
1882
- LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (function (exports, _0_22_12) {
2052
+ LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (function (exports, _0_22_13) {
1883
2053
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
1884
2054
 
1885
2055
  // Do an OAuthed fetch
1886
2056
  async function authFetch(url, accept = 'javascript') {
1887
- const authInfo = _0_22_12.getAuthInfo();
2057
+ const authInfo = _0_22_13.getAuthInfo();
1888
2058
  if (authInfo) {
1889
2059
  return fetch(url, {
1890
2060
  headers: {
@@ -1933,7 +2103,7 @@ LWR.define('lwr/everywhereAmd/v/0_0_1', ['exports', 'lwr/vault/v/0_0_1'], (funct
1933
2103
  function authenticate(authInfo) {
1934
2104
  // Put OAuth info into the vault
1935
2105
  if (authInfo) {
1936
- _0_22_12.setAuthInfo(authInfo);
2106
+ _0_22_13.setAuthInfo(authInfo);
1937
2107
  }
1938
2108
  }
1939
2109