@module-federation/bridge-vue3 2.0.1 → 2.2.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 +21 -2
- package/dist/index.cjs +8 -8
- package/dist/index.js +1888 -1956
- package/package.json +4 -5
- package/project.json +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @module-federation/bridge-vue3
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [c856ec1]
|
|
8
|
+
- Updated dependencies [12240bb]
|
|
9
|
+
- Updated dependencies [e5dd6ef]
|
|
10
|
+
- @module-federation/sdk@2.2.0
|
|
11
|
+
- @module-federation/runtime@2.2.0
|
|
12
|
+
- @module-federation/bridge-shared@2.2.0
|
|
13
|
+
|
|
14
|
+
## 2.1.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [918294f]
|
|
19
|
+
- Updated dependencies [918294f]
|
|
20
|
+
- @module-federation/runtime@2.1.0
|
|
21
|
+
- @module-federation/sdk@2.1.0
|
|
22
|
+
- @module-federation/bridge-shared@2.1.0
|
|
23
|
+
|
|
3
24
|
## 2.0.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -193,7 +214,6 @@
|
|
|
193
214
|
### Patch Changes
|
|
194
215
|
|
|
195
216
|
- a7cf276: chore: upgrade NX to 21.2.3, Storybook to 9.0.9, and TypeScript to 5.8.3
|
|
196
|
-
|
|
197
217
|
- Upgraded NX from 21.0.3 to 21.2.3 with workspace configuration updates
|
|
198
218
|
- Migrated Storybook from 8.3.5 to 9.0.9 with updated configurations and automigrations
|
|
199
219
|
- Upgraded TypeScript from 5.7.3 to 5.8.3 with compatibility fixes
|
|
@@ -355,7 +375,6 @@
|
|
|
355
375
|
### Patch Changes
|
|
356
376
|
|
|
357
377
|
- 6bc13cf: Fixed several issues:
|
|
358
|
-
|
|
359
378
|
1. Resolved inconsistencies in naming between `name` and `moduleName` to align with the type defined in `packages/bridge/bridge-shared/src/type.ts`. This also fixed an issue where `name` was being passed to the remote component, and if it was `<router-view>`, it caused rendering issues.
|
|
360
379
|
2. Issue: When passing props from a Vue 3 host application to a Vue 3 remote application created with `createRemoteComponent`, the props were being applied as attributes on the root container instead of being passed to the remote component.
|
|
361
380
|
Fix: Set `inheritAttrs: false` in `remoteApp.tsx` and explicitly pass all attributes to the remote component using `useAttrs()`.
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),
|
|
3
|
-
${
|
|
4
|
-
`)}`:void 0}catch{return}}class
|
|
5
|
-
})`,{filename,importModuleDynamically:((
|
|
6
|
-
${
|
|
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,a;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__={}),(a=r.__FEDERATION__).__PRELOADED_MAP__??(a.__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.1")}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,a]=s.split(":"),c=`${i}:${t}`,u=r[c];if(u)return{value:u,key:c}}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,a=getFMId(i),c=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,a).value;if((c==null?void 0:c.version)===s)return c}},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,a,c,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,a)=>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`:a?o==="0"?s==="0"?`>=${o}.${s}.${i}-${a} <${o}.${s}.${Number(i)+1}-0`:`>=${o}.${s}.${i}-${a} <${o}.${Number(s)+1}.0-0`:`>=${o}.${s}.${i}-${a} <${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,a)=>isXVersion(o)?"":isXVersion(s)?`>=${o}.0.0 <${Number(o)+1}.0.0-0`:isXVersion(i)?`>=${o}.${s}.0 <${o}.${Number(s)+1}.0-0`:a?`>=${o}.${s}.${i}-${a} <${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,a,c)=>{const u=isXVersion(s),l=u||isXVersion(i),d=l||isXVersion(a);return o==="="&&d&&(o=""),c="",u?o===">"||o==="<"?"<0.0.0-0":"*":o&&d?(l&&(i=0),a=0,o===">"?(o=">=",l?(s=Number(s)+1,i=0,a=0):(i=Number(i)+1,a=0)):o==="<="&&(o="<",l?s=Number(s)+1:i=Number(i)+1),o==="<"&&(c="-0"),`${o+s}.${i}.${a}${c}`):l?`>=${s}.0.0${c} <${Number(s)+1}.0.0-0`:d?`>=${s}.${i}.0${c} <${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 a=n[s],c=o[s];if(a!==c)return a===void 0&&c===void 0?0:a?c?compareAtom(a,c):-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,a,c]=n,u={operator:o,version:combineVersion(s,i,a,c),major:s,minor:i,patch:a,preRelease:c==null?void 0:c.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,w={operator:R,version:combineVersion(_,I,S,T),major:_,minor:I,patch:S,preRelease:T==null?void 0:T.split(".")};if(!compare(w,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,a;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&&((a=r.treeShaking)!=null&&a.mode))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((a,c)=>{const u=arrayOptions(n[c]);return a[c]=a[c]||[],u.forEach(l=>{a[c].push(formatShare(l,o,c,t.shareStrategy))}),a},{}),i={...r.shared};return Object.keys(s).forEach(a=>{i[a]?s[a].forEach(c=>{i[a].find(l=>l.version===c.version)||i[a].push(c)}):i[a]=s[a]}),{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 a=o;for(let c=0;c<3-i.length;c++)a+=".0";return a}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="",a=shouldUseTreeShaking(o);const c=function(u,l){return a?s[u].treeShaking?s[l].treeShaking?!isLoaded(s[u].treeShaking)&&versionLt(u,l):!1:!0:!isLoaded(s[u])&&versionLt(u,l)};if(a){if(i=findVersion(r[t][n],c),i)return{version:i,useTreesShaking:a};a=!1}return{version:findVersion(r[t][n],c),useTreesShaking:a}}const isLoadingOrLoaded=r=>isLoaded(r)||isLoading(r);function findSingletonVersionOrderByLoaded(r,t,n,o){const s=r[t][n];let i="",a=shouldUseTreeShaking(o);const c=function(u,l){if(a){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(a){if(i=findVersion(r[t][n],c),i)return{version:i,useTreesShaking:a};a=!1}return{version:findVersion(r[t][n],c),useTreesShaking:a}}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:a,treeShaking:c}=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(a),{version:h,useTreesShaking:p}=m(r,l,t,c),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(c);if(R){for(const[_,I]of Object.entries(r[l][t]))if(shouldUseTreeShaking(I.treeShaking,c==null?void 0:c.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,a=u=>u!==null&&typeof u=="object"&&!Array.isArray(u),c=(...u)=>{const l={};for(const d of u)if(d)for(const[m,h]of Object.entries(d)){const p=l[m];a(p)&&a(h)?l[m]=c(p,h):h!==void 0&&(l[m]=h)}return l};return c(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 c=n.name;return s=`.${s}`,{pkgNameOrAlias:c,expose:s,remote:n}}else if(s==="")return{pkgNameOrAlias:n.name,expose:".",remote:n}}const i=n.alias&&t.startsWith(n.alias);let a=n.alias&&t.replace(n.alias,"");if(n.alias&&i){if(a&&a.startsWith("/")){const c=n.alias;return a=`.${a}`,{pkgNameOrAlias:c,expose:a,remote:n}}else if(a==="")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 a=s?s(n):n;return loadScript(a,{attrs:{},createScriptHook:(c,u)=>{const l=o.lifecycle.createScript.emit({url:c,attrs:u});if(l&&(l instanceof HTMLScriptElement||"script"in l||"timeout"in l))return l}}).then(()=>handleRemoteEntryLoaded(r,t,n)).catch(c=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:r,resourceUrl:n})),c})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:n,getEntryUrl:o}){const{entry:s,entryGlobalName:i,name:a,type:c}=r;switch(c){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:a,loaderHook:n,getEntryUrl:o})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:n,entryGlobalName:o,name:s,type:i}=r,{entryExports:a}=getRemoteEntryExports(s,o);return a||loadScriptNode(n,{attrs:{name:s,globalName:o,type:i},loaderHook:{createScriptHook:(c,u={})=>{const l=t.lifecycle.createScript.emit({url:c,attrs:u});if(l&&"url"in l)return l}}}).then(()=>handleRemoteEntryLoaded(s,o,n)).catch(c=>{throw c})}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,a=getRemoteEntryUniqueKey(o);if(n)return n;if(!globalLoading[a]){const c=t.remoteHandler.hooks.lifecycle.loadEntry,u=t.loaderHook;globalLoading[a]=c.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[a]}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:a}=n;if(t.options.inBrowser){if(a.forEach(c=>{const{moduleInfo:u}=c,l=t.moduleCache.get(r.name);getRemoteEntry(l?{origin:t,remoteInfo:u,remoteEntryExports:l.remoteEntryExports}:{origin:t,remoteInfo:u,remoteEntryExports:void 0})}),o){const c={rel:"preload",as:"style"};s.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:c,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 c={rel:"stylesheet",type:"text/css"};s.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:c,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 c={rel:"preload",as:"script"};i.forEach(u=>{const{link:l,needAttach:d}=createLink({url:u,cb:()=>{},attrs:c,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 c={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:c,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(c=>{n[c]||(n[c]={})});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)return o;if(this.initPromise)return await this.initPromise,o;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:s,shareScope:i,initScope:a}=createRemoteEntryInitOptions(this.remoteInfo,this.host.shareScopeMap),c=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:s,initScope:a,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(c.shareScope,c.initScope,c.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...c,id:t,remoteSnapshot:n,remoteEntryExports:o}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return o}async get(t,n,o,s){const{loadFactory:i=!0}=o||{loadFactory:!0},a=await this.init(t,s);this.lib=a;let c;c=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:n,moduleInfo:this.remoteInfo}),c||(c=await a.get(n)),assert(c,`${getFMId(this.remoteInfo)} remote don't export ${n}.`);const u=processModuleAlias(this.remoteInfo.name,n),l=this.wraperFactory(c,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=a=>a===!1?!1:s<o.length?Promise.resolve(o[s++].apply(null,t)).then(i):a;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=a=>(warn(a),this.onerror(a),t),i=a=>{if(checkReturnData(t,a)){if(t=a,o<n.length)try{return Promise.resolve(n[o++](t)).then(i,s)}catch(c){return s(c)}}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 a=t[i];a&&this.lifecycle[i].on(a)}))}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:a}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:c,globalSnapshot:u}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:a});assignRemoteInfo(i,c);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:c,globalSnapshot:u});return d&&preloadAssets(i,s,d,!1),{...r,remoteSnapshot:c}}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 a=getFMId(t),{value:c}=getInfoWithoutType(r,a),u=i||c;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=[],a=[],c=[],u=new Set,l=new Set,{options:d}=r,{preloadConfig:m}=t,{depsRemote:h}=m;if(traverseModuleInfo(o,n,(g,b,R)=>{var A;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&&c.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=(A=g==null?void 0:g.modules)==null?void 0:A.reduce(($,k)=>((T==null?void 0:T.indexOf(k.moduleName))!==-1&&$.push(k),$),[]));function w($){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],P=`${b.name}/${N.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:N.moduleName==="."?b.name:P,name:b.name,remoteSnapshot:g,preloadConfig:_,remote:b,origin:r}),!getPreloaded(P)&&(_.resourceCategory==="all"?(i.push(...w(N.assets.css.async)),i.push(...w(N.assets.css.sync)),a.push(...w(N.assets.js.async)),a.push(...w(N.assets.js.sync))):(_.resourceCategory="sync")&&(i.push(...w(N.assets.css.sync)),a.push(...w(N.assets.js.sync))),setPreloaded(P))}}},!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=a.filter(g=>!u.has(g)&&!isExisted("script",g));return{cssAssets:i.filter(g=>!l.has(g)&&!isExisted("link",g)),jsAssetsWithoutEntry:y,entryAssets:c.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:a}=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,a),generatePreloadAssets(t,n,o,i,a)):{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:a,remoteSnapshot:c,globalSnapshot:u}=this.getGlobalRemoteInfo(t),{remoteSnapshot:l,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:a,remoteSnapshot:c,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 a=this.manifestCache.get(t);if(a)return a;try{let c=await this.loaderHook.lifecycle.fetch.emit(t,{});(!c||!(c instanceof Response))&&(c=await fetch(t,{})),a=await c.json()}catch(c){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:c,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),a||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:n.name,hostName:this.HostInstance.options.name},`${c}`)))}return assert(a.metaData&&a.exposes&&a.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,a),a},i=async()=>{const a=await s(),c=generateSnapshotFromManifest(a,{version:t}),{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:n,manifestJson:a,remoteSnapshot:c,manifestUrl:t,from:"manifest"});return u};return this.manifestLoading[t]||(this.manifestLoading[t]=i().then(a=>a)),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(a=>{o[a].forEach(u=>{u.scope.forEach(l=>{var m;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:a,shared:u}),((m=this.shareScopeMap[l])==null?void 0:m[a])||this.setShared({pkgName:a,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:a}=i;assert(a,`Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);const{shared:c,useTreesShaking:u}=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare)||{};if(c){const l=directShare(c,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:c,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(a.treeShaking),d=directShare(a,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,a,this.hooks.lifecycle.resolveShare)||{};if(y){const g=directShare(y,E);g.lib=p,g.loaded=!0,y.from=a.from}return p})();return this.setShared({pkgName:t,loaded:!1,shared:a,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 a=n==null?void 0:n.initScope;const c=[];if(s!=="build"){const{initTokens:p}=this;a||(a=[]);let y=p[t];if(y||(y=p[t]={from:this.host.name}),a.indexOf(y)>=0)return c;a.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&&c.push(h(p.name))}),c}loadShareSync(t,n){const{host:o}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:o.options.shared});s!=null&&s.scope&&s.scope.forEach(c=>{this.initializeSharing(c,{strategy:s.strategy})});const{shared:i,useTreesShaking:a}=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 c=i.get();if(!(c instanceof Promise))return addUseIn(i,o.options.name),this.setShared({pkgName:t,loaded:!0,from:o.options.name,lib:c,shared:i}),c}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const c=s.get();if(c 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=c,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:a,get:c,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",a),E(g,"loading",i),E(g,"get",c)};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:a}=o;if(this.idToRemoteMap[t]={name:o.name,expose:s},a&&t.startsWith(i)){const c=t.replace(i,a);this.idToRemoteMap[c]={name:o.name,expose:s};return}if(a&&t.startsWith(a)){const c=t.replace(a,i);this.idToRemoteMap[c]={name:o.name,expose:s}}}async loadRemote(t,n){const{host:o}=this;try{const{loadFactory:s=!0}=n||{loadFactory:!0},{module:i,moduleOptions:a,remoteMatchInfo:c}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:u,remote:l,expose:d,id:m,remoteSnapshot:h}=c,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:a,moduleInstance:i,origin:o});return this.setIdToRemoteMap(t,c),typeof y=="function"?y:p}catch(s){const{from:i="runtime"}=n||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:i,lifecycle:"onLoad",origin:o});if(!a)throw s;return a}}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,a=getRemoteInfo(i),{globalSnapshot:c,remoteSnapshot:u}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:s,remote:i,remoteInfo:a,globalSnapshot:c,remoteSnapshot:u});l&&preloadAssets(a,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,a=matchRemoteWithNameAndExpose(n.options.remotes,i);assert(a,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:n.options.name,requestId:i}));const{remote:c}=a,u=getRemoteInfo(c),l=await n.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...a,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 c=n.find(u=>{var l;return t.alias&&(u.name.startsWith(t.alias)||((l=u.alias)==null?void 0:l.startsWith(t.alias)))});assert(!c,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${c&&c.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 a=n.find(c=>c.name===t.name);if(!a)i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const c=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];o!=null&&o.force&&(this.removeRemote(a),i(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(c.join(" ")))}}removeRemote(t){var n;try{const{host:o}=this,{name:s}=t,i=o.options.remotes.findIndex(c=>c.name===s);i!==-1&&o.options.remotes.splice(i,1);const a=o.moduleCache.get(t.name);if(a){const c=a.remoteInfo,u=c.entryGlobalName;CurrentGlobal[u]&&((n=Object.getOwnPropertyDescriptor(CurrentGlobal,u))!=null&&n.configurable?delete CurrentGlobal[u]:CurrentGlobal[u]=void 0);const l=getRemoteEntryUniqueKey(a.remoteInfo);globalLoading[l]&&delete globalLoading[l],o.snapshotHandler.manifestCache.delete(c.entry);let d=c.buildVersion?composeKeyWithSeparator(c.name,c.buildVersion):c.name;const m=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(p=>c.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(w=>{const A=T[w];A&&typeof A=="object"&&A.from===c.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter($=>$!==c.name),A.useIn.length?E=!1:g.push([b,_,S,w])):g.push([b,_,S,w]))})})})}),E&&(p.shareScopeMap={},delete y[d]),g.forEach(([b,R,_,I])=>{var S,T,w;(w=(T=(S=y[b])==null?void 0:S[R])==null?void 0:T[_])==null||delete w[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.1",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}),a=this.remoteHandler.formatAndRegisterRemote(i,s),{allShareInfos:c}=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:a,shared:c};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),a=new Map,c=new Set;i.forEach(h=>{a.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=a.get(g);if(b&&!c.has(b)){const R={...b,path:E.path};h.children[y]=R,c.add(b),l(R,g)}}return h};let d=[];for(const h of i)if(!c.has(h)){const p=l(h,h.path);c.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.1",async render(o){var y,E,g;LoggerInstance.debug("createBridgeComponent render Info",o);const{moduleName:s,dom:i,basename:a,memoryRoute:c,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:a,memoryRoute:c,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:_}),c&&await _.push(c.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(),a=Vue.useAttrs(),c=async()=>{var h,p,y,E;const l=(h=r.providerInfo)==null?void 0:h.call(r);n.value=l;let d={...a,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&&c(),o.value!==""&&o.value!==l&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),o.value=l});return Vue.onMounted(()=>{c()}),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.1",...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(),a=i&&i[Symbol.for("mf_module_id")],c=i[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:a,module:i,exportName:s,basename:n,route:t}),s in i&&typeof c=="function")return{render(){return Vue.h(RemoteApp,{moduleName:a,providerInfo:c,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 v=require("vue"),Oe=require("vue-router");function ze(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 Gt=ze(v),ce=ze(Oe),xt=".json",Ut="FEDERATION_DEBUG",Vt=":";let $e=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});const H=typeof ENV_TARGET<"u"?ENV_TARGET==="web":typeof window<"u"&&typeof window.document<"u";function Je(){return H}function Xe(){return typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative"}function Bt(){try{if(Je()&&window.localStorage)return!!localStorage.getItem(Ut)}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:Bt()}const Wt="[ Federation Runtime ]",Ye=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}${Vt}${r}`:r:t,""):""},Ne=(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?!Je()&&!Xe()&&"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),"")},Ze=e=>{console.warn(`${Wt}: ${e}`)};function Qe(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 jt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qt(e,t={}){var E,b,N;const{remotes:r={},overrides:n={},version:o}=t;let s;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&o?jt(o):e.metaData.publicPath:e.metaData.getPublicPath,a=Object.keys(n);let l={};Object.keys(r).length||(l=((E=e.remotes)==null?void 0:E.reduce((_,$)=>{let R;const w=$.federationContainerName;return a.includes(w)?R=n[w]:"version"in $?R=$.version:R=$.entry,_[w]={matchedVersion:R},_},{}))||{}),Object.keys(r).forEach(_=>l[_]={matchedVersion:a.includes(_)?n[_]:r[_]});const{remoteEntry:{path:c,name:f,type:h},types:u={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:d},globalName:m,ssrRemoteEntry:y}=e.metaData,{exposes:g}=e;let p={version:o||"",buildVersion:d,globalName:m,remoteEntry:oe(c,f),remoteEntryType:h,remoteTypes:oe(u.path,u.name),remoteTypesZip:u.zip||"",remoteTypesAPI:u.api||"",remotesInfo:l,shared:e==null?void 0:e.shared.map(_=>({assets:_.assets,sharedName:_.name,version:_.version,usedExports:_.referenceExports||[]})),modules:g==null?void 0:g.map(_=>({moduleName:_.name,modulePath:_.path,assets:_.assets}))};if((b=e.metaData)!=null&&b.prefetchInterface){const _=e.metaData.prefetchInterface;p={...p,prefetchInterface:_}}if((N=e.metaData)!=null&&N.prefetchEntry){const{path:_,name:$,type:R}=e.metaData.prefetchEntry;p={...p,prefetchEntry:oe(_,$),prefetchEntryType:R}}if("publicPath"in e.metaData?(s={...p,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...p,getPublicPath:i()},y){const _=oe(y.path,y.name);s.ssrRemoteEntry=_,s.ssrRemoteEntryType=y.type||"commonjs-module"}return s}function et(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(xt))}const Kt="[ Module Federation ]",X=console,zt=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function Jt(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
|
|
2
|
+
`),r=t.filter(n=>!zt.some(o=>n.includes(o)));return r.length?`Stack trace:
|
|
3
|
+
${r.slice(0,5).join(`
|
|
4
|
+
`)}`:void 0}catch{return}}var tt=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()?Jt():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 rt(e){return new tt(e)}function Xt(e){const t=new tt(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Xt(Kt);async function nt(e,t){try{return await e()}catch(r){Ze(r);return}}function Ie(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function ot(e){let t=null,r=!0,n=2e4,o;const s=document.getElementsByTagName("script");for(let c=0;c<s.length;c++){const f=s[c],h=f.getAttribute("src");if(h&&Ie(h,e.url)){t=f,r=!1;break}}if(!t){const c=e.attrs;t=document.createElement("script"),t.type=(c==null?void 0:c.type)==="module"?"module":"text/javascript";let f;e.createScriptHook&&(f=e.createScriptHook(e.url,e.attrs),f instanceof HTMLScriptElement?t=f:typeof f=="object"&&("script"in f&&f.script&&(t=f.script),"timeout"in f&&f.timeout&&(n=f.timeout))),t.src||(t.src=e.url),c&&!f&&Object.keys(c).forEach(h=>{t&&(h==="async"||h==="defer"?t[h]=c[h]:t.getAttribute(h)||t.setAttribute(h,c[h]))})}let i=null;const a=typeof window<"u"?c=>{if(c.filename&&Ie(c.filename,e.url)){const f=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);f.name="ScriptExecutionError",i=f}}:null;a&&window.addEventListener("error",a);const l=async(c,f)=>{clearTimeout(o),a&&window.removeEventListener("error",a);const h=()=>{if((f==null?void 0:f.type)==="error"){const u=new Error(`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);u.name="ScriptNetworkError",e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(u))}else i?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,nt(()=>{const{needDeleteScript:u=!0}=e;u&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const u=c(f);if(u instanceof Promise){const d=await u;return h(),d}return h(),u}h()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o=setTimeout(()=>{l(null,new Error(`Remote script "${e.url}" time-outed.`))},n),{script:t,needAttach:r}}function Ee(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"),l=i.getAttribute("rel");if(a&&Ie(a,e.url)&&l===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,nt(()=>{const{needDeleteLink:l=!0}=e;l&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),s)){const l=s(i);return a(),l}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),{link:t,needAttach:r}}function Yt(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((o,s)=>{const{script:i,needAttach:a}=ot({url:e,cb:o,onErrorCallback:s,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});a&&document.head.appendChild(i)})}const se=new Map;function B(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 st=async()=>{const e=await B("node-fetch");return e.default||e},Zt=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 st():fetch)(e,t||{}):o},Qt=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,l)=>Zt(a,l,n):typeof fetch>"u"?st():fetch,i=async(a,l)=>{var c;try{const h=await(await a(l.href)).text(),[u,d]=await Promise.all([B("path"),B("vm")]),m={exports:{},module:{exports:{}}},y=l.pathname.split("/").slice(0,-1).join("/"),g=u.basename(l.pathname),p=new d.Script(`(function(exports, module, require, __dirname, __filename) {${h}
|
|
5
|
+
})`,{filename:g,importModuleDynamically:((c=d.constants)==null?void 0:c.USE_MAIN_CONTEXT_DEFAULT_LOADER)??B});let E;E=(await B("node:module")).createRequire(l.protocol==="file:"||l.protocol==="node:"?l.href:u.join(process.cwd(),"__mf_require_base__.js")),p.runInThisContext()(m.exports,m.module,E,y,g);const b=m.module.exports||m.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 Te(o.href,{fetch:a,vm:await B("vm")}).then(async l=>{await l.evaluate(),t(void 0,l.namespace)}).catch(l=>{t(l instanceof Error?l:new Error(`Script execution error: ${l}`))});i(a,o)}).catch(a=>{t(a)})}:(e,t,r,n)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},er=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(e,t)=>new Promise((r,n)=>{Qt(e,(o,s)=>{var i,a;if(o)n(o);else{const l=((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[l]=s)}},t.attrs,t.loaderHook)}):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},_e=new Map;async function Te(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 l=new URL(i,e).href;return Te(l,t)}});return _e.set(e,s),await s.link(async i=>{const a=new URL(i,e).href;return await Te(a,t)}),s}const D=rt("[ Module Federation Bridge Vue3 ]"),tr=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,it=(e,t,r,n)=>{const o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(tr(e)),n&&o.push(`Original Error Message:
|
|
6
|
+
${n}`),o.join(`
|
|
7
|
+
`)};function rr(e,t,r,n,o,s){return n(it(e,t,r,o))}const G="[ Federation Runtime ]",ve=rt(G);function k(e,t,r,n,o){e||S(t)}function S(e,t,r,n,o){if(t!==void 0)return rr(e,t,r??{},i=>{throw new Error(`${G}: ${i}`)},n);const s=e;throw s instanceof Error?(s.message.startsWith(G)||(s.message=`${G}: ${s.message}`),s):new Error(`${G}: ${s}`)}function Le(e){e instanceof Error&&(e.message.startsWith(G)||(e.message=`${G}: ${e.message}`)),ve.warn(e)}function nr(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 Me(e){return typeof e.entry<"u"}function at(e){return!e.entry.includes(".json")}function Ce(e){return e&&typeof e=="object"}const or=Object.prototype.toString;function sr(e){return or.call(e)==="[object Object]"}function ct(e){return Array.isArray(e)?e:[e]}function lt(e){const t={url:"",type:"global",globalName:""};return H||Xe()||!("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 ir=(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,O=(()=>{try{return document.defaultView}catch{return I}})(),ee=O;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 ut(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)}ut(I);ut(O);function ar(e,t=we()){t&&(I.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,I.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.2.0")}function K(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 S(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}const xe=()=>O.__FEDERATION__.moduleInfo,cr=(e,t)=>{const r=K(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=K(O.__FEDERATION__.moduleInfo,s).value;if((i==null?void 0:i.version)===n)return i}},fe=e=>cr(e,O.__FEDERATION__.moduleInfo),Ue=(e,t)=>{const r=Q(e);return O.__FEDERATION__.moduleInfo[r]=t,O.__FEDERATION__.moduleInfo},lr=e=>(O.__FEDERATION__.moduleInfo={...O.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete O.__FEDERATION__.moduleInfo[r]}),De=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:I[r]}},ur=()=>O.__FEDERATION__.__GLOBAL_PLUGIN__,fr=e=>I.__FEDERATION__.__PRELOADED_MAP__.get(e),hr=e=>I.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Ve="[0-9A-Za-z-]+",Fe=`(?:\\+(${Ve}(?:\\.${Ve})*))`,Z="0|[1-9]\\d*",he="[0-9]+",ft="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Be=`(?:${he}|${ft})`,dr=`(?:-?(${Be}(?:\\.${Be})*))`,We=`(?:${Z}|${ft})`,ht=`(?:-(${We}(?:\\.${We})*))`,be=`${Z}|x|X|\\*`,z=`[v=\\s]*(${be})(?:\\.(${be})(?:\\.(${be})(?:${ht})?${Fe}?)?)?`,mr=`^\\s*(${z})\\s+-\\s+(${z})\\s*$`,pr=`[v=\\s]*${`(${he})\\.(${he})\\.(${he})`}${dr}?${Fe}?`,He="((?:<|>)?=?)",yr=`(\\s*)${He}\\s*(${pr}|${z})`,dt="(?:~>?)",gr=`(\\s*)${dt}\\s+`,mt="(?:\\^)",Er=`(\\s*)${mt}\\s+`,_r="(<|>)?=?\\s*\\*",br=`^${mt}${z}$`,Rr=`v?${`(${Z})\\.(${Z})\\.(${Z})`}${ht}?${Fe}?`,Sr=`^${dt}${z}$`,$r=`^${He}\\s*${z}$`,wr=`^${He}\\s*(${Rr})$|^$`,Nr="^\\s*>=\\s*0.0.0\\s*$";function C(e){return new RegExp(e)}function T(e){return!e||e.toLowerCase()==="x"||e==="*"}function pt(...e){return t=>e.reduce((r,n)=>n(r),t)}function je(e){return e.match(C(wr))}function qe(e,t,r,n){const o=`${e}.${t}.${r}`;return n?`${o}-${n}`:o}function Ir(e){return e.replace(C(mr),(t,r,n,o,s,i,a,l,c,f,h,u)=>(T(n)?r="":T(o)?r=`>=${n}.0.0`:T(s)?r=`>=${n}.${o}.0`:r=`>=${r}`,T(c)?l="":T(f)?l=`<${Number(c)+1}.0.0-0`:T(h)?l=`<${c}.${Number(f)+1}.0-0`:u?l=`<=${c}.${f}.${h}-${u}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Tr(e){return e.replace(C(yr),"$1$2$3")}function vr(e){return e.replace(C(gr),"$1~")}function Ar(e){return e.replace(C(Er),"$1^")}function Pr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(br),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(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 kr(e){return e.trim().split(/\s+/).map(t=>t.replace(C(Sr),(r,n,o,s,i)=>T(n)?"":T(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:T(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 Or(e){return e.split(/\s+/).map(t=>t.trim().replace(C($r),(r,n,o,s,i,a)=>{const l=T(o),c=l||T(s),f=c||T(i);return n==="="&&f&&(n=""),a="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&f?(c&&(s=0),i=0,n===">"?(n=">=",c?(o=Number(o)+1,s=0,i=0):(s=Number(s)+1,i=0)):n==="<="&&(n="<",c?o=Number(o)+1:s=Number(s)+1),n==="<"&&(a="-0"),`${n+o}.${s}.${i}${a}`):c?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:f?`>=${o}.${s}.0${a} <${o}.${Number(s)+1}.0-0`:r})).join(" ")}function Lr(e){return e.trim().replace(C(_r),"")}function Mr(e){return e.trim().replace(C(Nr),"")}function de(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Cr(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)||Cr(e,t)}function Re(e,t){return e.version===t.version}function Dr(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 Fr(e){return pt(Pr,kr,Or,Lr)(e)}function Hr(e){return pt(Ir,Tr,vr,Ar)(e.trim()).split(/\s+/).join(" ")}function Y(e,t){if(!e)return!1;const r=je(e);if(!r)return!1;const[,n,,o,s,i,a]=r,l={operator:n,version:qe(o,s,i,a),major:o,minor:s,patch:i,preRelease:a==null?void 0:a.split(".")},c=t.split("||");for(const f of c){const h=f.trim();if(!h||h==="*"||h==="x")return!0;try{const u=Hr(h);if(!u.trim())return!0;const d=u.split(" ").map(g=>Fr(g)).join(" ");if(!d.trim())return!0;const m=d.split(/\s+/).map(g=>Mr(g)).filter(Boolean);if(m.length===0)continue;let y=!0;for(const g of m){const p=je(g);if(!p){y=!1;break}const[,E,,b,N,_,$]=p;if(!Dr({operator:E,version:qe(b,N,_,$),major:b,minor:N,patch:_,preRelease:$==null?void 0:$.split(".")},l)){y=!1;break}}if(y)return!0}catch(u){console.error(`[semver] Error processing range part "${h}":`,u);continue}}return!1}const ne="default",yt="global";function Gr(e,t,r,n){var s,i;let o;return"get"in e?o=e.get:"lib"in e?o=()=>Promise.resolve(e.lib):o=()=>Promise.resolve(()=>{S(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(s=e.shareConfig)!=null&&s.eager&&((i=e.treeShaking)!=null&&i.mode)&&S(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{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 gt(e,t){const r=t.shared||{},n=t.name,o=Object.keys(r).reduce((i,a)=>{const l=ct(r[a]);return i[a]=i[a]||[],l.forEach(c=>{i[a].push(Gr(c,n,a,t.shareStrategy))}),i},{}),s={...e.shared};return Object.keys(o).forEach(i=>{s[i]?o[i].forEach(a=>{s[i].find(l=>l.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?Ur(e,t):!0:!1}function x(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 x(n,o)};return Object.keys(e).reduce((n,o)=>!n||r(n,o)||n==="0"?o:n,0)},pe=e=>!!e.loaded||typeof e.lib=="function",xr=e=>!!e.loading,Ur=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Vr(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){return i?o[l].treeShaking?o[c].treeShaking?!pe(o[l].treeShaking)&&x(l,c):!1:!0:!pe(o[l])&&x(l,c)};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 U=e=>pe(e)||xr(e);function Br(e,t,r,n){const o=e[t][r];let s="",i=te(n);const a=function(l,c){if(i){if(!o[l].treeShaking)return!0;if(!o[c].treeShaking)return!1;if(U(o[c].treeShaking))return U(o[l].treeShaking)?!!x(l,c):!0;if(U(o[l].treeShaking))return!1}return U(o[c])?U(o[l])?!!x(l,c):!0:U(o[l])?!1:x(l,c)};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 Wr(e){return e==="loaded-first"?Br:Vr}function me(e,t,r,n){if(!e)return;const{shareConfig:o,scope:s=ne,strategy:i,treeShaking:a}=r,l=Array.isArray(s)?s:[s];for(const c of l)if(o&&e[c]&&e[c][t]){const{requiredVersion:f}=o,{version:h,useTreesShaking:u}=Wr(i)(e,c,t,a),d=()=>{const y=e[c][t][h];if(o.singleton){if(typeof f=="string"&&!Y(h,f)){const g=`Version ${h} from ${h&&y.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${f})`;o.strictVersion?S(g):Le(g)}return{shared:y,useTreesShaking:u}}else{if(f===!1||f==="*")return{shared:y,useTreesShaking:u};if(Y(h,f))return{shared:y,useTreesShaking:u};const g=te(a);if(g){for(const[p,E]of Object.entries(e[c][t]))if(te(E.treeShaking,a==null?void 0:a.usedExports)&&Y(p,f))return{shared:E,useTreesShaking:g}}for(const[p,E]of Object.entries(e[c][t]))if(Y(p,f))return{shared:E,useTreesShaking:!1}}},m={shareScopeMap:e,scope:c,pkgName:t,version:h,GlobalFederation:ee.__FEDERATION__,shareInfo:r,resolver:d};return(n.emit(m)||m).resolver()}}function Et(){return ee.__FEDERATION__.__SHARE__}function Ke(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,o=l=>{if(!l)return;const c={};return l.forEach(h=>{c[h.version]=h}),c[re(c,function(h,u){return!pe(c[h])&&x(h,u)})]},s=(r==null?void 0:r.resolver)??o,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),a=(...l)=>{const c={};for(const f of l)if(f)for(const[h,u]of Object.entries(f)){const d=c[h];i(d)&&i(u)?c[h]=a(d,u):u!==void 0&&(c[h]=u)}return c};return a(s(n[t]),r==null?void 0:r.customShareInfo)}const V=(e,t)=>{e.useIn||(e.useIn=[]),nr(e.useIn,t)};function ae(e,t){return t&&e.treeShaking?e.treeShaking:e}function jr(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 qr(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}const _t="RUNTIME-001",bt="RUNTIME-002",Rt="RUNTIME-003",St="RUNTIME-004",$t="RUNTIME-005",Ae="RUNTIME-006",wt="RUNTIME-007",Ge="RUNTIME-008",Kr="RUNTIME-009",Nt="RUNTIME-010",It="RUNTIME-011",L={[_t]:"Failed to get remoteEntry exports.",[bt]:'The remote entry interface does not contain "init"',[Rt]:"Failed to get manifest.",[St]:"Failed to locate remote.",[$t]:"Invalid loadShareSync function call from bundler runtime",[Ae]:"Invalid loadShareSync function call from runtime",[wt]:"Failed to get remote snapshot.",[Ge]:"Failed to load script resources.",[Kr]:"Please call createInstance first.",[Nt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[It]:"The remoteEntry URL is missing from the remote snapshot."};({...L});const Tt=".then(callbacks[0]).catch(callbacks[1])";async function zr({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Tt}`)([r,n]):import(e).then(r).catch(n)}catch(o){S(`Failed to load ESM entry from "${e}". ${o instanceof Error?o.message:String(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}")${Tt}`)([r,n])}catch(o){S(`Failed to load SystemJS entry from "${e}". ${o instanceof Error?o.message:String(o)}`)}})}function vt(e,t,r){const{remoteEntryKey:n,entryExports:o}=De(e,t);return o||S(_t,L,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),o}async function Xr({name:e,globalName:t,entry:r,loaderHook:n,getEntryUrl:o}){const{entryExports:s}=De(e,t);if(s)return s;const i=o?o(r):r;return Yt(i,{attrs:{},createScriptHook:(a,l)=>{const c=n.lifecycle.createScript.emit({url:a,attrs:l});if(c&&(c instanceof HTMLScriptElement||"script"in c||"timeout"in c))return c}}).then(()=>vt(e,t,r),a=>{const l=a instanceof Error?a.message:String(a);S(Ge,L,{remoteName:e,resourceUrl:i},l)})}async function Yr({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 zr({entry:o,remoteEntryExports:t});case"system":return Jr({entry:o,remoteEntryExports:t});default:return Xr({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}=De(o,n);return i||er(r,{attrs:{name:o,globalName:n,type:s},loaderHook:{createScriptHook:(a,l={})=>{const c=t.lifecycle.createScript.emit({url:a,attrs:l});if(c&&"url"in c)return c}}}).then(()=>vt(o,n,r)).catch(a=>{S(`Failed to load Node.js entry for remote "${o}" from "${r}". ${a instanceof Error?a.message:String(a)}`)})}function Pe(e){const{entry:t,name:r}=e;return Ye(r,t)}async function ye(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:o,_inErrorHandling:s=!1}=e,i=Pe(n);if(r)return r;if(!W[i]){const a=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;W[i]=a.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":H)?Yr({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:o}):Zr({remoteInfo:n,loaderHook:l}))).catch(async c=>{const f=Pe(n),h=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes(Ge)&&!h&&!s){const u=m=>ye({...m,_inErrorHandling:!0}),d=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:u,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:W,uniqueKey:f});if(d)return d}throw c})}return W[i]}function ke(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||yt,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||ne}}function Qr(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function en(e,t){const r=ur(),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 tn(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function J(e){var r,n,o,s,i,a;const t={};for(const[l,c]of Object.entries(e.shared)){const f=c[0];f&&(t[l]={version:f.version,singleton:(r=f.shareConfig)==null?void 0:r.singleton,requiredVersion:((n=f.shareConfig)==null?void 0:n.requiredVersion)===!1?!1:(o=f.shareConfig)==null?void 0:o.requiredVersion,eager:f.eager,strictVersion:(s=f.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((i=e.remotes)==null?void 0:i.length)>0?"host":"unknown"},mfConfig:{name:e.name,remotes:((a=e.remotes)==null?void 0:a.map(tn))??[],shared:t}}}function At(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1,...e}}function rn(e,t){return t.map(r=>{const n=qr(e,r.nameOrAlias);return k(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Qe({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:At(r)}})}function nn(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Pt(e,t,r,n=!0){const{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(a=>{const{moduleInfo:l}=a,c=t.moduleCache.get(e.name);ye(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const a={rel:"preload",as:"style"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={rel:"stylesheet",type:"text/css"};o.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d},needDeleteLink:!1});f&&document.head.appendChild(c)})}if(n){const a={rel:"preload",as:"script"};s.forEach(l=>{const{link:c,needAttach:f}=Ee({url:l,cb:()=>{},attrs:a,createLinkHook:(h,u)=>{const d=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:u});if(d instanceof HTMLLinkElement)return d}});f&&document.head.appendChild(c)})}else{const a={fetchpriority:"high",type:(e==null?void 0:e.type)==="module"?"module":"text/javascript"};s.forEach(l=>{const{script:c,needAttach:f}=ot({url:l,cb:()=>{},attrs:a,createScriptHook:(h,u)=>{const d=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:u});if(d instanceof HTMLScriptElement)return d},needDeleteScript:!0});f&&document.head.appendChild(c)})}}}function on(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 kt=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 k(e,`remoteEntryExports is undefined
|
|
8
|
+
${Qe(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}=on(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"&&S(bt,L,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,J(this.host.options)),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)),k(i,`${Q(this.remoteInfo)} remote don't export ${t}.`);const a=ir(this.remoteInfo.name,t),l=this.wraperFactory(i,a);return o?await l():l}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}}},A=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 A{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 Ot(e,t){if(!Ce(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var j=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ot(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Le(r),this.onerror(r)}return e}},F=class extends A{constructor(e){super(),this.onerror=S,this.type=e}emit(e){Ce(e)||S(`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=>(Le(s),this.onerror(s),e),o=s=>{if(Ot(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)}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var n;k(sr(e),"Plugin configuration is invalid.");const r=e.name;k(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){k(e,"A name is required.");const t=this.registerPlugins[e];k(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Lt(e,t){const r=lt(t);r.url||S(It,L,{remoteName:e.name});let n=Ne(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 sn(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:o,remoteInfo:s,id:i}=e;if(!Me(t)||!at(t)){const{remoteSnapshot:a,globalSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Lt(s,a);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},f=await o.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:c,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:l});return f&&Pt(s,o,f,!1),{...e,remoteSnapshot:a}}return e}}}function an(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 Mt(e,t,r,n,o={},s){const{value:i}=K(e,Q(t)),a=s||i;if(a&&!et(a)&&(r(a,t,n),a.remotesInfo)){const l=Object.keys(a.remotesInfo);for(const c of l){if(o[c])continue;o[c]=!0;const f=an(c),h=a.remotesInfo[c];Mt(e,{name:f.name,version:h.matchedVersion},r,!1,o,void 0)}}}const Se=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function cn(e,t,r,n,o){const s=[],i=[],a=[],l=new Set,c=new Set,{options:f}=e,{preloadConfig:h}=t,{depsRemote:u}=h;if(Mt(n,r,(m,y,g)=>{var $;let p;if(g)p=h;else if(Array.isArray(u)){const R=u.find(w=>w.nameOrAlias===y.name||w.nameOrAlias===y.alias);if(!R)return;p=At(R)}else if(u===!0)p=h;else return;const E=Ne(m,lt(m).url);E&&a.push({name:y.name,moduleInfo:{name:y.name,entry:E,type:"remoteEntryType"in m?m.remoteEntryType:"global",entryGlobalName:"globalName"in m?m.globalName:y.name,shareScope:"",version:"version"in m?m.version:void 0},url:E});let b="modules"in m?m.modules:[];const N=nn(p.exposes);N.length&&"modules"in m&&(b=($=m==null?void 0:m.modules)==null?void 0:$.reduce((R,w)=>((N==null?void 0:N.indexOf(w.moduleName))!==-1&&R.push(w),R),[]));function _(R){const w=R.map(M=>Ne(m,M));return p.filter?w.filter(p.filter):w}if(b){const R=b.length;for(let w=0;w<R;w++){const M=b[w],ge=`${y.name}/${M.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:M.moduleName==="."?y.name:ge,name:y.name,remoteSnapshot:m,preloadConfig:p,remote:y,origin:e}),!fr(ge)&&(p.resourceCategory==="all"?(s.push(..._(M.assets.css.async)),s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.async)),i.push(..._(M.assets.js.sync))):p.resourceCategory==="sync"&&(s.push(..._(M.assets.css.sync)),i.push(..._(M.assets.js.sync))),hr(ge))}}},!0,{},o),o.shared&&o.shared.length>0){const m=(y,g)=>{const{shared:p}=me(e.shareScopeMap,g.sharedName,y,e.sharedHandler.hooks.lifecycle.resolveShare)||{};p&&typeof p.lib=="function"&&(g.assets.js.sync.forEach(E=>{l.add(E)}),g.assets.css.sync.forEach(E=>{c.add(E)}))};o.shared.forEach(y=>{var E;const g=(E=f.shared)==null?void 0:E[y.sharedName];if(!g)return;const p=y.version?g.find(b=>b.version===y.version):g;p&&ct(p).forEach(b=>{m(b,y)})})}const d=i.filter(m=>!l.has(m)&&!Se("script",m));return{cssAssets:s.filter(m=>!c.has(m)&&!Se("link",m)),jsAssetsWithoutEntry:d,entryAssets:a.filter(m=>!Se("script",m.url))}}const ln=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?Me(o)&&at(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Lt(n,i),cn(t,r,n,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function Ct(e,t){const r=fe({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&K(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:xe(),remoteSnapshot:fe({name:e.name,version:"version"in e?e.version:void 0})}}var un=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new P("beforeLoadRemoteSnapshot"),loadSnapshot:new F("loadGlobalSnapshot"),loadRemoteSnapshot:new F("loadRemoteSnapshot"),afterLoadSnapshot:new F("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:{}},lr({[this.HostInstance.options.name]:o})),o&&"remotesInfo"in o&&!K(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:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:s,remoteSnapshot:i,globalSnapshot:a});let f,h;if(l)if(et(l)){const u=H?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",d=await this.getManifestJson(u,e,{}),m=Ue({...e,entry:u},d);f=d,h=m}else{const{remoteSnapshot:u}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});f=u,h=c}else if(Me(e)){const u=await this.getManifestJson(e.entry,e,{}),d=Ue(e,u),{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:u,from:"global"});f=m,h=d}else S(wt,L,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,J(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:f}),{remoteSnapshot:f,globalSnapshot:h}}getGlobalRemoteInfo(e){return Ct(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],S(Rt,L,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,J(this.HostInstance.options)))}return k(s.metaData&&s.exposes&&s.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!s.metaData&&"metaData",!s.exposes&&"exposes",!s.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,s),s},o=async()=>{const s=await n(),i=qt(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]}},fn=class{constructor(e){this.hooks=new q({beforeRegisterShare:new j("beforeRegisterShare"),afterResolve:new F("afterResolve"),beforeLoadShare:new F("beforeLoadShare"),loadShare:new P,resolveShare:new j("resolveShare"),initContainerShareScopeMap:new j("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=gt(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=Ke({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});k(o,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const{shared:s,useTreesShaking:i}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(s){const a=ae(s,i);if(a.lib)return V(a,r.options.name),a.lib;if(a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),V(a,r.options.name),l}else{const c=(async()=>{const f=await a.get();return V(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:c,treeShaking:i?a:void 0}),c}}else{if(t!=null&&t.customShareInfo)return!1;const a=te(o.treeShaking),l=ae(o,a),f=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,V(l,r.options.name);const{shared:u,useTreesShaking:d}=me(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(u){const m=ae(u,d);m.lib=h,m.loaded=!0,u.from=o.from}return h})();return this.setShared({pkgName:e,loaded:!1,shared:o,from:r.options.name,lib:null,loading:f,treeShaking:a?l: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 d=u[e];if(d||(d=u[e]={from:this.host.name}),s.indexOf(d)>=0)return i;s.push(d)}const a=this.shareScopeMap,l=r.options.name;a[e]||(a[e]={});const c=a[e],f=(u,d)=>{var b;const{version:m,eager:y}=d;c[u]=c[u]||{};const g=c[u],p=g[m]&&ae(g[m]),E=!!(p&&("eager"in p&&p.eager||"shareConfig"in p&&((b=p.shareConfig)!=null&&b.eager)));(!p||p.strategy!=="loaded-first"&&!p.loaded&&(!y!=!E?y:l>g[m].from))&&(g[m]=d)},h=async u=>{const{module:d}=await r.remoteHandler.getRemoteModuleAndOptions({id:u});let m;try{m=await d.getEntry()}catch(y){if(m=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:u,error:y,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!m)return}finally{m!=null&&m.init&&!d.initing&&(d.remoteEntryExports=m,await d.init(void 0,void 0,s))}};return Object.keys(r.options.shared).forEach(u=>{r.options.shared[u].forEach(d=>{d.scope.includes(e)&&f(u,d)})}),(r.options.shareStrategy==="version-first"||o==="version-first")&&r.options.remotes.forEach(u=>{u.shareScope===e&&i.push(h(u.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Ke({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}=me(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(o){if(typeof o.lib=="function")return V(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 V(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();return i instanceof Promise&&S((t==null?void 0:t.from)==="build"?$t:Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}S(Ae,L,{hostName:r.options.name,sharedPkgName:e},void 0,J(r.options))}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:l,scope:c="default",...f}=t,h=Array.isArray(c)?c:[c],u=d=>{const m=(g,p,E)=>{E&&!g[p]&&(g[p]=E)},y=a?d.treeShaking:d;m(y,"loaded",s),m(y,"loading",o),m(y,"get",i)};h.forEach(d=>{this.shareScopeMap[d]||(this.shareScopeMap[d]={}),this.shareScopeMap[d][e]||(this.shareScopeMap[d][e]={}),this.shareScopeMap[d][e][l]||(this.shareScopeMap[d][e][l]={version:l,scope:[d],...f,lib:n});const m=this.shareScopeMap[d][e][l];u(m),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(e){const t=Et(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},hn=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new j("beforeRegisterRemote"),registerRemote:new j("registerRemote"),beforeRequest:new F("beforeRequest"),onLoad:new P("onLoad"),handlePreloadModule:new A("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:l,expose:c,id:f,remoteSnapshot:h}=i,u=await o.get(f,c,t,h),d=await this.hooks.lifecycle.onLoad.emit({id:f,pkgNameOrAlias:a,expose:c,exposeModule:n?u:void 0,exposeModuleFactory:n?void 0:u,remote:l,options:s,moduleInstance:o,origin:r});return this.setIdToRemoteMap(e,i),typeof d=="function"?d: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=rn(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,s=ke(o),{globalSnapshot:i,remoteSnapshot:a}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:o}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:o,remoteInfo:s,globalSnapshot:i,remoteSnapshot:a});l&&Pt(s,t,l)}))}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(d){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:d,lifecycle:"beforeRequest"}),!n)throw d}const{id:o}=n,s=jr(t.options.remotes,o);s||S(St,L,{hostName:t.options.name,requestId:o},void 0,J(t.options));const{remote:i}=s,a=ke(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:o,...s,options:t.options,origin:t,remoteInfo:a}),{remote:c,expose:f}=l;k(c&&f,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${o}.`);let h=t.moduleCache.get(c.name);const u={host:t,remoteInfo:a};return h||(h=new kt(u),t.moduleCache.set(c.name,h)),{module:h,moduleOptions:u,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,o=()=>{if(e.alias){const i=t.find(a=>{var l;return e.alias&&(a.name.startsWith(e.alias)||((l=a.alias)==null?void 0:l.startsWith(e.alias)))});k(!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&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=ne),e.type||(e.type=yt)};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}),Ze(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 l=Pe(s.remoteInfo);W[l]&&delete W[l],r.snapshotHandler.manifestCache.delete(i.entry);let c=i.buildVersion?Ye(i.name,i.buildVersion):i.name;const f=I.__FEDERATION__.__INSTANCES__.findIndex(u=>i.buildVersion?u.options.id===c:u.name===c);if(f!==-1){const u=I.__FEDERATION__.__INSTANCES__[f];c=u.options.id||c;const d=Et();let m=!0;const y=[];Object.keys(d).forEach(g=>{const p=d[g];p&&Object.keys(p).forEach(E=>{const b=p[E];b&&Object.keys(b).forEach(N=>{const _=b[N];_&&Object.keys(_).forEach($=>{const R=_[$];R&&typeof R=="object"&&R.from===i.name&&(R.loaded||R.loading?(R.useIn=R.useIn.filter(w=>w!==i.name),R.useIn.length?m=!1:y.push([g,E,N,$])):y.push([g,E,N,$]))})})})}),m&&(u.shareScopeMap={},delete d[c]),y.forEach(([g,p,E,b])=>{var N,_,$;($=(_=(N=d[g])==null?void 0:N[p])==null?void 0:_[E])==null||delete $[b]}),I.__FEDERATION__.__INSTANCES__.splice(f,1)}const{hostGlobalSnapshot:h}=Ct(e,r);if(h){const u=h&&"remotesInfo"in h&&h.remotesInfo&&K(h.remotesInfo,e.name).key;u&&(delete h.remotesInfo[u],ee.__FEDERATION__.__MANIFEST_LOADING__[u]&&delete ee.__FEDERATION__.__MANIFEST_LOADING__[u])}r.moduleCache.delete(e.name)}}catch(r){ve.error(`removeRemote failed: ${r instanceof Error?r.message:String(r)}`)}}};const dn=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;var mn=class{constructor(e){this.hooks=new q({beforeInit:new j("beforeInit"),init:new A,beforeInitContainer:new F("beforeInitContainer"),initContainer:new F("initContainer")}),this.version="2.2.0",this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new A,createScript:new A,createLink:new A,fetch:new P,loadEntryError:new P,getModuleFactory:new P}),this.bridgeHook=new q({beforeBridgeRender:new A,afterBridgeRender:new A,beforeBridgeDestroy:new A,afterBridgeDestroy:new A});const t=dn?[sn(),ln()]:[],r={id:Qr(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:H};this.name=e.name,this.options=r,this.snapshotHandler=new un(this),this.sharedHandler=new fn(this),this.remoteHandler=new hn(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&&S(it(Nt,L)),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=ke({name:e,entry:t}),o=new kt({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}=gt(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(c=>{a.includes(c)||a.push(c)});const l={...e,...t,plugins:a,remotes:s,shared:i};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=en(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 pn=null;function Dt(){return pn}ar(mn);function Ft(e,t){return e.map(r=>{const n={...r,path:t+r.path};return r.children&&r.children.length>0&&(n.children=Ft(r.children,t)),n})}function yn(e){const{router:t,basename:r,memoryRoute:n,hashRoute:o}=e,s=t.getRoutes().sort((u,d)=>u.path.split("/").filter(m=>m).length-d.path.split("/").filter(m=>m).length),i=new Map,a=new Set;s.forEach(u=>{i.set(u.path,u)});const l=(u,d)=>`${u}/${d}`.replace(/\/+/g,"/").replace(/\/$/,"")||"/",c=(u,d="")=>{if(!u.children||u.children.length===0)return u;for(let m=0;m<u.children.length;m++){const y=u.children[m],g=l(d,y.path),p=i.get(g);if(p&&!a.has(p)){const E={...p,path:y.path};u.children[m]=E,a.add(p),c(E,g)}}return u};let f=[];for(const u of s)if(!a.has(u)){const d=c(u,u.path);a.add(u),f.push(d)}let h;return n?h=ce.createMemoryHistory(r):o?(h=ce.createWebHashHistory(),r&&(f=Ft(f,r))):h=ce.createWebHistory(r),{history:h,routes:f}}function gn(e){const t=new Map,r=Dt();return()=>({__APP_VERSION__:"2.2.0",async render(n){var m,y,g;D.debug("createBridgeComponent render Info",n);const{moduleName:o,dom:s,basename:i,memoryRoute:a,hashRoute:l,...c}=n,f=Gt.createApp(e.rootComponent,c);t.set(s,f);const h=await((g=(y=(m=r==null?void 0:r.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:y.beforeBridgeRender)==null?void 0:g.emit(n)),u=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},d=e.appOptions({app:f,basename:i,memoryRoute:a,hashRoute:l,...c,...u});if(d!=null&&d.router){const{history:p,routes:E}=yn({router:d.router,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute}),b=ce.createRouter({...d.router.options,history:p,routes:E});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 En(){const e=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(e)}const _n=v.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(e){const t=v.ref(null),r=v.ref(null),n=v.ref(""),o=Oe.useRoute(),s=Dt(),i=v.useAttrs(),a=async()=>{var u,d,m,y;const c=(u=e.providerInfo)==null?void 0:u.call(e);r.value=c;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 h=await((y=(m=(d=s==null?void 0:s.bridgeHook)==null?void 0:d.lifecycle)==null?void 0:m.beforeBridgeRender)==null?void 0:y.emit(f))||{};f={...f,...h.extraProps},c.render(f)},l=v.watch(()=>o==null?void 0:o.path,c=>{c!==o.path&&a(),n.value!==""&&n.value!==c&&(D.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...e,pathname:o.path}),En()),n.value=c});return v.onMounted(()=>{a()}),v.onBeforeUnmount(()=>{var c;D.debug("createRemoteAppComponent LazyComponent destroy >>>",{...e}),l(),(c=r.value)==null||c.destroy({dom:t.value})}),()=>v.createVNode("div",v.mergeProps(e.rootAttrs||{},{ref:t}),null)}});function Ht(e){return v.defineAsyncComponent({__APP_VERSION__:"2.2.0",...e.asyncComponentOptions,loader:async()=>{var l,c;const t=Oe.useRoute();let r="/";const n=(c=(l=t==null?void 0:t.matched)==null?void 0:l[0])==null?void 0:c.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 v.h(_n,{moduleName:i,providerInfo:a,basename:r,rootAttrs:e.rootAttrs})}};throw new Error("module not found")}})}function bn(e){return D.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),Ht(e)}exports.createBridgeComponent=gn;exports.createRemoteAppComponent=Ht;exports.createRemoteComponent=bn;
|