@module-federation/bridge-vue3 2.0.0 → 2.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @module-federation/bridge-vue3
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [918294f]
8
+ - Updated dependencies [918294f]
9
+ - @module-federation/runtime@2.1.0
10
+ - @module-federation/sdk@2.1.0
11
+ - @module-federation/bridge-shared@2.1.0
12
+
13
+ ## 2.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - @module-federation/runtime@2.0.1
18
+ - @module-federation/sdk@2.0.1
19
+ - @module-federation/bridge-shared@2.0.1
20
+
3
21
  ## 2.0.0
4
22
 
5
23
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter),MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"&&typeof window.document<"u"}function isReactNativeEnv(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function isBrowserDebug(){try{if(isBrowserEnv()&&window.localStorage)return!!localStorage.getItem(BROWSER_LOG_KEY)}catch{return!1}return!1}function isDebugMode(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:isBrowserDebug()}const LOG_CATEGORY$1="[ Federation Runtime ]",composeKeyWithSeparator=function(...r){return r.length?r.reduce((t,n)=>n?t?`${t}${SEPARATOR}${n}`:n:t,""):""},getResourceUrl=(r,t)=>{if("getPublicPath"in r){let n;return r.getPublicPath.startsWith("function")?n=new Function("return "+r.getPublicPath)()():n=new Function(r.getPublicPath)(),`${n}${t}`}else return"publicPath"in r?!isBrowserEnv()&&!isReactNativeEnv()&&"ssrPublicPath"in r?`${r.ssrPublicPath}${t}`:`${r.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",r,t),"")},warn$1=r=>{console.warn(`${LOG_CATEGORY$1}: ${r}`)};function safeToString(r){try{return JSON.stringify(r,null,2)}catch{return""}}const simpleJoinRemoteEntry=(r,t)=>{if(!r)return t;const o=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const i=s.slice(1);return i.endsWith("/")?i.slice(0,-1):i}return s})(r);return o?o.endsWith("/")?`${o}${t}`:`${o}/${t}`:t};function inferAutoPublicPath(r){return r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(r,t={}){var R,_,I;const{remotes:n={},overrides:o={},version:s}=t;let i;const c=()=>"publicPath"in r.metaData?r.metaData.publicPath==="auto"&&s?inferAutoPublicPath(s):r.metaData.publicPath:r.metaData.getPublicPath,a=Object.keys(o);let u={};Object.keys(n).length||(u=((R=r.remotes)==null?void 0:R.reduce((S,T)=>{let A;const w=T.federationContainerName;return a.includes(w)?A=o[w]:"version"in T?A=T.version:A=T.entry,S[w]={matchedVersion:A},S},{}))||{}),Object.keys(n).forEach(S=>u[S]={matchedVersion:a.includes(S)?o[S]:n[S]});const{remoteEntry:{path:l,name:d,type:m},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:p},globalName:y,ssrRemoteEntry:E}=r.metaData,{exposes:g}=r;let b={version:s||"",buildVersion:p,globalName:y,remoteEntry:simpleJoinRemoteEntry(l,d),remoteEntryType:m,remoteTypes:simpleJoinRemoteEntry(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:u,shared:r==null?void 0:r.shared.map(S=>({assets:S.assets,sharedName:S.name,version:S.version,usedExports:S.referenceExports||[]})),modules:g==null?void 0:g.map(S=>({moduleName:S.name,modulePath:S.path,assets:S.assets}))};if((_=r.metaData)!=null&&_.prefetchInterface){const S=r.metaData.prefetchInterface;b={...b,prefetchInterface:S}}if((I=r.metaData)!=null&&I.prefetchEntry){const{path:S,name:T,type:A}=r.metaData.prefetchEntry;b={...b,prefetchEntry:simpleJoinRemoteEntry(S,T),prefetchEntryType:A}}if("publicPath"in r.metaData?i={...b,publicPath:c(),ssrPublicPath:r.metaData.ssrPublicPath}:i={...b,getPublicPath:c()},E){const S=simpleJoinRemoteEntry(E.path,E.name);i.ssrRemoteEntry=S,i.ssrRemoteEntryType=E.type||"commonjs-module"}return i}function isManifestProvider(r){return!!("remoteEntry"in r&&r.remoteEntry.includes(MANIFEST_EXT))}const PREFIX="[ Module Federation ]",DEFAULT_DELEGATE=console,LOGGER_STACK_SKIP_TOKENS=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function captureStackTrace(){try{const r=new Error().stack;if(!r)return;const[,...t]=r.split(`
2
- `),n=t.filter(s=>!LOGGER_STACK_SKIP_TOKENS.some(i=>s.includes(i)));return n.length?`Stack trace:
3
- ${n.slice(0,5).join(`
4
- `)}`:void 0}catch{return}}class Logger{constructor(t,n=DEFAULT_DELEGATE){this.prefix=t,this.delegate=n??DEFAULT_DELEGATE}setPrefix(t){this.prefix=t}setDelegate(t){this.delegate=t??DEFAULT_DELEGATE}emit(t,n){const o=this.delegate,i=isDebugMode()?captureStackTrace():void 0,c=i?[...n,i]:n,a=(()=>{switch(t){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];case"debug":default:return["debug","log"]}})();for(const u of a){const l=o[u];if(typeof l=="function"){l.call(o,this.prefix,...c);return}}for(const u of a){const l=DEFAULT_DELEGATE[u];if(typeof l=="function"){l.call(DEFAULT_DELEGATE,this.prefix,...c);return}}}log(...t){this.emit("log",t)}warn(...t){this.emit("warn",t)}error(...t){this.emit("error",t)}success(...t){this.emit("info",t)}info(...t){this.emit("info",t)}ready(...t){this.emit("info",t)}debug(...t){isDebugMode()&&this.emit("debug",t)}}function createLogger(r){return new Logger(r)}function createInfrastructureLogger(r){const t=new Logger(r);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}createInfrastructureLogger(PREFIX);async function safeWrapper(r,t){try{return await r()}catch(n){warn$1(n);return}}function isStaticResourcesEqual(r,t){const n=/^(https?:)?\/\//i,o=r.replace(n,"").replace(/\/$/,""),s=t.replace(n,"").replace(/\/$/,"");return o===s}function createScript(r){let t=null,n=!0,o=2e4,s;const i=document.getElementsByTagName("script");for(let a=0;a<i.length;a++){const u=i[a],l=u.getAttribute("src");if(l&&isStaticResourcesEqual(l,r.url)){t=u,n=!1;break}}if(!t){const a=r.attrs;t=document.createElement("script"),t.type=(a==null?void 0:a.type)==="module"?"module":"text/javascript";let u;r.createScriptHook&&(u=r.createScriptHook(r.url,r.attrs),u instanceof HTMLScriptElement?t=u:typeof u=="object"&&("script"in u&&u.script&&(t=u.script),"timeout"in u&&u.timeout&&(o=u.timeout))),t.src||(t.src=r.url),a&&!u&&Object.keys(a).forEach(l=>{t&&(l==="async"||l==="defer"?t[l]=a[l]:t.getAttribute(l)||t.setAttribute(l,a[l]))})}const c=async(a,u)=>{clearTimeout(s);const l=()=>{(u==null?void 0:u.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(u)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:d=!0}=r;d&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),a&&typeof a=="function")){const d=a(u);if(d instanceof Promise){const m=await d;return l(),m}return l(),d}l()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),s=setTimeout(()=>{c(null,new Error(`Remote script "${r.url}" time-outed.`))},o),{script:t,needAttach:n}}function createLink(r){let t=null,n=!0;const o=document.getElementsByTagName("link");for(let i=0;i<o.length;i++){const c=o[i],a=c.getAttribute("href"),u=c.getAttribute("rel");if(a&&isStaticResourcesEqual(a,r.url)&&u===r.attrs.rel){t=c,n=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",r.url);let i;const c=r.attrs;r.createLinkHook&&(i=r.createLinkHook(r.url,c),i instanceof HTMLLinkElement&&(t=i)),c&&!i&&Object.keys(c).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,c[a])})}const s=(i,c)=>{const a=()=>{(c==null?void 0:c.type)==="error"?r!=null&&r.onErrorCallback&&(r==null||r.onErrorCallback(c)):r!=null&&r.cb&&(r==null||r.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:u=!0}=r;u&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i)){const u=i(c);return a(),u}a()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:n}}function loadScript(r,t){const{attrs:n={},createScriptHook:o}=t;return new Promise((s,i)=>{const{script:c,needAttach:a}=createScript({url:r,cb:s,onErrorCallback:i,attrs:{fetchpriority:"high",...n},createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(c)})}const sdkImportCache=new Map;function importNodeModule(r){if(!r)throw new Error("import specifier is required");if(sdkImportCache.has(r))return sdkImportCache.get(r);const n=new Function("name","return import(name)")(r).then(o=>o).catch(o=>{throw console.error(`Error importing module ${r}:`,o),sdkImportCache.delete(r),o});return sdkImportCache.set(r,n),n}const loadNodeFetch=async()=>{const r=await importNodeModule("node-fetch");return r.default||r},lazyLoaderHookFetch=async(r,t,n)=>{const s=await((i,c)=>n.lifecycle.fetch.emit(i,c))(r,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(r,t||{}):s},createScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(url,cb,attrs,loaderHook)=>{if(loaderHook!=null&&loaderHook.createScriptHook){const r=loaderHook.createScriptHook(url);r&&typeof r=="object"&&"url"in r&&(url=r.url)}let urlObj;try{urlObj=new URL(url)}catch(r){console.error("Error constructing URL:",r),cb(new Error(`Invalid URL: ${r}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(r,t)=>lazyLoaderHookFetch(r,t,loaderHook):typeof fetch>"u"?loadNodeFetch():fetch,handleScriptFetch=async(f,urlObj)=>{var r;try{const res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([importNodeModule("path"),importNodeModule("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname),script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
5
- })`,{filename,importModuleDynamically:((r=vm.constants)==null?void 0:r.USE_MAIN_CONTEXT_DEFAULT_LOADER)??importNodeModule});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);const exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){const t=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,t);return}cb(void 0,exportedInterface)}catch(t){cb(t instanceof Error?t:new Error(`Script execution error: ${t}`))}};getFetch().then(async r=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:r,vm:await importNodeModule("vm")}).then(async t=>{await t.evaluate(),cb(void 0,t.namespace)}).catch(t=>{cb(t instanceof Error?t:new Error(`Script execution error: ${t}`))});handleScriptFetch(r,urlObj)}).catch(r=>{cb(r)})}:(r,t,n,o)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},loadScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(r,t)=>new Promise((n,o)=>{createScriptNode(r,(s,i)=>{var c,a;if(s)o(s);else{const u=((c=t==null?void 0:t.attrs)==null?void 0:c.globalName)||`__FEDERATION_${(a=t==null?void 0:t.attrs)==null?void 0:a.name}:custom__`,l=globalThis[u]=i;n(l)}},t.attrs,t.loaderHook)}):(r,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},esmModuleCache=new Map;async function loadModule(r,t){if(esmModuleCache.has(r))return esmModuleCache.get(r);const{fetch:n,vm:o}=t,i=await(await n(r)).text(),c=new o.SourceTextModule(i,{importModuleDynamically:async(a,u)=>{const l=new URL(a,r).href;return loadModule(l,t)}});return esmModuleCache.set(r,c),await c.link(async a=>{const u=new URL(a,r).href;return await loadModule(u,t)}),c}const LoggerInstance=createLogger("[ Module Federation Bridge Vue3 ]"),RUNTIME_001="RUNTIME-001",RUNTIME_002="RUNTIME-002",RUNTIME_003="RUNTIME-003",RUNTIME_004="RUNTIME-004",RUNTIME_005="RUNTIME-005",RUNTIME_006="RUNTIME-006",RUNTIME_007="RUNTIME-007",RUNTIME_008="RUNTIME-008",RUNTIME_009="RUNTIME-009",getDocsUrl=r=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}#${r.toLowerCase()}`,getShortErrorMsg=(r,t,n,o)=>{const s=[`${[t[r]]} #${r}`];return n&&s.push(`args: ${JSON.stringify(n)}`),s.push(getDocsUrl(r)),o&&s.push(`Original Error Message:
6
- ${o}`),s.join(`
7
- `)},runtimeDescMap={[RUNTIME_001]:"Failed to get remoteEntry exports.",[RUNTIME_002]:'The remote entry interface does not contain "init"',[RUNTIME_003]:"Failed to get manifest.",[RUNTIME_004]:"Failed to locate remote.",[RUNTIME_005]:"Invalid loadShareSync function call from bundler runtime",[RUNTIME_006]:"Invalid loadShareSync function call from runtime",[RUNTIME_007]:"Failed to get remote snapshot.",[RUNTIME_008]:"Failed to load script resources.",[RUNTIME_009]:"Please call createInstance first."},LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(r,t){r||error(t)}function error(r){throw r instanceof Error?(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`),r):new Error(`${LOG_CATEGORY}: ${r}`)}function warn(r){r instanceof Error&&(r.message.startsWith(LOG_CATEGORY)||(r.message=`${LOG_CATEGORY}: ${r.message}`)),logger.warn(r)}function addUniqueItem(r,t){return r.findIndex(n=>n===t)===-1&&r.push(t),r}function getFMId(r){return"version"in r&&r.version?`${r.name}:${r.version}`:"entry"in r&&r.entry?`${r.name}:${r.entry}`:`${r.name}`}function isRemoteInfoWithEntry(r){return typeof r.entry<"u"}function isPureRemoteEntry(r){return!r.entry.includes(".json")}function isObject(r){return r&&typeof r=="object"}const objectToString=Object.prototype.toString;function isPlainObject(r){return objectToString.call(r)==="[object Object]"}function arrayOptions(r){return Array.isArray(r)?r:[r]}function getRemoteEntryInfoFromSnapshot(r){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()||!("ssrRemoteEntry"in r)?"remoteEntry"in r?{url:r.remoteEntry,type:r.remoteEntryType,globalName:r.globalName}:t:"ssrRemoteEntry"in r?{url:r.ssrRemoteEntry||t.url,type:r.ssrRemoteEntryType||t.type,globalName:r.globalName}:t}const processModuleAlias=(r,t)=>{let n;return r.endsWith("/")?n=r.slice(0,-1):n=r,t.startsWith(".")&&(t=t.slice(1)),n=n+t,n},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(r,t,n){Object.defineProperty(r,t,{value:n,configurable:!1,writable:!0})}function includeOwnProperty(r,t){return Object.hasOwnProperty.call(r,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(r){var t,n,o,s,i,c;includeOwnProperty(r,"__VMOK__")&&!includeOwnProperty(r,"__FEDERATION__")&&definePropertyGlobalVal(r,"__FEDERATION__",r.__VMOK__),includeOwnProperty(r,"__FEDERATION__")||(definePropertyGlobalVal(r,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(r,"__VMOK__",r.__FEDERATION__)),(t=r.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(n=r.__FEDERATION__).__INSTANCES__??(n.__INSTANCES__=[]),(o=r.__FEDERATION__).moduleInfo??(o.moduleInfo={}),(s=r.__FEDERATION__).__SHARE__??(s.__SHARE__={}),(i=r.__FEDERATION__).__MANIFEST_LOADING__??(i.__MANIFEST_LOADING__={}),(c=r.__FEDERATION__).__PRELOADED_MAP__??(c.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(r,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=r,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.0.0")}function getInfoWithoutType(r,t){if(typeof t=="string"){if(r[t])return{value:r[t],key:t};{const o=Object.keys(r);for(const s of o){const[i,c]=s.split(":"),a=`${i}:${t}`,u=r[a];if(u)return{value:u,key:a}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(r,t)=>{const n=getFMId(r),o=getInfoWithoutType(t,n).value;if(o&&!o.version&&"version"in r&&r.version&&(o.version=r.version),o)return o;if("version"in r&&r.version){const{version:s,...i}=r,c=getFMId(i),a=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,c).value;if((a==null?void 0:a.version)===s)return a}},getGlobalSnapshotInfoByModuleInfo=r=>getTargetSnapshotInfoByModuleInfo(r,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(r,t)=>{const n=getFMId(r);return nativeGlobal.__FEDERATION__.moduleInfo[n]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=r=>(nativeGlobal.__FEDERATION__.moduleInfo={...nativeGlobal.__FEDERATION__.moduleInfo,...r},()=>{const t=Object.keys(r);for(const n of t)delete nativeGlobal.__FEDERATION__.moduleInfo[n]}),getRemoteEntryExports=(r,t)=>{const n=t||`__FEDERATION_${r}:custom__`,o=CurrentGlobal[n];return{remoteEntryKey:n,entryExports:o}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r),setPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(r){return new RegExp(r)}function isXVersion(r){return!r||r.toLowerCase()==="x"||r==="*"}function pipe(...r){return t=>r.reduce((n,o)=>o(n),t)}function extractComparator(r){return r.match(parseRegex(comparator))}function combineVersion(r,t,n,o){const s=`${r}.${t}.${n}`;return o?`${s}-${o}`:s}function parseHyphen(r){return r.replace(parseRegex(hyphenRange),(t,n,o,s,i,c,a,u,l,d,m,h)=>(isXVersion(o)?n="":isXVersion(s)?n=`>=${o}.0.0`:isXVersion(i)?n=`>=${o}.${s}.0`:n=`>=${n}`,isXVersion(l)?u="":isXVersion(d)?u=`<${Number(l)+1}.0.0-0`:isXVersion(m)?u=`<${l}.${Number(d)+1}.0-0`:h?u=`<=${l}.${d}.${m}-${h}`:u=`<=${u}`,`${n} ${u}`.trim()))}function parseComparatorTrim(r){return r.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(r){return r.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(r){return r.replace(parseRegex(caretTrim),"$1^")}function parseCarets(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(n,o,s,i,c)=>isXVersion(o)?"":isXVersion(s)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:isXVersion(i)?o==="0"?`>=${o}.${s}.0 <${o}.${Number(s)+1}.0-0`:`>=${o}.${s}.0 <${Number(o)+1}.0.0-0`:c?o==="0"?s==="0"?`>=${o}.${s}.${i}-${c} <${o}.${s}.${Number(i)+1}-0`:`>=${o}.${s}.${i}-${c} <${o}.${Number(s)+1}.0-0`:`>=${o}.${s}.${i}-${c} <${Number(o)+1}.0.0-0`:o==="0"?s==="0"?`>=${o}.${s}.${i} <${o}.${s}.${Number(i)+1}-0`:`>=${o}.${s}.${i} <${o}.${Number(s)+1}.0-0`:`>=${o}.${s}.${i} <${Number(o)+1}.0.0-0`)).join(" ")}function parseTildes(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(n,o,s,i,c)=>isXVersion(o)?"":isXVersion(s)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:isXVersion(i)?`>=${o}.${s}.0 <${o}.${Number(s)+1}.0-0`:c?`>=${o}.${s}.${i}-${c} <${o}.${Number(s)+1}.0-0`:`>=${o}.${s}.${i} <${o}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(r){return r.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(n,o,s,i,c,a)=>{const u=isXVersion(s),l=u||isXVersion(i),d=l||isXVersion(c);return o==="="&&d&&(o=""),a="",u?o===">"||o==="<"?"<0.0.0-0":"*":o&&d?(l&&(i=0),c=0,o===">"?(o=">=",l?(s=Number(s)+1,i=0,c=0):(i=Number(i)+1,c=0)):o==="<="&&(o="<",l?s=Number(s)+1:i=Number(i)+1),o==="<"&&(a="-0"),`${o+s}.${i}.${c}${a}`):l?`>=${s}.0.0${a} <${Number(s)+1}.0.0-0`:d?`>=${s}.${i}.0${a} <${s}.${Number(i)+1}.0-0`:n})).join(" ")}function parseStar(r){return r.trim().replace(parseRegex(star),"")}function parseGTE0(r){return r.trim().replace(parseRegex(gte0),"")}function compareAtom(r,t){return r=Number(r)||r,t=Number(t)||t,r>t?1:r===t?0:-1}function comparePreRelease(r,t){const{preRelease:n}=r,{preRelease:o}=t;if(n===void 0&&o)return 1;if(n&&o===void 0)return-1;if(n===void 0&&o===void 0)return 0;for(let s=0,i=n.length;s<=i;s++){const c=n[s],a=o[s];if(c!==a)return c===void 0&&a===void 0?0:c?a?compareAtom(c,a):-1:1}return 0}function compareVersion(r,t){return compareAtom(r.major,t.major)||compareAtom(r.minor,t.minor)||compareAtom(r.patch,t.patch)||comparePreRelease(r,t)}function eq(r,t){return r.version===t.version}function compare(r,t){switch(r.operator){case"":case"=":return eq(r,t);case">":return compareVersion(r,t)<0;case">=":return eq(r,t)||compareVersion(r,t)<0;case"<":return compareVersion(r,t)>0;case"<=":return eq(r,t)||compareVersion(r,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(r){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(r)}function parseRange(r){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(r.trim()).split(/\s+/).join(" ")}function satisfy(r,t){if(!r)return!1;const n=extractComparator(r);if(!n)return!1;const[,o,,s,i,c,a]=n,u={operator:o,version:combineVersion(s,i,c,a),major:s,minor:i,patch:c,preRelease:a==null?void 0:a.split(".")},l=t.split("||");for(const d of l){const m=d.trim();if(!m||m==="*"||m==="x")return!0;try{const h=parseRange(m);if(!h.trim())return!0;const p=h.split(" ").map(g=>parseComparatorString(g)).join(" ");if(!p.trim())return!0;const y=p.split(/\s+/).map(g=>parseGTE0(g)).filter(Boolean);if(y.length===0)continue;let E=!0;for(const g of y){const b=extractComparator(g);if(!b){E=!1;break}const[,R,,_,I,S,T]=b,A={operator:R,version:combineVersion(_,I,S,T),major:_,minor:I,patch:S,preRelease:T==null?void 0:T.split(".")};if(!compare(A,u)){E=!1;break}}if(E)return!0}catch(h){console.error(`[semver] Error processing range part "${m}":`,h);continue}}return!1}function formatShare(r,t,n,o){var i;let s;if("get"in r?s=r.get:"lib"in r?s=()=>Promise.resolve(r.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${n}'!`)}),(i=r.shareConfig)!=null&&i.eager&&r.treeShaking)throw new Error('Can not set "eager:true" and "treeShaking" at the same time!');return{deps:[],useIn:[],from:t,loading:null,...r,shareConfig:{requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1,...r.shareConfig},get:s,loaded:r!=null&&r.loaded||"lib"in r?!0:void 0,version:r.version??"0",scope:Array.isArray(r.scope)?r.scope:[r.scope??"default"],strategy:(r.strategy??o)||"version-first",treeShaking:r.treeShaking?{...r.treeShaking,mode:r.treeShaking.mode??"server-calc",status:r.treeShaking.status??1,useIn:[]}:void 0}}function formatShareConfigs(r,t){const n=t.shared||{},o=t.name,s=Object.keys(n).reduce((c,a)=>{const u=arrayOptions(n[a]);return c[a]=c[a]||[],u.forEach(l=>{c[a].push(formatShare(l,o,a,t.shareStrategy))}),c},{}),i={...r.shared};return Object.keys(s).forEach(c=>{i[c]?s[c].forEach(a=>{i[c].find(l=>l.version===a.version)||i[c].push(a)}):i[c]=s[c]}),{allShareInfos:i,newShareInfos:s}}function shouldUseTreeShaking(r,t){if(!r)return!1;const{status:n,mode:o}=r;return n===0?!1:n===2?!0:o==="runtime-infer"?t?isMatchUsedExports(r,t):!0:!1}function versionLt(r,t){const n=o=>{if(!Number.isNaN(Number(o))){const i=o.split(".");let c=o;for(let a=0;a<3-i.length;a++)c+=".0";return c}return o};return!!satisfy(n(r),`<=${n(t)}`)}const findVersion=(r,t)=>{const n=t||function(o,s){return versionLt(o,s)};return Object.keys(r).reduce((o,s)=>!o||n(o,s)||o==="0"?s:o,0)},isLoaded=r=>!!r.loaded||typeof r.lib=="function",isLoading=r=>!!r.loading,isMatchUsedExports=(r,t)=>{if(!r||!t)return!1;const{usedExports:n}=r;return n?!!t.every(o=>n.includes(o)):!1};function findSingletonVersionOrderByVersion(r,t,n,o){const s=r[t][n];let i="",c=shouldUseTreeShaking(o);const a=function(u,l){return c?s[u].treeShaking?s[l].treeShaking?!isLoaded(s[u].treeShaking)&&versionLt(u,l):!1:!0:!isLoaded(s[u])&&versionLt(u,l)};if(c){if(i=findVersion(r[t][n],a),i)return{version:i,useTreesShaking:c};c=!1}return{version:findVersion(r[t][n],a),useTreesShaking:c}}const isLoadingOrLoaded=r=>isLoaded(r)||isLoading(r);function findSingletonVersionOrderByLoaded(r,t,n,o){const s=r[t][n];let i="",c=shouldUseTreeShaking(o);const a=function(u,l){if(c){if(!s[u].treeShaking)return!0;if(!s[l].treeShaking)return!1;if(isLoadingOrLoaded(s[l].treeShaking))return isLoadingOrLoaded(s[u].treeShaking)?!!versionLt(u,l):!0;if(isLoadingOrLoaded(s[u].treeShaking))return!1}return isLoadingOrLoaded(s[l])?isLoadingOrLoaded(s[u])?!!versionLt(u,l):!0:isLoadingOrLoaded(s[u])?!1:versionLt(u,l)};if(c){if(i=findVersion(r[t][n],a),i)return{version:i,useTreesShaking:c};c=!1}return{version:findVersion(r[t][n],a),useTreesShaking:c}}function getFindShareFunction(r){return r==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(r,t,n,o){if(!r)return;const{shareConfig:s,scope:i=DEFAULT_SCOPE,strategy:c,treeShaking:a}=n,u=Array.isArray(i)?i:[i];for(const l of u)if(s&&r[l]&&r[l][t]){const{requiredVersion:d}=s,m=getFindShareFunction(c),{version:h,useTreesShaking:p}=m(r,l,t,a),y=()=>{const b=r[l][t][h];if(s.singleton){if(typeof d=="string"&&!satisfy(h,d)){const R=`Version ${h} from ${h&&b.from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${d})`;s.strictVersion?error(R):warn(R)}return{shared:b,useTreesShaking:p}}else{if(d===!1||d==="*")return{shared:b,useTreesShaking:p};if(satisfy(h,d))return{shared:b,useTreesShaking:p};const R=shouldUseTreeShaking(a);if(R){for(const[_,I]of Object.entries(r[l][t]))if(shouldUseTreeShaking(I.treeShaking,a==null?void 0:a.usedExports)&&satisfy(_,d))return{shared:I,useTreesShaking:R}}for(const[_,I]of Object.entries(r[l][t]))if(satisfy(_,d))return{shared:I,useTreesShaking:!1}}},E={shareScopeMap:r,scope:l,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,shareInfo:n,resolver:y};return(o.emit(E)||E).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(r){const{pkgName:t,extraOptions:n,shareInfos:o}=r,s=u=>{if(!u)return;const l={};u.forEach(h=>{l[h.version]=h});const m=findVersion(l,function(h,p){return!isLoaded(l[h])&&versionLt(h,p)});return l[m]},i=(n==null?void 0:n.resolver)??s,c=u=>u!==null&&typeof u=="object"&&!Array.isArray(u),a=(...u)=>{const l={};for(const d of u)if(d)for(const[m,h]of Object.entries(d)){const p=l[m];c(p)&&c(h)?l[m]=a(p,h):h!==void 0&&(l[m]=h)}return l};return a(i(o[t]),n==null?void 0:n.customShareInfo)}const addUseIn=(r,t)=>{r.useIn||(r.useIn=[]),addUniqueItem(r.useIn,t)};function directShare(r,t){return t&&r.treeShaking?r.treeShaking:r}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(r,t){for(const n of r){const o=t.startsWith(n.name);let s=t.replace(n.name,"");if(o){if(s.startsWith("/")){const a=n.name;return s=`.${s}`,{pkgNameOrAlias:a,expose:s,remote:n}}else if(s==="")return{pkgNameOrAlias:n.name,expose:".",remote:n}}const i=n.alias&&t.startsWith(n.alias);let c=n.alias&&t.replace(n.alias,"");if(n.alias&&i){if(c&&c.startsWith("/")){const a=n.alias;return c=`.${c}`,{pkgNameOrAlias:a,expose:c,remote:n}}else if(c==="")return{pkgNameOrAlias:n.alias,expose:".",remote:n}}}}function matchRemote(r,t){for(const n of r)if(t===n.name||n.alias&&t===n.alias)return n}function registerPlugins(r,t){const n=getGlobalHostPlugins(),o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return n.length>0&&n.forEach(s=>{r!=null&&r.find(i=>i.name!==s.name)&&r.push(s)}),r&&r.length>0&&r.forEach(s=>{o.forEach(i=>{i.applyPlugin(s,t)})}),r}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:r,remoteEntryExports:t}){return new Promise((n,o)=>{try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${r}")${importCallback}`)([n,o]):import(r).then(n).catch(o)}catch(s){o(s)}})}async function loadSystemJsEntry({entry:r,remoteEntryExports:t}){return new Promise((n,o)=>{try{t?n(t):typeof __system_context__>"u"?System.import(r).then(n).catch(o):new Function("callbacks",`System.import("${r}")${importCallback}`)([n,o])}catch(s){o(s)}})}function handleRemoteEntryLoaded(r,t,n){const{remoteEntryKey:o,entryExports:s}=getRemoteEntryExports(r,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:r,remoteEntryUrl:n,remoteEntryKey:o})),s}async function loadEntryScript({name:r,globalName:t,entry:n,loaderHook:o,getEntryUrl:s}){const{entryExports:i}=getRemoteEntryExports(r,t);if(i)return i;const c=s?s(n):n;return loadScript(c,{attrs:{},createScriptHook:(a,u)=>{const l=o.lifecycle.createScript.emit({url:a,attrs:u});if(l&&(l instanceof HTMLScriptElement||"script"in l||"timeout"in l))return l}}).then(()=>handleRemoteEntryLoaded(r,t,n)).catch(a=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:r,resourceUrl:n})),a})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:n,getEntryUrl:o}){const{entry:s,entryGlobalName:i,name:c,type:a}=r;switch(a){case"esm":case"module":return loadEsmEntry({entry:s,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:s,remoteEntryExports:t});default:return loadEntryScript({entry:s,globalName:i,name:c,loaderHook:n,getEntryUrl:o})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:n,entryGlobalName:o,name:s,type:i}=r,{entryExports:c}=getRemoteEntryExports(s,o);return c||loadScriptNode(n,{attrs:{name:s,globalName:o,type:i},loaderHook:{createScriptHook:(a,u={})=>{const l=t.lifecycle.createScript.emit({url:a,attrs:u});if(l&&"url"in l)return l}}}).then(()=>handleRemoteEntryLoaded(s,o,n)).catch(a=>{throw a})}function getRemoteEntryUniqueKey(r){const{entry:t,name:n}=r;return composeKeyWithSeparator(n,t)}async function getRemoteEntry(r){const{origin:t,remoteEntryExports:n,remoteInfo:o,getEntryUrl:s,_inErrorHandling:i=!1}=r,c=getRemoteEntryUniqueKey(o);if(n)return n;if(!globalLoading[c]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,u=t.loaderHook;globalLoading[c]=a.emit({loaderHook:u,remoteInfo:o,remoteEntryExports:n}).then(l=>l||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:o,remoteEntryExports:n,loaderHook:u,getEntryUrl:s}):loadEntryNode({remoteInfo:o,loaderHook:u}))).catch(async l=>{const d=getRemoteEntryUniqueKey(o);if(l instanceof Error&&l.message.includes(RUNTIME_008)&&!i){const h=y=>getRemoteEntry({...y,_inErrorHandling:!0}),p=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:o,remoteEntryExports:n,globalLoading,uniqueKey:d});if(p)return p}throw l})}return globalLoading[c]}function getRemoteInfo(r){return{...r,entry:"entry"in r?r.entry:"",type:r.type||DEFAULT_REMOTE_TYPE,entryGlobalName:r.entryGlobalName||r.name,shareScope:r.shareScope||DEFAULT_SCOPE}}function defaultPreloadArgs(r){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...r}}function formatPreloadArgs(r,t){return t.map(n=>{const o=matchRemote(r,n.nameOrAlias);return assert(o,`Unable to preload ${n.nameOrAlias} as it is not included in ${!o&&safeToString({remoteInfo:o,remotes:r})}`),{remote:o,preloadConfig:defaultPreloadArgs(n)}})}function normalizePreloadExposes(r){return r?r.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(r,t,n,o=!0){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:c}=n;if(t.options.inBrowser){if(c.forEach(a=>{const{moduleInfo:u}=a,l=t.moduleCache.get(r.name);getRemoteEntry(l?{origin:t,remoteInfo:u,remoteEntryExports:l.remoteEntryExports}:{origin:t,remoteInfo:u,remoteEntryExports:void 0})}),o){const a={rel:"preload",as:"style"};s.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:a,createLinkHook:(m,h)=>{const p=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h});if(p instanceof HTMLLinkElement)return p}});d&&document.head.appendChild(l)})}else{const a={rel:"stylesheet",type:"text/css"};s.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:a,createLinkHook:(m,h)=>{const p=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h});if(p instanceof HTMLLinkElement)return p},needDeleteLink:!1});d&&document.head.appendChild(l)})}if(o){const a={rel:"preload",as:"script"};i.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:a,createLinkHook:(m,h)=>{const p=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h});if(p instanceof HTMLLinkElement)return p}});d&&document.head.appendChild(l)})}else{const a={fetchpriority:"high",type:(r==null?void 0:r.type)==="module"?"module":"text/javascript"};i.forEach(u=>{const{script:l,needAttach:d}=createScript({url:u,cb:()=>{},attrs:a,createScriptHook:(m,h)=>{const p=t.loaderHook.lifecycle.createScript.emit({url:m,attrs:h});if(p instanceof HTMLScriptElement)return p},needDeleteScript:!0});d&&document.head.appendChild(l)})}}}function createRemoteEntryInitOptions(r,t){const n=t,o=Array.isArray(r.shareScope)?r.shareScope:[r.shareScope];o.length||o.push("default"),o.forEach(a=>{n[a]||(n[a]={})});const s={version:r.version||"",shareScopeKeys:Array.isArray(r.shareScope)?o:r.shareScope||"default"};Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1});const i=n[o[0]];return{remoteEntryInitOptions:s,shareScope:i,initScope:[]}}class Module{constructor({remoteInfo:t,host:n}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=t,this.host=n}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return assert(t,`remoteEntryExports is undefined
8
- ${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(t,n){const o=await this.getEntry();if(!this.inited&&!this.initing){this.initing=!0;const{remoteEntryInitOptions:s,shareScope:i,initScope:c}=createRemoteEntryInitOptions(this.remoteInfo,this.host.shareScopeMap),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:s,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});typeof(o==null?void 0:o.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await o.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:t,remoteSnapshot:n,remoteEntryExports:o}),this.inited=!0}return o}async get(t,n,o,s){const{loadFactory:i=!0}=o||{loadFactory:!0},c=await this.init(t,s);this.lib=c;let a;a=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:c,expose:n,moduleInfo:this.remoteInfo}),a||(a=await c.get(n)),assert(a,`${getFMId(this.remoteInfo)} remote don't export ${n}.`);const u=processModuleAlias(this.remoteInfo.name,n),l=this.wraperFactory(a,u);return i?await l():l}wraperFactory(t,n){function o(s,i){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:i,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return o(s,n),s}:()=>{const s=t();return o(s,n),s}}}class SyncHook{constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const n=this;this.on(function o(...s){return n.remove(o),t.apply(null,s)})}emit(...t){let n;return this.listeners.size>0&&this.listeners.forEach(o=>{n=o(...t)}),n}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}}class AsyncHook extends SyncHook{emit(...t){let n;const o=Array.from(this.listeners);if(o.length>0){let s=0;const i=c=>c===!1?!1:s<o.length?Promise.resolve(o[s++].apply(null,t)).then(i):c;n=i()}return Promise.resolve(n)}}function checkReturnData(r,t){if(!isObject(t))return!1;if(r!==t){for(const n in r)if(!(n in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const n of this.listeners)try{const o=n(t);if(checkReturnData(t,o))t=o;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(o){warn(o),this.onerror(o)}return t}}class AsyncWaterfallHook extends SyncHook{constructor(t){super(),this.onerror=error,this.type=t}emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const n=Array.from(this.listeners);if(n.length>0){let o=0;const s=c=>(warn(c),this.onerror(c),t),i=c=>{if(checkReturnData(t,c)){if(t=c,o<n.length)try{return Promise.resolve(n[o++](t)).then(i,s)}catch(a){return s(a)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return t};return Promise.resolve(i(t))}return Promise.resolve(t)}}class PluginSystem{constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}applyPlugin(t,n){var s;assert(isPlainObject(t),"Plugin configuration is invalid.");const o=t.name;assert(o,"A name must be provided by the plugin."),this.registerPlugins[o]||(this.registerPlugins[o]=t,(s=t.apply)==null||s.call(t,n),Object.keys(this.lifecycle).forEach(i=>{const c=t[i];c&&this.lifecycle[i].on(c)}))}removePlugin(t){assert(t,"A name is required.");const n=this.registerPlugins[t];assert(n,`The plugin "${t}" is not registered.`),Object.keys(n).forEach(o=>{o!=="name"&&this.lifecycle[o].remove(n[o])})}}function assignRemoteInfo(r,t){const n=getRemoteEntryInfoFromSnapshot(t);n.url||error(`The attribute remoteEntry of ${r.name} must not be undefined.`);let o=getResourceUrl(t,n.url);!isBrowserEnv()&&!o.startsWith("http")&&(o=`https:${o}`),r.type=n.type,r.entryGlobalName=n.globalName,r.entry=o,r.version=t.version,r.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(r){const{remote:t,pkgNameOrAlias:n,expose:o,origin:s,remoteInfo:i,id:c}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:a,globalSnapshot:u}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:c});assignRemoteInfo(i,a);const l={remote:t,preloadConfig:{nameOrAlias:n,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},d=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:l,remoteInfo:i,remote:t,remoteSnapshot:a,globalSnapshot:u});return d&&preloadAssets(i,s,d,!1),{...r,remoteSnapshot:a}}return r}}}function splitId(r){const t=r.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function traverseModuleInfo(r,t,n,o,s={},i){const c=getFMId(t),{value:a}=getInfoWithoutType(r,c),u=i||a;if(u&&!isManifestProvider(u)&&(n(u,t,o),u.remotesInfo)){const l=Object.keys(u.remotesInfo);for(const d of l){if(s[d])continue;s[d]=!0;const m=splitId(d),h=u.remotesInfo[d];traverseModuleInfo(r,{name:m.name,version:h.matchedVersion},n,!1,s,void 0)}}}const isExisted=(r,t)=>document.querySelector(`${r}[${r==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(r,t,n,o,s){const i=[],c=[],a=[],u=new Set,l=new Set,{options:d}=r,{preloadConfig:m}=t,{depsRemote:h}=m;if(traverseModuleInfo(o,n,(g,b,R)=>{var w;let _;if(R)_=m;else if(Array.isArray(h)){const $=h.find(k=>k.nameOrAlias===b.name||k.nameOrAlias===b.alias);if(!$)return;_=defaultPreloadArgs($)}else if(h===!0)_=m;else return;const I=getResourceUrl(g,getRemoteEntryInfoFromSnapshot(g).url);I&&a.push({name:b.name,moduleInfo:{name:b.name,entry:I,type:"remoteEntryType"in g?g.remoteEntryType:"global",entryGlobalName:"globalName"in g?g.globalName:b.name,shareScope:"",version:"version"in g?g.version:void 0},url:I});let S="modules"in g?g.modules:[];const T=normalizePreloadExposes(_.exposes);T.length&&"modules"in g&&(S=(w=g==null?void 0:g.modules)==null?void 0:w.reduce(($,k)=>((T==null?void 0:T.indexOf(k.moduleName))!==-1&&$.push(k),$),[]));function A($){const k=$.map(N=>getResourceUrl(g,N));return _.filter?k.filter(_.filter):k}if(S){const $=S.length;for(let k=0;k<$;k++){const N=S[k],L=`${b.name}/${N.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:N.moduleName==="."?b.name:L,name:b.name,remoteSnapshot:g,preloadConfig:_,remote:b,origin:r}),!getPreloaded(L)&&(_.resourceCategory==="all"?(i.push(...A(N.assets.css.async)),i.push(...A(N.assets.css.sync)),c.push(...A(N.assets.js.async)),c.push(...A(N.assets.js.sync))):(_.resourceCategory="sync")&&(i.push(...A(N.assets.css.sync)),c.push(...A(N.assets.js.sync))),setPreloaded(L))}}},!0,{},s),s.shared&&s.shared.length>0){const g=(b,R)=>{const{shared:_}=getRegisteredShare(r.shareScopeMap,R.sharedName,b,r.sharedHandler.hooks.lifecycle.resolveShare)||{};_&&typeof _.lib=="function"&&(R.assets.js.sync.forEach(I=>{u.add(I)}),R.assets.css.sync.forEach(I=>{l.add(I)}))};s.shared.forEach(b=>{var S;const R=(S=d.shared)==null?void 0:S[b.sharedName];if(!R)return;const _=b.version?R.find(T=>T.version===b.version):R;if(!_)return;arrayOptions(_).forEach(T=>{g(T,b)})})}const y=c.filter(g=>!u.has(g)&&!isExisted("script",g));return{cssAssets:i.filter(g=>!l.has(g)&&!isExisted("link",g)),jsAssetsWithoutEntry:y,entryAssets:a.filter(g=>!isExisted("script",g.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(r){const{origin:t,preloadOptions:n,remoteInfo:o,remote:s,globalSnapshot:i,remoteSnapshot:c}=r;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:o.name,entry:s.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(o,c),generatePreloadAssets(t,n,o,i,c)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(r,t){const n=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),o=n&&"remotesInfo"in n&&n.remotesInfo&&getInfoWithoutType(n.remotesInfo,r.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:"version"in r?r.version:void 0})}}class SnapshotHandler{constructor(t){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot"),afterLoadSnapshot:new AsyncWaterfallHook("afterLoadSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=t,this.loaderHook=t.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:t,id:n,expose:o}){const{options:s}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:s,moduleInfo:t});let i=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});i||(i={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:i})),i&&"remotesInfo"in i&&!getInfoWithoutType(i.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(i.remotesInfo={...i==null?void 0:i.remotesInfo,[t.name]:{matchedVersion:"version"in t?t.version:t.entry}});const{hostGlobalSnapshot:c,remoteSnapshot:a,globalSnapshot:u}=this.getGlobalRemoteInfo(t),{remoteSnapshot:l,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:c,remoteSnapshot:a,globalSnapshot:u});let m,h;if(l)if(isManifestProvider(l)){const p=isBrowserEnv()?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",y=await this.getManifestJson(p,t,{}),E=setGlobalSnapshotInfoByModuleInfo({...t,entry:p},y);m=y,h=E}else{const{remoteSnapshot:p}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:l,from:"global"});m=p,h=d}else if(isRemoteInfoWithEntry(t)){const p=await this.getManifestJson(t.entry,t,{}),y=setGlobalSnapshotInfoByModuleInfo(t,p),{remoteSnapshot:E}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:p,from:"global"});m=E,h=y}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(d)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:n,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:m}),{remoteSnapshot:m,globalSnapshot:h}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,n,o){const s=async()=>{let c=this.manifestCache.get(t);if(c)return c;try{let a=await this.loaderHook.lifecycle.fetch.emit(t,{});(!a||!(a instanceof Response))&&(a=await fetch(t,{})),c=await a.json()}catch(a){c=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:a,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),c||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:n.name,hostName:this.HostInstance.options.name},`${a}`)))}return assert(c.metaData&&c.exposes&&c.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,c),c},i=async()=>{const c=await s(),a=generateSnapshotFromManifest(c,{version:t}),{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:n,manifestJson:c,remoteSnapshot:a,manifestUrl:t,from:"manifest"});return u};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(c=>c)),this.manifestLoading[t]}}class SharedHandler{constructor(t){this.hooks=new PluginSystem({beforeRegisterShare:new SyncWaterfallHook("beforeRegisterShare"),afterResolve:new AsyncWaterfallHook("afterResolve"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),initContainerShareScopeMap:new SyncWaterfallHook("initContainerShareScopeMap")}),this.host=t,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(t.options)}registerShared(t,n){const{newShareInfos:o,allShareInfos:s}=formatShareConfigs(t,n);return Object.keys(o).forEach(c=>{o[c].forEach(u=>{u.scope.forEach(l=>{var m;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:c,shared:u}),((m=this.shareScopeMap[l])==null?void 0:m[c])||this.setShared({pkgName:c,lib:u.lib,get:u.get,loaded:u.loaded||!!u.lib,shared:u,from:n.name})})})}),{newShareInfos:o,allShareInfos:s}}async loadShare(t,n){const{host:o}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:o.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async l=>{await Promise.all(this.initializeSharing(l,{strategy:s.strategy}))}));const i=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:o.options.shared,origin:o}),{shareInfo:c}=i;assert(c,`Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);const{shared:a,useTreesShaking:u}=getRegisteredShare(this.shareScopeMap,t,c,this.hooks.lifecycle.resolveShare)||{};if(a){const l=directShare(a,u);if(l.lib)return addUseIn(l,o.options.name),l.lib;if(l.loading&&!l.loaded){const d=await l.loading;return l.loaded=!0,l.lib||(l.lib=d),addUseIn(l,o.options.name),d}else{const m=(async()=>{const h=await l.get();return addUseIn(l,o.options.name),l.loaded=!0,l.lib=h,h})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:o.options.name,lib:null,loading:m,treeShaking:u?l:void 0}),m}}else{if(n!=null&&n.customShareInfo)return!1;const l=shouldUseTreeShaking(c.treeShaking),d=directShare(c,l),h=(async()=>{const p=await d.get();d.lib=p,d.loaded=!0,addUseIn(d,o.options.name);const{shared:y,useTreesShaking:E}=getRegisteredShare(this.shareScopeMap,t,c,this.hooks.lifecycle.resolveShare)||{};if(y){const g=directShare(y,E);g.lib=p,g.loaded=!0,y.from=c.from}return p})();return this.setShared({pkgName:t,loaded:!1,shared:c,from:o.options.name,lib:null,loading:h,treeShaking:l?d:void 0}),h}}initializeSharing(t=DEFAULT_SCOPE,n){const{host:o}=this,s=n==null?void 0:n.from,i=n==null?void 0:n.strategy;let c=n==null?void 0:n.initScope;const a=[];if(s!=="build"){const{initTokens:p}=this;c||(c=[]);let y=p[t];if(y||(y=p[t]={from:this.host.name}),c.indexOf(y)>=0)return a;c.push(y)}const u=this.shareScopeMap,l=o.options.name;u[t]||(u[t]={});const d=u[t],m=(p,y)=>{var I;const{version:E,eager:g}=y;d[p]=d[p]||{};const b=d[p],R=b[E]&&directShare(b[E]),_=!!(R&&("eager"in R&&R.eager||"shareConfig"in R&&((I=R.shareConfig)!=null&&I.eager)));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!g!=!_?g:l>b[E].from))&&(b[E]=y)},h=async p=>{const{module:y}=await o.remoteHandler.getRemoteModuleAndOptions({id:p});let E;try{E=await y.getEntry()}catch(g){E=await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:p,error:g,from:"runtime",lifecycle:"beforeLoadShare",origin:o})}finally{E!=null&&E.init&&(y.remoteEntryExports=E,await y.init())}};return Object.keys(o.options.shared).forEach(p=>{o.options.shared[p].forEach(E=>{E.scope.includes(t)&&m(p,E)})}),(o.options.shareStrategy==="version-first"||i==="version-first")&&o.options.remotes.forEach(p=>{p.shareScope===t&&a.push(h(p.name))}),a}loadShareSync(t,n){const{host:o}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:o.options.shared});s!=null&&s.scope&&s.scope.forEach(a=>{this.initializeSharing(a,{strategy:s.strategy})});const{shared:i,useTreesShaking:c}=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare)||{};if(i){if(typeof i.lib=="function")return addUseIn(i,o.options.name),i.loaded||(i.loaded=!0,i.from===o.options.name&&(s.loaded=!0)),i.lib;if(typeof i.get=="function"){const a=i.get();if(!(a instanceof Promise))return addUseIn(i,o.options.name),this.setShared({pkgName:t,loaded:!0,from:o.options.name,lib:a,shared:i}),a}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const a=s.get();if(a instanceof Promise){const u=(n==null?void 0:n.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(u,runtimeDescMap,{hostName:o.options.name,sharedPkgName:t}))}return s.lib=a,this.setShared({pkgName:t,loaded:!0,from:o.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:o.options.name,sharedPkgName:t}))}initShareScopeMap(t,n,o={}){const{host:s}=this;this.shareScopeMap[t]=n,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:n,options:s.options,origin:s,scopeName:t,hostShareScopeMap:o.hostShareScopeMap})}setShared({pkgName:t,shared:n,from:o,lib:s,loading:i,loaded:c,get:a,treeShaking:u}){const{version:l,scope:d="default",...m}=n,h=Array.isArray(d)?d:[d],p=y=>{const E=(b,R,_)=>{_&&!b[R]&&(b[R]=_)},g=u?y.treeShaking:y;E(g,"loaded",c),E(g,"loading",i),E(g,"get",a)};h.forEach(y=>{this.shareScopeMap[y]||(this.shareScopeMap[y]={}),this.shareScopeMap[y][t]||(this.shareScopeMap[y][t]={}),this.shareScopeMap[y][t][l]||(this.shareScopeMap[y][t][l]={version:l,scope:[y],...m,lib:s});const E=this.shareScopeMap[y][t][l];p(E),o&&E.from!==o&&(E.from=o)})}_setGlobalShareScopeMap(t){const n=getGlobalShareScope(),o=t.id||t.name;o&&!n[o]&&(n[o]=this.shareScopeMap)}}class RemoteHandler{constructor(t){this.hooks=new PluginSystem({beforeRegisterRemote:new SyncWaterfallHook("beforeRegisterRemote"),registerRemote:new SyncWaterfallHook("registerRemote"),beforeRequest:new AsyncWaterfallHook("beforeRequest"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforePreloadRemote:new AsyncHook("beforePreloadRemote"),generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook,loadEntry:new AsyncHook}),this.host=t,this.idToRemoteMap={}}formatAndRegisterRemote(t,n){return(n.remotes||[]).reduce((s,i)=>(this.registerRemote(i,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,n){const{remote:o,expose:s}=n,{name:i,alias:c}=o;if(this.idToRemoteMap[t]={name:o.name,expose:s},c&&t.startsWith(i)){const a=t.replace(i,c);this.idToRemoteMap[a]={name:o.name,expose:s};return}if(c&&t.startsWith(c)){const a=t.replace(c,i);this.idToRemoteMap[a]={name:o.name,expose:s}}}async loadRemote(t,n){const{host:o}=this;try{const{loadFactory:s=!0}=n||{loadFactory:!0},{module:i,moduleOptions:c,remoteMatchInfo:a}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:u,remote:l,expose:d,id:m,remoteSnapshot:h}=a,p=await i.get(m,d,n,h),y=await this.hooks.lifecycle.onLoad.emit({id:m,pkgNameOrAlias:u,expose:d,exposeModule:s?p:void 0,exposeModuleFactory:s?void 0:p,remote:l,options:c,moduleInstance:i,origin:o});return this.setIdToRemoteMap(t,a),typeof y=="function"?y:p}catch(s){const{from:i="runtime"}=n||{from:"runtime"},c=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:o});if(!c)throw s;return c}}async preloadRemote(t){const{host:n}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:n.options,origin:n});const o=formatPreloadArgs(n.options.remotes,t);await Promise.all(o.map(async s=>{const{remote:i}=s,c=getRemoteInfo(i),{globalSnapshot:a,remoteSnapshot:u}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:s,remote:i,remoteInfo:c,globalSnapshot:a,remoteSnapshot:u});l&&preloadAssets(c,n,l)}))}registerRemotes(t,n){const{host:o}=this;t.forEach(s=>{this.registerRemote(s,o.options.remotes,{force:n==null?void 0:n.force})})}async getRemoteModuleAndOptions(t){const{host:n}=this,{id:o}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:n.options,origin:n})}catch(y){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:n.options,origin:n,from:"runtime",error:y,lifecycle:"beforeRequest"}),!s)throw y}const{id:i}=s,c=matchRemoteWithNameAndExpose(n.options.remotes,i);assert(c,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:n.options.name,requestId:i}));const{remote:a}=c,u=getRemoteInfo(a),l=await n.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...c,options:n.options,origin:n,remoteInfo:u}),{remote:d,expose:m}=l;assert(d&&m,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let h=n.moduleCache.get(d.name);const p={host:n,remoteInfo:u};return h||(h=new Module(p),n.moduleCache.set(d.name,h)),{module:h,moduleOptions:p,remoteMatchInfo:l}}registerRemote(t,n,o){const{host:s}=this,i=()=>{if(t.alias){const a=n.find(u=>{var l;return t.alias&&(u.name.startsWith(t.alias)||((l=u.alias)==null?void 0:l.startsWith(t.alias)))});assert(!a,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a&&a.name} name or alias`)}"entry"in t&&isBrowserEnv()&&!t.entry.startsWith("http")&&(t.entry=new URL(t.entry,window.location.origin).href),t.shareScope||(t.shareScope=DEFAULT_SCOPE),t.type||(t.type=DEFAULT_REMOTE_TYPE)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:t,origin:s});const c=n.find(a=>a.name===t.name);if(!c)i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const a=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];o!=null&&o.force&&(this.removeRemote(c),i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(a.join(" ")))}}removeRemote(t){var n;try{const{host:o}=this,{name:s}=t,i=o.options.remotes.findIndex(a=>a.name===s);i!==-1&&o.options.remotes.splice(i,1);const c=o.moduleCache.get(t.name);if(c){const a=c.remoteInfo,u=a.entryGlobalName;CurrentGlobal[u]&&((n=Object.getOwnPropertyDescriptor(CurrentGlobal,u))!=null&&n.configurable?delete CurrentGlobal[u]:CurrentGlobal[u]=void 0);const l=getRemoteEntryUniqueKey(c.remoteInfo);globalLoading[l]&&delete globalLoading[l],o.snapshotHandler.manifestCache.delete(a.entry);let d=a.buildVersion?composeKeyWithSeparator(a.name,a.buildVersion):a.name;const m=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(p=>a.buildVersion?p.options.id===d:p.name===d);if(m!==-1){const p=CurrentGlobal.__FEDERATION__.__INSTANCES__[m];d=p.options.id||d;const y=getGlobalShareScope();let E=!0;const g=[];Object.keys(y).forEach(b=>{const R=y[b];R&&Object.keys(R).forEach(_=>{const I=R[_];I&&Object.keys(I).forEach(S=>{const T=I[S];T&&Object.keys(T).forEach(A=>{const w=T[A];w&&typeof w=="object"&&w.from===a.name&&(w.loaded||w.loading?(w.useIn=w.useIn.filter($=>$!==a.name),w.useIn.length?E=!1:g.push([b,_,S,A])):g.push([b,_,S,A]))})})})}),E&&(p.shareScopeMap={},delete y[d]),g.forEach(([b,R,_,I])=>{var S,T,A;(A=(T=(S=y[b])==null?void 0:S[R])==null?void 0:T[_])==null||delete A[I]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(m,1)}const{hostGlobalSnapshot:h}=getGlobalRemoteInfo(t,o);if(h){const p=h&&"remotesInfo"in h&&h.remotesInfo&&getInfoWithoutType(h.remotesInfo,t.name).key;p&&(delete h.remotesInfo[p],Global.__FEDERATION__.__MANIFEST_LOADING__[p]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[p])}o.moduleCache.delete(t.name)}}catch(o){logger.log("removeRemote fail: ",o)}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="2.0.0",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,loadEntryError:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const n=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],o={id:getBuilderId(),name:t.name,plugins:n,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=o,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...o.plugins,...t.plugins||[]]),this.options=this.formatOptions(o,t)}initOptions(t){this.registerPlugins(t.plugins);const n=this.formatOptions(this.options,t);return this.options=n,n}async loadShare(t,n){return this.sharedHandler.loadShare(t,n)}loadShareSync(t,n){return this.sharedHandler.loadShareSync(t,n)}initializeSharing(t=DEFAULT_SCOPE,n){return this.sharedHandler.initializeSharing(t,n)}initRawContainer(t,n,o){const s=getRemoteInfo({name:t,entry:n}),i=new Module({host:this,remoteInfo:s});return i.remoteEntryExports=o,this.moduleCache.set(t,i),i}async loadRemote(t,n){return this.remoteHandler.loadRemote(t,n)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,n,o={}){this.sharedHandler.initShareScopeMap(t,n,o)}formatOptions(t,n){const{allShareInfos:o}=formatShareConfigs(t,n),{userOptions:s,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:n,options:t,shareInfo:o}),c=this.remoteHandler.formatAndRegisterRemote(i,s),{allShareInfos:a}=this.sharedHandler.registerShared(i,s),u=[...i.plugins];s.plugins&&s.plugins.forEach(d=>{u.includes(d)||u.push(d)});const l={...t,...n,plugins:u,remotes:c,shared:a};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(t){const n=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((o,s)=>(s&&o&&!o.find(i=>i.name===s.name)&&o.push(s),o),n||[])}registerRemotes(t,n){return this.remoteHandler.registerRemotes(t,n)}registerShared(t){this.sharedHandler.registerShared(this.options,{...this.options,shared:t})}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function addBasenameToNestedRoutes(r,t){return r.map(n=>{const o={...n,path:t+n.path};return n.children&&n.children.length>0&&(o.children=addBasenameToNestedRoutes(n.children,t)),o})}function processRoutes(r){const{router:t,basename:n,memoryRoute:o,hashRoute:s}=r,i=t.getRoutes().sort((h,p)=>h.path.split("/").filter(y=>y).length-p.path.split("/").filter(y=>y).length),c=new Map,a=new Set;i.forEach(h=>{c.set(h.path,h)});const u=(h,p)=>`${h}/${p}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",l=(h,p="")=>{if(!h.children||h.children.length===0)return h;for(let y=0;y<h.children.length;y++){const E=h.children[y],g=u(p,E.path),b=c.get(g);if(b&&!a.has(b)){const R={...b,path:E.path};h.children[y]=R,a.add(b),l(R,g)}}return h};let d=[];for(const h of i)if(!a.has(h)){const p=l(h,h.path);a.add(h),d.push(p)}let m;return o?m=VueRouter__namespace.createMemoryHistory(n):s?(m=VueRouter__namespace.createWebHashHistory(),n&&(d=addBasenameToNestedRoutes(d,n))):m=VueRouter__namespace.createWebHistory(n),{history:m,routes:d}}function createBridgeComponent(r){const t=new Map,n=getInstance();return()=>({__APP_VERSION__:"2.0.0",async render(o){var y,E,g;LoggerInstance.debug("createBridgeComponent render Info",o);const{moduleName:s,dom:i,basename:c,memoryRoute:a,hashRoute:u,...l}=o,d=Vue__namespace.createApp(r.rootComponent,l);t.set(i,d);const m=await((g=(E=(y=n==null?void 0:n.bridgeHook)==null?void 0:y.lifecycle)==null?void 0:E.beforeBridgeRender)==null?void 0:g.emit(o)),h=m&&typeof m=="object"&&(m!=null&&m.extraProps)?m==null?void 0:m.extraProps:{},p=r.appOptions({app:d,basename:c,memoryRoute:a,hashRoute:u,...l,...h});if(p!=null&&p.router){const{history:b,routes:R}=processRoutes({router:p.router,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute}),_=VueRouter__namespace.createRouter({...p.router.options,history:b,routes:R});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:_}),a&&await _.push(a.entryPath),d.use(_)}d.mount(i)},destroy(o){LoggerInstance.debug("createBridgeComponent destroy Info",o);const s=t.get(o==null?void 0:o.dom);s==null||s.unmount()}})}function e(){const r=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(r)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(r){const t=Vue.ref(null),n=Vue.ref(null),o=Vue.ref(""),s=VueRouter.useRoute(),i=getInstance(),c=Vue.useAttrs(),a=async()=>{var h,p,y,E;const l=(h=r.providerInfo)==null?void 0:h.call(r);n.value=l;let d={...c,moduleName:r.moduleName,dom:t.value,basename:r.basename,memoryRoute:r.memoryRoute,hashRoute:r.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",d);const m=await((E=(y=(p=i==null?void 0:i.bridgeHook)==null?void 0:p.lifecycle)==null?void 0:y.beforeBridgeRender)==null?void 0:E.emit(d))||{};d={...d,...m.extraProps},l.render(d)},u=Vue.watch(()=>s==null?void 0:s.path,l=>{l!==s.path&&a(),o.value!==""&&o.value!==l&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),o.value=l});return Vue.onMounted(()=>{a()}),Vue.onBeforeUnmount(()=>{var l;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...r}),u(),(l=n.value)==null||l.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(r.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(r){return Vue.defineAsyncComponent({__APP_VERSION__:"2.0.0",...r.asyncComponentOptions,loader:async()=>{var u,l;const t=VueRouter.useRoute();let n="/";const o=(l=(u=t==null?void 0:t.matched)==null?void 0:u[0])==null?void 0:l.path;o&&(o.endsWith("/:pathMatch(.*)*")?n=o.replace("/:pathMatch(.*)*",""):n=t.matched[0].path);const s=(r==null?void 0:r.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:n,info:r});const i=await r.loader(),c=i&&i[Symbol.for("mf_module_id")],a=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:c,module:i,exportName:s,basename:n,route:t}),s in i&&typeof a=="function")return{render(){return Vue.h(RemoteApp,{moduleName:c,providerInfo:a,basename:n,rootAttrs:r.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(r){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(r)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("vue"),ke=require("vue-router");function Ke(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Dt=Ke(A),ce=Ke(ke),Ft=".json",Ht="FEDERATION_DEBUG",Gt=":";let $e=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});function H(){return typeof window<"u"&&typeof window.document<"u"}function ze(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function Ut(){try{if(H()&&window.localStorage)return!!localStorage.getItem(Ht)}catch{return!1}return!1}function we(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:Ut()}const xt="[ Federation Runtime ]",Je=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${Gt}${r}`:r:t,""):""},Ie=(e,t)=>{if("getPublicPath"in e){let r;return e.getPublicPath.startsWith("function")?r=new Function("return "+e.getPublicPath)()():r=new Function(e.getPublicPath)(),`${r}${t}`}else return"publicPath"in e?!H()&&!ze()&&"ssrPublicPath"in e&&typeof e.ssrPublicPath=="string"?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},Xe=e=>{console.warn(`${xt}: ${e}`)};function Ye(e){try{return JSON.stringify(e,null,2)}catch{return""}}const oe=(e,t)=>{if(!e)return t;const n=(o=>{if(o===".")return"";if(o.startsWith("./"))return o.replace("./","");if(o.startsWith("/")){const s=o.slice(1);return s.endsWith("/")?s.slice(0,-1):s}return o})(e);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function Bt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function Vt(e,t={}){var g,b,w;const{remotes:r={},overrides:n={},version:o}=t;let s;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&o?Bt(o):e.metaData.publicPath:e.metaData.getPublicPath,a=Object.keys(n);let c={};Object.keys(r).length||(c=((g=e.remotes)==null?void 0:g.reduce((_,S)=>{let R;const $=S.federationContainerName;return a.includes($)?R=n[$]:"version"in S?R=S.version:R=S.entry,_[$]={matchedVersion:R},_},{}))||{}),Object.keys(r).forEach(_=>c[_]={matchedVersion:a.includes(_)?n[_]:r[_]});const{remoteEntry:{path:l,name:f,type:d},types:u={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:h},globalName:p,ssrRemoteEntry:y}=e.metaData,{exposes:E}=e;let m={version:o||"",buildVersion:h,globalName:p,remoteEntry:oe(l,f),remoteEntryType:d,remoteTypes:oe(u.path,u.name),remoteTypesZip:u.zip||"",remoteTypesAPI:u.api||"",remotesInfo:c,shared:e==null?void 0:e.shared.map(_=>({assets:_.assets,sharedName:_.name,version:_.version,usedExports:_.referenceExports||[]})),modules:E==null?void 0:E.map(_=>({moduleName:_.name,modulePath:_.path,assets:_.assets}))};if((b=e.metaData)!=null&&b.prefetchInterface){const _=e.metaData.prefetchInterface;m={...m,prefetchInterface:_}}if((w=e.metaData)!=null&&w.prefetchEntry){const{path:_,name:S,type:R}=e.metaData.prefetchEntry;m={...m,prefetchEntry:oe(_,S),prefetchEntryType:R}}if("publicPath"in e.metaData?(s={...m,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...m,getPublicPath:i()},y){const _=oe(y.path,y.name);s.ssrRemoteEntry=_,s.ssrRemoteEntryType=y.type||"commonjs-module"}return s}function Ze(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(Ft))}const Wt="[ Module Federation ]",X=console,jt=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function qt(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
2
+ `),r=t.filter(n=>!jt.some(o=>n.includes(o)));return r.length?`Stack trace:
3
+ ${r.slice(0,5).join(`
4
+ `)}`:void 0}catch{return}}var Qe=class{constructor(e,t=X){this.prefix=e,this.delegate=t??X}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??X}emit(e,t){const r=this.delegate,n=we()?qt():void 0,o=n?[...t,n]:t,s=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const i of s){const a=r[i];if(typeof a=="function"){a.call(r,this.prefix,...o);return}}for(const i of s){const a=X[i];if(typeof a=="function"){a.call(X,this.prefix,...o);return}}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){we()&&this.emit("debug",e)}};function et(e){return new Qe(e)}function Kt(e){const t=new Qe(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Kt(Wt);async function tt(e,t){try{return await e()}catch(r){Xe(r);return}}function rt(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function nt(e){let t=null,r=!0,n=2e4,o;const s=document.getElementsByTagName("script");for(let a=0;a<s.length;a++){const c=s[a],l=c.getAttribute("src");if(l&&rt(l,e.url)){t=c,r=!1;break}}if(!t){const a=e.attrs;t=document.createElement("script"),t.type=(a==null?void 0:a.type)==="module"?"module":"text/javascript";let c;e.createScriptHook&&(c=e.createScriptHook(e.url,e.attrs),c instanceof HTMLScriptElement?t=c:typeof c=="object"&&("script"in c&&c.script&&(t=c.script),"timeout"in c&&c.timeout&&(n=c.timeout))),t.src||(t.src=e.url),a&&!c&&Object.keys(a).forEach(l=>{t&&(l==="async"||l==="defer"?t[l]=a[l]:t.getAttribute(l)||t.setAttribute(l,a[l]))})}const i=async(a,c)=>{clearTimeout(o);const l=()=>{(c==null?void 0:c.type)==="error"?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(c)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,tt(()=>{const{needDeleteScript:f=!0}=e;f&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),a&&typeof a=="function")){const f=a(c);if(f instanceof Promise){const d=await f;return l(),d}return l(),f}l()};return t.onerror=i.bind(null,t.onerror),t.onload=i.bind(null,t.onload),o=setTimeout(()=>{i(null,new Error(`Remote script "${e.url}" time-outed.`))},n),{script:t,needAttach:r}}function ge(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let s=0;s<n.length;s++){const i=n[s],a=i.getAttribute("href"),c=i.getAttribute("rel");if(a&&rt(a,e.url)&&c===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let s;const i=e.attrs;e.createLinkHook&&(s=e.createLinkHook(e.url,i),s instanceof HTMLLinkElement&&(t=s)),i&&!s&&Object.keys(i).forEach(a=>{t&&!t.getAttribute(a)&&t.setAttribute(a,i[a])})}const o=(s,i)=>{const a=()=>{(i==null?void 0:i.type)==="error"?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(i)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,tt(()=>{const{needDeleteLink:c=!0}=e;c&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),s)){const c=s(i);return a(),c}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),{link:t,needAttach:r}}function zt(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((o,s)=>{const{script:i,needAttach:a}=nt({url:e,cb:o,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});a&&document.head.appendChild(i)})}const se=new Map;function V(e){if(!e)throw new Error("import specifier is required");if(se.has(e))return se.get(e);const t=new Function("name","return import(name)")(e).then(r=>r).catch(r=>{throw console.error(`Error importing module ${e}:`,r),se.delete(e),r});return se.set(e,t),t}const ot=async()=>{const e=await V("node-fetch");return e.default||e},Jt=async(e,t,r)=>{const o=await((s,i)=>r.lifecycle.fetch.emit(s,i))(e,t||{});return!o||!(o instanceof Response)?(typeof fetch>"u"?await ot():fetch)(e,t||{}):o},Xt=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t,r,n)=>{if(n!=null&&n.createScriptHook){const a=n.createScriptHook(e);a&&typeof a=="object"&&"url"in a&&(e=a.url)}let o;try{o=new URL(e)}catch(a){console.error("Error constructing URL:",a),t(new Error(`Invalid URL: ${a}`));return}const s=async()=>n!=null&&n.fetch?(a,c)=>Jt(a,c,n):typeof fetch>"u"?ot():fetch,i=async(a,c)=>{var l;try{const d=await(await a(c.href)).text(),[u,h]=await Promise.all([V("path"),V("vm")]),p={exports:{},module:{exports:{}}},y=c.pathname.split("/").slice(0,-1).join("/"),E=u.basename(c.pathname),m=new h.Script(`(function(exports, module, require, __dirname, __filename) {${d}
5
+ })`,{filename:E,importModuleDynamically:((l=h.constants)==null?void 0:l.USE_MAIN_CONTEXT_DEFAULT_LOADER)??V});let g;g=(await V("node:module")).createRequire(c.protocol==="file:"||c.protocol==="node:"?c.href:u.join(process.cwd(),"__mf_require_base__.js")),m.runInThisContext()(p.exports,p.module,g,y,E);const b=p.module.exports||p.exports;if(r&&b&&r.globalName){t(void 0,b[r.globalName]||b);return}t(void 0,b)}catch(f){t(f instanceof Error?f:new Error(`Script execution error: ${f}`))}};s().then(async a=>{if((r==null?void 0:r.type)==="esm"||(r==null?void 0:r.type)==="module")return Ne(o.href,{fetch:a,vm:await V("vm")}).then(async c=>{await c.evaluate(),t(void 0,c.namespace)}).catch(c=>{t(c instanceof Error?c:new Error(`Script execution error: ${c}`))});i(a,o)}).catch(a=>{t(a)})}:(e,t,r,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},Yt=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,n)=>{Xt(e,(o,s)=>{var i,a;if(o)n(o);else{const c=((i=t==null?void 0:t.attrs)==null?void 0:i.globalName)||`__FEDERATION_${(a=t==null?void 0:t.attrs)==null?void 0:a.name}:custom__`;r(globalThis[c]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},_e=new Map;async function Ne(e,t){if(_e.has(e))return _e.get(e);const{fetch:r,vm:n}=t,o=await(await r(e)).text(),s=new n.SourceTextModule(o,{importModuleDynamically:async(i,a)=>{const c=new URL(i,e).href;return Ne(c,t)}});return _e.set(e,s),await s.link(async i=>{const a=new URL(i,e).href;return await Ne(a,t)}),s}const D=et("[ Module Federation Bridge Vue3 ]"),j="[ Federation Runtime ]",Te=et(j);function T(e,t){e||O(t)}function O(e){throw e instanceof Error?(e.message.startsWith(j)||(e.message=`${j}: ${e.message}`),e):new Error(`${j}: ${e}`)}function Oe(e){e instanceof Error&&(e.message.startsWith(j)||(e.message=`${j}: ${e.message}`)),Te.warn(e)}function Zt(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Q(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Le(e){return typeof e.entry<"u"}function st(e){return!e.entry.includes(".json")}function Me(e){return e&&typeof e=="object"}const Qt=Object.prototype.toString;function er(e){return Qt.call(e)==="[object Object]"}function it(e){return Array.isArray(e)?e:[e]}function at(e){const t={url:"",type:"global",globalName:""};return H()||ze()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const tr=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},I=typeof globalThis=="object"?globalThis:window,k=(()=>{try{return document.defaultView}catch{return I}})(),ee=k;function le(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ue(e,t){return Object.hasOwnProperty.call(e,t)}ue(I,"__GLOBAL_LOADING_REMOTE_ENTRY__")||le(I,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const W=I.__GLOBAL_LOADING_REMOTE_ENTRY__;function ct(e){var t,r,n,o,s,i;ue(e,"__VMOK__")&&!ue(e,"__FEDERATION__")&&le(e,"__FEDERATION__",e.__VMOK__),ue(e,"__FEDERATION__")||(le(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),le(e,"__VMOK__",e.__FEDERATION__)),(t=e.__FEDERATION__).__GLOBAL_PLUGIN__??(t.__GLOBAL_PLUGIN__=[]),(r=e.__FEDERATION__).__INSTANCES__??(r.__INSTANCES__=[]),(n=e.__FEDERATION__).moduleInfo??(n.moduleInfo={}),(o=e.__FEDERATION__).__SHARE__??(o.__SHARE__={}),(s=e.__FEDERATION__).__MANIFEST_LOADING__??(s.__MANIFEST_LOADING__={}),(i=e.__FEDERATION__).__PRELOADED_MAP__??(i.__PRELOADED_MAP__=new Map)}ct(I);ct(k);function rr(e,t=we()){t&&(I.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.1.0")}function z(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[o,s]=n.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const Ge=()=>k.__FEDERATION__.moduleInfo,nr=(e,t)=>{const r=z(t,Q(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:n,...o}=e,s=Q(o),i=z(k.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>nr(e,k.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return k.__FEDERATION__.moduleInfo[r]=t,k.__FEDERATION__.moduleInfo},or=e=>(k.__FEDERATION__.moduleInfo={...k.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete k.__FEDERATION__.moduleInfo[r]}),Ce=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:I[r]}},sr=()=>k.__FEDERATION__.__GLOBAL_PLUGIN__,ir=e=>I.__FEDERATION__.__PRELOADED_MAP__.get(e),ar=e=>I.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),xe="[0-9A-Za-z-]+",De=`(?:\\+(${xe}(?:\\.${xe})*))`,Z="0|[1-9]\\d*",he="[0-9]+",lt="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${lt})`,cr=`(?:-?(${Be}(?:\\.${Be})*))`,Ve=`(?:${Z}|${lt})`,ut=`(?:-(${Ve}(?:\\.${Ve})*))`,be=`${Z}|x|X|\\*`,J=`[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ut})?${De}?)?)?`,lr=`^\\s*(${J})\\s+-\\s+(${J})\\s*$`,ur=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${cr}?${De}?`,Fe="((?:<|>)?=?)",fr=`(\\s*)${Fe}\\s*(${ur}|${J})`,ft="(?:~>?)",hr=`(\\s*)${ft}\\s+`,ht="(?:\\^)",dr=`(\\s*)${ht}\\s+`,pr="(<|>)?=?\\s*\\*",mr=`^${ht}${J}$`,yr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ut}?${De}?`,Er=`^${ft}${J}$`,gr=`^${Fe}\\s*${J}$`,_r=`^${Fe}\\s*(${yr})$|^$`,br="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function N(e){return!e||e.toLowerCase()==="x"||e==="*"}function dt(...e){return t=>e.reduce((r,n)=>n(r),t)}function We(e){return e.match(C(_r))}function je(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Rr(e){return e.replace(C(lr),(t,r,n,o,s,i,a,c,l,f,d,u)=>(N(n)?r="":N(o)?r=`>=${n}.0.0`:N(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,N(l)?c="":N(f)?c=`<${Number(l)+1}.0.0-0`:N(d)?c=`<${l}.${Number(f)+1}.0-0`:u?c=`<=${l}.${f}.${d}-${u}`:c=`<=${c}`,`${r} ${c}`.trim()))}function Sr(e){return e.replace(C(fr),"$1$2$3")}function $r(e){return e.replace(C(hr),"$1~")}function wr(e){return e.replace(C(dr),"$1^")}function Ir(e){return e.trim().split(/\s+/).map(t=>t.replace(C(mr),(r,n,o,s,i)=>N(n)?"":N(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:N(s)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?o==="0"?`>=${n}.${o}.${s}-${i} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s}-${i} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${s} <${n}.${o}.${Number(s)+1}-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${Number(n)+1}.0.0-0`)).join(" ")}function Nr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Er),(r,n,o,s,i)=>N(n)?"":N(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:N(s)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:i?`>=${n}.${o}.${s}-${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${s} <${n}.${Number(o)+1}.0-0`)).join(" ")}function Tr(e){return e.split(/\s+/).map(t=>t.trim().replace(C(gr),(r,n,o,s,i,a)=>{const c=N(o),l=c||N(s),f=l||N(i);return n==="="&&f&&(n=""),a="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&f?(l&&(s=0),i=0,n===">"?(n=">=",l?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",l?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):l?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:f?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Ar(e){return e.trim().replace(C(pr),"")}function vr(e){return e.trim().replace(C(br),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Pr(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,s=r.length;o<=s;o++){const i=r[o],a=n[o];if(i!==a)return i===void 0&&a===void 0?0:i?a?de(i,a):-1:1}return 0}function ie(e,t){return de(e.major,t.major)||de(e.minor,t.minor)||de(e.patch,t.patch)||Pr(e,t)}function Re(e,t){return e.version===t.version}function kr(e,t){switch(e.operator){case"":case"=":return Re(e,t);case">":return ie(e,t)<0;case">=":return Re(e,t)||ie(e,t)<0;case"<":return ie(e,t)>0;case"<=":return Re(e,t)||ie(e,t)>0;case void 0:return!0;default:return!1}}function Or(e){return dt(Ir,Nr,Tr,Ar)(e)}function Lr(e){return dt(Rr,Sr,$r,wr)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=We(e);if(!r)return!1;const[,n,,o,s,i,a]=r,c={operator:n,version:je(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},l=t.split("||");for(const f of l){const d=f.trim();if(!d||d==="*"||d==="x")return!0;try{const u=Lr(d);if(!u.trim())return!0;const h=u.split(" ").map(E=>Or(E)).join(" ");if(!h.trim())return!0;const p=h.split(/\s+/).map(E=>vr(E)).filter(Boolean);if(p.length===0)continue;let y=!0;for(const E of p){const m=We(E);if(!m){y=!1;break}const[,g,,b,w,_,S]=m;if(!kr({operator:g,version:je(b,w,_,S),major:b,minor:w,patch:_,preRelease:S==null?void 0:S.split(".")},c)){y=!1;break}}if(y)return!0}catch(u){console.error(`[semver] Error processing range part "${d}":`,u);continue}}return!1}const ne="default",pt="global";function Mr(e,t,r,n){var s,i;let o;if("get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${r}'!`)}),(s=e.shareConfig)!=null&&s.eager&&((i=e.treeShaking)!=null&&i.mode))throw new Error('Can not set "eager:true" and "treeShaking" at the same time!');return{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:o,loaded:e!=null&&e.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??$e.UNKNOWN,useIn:[]}:void 0}}function mt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const c=it(r[a]);return i[a]=i[a]||[],c.forEach(l=>{i[a].push(Mr(l,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(c=>c.version===a.version)||s[i].push(a)}):s[i]=o[i]}),{allShareInfos:s,newShareInfos:o}}function te(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===$e.NO_USE?!1:r===$e.CALCULATED?!0:n==="runtime-infer"?t?Dr(e,t):!0:!1}function U(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let s=n;for(let i=0;i<3-o.length;i++)s+=".0";return s}return n};return!!Y(r(e),`<=${r(t)}`)}const re=(e,t)=>{const r=t||function(n,o){return U(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},me=e=>!!e.loaded||typeof e.lib=="function",Cr=e=>!!e.loading,Dr=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Fr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(c,l){return i?o[c].treeShaking?o[l].treeShaking?!me(o[c].treeShaking)&&U(c,l):!1:!0:!me(o[c])&&U(c,l)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}const x=e=>me(e)||Cr(e);function Hr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(c,l){if(i){if(!o[c].treeShaking)return!0;if(!o[l].treeShaking)return!1;if(x(o[l].treeShaking))return x(o[c].treeShaking)?!!U(c,l):!0;if(x(o[c].treeShaking))return!1}return x(o[l])?x(o[c])?!!U(c,l):!0:x(o[c])?!1:U(c,l)};if(i){if(s=re(e[t][r],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:re(e[t][r],a),useTreesShaking:i}}function Gr(e){return e==="loaded-first"?Hr:Fr}function pe(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,c=Array.isArray(s)?s:[s];for(const l of c)if(o&&e[l]&&e[l][t]){const{requiredVersion:f}=o,{version:d,useTreesShaking:u}=Gr(i)(e,l,t,a),h=()=>{const y=e[l][t][d];if(o.singleton){if(typeof f=="string"&&!Y(d,f)){const E=`Version ${d} from ${d&&y.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${f})`;o.strictVersion?O(E):Oe(E)}return{shared:y,useTreesShaking:u}}else{if(f===!1||f==="*")return{shared:y,useTreesShaking:u};if(Y(d,f))return{shared:y,useTreesShaking:u};const E=te(a);if(E){for(const[m,g]of Object.entries(e[l][t]))if(te(g.treeShaking,a==null?void 0:a.usedExports)&&Y(m,f))return{shared:g,useTreesShaking:E}}for(const[m,g]of Object.entries(e[l][t]))if(Y(m,f))return{shared:g,useTreesShaking:!1}}},p={shareScopeMap:e,scope:l,pkgName:t,version:d,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:h};return(n.emit(p)||p).resolver()}}function yt(){return ee.__FEDERATION__.__SHARE__}function qe(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=c=>{if(!c)return;const l={};return c.forEach(d=>{l[d.version]=d}),l[re(l,function(d,u){return!me(l[d])&&U(d,u)})]},s=(r==null?void 0:r.resolver)??o,i=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),a=(...c)=>{const l={};for(const f of c)if(f)for(const[d,u]of Object.entries(f)){const h=l[d];i(h)&&i(u)?l[d]=a(h,u):u!==void 0&&(l[d]=u)}return l};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const B=(e,t)=>{e.useIn||(e.useIn=[]),Zt(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function Ur(e,t){for(const r of e){const n=t.startsWith(r.name);let o=t.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const s=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&s){if(i&&i.startsWith("/")){const a=r.alias;return i=`.${i}`,{pkgNameOrAlias:a,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function xr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const Et="RUNTIME-001",gt="RUNTIME-002",_t="RUNTIME-003",bt="RUNTIME-004",Rt="RUNTIME-005",Ae="RUNTIME-006",St="RUNTIME-007",He="RUNTIME-008",Br="RUNTIME-009",$t="RUNTIME-010",Vr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,F=(e,t,r,n)=>{const o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(Vr(e)),n&&o.push(`Original Error Message:
6
+ ${n}`),o.join(`
7
+ `)},M={[Et]:"Failed to get remoteEntry exports.",[gt]:'The remote entry interface does not contain "init"',[_t]:"Failed to get manifest.",[bt]:"Failed to locate remote.",[Rt]:"Invalid loadShareSync function call from bundler runtime",[Ae]:"Invalid loadShareSync function call from runtime",[St]:"Failed to get remote snapshot.",[He]:"Failed to load script resources.",[Br]:"Please call createInstance first.",[$t]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.'};({...M});const wt=".then(callbacks[0]).catch(callbacks[1])";async function Wr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${wt}`)([r,n]):import(e).then(r).catch(n)}catch(o){n(o)}})}async function jr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${wt}`)([r,n])}catch(o){n(o)}})}function It(e,t,r){const{remoteEntryKey:n,entryExports:o}=Ce(e,t);return T(o,F(Et,M,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n})),o}async function qr({name:e,globalName:t,entry:r,loaderHook:n,getEntryUrl:o}){const{entryExports:s}=Ce(e,t);return s||zt(o?o(r):r,{attrs:{},createScriptHook:(i,a)=>{const c=n.lifecycle.createScript.emit({url:i,attrs:a});if(c&&(c instanceof HTMLScriptElement||"script"in c||"timeout"in c))return c}}).then(()=>It(e,t,r)).catch(i=>{throw T(void 0,F(He,M,{remoteName:e,resourceUrl:r})),i})}async function Kr({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:o,entryGlobalName:s,name:i,type:a}=e;switch(a){case"esm":case"module":return Wr({entry:o,remoteEntryExports:t});case"system":return jr({entry:o,remoteEntryExports:t});default:return qr({entry:o,globalName:s,name:i,loaderHook:r,getEntryUrl:n})}}async function zr({remoteInfo:e,loaderHook:t}){const{entry:r,entryGlobalName:n,name:o,type:s}=e,{entryExports:i}=Ce(o,n);return i||Yt(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,c={})=>{const l=t.lifecycle.createScript.emit({url:a,attrs:c});if(l&&"url"in l)return l}}}).then(()=>It(o,n,r)).catch(a=>{throw a})}function ve(e){const{entry:t,name:r}=e;return Je(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=ve(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;W[i]=a.emit({loaderHook:c,remoteInfo:n,remoteEntryExports:r}).then(l=>l||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H())?Kr({remoteInfo:n,remoteEntryExports:r,loaderHook:c,getEntryUrl:o}):zr({remoteInfo:n,loaderHook:c}))).catch(async l=>{const f=ve(n);if(l instanceof Error&&l.message.includes(He)&&!s){const d=h=>ye({...h,_inErrorHandling:!0}),u=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:d,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:f});if(u)return u}throw l})}return W[i]}function Pe(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||pt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function Jr(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Xr(e,t){const r=sr(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(o=>{e!=null&&e.find(s=>s.name!==o.name)&&e.push(o)}),e&&e.length>0&&e.forEach(o=>{n.forEach(s=>{s.applyPlugin(o,t)})}),e}function Nt(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function Yr(e,t){return t.map(r=>{const n=xr(e,r.nameOrAlias);return T(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Ye({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:Nt(r)}})}function Zr(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Tt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:c}=a,l=t.moduleCache.get(e.name);ye(l?{origin:t,remoteInfo:c,remoteEntryExports:l.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(c=>{const{link:l,needAttach:f}=ge({url:c,cb:()=>{},attrs:a,createLinkHook:(d,u)=>{const h=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:u});if(h instanceof HTMLLinkElement)return h}});f&&document.head.appendChild(l)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(c=>{const{link:l,needAttach:f}=ge({url:c,cb:()=>{},attrs:a,createLinkHook:(d,u)=>{const h=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:u});if(h instanceof HTMLLinkElement)return h},needDeleteLink:!1});f&&document.head.appendChild(l)})}if(n){const a={rel:"preload",as:"script"};s.forEach(c=>{const{link:l,needAttach:f}=ge({url:c,cb:()=>{},attrs:a,createLinkHook:(d,u)=>{const h=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:u});if(h instanceof HTMLLinkElement)return h}});f&&document.head.appendChild(l)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(c=>{const{script:l,needAttach:f}=nt({url:c,cb:()=>{},attrs:a,createScriptHook:(d,u)=>{const h=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:u});if(h instanceof HTMLScriptElement)return h},needDeleteScript:!0});f&&document.head.appendChild(l)})}}}function Qr(e,t,r){const n=t,o=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];o.length||o.push("default"),o.forEach(i=>{n[i]||(n[i]={})});const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?o:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:n[o[0]],initScope:r??[]}}var At=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await ye({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return T(e,`remoteEntryExports is undefined
8
+ ${Ye(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:o,shareScope:s,initScope:i}=Qr(this.remoteInfo,this.host.shareScopeMap,r),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:o,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof(n==null?void 0:n.init)>"u"&&O(F(gt,M,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:o=!0}=r||{loadFactory:!0},s=await this.init(e,n);this.lib=s;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo}),i||(i=await s.get(t)),T(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=tr(this.remoteInfo.name,t),c=this.wraperFactory(i,a);return o?await c():c}wraperFactory(e,t){function r(n,o){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:o,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},v=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},P=class extends v{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const o=s=>s===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(o):s;t=o()}return Promise.resolve(t)}};function vt(e,t){if(!Me(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var q=class extends v{constructor(e){super(),this.onerror=O,this.type=e}emit(e){Me(e)||O(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(vt(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Oe(r),this.onerror(r)}return e}},G=class extends v{constructor(e){super(),this.onerror=O,this.type=e}emit(e){Me(e)||O(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const n=s=>(Oe(s),this.onerror(s),e),o=s=>{if(vt(e,s)){if(e=s,r<t.length)try{return Promise.resolve(t[r++](e)).then(o,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(o(e))}return Promise.resolve(e)}},K=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;T(er(e),"Plugin configuration is invalid.");const r=e.name;T(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,(n=e.apply)==null||n.call(e,t),Object.keys(this.lifecycle).forEach(o=>{const s=e[o];s&&this.lifecycle[o].on(s)}))}removePlugin(e){T(e,"A name is required.");const t=this.registerPlugins[e];T(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Pt(e,t){const r=at(t);r.url||O(`The attribute remoteEntry of ${e.name} must not be undefined.`);let n=Ie(t,r.url);!H()&&!n.startsWith("http")&&(n=`https:${n}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function en(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Le(t)||!st(t)){const{remoteSnapshot:a,globalSnapshot:c}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Pt(s,a);const l={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},f=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:l,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:c});return f&&Tt(s,o,f,!1),{...e,remoteSnapshot:a}}return e}}}function tn(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function kt(e,t,r,n,o={},s){const{value:i}=z(e,Q(t)),a=s||i;if(a&&!Ze(a)&&(r(a,t,n),a.remotesInfo)){const c=Object.keys(a.remotesInfo);for(const l of c){if(o[l])continue;o[l]=!0;const f=tn(l),d=a.remotesInfo[l];kt(e,{name:f.name,version:d.matchedVersion},r,!1,o,void 0)}}}const Se=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function rn(e,t,r,n,o){const s=[],i=[],a=[],c=new Set,l=new Set,{options:f}=e,{preloadConfig:d}=t,{depsRemote:u}=d;if(kt(n,r,(p,y,E)=>{var S;let m;if(E)m=d;else if(Array.isArray(u)){const R=u.find($=>$.nameOrAlias===y.name||$.nameOrAlias===y.alias);if(!R)return;m=Nt(R)}else if(u===!0)m=d;else return;const g=Ie(p,at(p).url);g&&a.push({name:y.name,moduleInfo:{name:y.name,entry:g,type:"remoteEntryType"in p?p.remoteEntryType:"global",entryGlobalName:"globalName"in p?p.globalName:y.name,shareScope:"",version:"version"in p?p.version:void 0},url:g});let b="modules"in p?p.modules:[];const w=Zr(m.exposes);w.length&&"modules"in p&&(b=(S=p==null?void 0:p.modules)==null?void 0:S.reduce((R,$)=>((w==null?void 0:w.indexOf($.moduleName))!==-1&&R.push($),R),[]));function _(R){const $=R.map(L=>Ie(p,L));return m.filter?$.filter(m.filter):$}if(b){const R=b.length;for(let $=0;$<R;$++){const L=b[$],Ee=`${y.name}/${L.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:L.moduleName==="."?y.name:Ee,name:y.name,remoteSnapshot:p,preloadConfig:m,remote:y,origin:e}),!ir(Ee)&&(m.resourceCategory==="all"?(s.push(..._(L.assets.css.async)),s.push(..._(L.assets.css.sync)),i.push(..._(L.assets.js.async)),i.push(..._(L.assets.js.sync))):(m.resourceCategory="sync")&&(s.push(..._(L.assets.css.sync)),i.push(..._(L.assets.js.sync))),ar(Ee))}}},!0,{},o),o.shared&&o.shared.length>0){const p=(y,E)=>{const{shared:m}=pe(e.shareScopeMap,E.sharedName,y,e.sharedHandler.hooks.lifecycle.resolveShare)||{};m&&typeof m.lib=="function"&&(E.assets.js.sync.forEach(g=>{c.add(g)}),E.assets.css.sync.forEach(g=>{l.add(g)}))};o.shared.forEach(y=>{var g;const E=(g=f.shared)==null?void 0:g[y.sharedName];if(!E)return;const m=y.version?E.find(b=>b.version===y.version):E;m&&it(m).forEach(b=>{p(b,y)})})}const h=i.filter(p=>!c.has(p)&&!Se("script",p));return{cssAssets:s.filter(p=>!l.has(p)&&!Se("link",p)),jsAssetsWithoutEntry:h,entryAssets:a.filter(p=>!Se("script",p.url))}}const nn=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:s,remoteSnapshot:i}=e;return H()?Le(o)&&st(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Pt(n,i),rn(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ot(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&z(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:Ge(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:Ge(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var on=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new K({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new G("loadGlobalSnapshot"),loadRemoteSnapshot:new G("loadRemoteSnapshot"),afterLoadSnapshot:new G("afterLoadSnapshot")}),this.manifestLoading=ee.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let o=fe({name:this.HostInstance.options.name,version:this.HostInstance.options.version});o||(o={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},or({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!z(o.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(o.remotesInfo={...o==null?void 0:o.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let f,d;if(c)if(Ze(c)){const u=H()?c.remoteEntry:c.ssrRemoteEntry||c.remoteEntry||"",h=await this.getManifestJson(u,e,{}),p=Ue({...e,entry:u},h);f=h,d=p}else{const{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:"global"});f=u,d=l}else if(Le(e)){const u=await this.getManifestJson(e.entry,e,{}),h=Ue(e,u),{remoteSnapshot:p}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});f=p,d=h}else O(F(St,M,{hostName:e.name,hostVersion:e.version,globalSnapshot:JSON.stringify(l)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:f}),{remoteSnapshot:f,globalSnapshot:d}}getGlobalRemoteInfo(e){return Ot(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let s=this.manifestCache.get(e);if(s)return s;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{});(!i||!(i instanceof Response))&&(i=await fetch(e,{})),s=await i.json()}catch(i){s=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),s||(delete this.manifestLoading[e],O(F(_t,M,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`)))}return T(s.metaData&&s.exposes&&s.shared,`${e} is not a federation manifest`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=Vt(s,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:s,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=o().then(s=>s)),this.manifestLoading[e]}},sn=class{constructor(e){this.hooks=new K({beforeRegisterShare:new q("beforeRegisterShare"),afterResolve:new G("afterResolve"),beforeLoadShare:new G("beforeLoadShare"),loadShare:new P,resolveShare:new q("resolveShare"),initContainerShareScopeMap:new q("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=mt(e,t);return Object.keys(r).forEach(o=>{r[o].forEach(s=>{s.scope.forEach(i=>{var a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:o,shared:s}),(a=this.shareScopeMap[i])!=null&&a[o]||this.setShared({pkgName:o,lib:s.lib,get:s.get,loaded:s.loaded||!!s.lib,shared:s,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=qe({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&await Promise.all(n.scope.map(async a=>{await Promise.all(this.initializeSharing(a,{strategy:n.strategy}))}));const{shareInfo:o}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});T(o,`Cannot find ${e} Share in the ${r.options.name}. Please ensure that the ${e} Share parameters have been injected`);const{shared:s,useTreesShaking:i}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return B(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const c=await a.loading;return a.loaded=!0,a.lib||(a.lib=c),B(a,r.options.name),c}else{const l=(async()=>{const f=await a.get();return B(a,r.options.name),a.loaded=!0,a.lib=f,f})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:l,treeShaking:i?a:void 0}),l}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),c=ae(o,a),f=(async()=>{const d=await c.get();c.lib=d,c.loaded=!0,B(c,r.options.name);const{shared:u,useTreesShaking:h}=pe(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(u){const p=ae(u,h);p.lib=d,p.loaded=!0,u.from=o.from}return d})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:f,treeShaking:a?c:void 0}),f}}initializeSharing(e=ne,t){const{host:r}=this,n=t==null?void 0:t.from,o=t==null?void 0:t.strategy;let s=t==null?void 0:t.initScope;const i=[];if(n!=="build"){const{initTokens:u}=this;s||(s=[]);let h=u[e];if(h||(h=u[e]={from:this.host.name}),s.indexOf(h)>=0)return i;s.push(h)}const a=this.shareScopeMap,c=r.options.name;a[e]||(a[e]={});const l=a[e],f=(u,h)=>{var b;const{version:p,eager:y}=h;l[u]=l[u]||{};const E=l[u],m=E[p]&&ae(E[p]),g=!!(m&&("eager"in m&&m.eager||"shareConfig"in m&&((b=m.shareConfig)!=null&&b.eager)));(!m||m.strategy!=="loaded-first"&&!m.loaded&&(!y!=!g?y:c>E[p].from))&&(E[p]=h)},d=async u=>{const{module:h}=await r.remoteHandler.getRemoteModuleAndOptions({id:u});let p;try{p=await h.getEntry()}catch(y){p=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:u,error:y,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}finally{p!=null&&p.init&&!h.initing&&(h.remoteEntryExports=p,await h.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(u=>{r.options.shared[u].forEach(h=>{h.scope.includes(e)&&f(u,h)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(u=>{u.shareScope===e&&i.push(d(u.name))}),i}loadShareSync(e,t){const{host:r}=this,n=qe({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n!=null&&n.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:o,useTreesShaking:s}=pe(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return B(o,r.options.name),o.loaded||(o.loaded=!0,o.from===r.options.name&&(n.loaded=!0)),o.lib;if(typeof o.get=="function"){const i=o.get();if(!(i instanceof Promise))return B(o,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:o}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();if(i instanceof Promise){const a=(t==null?void 0:t.from)==="build"?Rt:Ae;throw new Error(F(a,M,{hostName:r.options.name,sharedPkgName:e}))}return n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}throw new Error(F(Ae,M,{hostName:r.options.name,sharedPkgName:e}))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:o,loaded:s,get:i,treeShaking:a}){const{version:c,scope:l="default",...f}=t,d=Array.isArray(l)?l:[l],u=h=>{const p=(E,m,g)=>{g&&!E[m]&&(E[m]=g)},y=a?h.treeShaking:h;p(y,"loaded",s),p(y,"loading",o),p(y,"get",i)};d.forEach(h=>{this.shareScopeMap[h]||(this.shareScopeMap[h]={}),this.shareScopeMap[h][e]||(this.shareScopeMap[h][e]={}),this.shareScopeMap[h][e][c]||(this.shareScopeMap[h][e][c]={version:c,scope:[h],...f,lib:n});const p=this.shareScopeMap[h][e][c];u(p),r&&p.from!==r&&(p.from=r)})}_setGlobalShareScopeMap(e){const t=yt(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},an=class{constructor(e){this.hooks=new K({beforeRegisterRemote:new q("beforeRegisterRemote"),registerRemote:new q("registerRemote"),beforeRequest:new G("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new v("handlePreloadModule"),errorLoadRemote:new P("errorLoadRemote"),beforePreloadRemote:new P("beforePreloadRemote"),generatePreloadAssets:new P("generatePreloadAssets"),afterPreloadRemote:new P,loadEntry:new P}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:o,alias:s}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},s&&e.startsWith(o)){const i=e.replace(o,s);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(s&&e.startsWith(s)){const i=e.replace(s,o);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:o,moduleOptions:s,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:a,remote:c,expose:l,id:f,remoteSnapshot:d}=i,u=await o.get(f,l,t,d),h=await this.hooks.lifecycle.onLoad.emit({id:f,pkgNameOrAlias:a,expose:l,exposeModule:n?u:void 0,exposeModuleFactory:n?void 0:u,remote:c,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof h=="function"?h:u}catch(n){const{from:o="runtime"}=t||{from:"runtime"},s=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,lifecycle:"onLoad",origin:r});if(!s)throw n;return s}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=Yr(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=Pe(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});c&&Tt(s,t,c)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t==null?void 0:t.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(h){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:h,lifecycle:"beforeRequest"}),!n)throw h}const{id:o}=n,s=Ur(t.options.remotes,o);T(s,F(bt,M,{hostName:t.options.name,requestId:o}));const{remote:i}=s,a=Pe(i),c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:l,expose:f}=c;T(l&&f,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let d=t.moduleCache.get(l.name);const u={host:t,remoteInfo:a};return d||(d=new At(u),t.moduleCache.set(l.name,d)),{module:d,moduleOptions:u,remoteMatchInfo:c}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var c;return e.alias&&(a.name.startsWith(e.alias)||((c=a.alias)==null?void 0:c.startsWith(e.alias)))});T(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&H()&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=pt)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const s=t.find(i=>i.name===e.name);if(!s)o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(s),o(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Xe(i.join(" ")))}}removeRemote(e){var t;try{const{host:r}=this,{name:n}=e,o=r.options.remotes.findIndex(i=>i.name===n);o!==-1&&r.options.remotes.splice(o,1);const s=r.moduleCache.get(e.name);if(s){const i=s.remoteInfo,a=i.entryGlobalName;I[a]&&((t=Object.getOwnPropertyDescriptor(I,a))!=null&&t.configurable?delete I[a]:I[a]=void 0);const c=ve(s.remoteInfo);W[c]&&delete W[c],r.snapshotHandler.manifestCache.delete(i.entry);let l=i.buildVersion?Je(i.name,i.buildVersion):i.name;const f=I.__FEDERATION__.__INSTANCES__.findIndex(u=>i.buildVersion?u.options.id===l:u.name===l);if(f!==-1){const u=I.__FEDERATION__.__INSTANCES__[f];l=u.options.id||l;const h=yt();let p=!0;const y=[];Object.keys(h).forEach(E=>{const m=h[E];m&&Object.keys(m).forEach(g=>{const b=m[g];b&&Object.keys(b).forEach(w=>{const _=b[w];_&&Object.keys(_).forEach(S=>{const R=_[S];R&&typeof R=="object"&&R.from===i.name&&(R.loaded||R.loading?(R.useIn=R.useIn.filter($=>$!==i.name),R.useIn.length?p=!1:y.push([E,g,w,S])):y.push([E,g,w,S]))})})})}),p&&(u.shareScopeMap={},delete h[l]),y.forEach(([E,m,g,b])=>{var w,_,S;(S=(_=(w=h[E])==null?void 0:w[m])==null?void 0:_[g])==null||delete S[b]}),I.__FEDERATION__.__INSTANCES__.splice(f,1)}const{hostGlobalSnapshot:d}=Ot(e,r);if(d){const u=d&&"remotesInfo"in d&&d.remotesInfo&&z(d.remotesInfo,e.name).key;u&&(delete d.remotesInfo[u],ee.__FEDERATION__.__MANIFEST_LOADING__[u]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[u])}r.moduleCache.delete(e.name)}}catch(r){Te.log("removeRemote fail: ",r)}}};const cn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var ln=class{constructor(e){this.hooks=new K({beforeInit:new q("beforeInit"),init:new v,beforeInitContainer:new G("beforeInitContainer"),initContainer:new G("initContainer")}),this.version="2.1.0",this.moduleCache=new Map,this.loaderHook=new K({getModuleInfo:new v,createScript:new v,createLink:new v,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new K({beforeBridgeRender:new v,afterBridgeRender:new v,beforeBridgeDestroy:new v,afterBridgeDestroy:new v});const t=cn?[en(),nn()]:[],r={id:Jr(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H()};this.name=e.name,this.options=r,this.snapshotHandler=new on(this),this.sharedHandler=new sn(this),this.remoteHandler=new an(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&O(F($t,M)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=ne,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=Pe({name:e,entry:t}),o=new At({host:this,remoteInfo:n});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=mt(e,t),{userOptions:n,options:o}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),s=this.remoteHandler.formatAndRegisterRemote(o,n),{allShareInfos:i}=this.sharedHandler.registerShared(o,n),a=[...o.plugins];n.plugins&&n.plugins.forEach(l=>{a.includes(l)||a.push(l)});const c={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){const t=Xr(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(o=>o.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};let un=null;function Lt(){return un}rr(ln);function Mt(e,t){return e.map(r=>{const n={...r,path:t+r.path};return r.children&&r.children.length>0&&(n.children=Mt(r.children,t)),n})}function fn(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((u,h)=>u.path.split("/").filter(p=>p).length-h.path.split("/").filter(p=>p).length),i=new Map,a=new Set;s.forEach(u=>{i.set(u.path,u)});const c=(u,h)=>`${u}/${h}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",l=(u,h="")=>{if(!u.children||u.children.length===0)return u;for(let p=0;p<u.children.length;p++){const y=u.children[p],E=c(h,y.path),m=i.get(E);if(m&&!a.has(m)){const g={...m,path:y.path};u.children[p]=g,a.add(m),l(g,E)}}return u};let f=[];for(const u of s)if(!a.has(u)){const h=l(u,u.path);a.add(u),f.push(h)}let d;return n?d=ce.createMemoryHistory(r):o?(d=ce.createWebHashHistory(),r&&(f=Mt(f,r))):d=ce.createWebHistory(r),{history:d,routes:f}}function hn(e){const t=new Map,r=Lt();return()=>({__APP_VERSION__:"2.1.0",async render(n){var p,y,E;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:c,...l}=n,f=Dt.createApp(e.rootComponent,l);t.set(s,f);const d=await((E=(y=(p=r==null?void 0:r.bridgeHook)==null?void 0:p.lifecycle)==null?void 0:y.beforeBridgeRender)==null?void 0:E.emit(n)),u=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},h=e.appOptions({app:f,basename:i,memoryRoute:a,hashRoute:c,...l,...u});if(h!=null&&h.router){const{history:m,routes:g}=fn({router:h.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),b=ce.createRouter({...h.router.options,history:m,routes:g});D.debug("createBridgeComponent render router info>>>",{moduleName:o,router:b}),a&&await b.push(a.entryPath),f.use(b)}f.mount(s)},destroy(n){D.debug("createBridgeComponent destroy Info",n);const o=t.get(n==null?void 0:n.dom);o==null||o.unmount()}})}function dn(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const pn=A.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=A.ref(null),r=A.ref(null),n=A.ref(""),o=ke.useRoute(),s=Lt(),i=A.useAttrs(),a=async()=>{var u,h,p,y;const l=(u=e.providerInfo)==null?void 0:u.call(e);r.value=l;let f={...i,moduleName:e.moduleName,dom:t.value,basename:e.basename,memoryRoute:e.memoryRoute,hashRoute:e.hashRoute};D.debug("createRemoteAppComponent LazyComponent render >>>",f);const d=await((y=(p=(h=s==null?void 0:s.bridgeHook)==null?void 0:h.lifecycle)==null?void 0:p.beforeBridgeRender)==null?void 0:y.emit(f))||{};f={...f,...d.extraProps},l.render(f)},c=A.watch(()=>o==null?void 0:o.path,l=>{l!==o.path&&a(),n.value!==""&&n.value!==l&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),dn()),n.value=l});return A.onMounted(()=>{a()}),A.onBeforeUnmount(()=>{var l;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),c(),(l=r.value)==null||l.destroy({dom:t.value})}),()=>A.createVNode("div",A.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ct(e){return A.defineAsyncComponent({__APP_VERSION__:"2.1.0",...e.asyncComponentOptions,loader:async()=>{var c,l;const t=ke.useRoute();let r="/";const n=(l=(c=t==null?void 0:t.matched)==null?void 0:c[0])==null?void 0:l.path;n&&(n.endsWith("/:pathMatch(.*)*")?r=n.replace("/:pathMatch(.*)*",""):r=t.matched[0].path);const o=(e==null?void 0:e.export)||"default";D.debug("createRemoteAppComponent LazyComponent create >>>",{basename:r,info:e});const s=await e.loader(),i=s&&s[Symbol.for("mf_module_id")],a=s[o];if(D.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:i,module:s,exportName:o,basename:r,route:t}),o in s&&typeof a=="function")return{render(){return A.h(pn,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs})}};throw new Error("module not found")}})}function mn(e){return D.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),Ct(e)}exports.createBridgeComponent=hn;exports.createRemoteAppComponent=Ct;exports.createRemoteComponent=mn;