@lemon-fe/vite-plugin-micro-frontend 1.0.1 → 1.0.3

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/dist/index.d.ts CHANGED
@@ -147,7 +147,7 @@ interface DynamicOptions<P = Record<string, unknown>> {
147
147
  *
148
148
  * @example
149
149
  * ```tsx
150
- * import { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/dynamic';
150
+ * import { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime';
151
151
  *
152
152
  * // 使用 dynamic
153
153
  * const MyComponent = dynamic({
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"path";import t from"@originjs/vite-plugin-federation";import n from"vite-plugin-qiankun";import*as r from"fs";import*as o from"chokidar";import*as a from"prettier";function i(){return{name:"micro-frontend:html-transform",transformIndexHtml:e=>e.replace(/<script[^>]*>.*?<\/script>/s,"")}}const s=new Map;function u(e,t){if(!t||void 0===t.index)return!1;const n=t.index,r=e.substring(0,n),o=r.lastIndexOf("\n"),a=r.substring(o+1).indexOf("//");if(-1!==a){if(a<n-(o+1))return!0}let i=0;const s=/\/\*/g,u=/\*\//g;let c,l;s.lastIndex=0,u.lastIndex=0;const f=[];for(;null!==(c=s.exec(r));)f.push({index:c.index,type:"start"});for(;null!==(l=u.exec(r));)f.push({index:l.index,type:"end"});f.sort((e,t)=>e.index-t.index);for(const e of f)"start"===e.type?i++:i--;return i>0}function c(e){if(!e.endsWith(".tsx"))return!1;try{const t=r.readFileSync(e,"utf-8");return!!t.match(/export\s+default\s+(\w+)/)}catch{return!1}}function l(e){if(!c(e))return!1;const t=function(e){try{const t=r.readFileSync(e,"utf-8"),n=t.match(/export\s+default\s+(\w+)/);if(!n)return"";const o=n[1],a=t.match(new RegExp(`${o}\\.title\\s*=\\s*['"\`]([^'"\`]+)['"\`]`)),i=t.match(new RegExp(`${o}\\.keepAlive\\s*=\\s*(true|false)`)),s=t.match(new RegExp(`${o}\\.authority\\s*=\\s*\\[([^\\]]+)\\]`));return JSON.stringify({title:a&&!u(t,a)?a[1]:void 0,keepAlive:i&&!u(t,i)?i[1]:void 0,authority:s&&!u(t,s)?s[1]:void 0})}catch(t){return console.error("读取文件失败:",e,t),""}}(e),n=s.get(e);return(void 0===n||t!==n)&&(s.set(e,t),!0)}function f(t,n,o,a){const i=function(t,n){return e.relative(n,t).replace(/\\/g,"/")}(t,o),s=e.basename(t,e.extname(t)),c=r.readFileSync(t,"utf-8").match(/export\s+default\s+(\w+)/);if(s.startsWith("_")&&"_layout"!==s||!c)return null;let l=e.join(n,"index"===s||"_layout"===s?"":s);l=l.replace(/\\/g,"/"),l=l.startsWith("/")?l:`/${l}`,l=`${l}`,l=l.replace(/\[([^\]]+)\]/g,":$1");const f=`${a.pageAliasPrefix||"@/pages"}/${i.replace(/\\/g,"/")}`,{title:p,keepAlive:d,authority:y}=function(e){const t=r.readFileSync(e,"utf-8"),n=t.match(/export\s+default\s+(\w+)/);if(!n)return{};const o=n[1],a={},i=new RegExp(`${o}\\.title\\s*=\\s*['"\`]([^'"\`]+)['"\`]`),s=t.match(i);s&&!u(t,s)&&(a.title=s[1]);const c=new RegExp(`${o}\\.keepAlive\\s*=\\s*(true|false)`),l=t.match(c);l&&!u(t,l)&&(a.keepAlive="true"===l[1]);const f=new RegExp(`${o}\\.authority\\s*=\\s*\\[([^\\]]+)\\]`),p=t.match(f);return p&&!u(t,p)&&(a.authority=p[1].split(",").map(e=>e.trim().replace(/['"`]/g,"")).filter(Boolean)),a}(t),m={path:l,exact:!0,component:`dynamic({ loader: () => import('${f.replace(/.tsx$/g,"")}'), loading: LoadingComponent})`,title:p?`$t({ defaultMessage: "${p}" })`:void 0};return"_layout"===s&&(m.exact=!1),y&&(m.authority=y),"_layout"===s&&(m.routes=[]),d&&(m.keepAlive=!0),m}async function p(t,n){function o(e,t=2){const n=" ".repeat(t),r=" ".repeat(t+2);let a=`${n}{\n`;if(a+=`${r}path: '${e.path}',\n`,void 0!==e.exact&&null!==e.exact&&(a+=`${r}exact: ${e.exact},\n`),void 0!==e.component&&null!==e.component&&(a+=`${r}component: ${e.component},\n`),void 0!==e.title&&null!==e.title&&(a+=`${r}title: ${e.title},\n`),e.authority&&(a+=`${r}authority: ${JSON.stringify(e.authority)},\n`),e.keepAlive&&(a+=`${r}keepAlive: ${e.keepAlive},\n`),e.routes&&e.routes.length>0){a+=`${r}routes: [\n${e.routes.map(e=>o(e,t+2)).join(",\n")}\n${r}],\n`}return a=a.replace(/,\n$/,"\n"),a+=`${n}}`,a}const i=t.map(e=>o(e)).join(",\n"),s=`/**\n * 自动根据 pages 目录生成路由配置\n * 新增、删除、修改组件 title、keepAlive、authority 属性时,会自动更新路由配置\n * 路由组件只支持默认导出\n */\nimport { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime';\nimport LoadingComponent from '${n.defaultLoadingComponentPath||"@/components/loading"}';\nimport { $t } from '${n.intlPath||"@/utils/intl"}';\n\nexport const routers = [\n${i}\n];\n`;try{const t=e.resolve(process.cwd(),".prettierrc");let n={};if(r.existsSync(t))try{const e=r.readFileSync(t,"utf-8");n=JSON.parse(e)}catch(e){console.warn("⚠️ 读取 prettier 配置失败,使用默认配置:",e)}const o={parser:"typescript",...n};return await a.format(s,o)}catch(e){return console.error("格式化代码失败:",e),s}}function d(t={}){const{pagesDir:n,outputPath:a,watch:i=!0,ignoreDirs:u=["components","utils","hooks","typings"],routeTemplate:d={}}=t;let y=!1,m=null;const h=n||e.resolve(process.cwd(),"src/pages"),v=a||e.resolve(process.cwd(),"src/routes.ts"),g=async()=>{if(!r.existsSync(h))return void console.warn("⚠️ pages 目录不存在:",h);const t=function(t,n){return function o(a,i=""){const s=r.readdirSync(a),u=[];let c=null;const l=s.find(e=>"_layout.tsx"===e);l&&(c=f(e.join(a,l),i,t,n),c&&(c.routes=[],u.push(c)));for(const l of s){const s=e.join(a,l),p=r.statSync(s);if("_layout.tsx"!==l)if(p.isDirectory()&&"components"!==l&&"utils"!==l&&"hooks"!==l){const t=o(s,e.join(i,l));t.length>0&&(c?c.routes.push(...t):u.push(...t))}else if(l.endsWith(".tsx")){const e=f(s,i,t,n);e&&(c?c.routes.push(e):u.push(e))}}return u}(t)}(h,d),n=await p(t,d);r.writeFileSync(v,n),console.log("✅ 路由已生成:",v)},b=()=>{m&&(m.close(),m=null,y=!1,s.clear())};return{name:"micro-frontend:routes",enforce:"pre",configureServer(e){g(),(()=>{if(y||!i)return;if(!r.existsSync(h))return;const e=["**/node_modules/**","**/*.d.ts","**/*.less","**/*.css","**/*.scss","**/*.sass",...u.map(e=>`**/${e}/**`)];m=o.watch(h,{ignored:e,persistent:!0,ignoreInitial:!0}),m.on("add",e=>{c(e)&&g()}).on("change",e=>{c(e)&&l(e)&&g()}).on("unlink",e=>{c(e)&&(s.delete(e),g())}).on("addDir",()=>{g()}).on("unlinkDir",()=>{g()}).on("error",e=>{console.error("❌ 文件监听错误:",e)}),y=!0})(),e.httpServer?.on("close",b)},buildStart(){console.log("🚀 构建开始,生成路由文件..."),g()}}}function y(t){const{remotes:n,outputPath:o}=t,a=o||e.resolve(process.cwd(),"src/utils/mf.tsx"),i=()=>{const t=function(e){const t=JSON.stringify(e,null,2);return"/* eslint-disable */\nimport { lazy, Suspense, type ReactNode, type ComponentType } from 'react';\n\n// 远程模块配置\nconst remotes = __REMOTES_JSON__ as const;\n\ntype RemoteAlias = keyof typeof remotes;\ntype ModuleSpecifier = `${RemoteAlias}/${string}`;\n\n// 多个入口文件之间共享的变量\nconst entryShared = (window as any).__entry_shared__ || {};\n\n// 脚本加载状态: undefined=未加载, Promise=加载中, true=已完成\nconst scriptCache: Record<string, Promise<void> | true | undefined> = {};\n\n/**\n * 获取多入口共享变量(懒初始化单例)\n */\nexport function getEntryShared<T>(key: string, init: () => T): T {\n return (entryShared[key] ??= init()) as T;\n}\n\n/**\n * 安全加载远程组件\n */\nexport function safeRemoteComponent<T extends ComponentType<any>>(opts: {\n moduleSpecifier: ModuleSpecifier;\n fallbackComponent: T;\n loadingElement?: ReactNode;\n}): T {\n const LazyComponent = lazy<T>(() =>\n loadRemoteModule(opts.moduleSpecifier, { default: opts.fallbackComponent }),\n );\n\n return ((props: any) => (\n <Suspense fallback={opts.loadingElement ?? null}>\n <LazyComponent {...props} />\n </Suspense>\n )) as T;\n}\n\n// ============ 内部实现 ============\n\nasync function loadRemoteModule<T>(specifier: ModuleSpecifier, fallback: T): Promise<T> {\n try {\n const slashIndex = specifier.indexOf('/');\n const alias = specifier.slice(0, slashIndex) as RemoteAlias;\n const moduleName = specifier.slice(slashIndex + 1);\n const remote = remotes[alias];\n\n if (!remote) {\n console.error(`[MF] Unknown remote alias: \"${alias}\"`);\n return fallback;\n }\n\n await loadScriptOnce(remote.remoteName, remote.entry);\n\n const container = (window as any)[remote.remoteName];\n const factory = await container.get(`./${moduleName}`);\n return factory();\n } catch (e) {\n console.error(`[MF] Failed to load \"${specifier}\"`, e);\n return fallback;\n }\n}\n\nasync function loadScriptOnce(name: string, url: string): Promise<void> {\n const cached = scriptCache[name];\n\n if (cached === true) return;\n if (cached) return cached;\n\n const promise = new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = `${url}?t=${Date.now()}`;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = reject;\n document.head.appendChild(script);\n }).then(\n () => {\n scriptCache[name] = true;\n },\n e => {\n scriptCache[name] = undefined;\n throw e;\n },\n );\n\n scriptCache[name] = promise;\n return promise;\n}\n\n// ==== Vite Module Federation 动态加载 ===\n\ntype RemoteComponentOptions<P = any> = {\n /** 远程模块加载函数,如 () => import('remoteApp/Component') */\n loader: () => Promise<{ default: ComponentType<P> }>;\n /** 加载失败时的回退组件 */\n fallback?: ComponentType<P>;\n /** 加载中显示的元素 */\n loading?: ReactNode;\n};\n\n/**\n * 创建一个动态加载的远程联邦组件\n * @example\n * const RemoteButton = createRemoteComponent({\n * loader: () => import('remoteApp/Button'),\n * fallback: () => <div>加载失败</div>,\n * loading: <Spin />,\n * });\n */\nexport function createRemoteComponent<P extends object = {}>(\n options: RemoteComponentOptions<P>,\n): ComponentType<P> {\n const { loader, fallback: Fallback, loading = null } = options;\n\n const LazyComponent = lazy(() =>\n loader().catch(error => {\n console.error('Failed to load remote component:', error);\n if (Fallback) {\n return { default: Fallback };\n }\n throw error;\n }),\n );\n\n const RemoteWrapper: React.FC<P> = props => (\n <Suspense fallback={loading}>\n {/* @ts-expect-error: 类型不完全匹配,但实际可以正常渲染 */}\n <LazyComponent {...props} />\n </Suspense>\n );\n\n return RemoteWrapper as ComponentType<P>;\n}\n\n".replace("__REMOTES_JSON__",t)}(n),o=e.dirname(a);if(r.existsSync(o)||r.mkdirSync(o,{recursive:!0}),r.existsSync(a)){if(r.readFileSync(a,"utf-8")===t)return}r.writeFileSync(a,t),console.log("✅ mf.tsx 已生成:",a)};return{name:"micro-frontend:mf-generator",enforce:"pre",configResolved(){i()},buildStart(){i()}}}var m,h,v,g={exports:{}},b={};function _(){if(h)return m;h=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return m=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var a,i,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),u=1;u<arguments.length;u++){for(var c in a=Object(arguments[u]))t.call(a,c)&&(s[c]=a[c]);if(e){i=e(a);for(var l=0;l<i.length;l++)n.call(a,i[l])&&(s[i[l]]=a[i[l]])}}return s},m}function w(){if(v)return b;v=1;var e=_(),t=60103,n=60106;b.Fragment=60107,b.StrictMode=60108,b.Profiler=60114;var r=60109,o=60110,a=60112;b.Suspense=60113;var i=60115,s=60116;if("function"==typeof Symbol&&Symbol.for){var u=Symbol.for;t=u("react.element"),n=u("react.portal"),b.Fragment=u("react.fragment"),b.StrictMode=u("react.strict_mode"),b.Profiler=u("react.profiler"),r=u("react.provider"),o=u("react.context"),a=u("react.forward_ref"),b.Suspense=u("react.suspense"),i=u("react.memo"),s=u("react.lazy")}var c="function"==typeof Symbol&&Symbol.iterator;function l(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p={};function d(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||f}function y(){}function m(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||f}d.prototype.isReactComponent={},d.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(l(85));this.updater.enqueueSetState(this,e,t,"setState")},d.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=d.prototype;var h=m.prototype=new y;h.constructor=m,e(h,d.prototype),h.isPureReactComponent=!0;var g={current:null},w=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function S(e,n,r){var o,a={},i=null,s=null;if(null!=n)for(o in void 0!==n.ref&&(s=n.ref),void 0!==n.key&&(i=""+n.key),n)w.call(n,o)&&!k.hasOwnProperty(o)&&(a[o]=n[o]);var u=arguments.length-2;if(1===u)a.children=r;else if(1<u){for(var c=Array(u),l=0;l<u;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(o in u=e.defaultProps)void 0===a[o]&&(a[o]=u[o]);return{$$typeof:t,type:e,key:i,ref:s,props:a,_owner:g.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var $=/\/+/g;function x(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function R(e,r,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u=!1;if(null===e)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case t:case n:u=!0}}if(u)return i=i(u=e),e=""===a?"."+x(u,0):a,Array.isArray(i)?(o="",null!=e&&(o=e.replace($,"$&/")+"/"),R(i,r,o,"",function(e){return e})):null!=i&&(C(i)&&(i=function(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}(i,o+(!i.key||u&&u.key===i.key?"":(""+i.key).replace($,"$&/")+"/")+e)),r.push(i)),1;if(u=0,a=""===a?".":a+":",Array.isArray(e))for(var f=0;f<e.length;f++){var p=a+x(s=e[f],f);u+=R(s,r,o,p,i)}else if(p=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=c&&e[c]||e["@@iterator"])?e:null}(e),"function"==typeof p)for(e=p.call(e),f=0;!(s=e.next()).done;)u+=R(s=s.value,r,o,p=a+x(s,f++),i);else if("object"===s)throw r=""+e,Error(l(31,"[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r));return u}function j(e,t,n){if(null==e)return e;var r=[],o=0;return R(e,r,"","",function(e){return t.call(n,e,o++)}),r}function P(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then(function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)},function(t){0===e._status&&(e._status=2,e._result=t)})}if(1===e._status)return e._result;throw e._result}var O={current:null};function E(){var e=O.current;if(null===e)throw Error(l(321));return e}var T={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:e};return b.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error(l(143));return e}},b.Component=d,b.PureComponent=m,b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,b.cloneElement=function(n,r,o){if(null==n)throw Error(l(267,n));var a=e({},n.props),i=n.key,s=n.ref,u=n._owner;if(null!=r){if(void 0!==r.ref&&(s=r.ref,u=g.current),void 0!==r.key&&(i=""+r.key),n.type&&n.type.defaultProps)var c=n.type.defaultProps;for(f in r)w.call(r,f)&&!k.hasOwnProperty(f)&&(a[f]=void 0===r[f]&&void 0!==c?c[f]:r[f])}var f=arguments.length-2;if(1===f)a.children=o;else if(1<f){c=Array(f);for(var p=0;p<f;p++)c[p]=arguments[p+2];a.children=c}return{$$typeof:t,type:n.type,key:i,ref:s,props:a,_owner:u}},b.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:o,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:r,_context:e},e.Consumer=e},b.createElement=S,b.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},b.createRef=function(){return{current:null}},b.forwardRef=function(e){return{$$typeof:a,render:e}},b.isValidElement=C,b.lazy=function(e){return{$$typeof:s,_payload:{_status:-1,_result:e},_init:P}},b.memo=function(e,t){return{$$typeof:i,type:e,compare:void 0===t?null:t}},b.useCallback=function(e,t){return E().useCallback(e,t)},b.useContext=function(e,t){return E().useContext(e,t)},b.useDebugValue=function(){},b.useEffect=function(e,t){return E().useEffect(e,t)},b.useImperativeHandle=function(e,t,n){return E().useImperativeHandle(e,t,n)},b.useLayoutEffect=function(e,t){return E().useLayoutEffect(e,t)},b.useMemo=function(e,t){return E().useMemo(e,t)},b.useReducer=function(e,t,n){return E().useReducer(e,t,n)},b.useRef=function(e){return E().useRef(e)},b.useState=function(e){return E().useState(e)},b.version="17.0.2",b}var k,S,C={};function $(){return k||(k=1,e=C,"production"!==process.env.NODE_ENV&&function(){var t=_(),n=60103,r=60106;e.Fragment=60107,e.StrictMode=60108,e.Profiler=60114;var o=60109,a=60110,i=60112;e.Suspense=60113;var s=60120,u=60115,c=60116,l=60121,f=60122,p=60117,d=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var m=Symbol.for;n=m("react.element"),r=m("react.portal"),e.Fragment=m("react.fragment"),e.StrictMode=m("react.strict_mode"),e.Profiler=m("react.profiler"),o=m("react.provider"),a=m("react.context"),i=m("react.forward_ref"),e.Suspense=m("react.suspense"),s=m("react.suspense_list"),u=m("react.memo"),c=m("react.lazy"),l=m("react.block"),f=m("react.server.block"),p=m("react.fundamental"),m("react.scope"),m("react.opaque.id"),d=m("react.debug_trace_mode"),m("react.offscreen"),y=m("react.legacy_hidden")}var h="function"==typeof Symbol&&Symbol.iterator;function v(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}var g={current:null},b={current:null},w={},k=null;function S(e){k=e}w.setExtraStackFrame=function(e){k=e},w.getCurrentStack=null,w.getStackAddendum=function(){var e="";k&&(e+=k);var t=w.getCurrentStack;return t&&(e+=t()||""),e};var C={ReactCurrentDispatcher:g,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:b,IsSomeRendererActing:{current:!1},assign:t};function $(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];R("warn",e,n)}function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];R("error",e,n)}function R(e,t,n){var r=C.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map(function(e){return""+e});o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}C.ReactDebugCurrentFrame=w;var j={};function P(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",o=r+"."+t;j[o]||(x("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,r),j[o]=!0)}var O={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){P(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){P(e,"replaceState")},enqueueSetState:function(e,t,n,r){P(e,"setState")}},E={};function T(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||O}Object.freeze(E),T.prototype.isReactComponent={},T.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},T.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var D={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},F=function(e,t){Object.defineProperty(T.prototype,e,{get:function(){$("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var N in D)D.hasOwnProperty(N)&&F(N,D[N]);function A(){}function I(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||O}A.prototype=T.prototype;var M=I.prototype=new A;function L(e){return e.displayName||"Context"}function z(t){if(null==t)return null;if("number"==typeof t.tag&&x("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case e.Fragment:return"Fragment";case r:return"Portal";case e.Profiler:return"Profiler";case e.StrictMode:return"StrictMode";case e.Suspense:return"Suspense";case s:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case a:return L(t)+".Consumer";case o:return L(t._context)+".Provider";case i:return d=t,y=t.render,m="ForwardRef",h=y.displayName||y.name||"",d.displayName||(""!==h?m+"("+h+")":m);case u:return z(t.type);case l:return z(t._render);case c:var n=t,f=n._payload,p=n._init;try{return z(p(f))}catch(e){return null}}var d,y,m,h;return null}M.constructor=I,t(M,T.prototype),M.isPureReactComponent=!0;var U,q,V,W=Object.prototype.hasOwnProperty,B={key:!0,ref:!0,__self:!0,__source:!0};function Y(e){if(W.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function H(e){if(W.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}V={};var J=function(e,t,r,o,a,i,s){var u={$$typeof:n,type:e,key:t,ref:r,props:s,_owner:i,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function X(e,t,n){var r,o={},a=null,i=null,s=null,u=null;if(null!=t)for(r in Y(t)&&(i=t.ref,function(e){if("string"==typeof e.ref&&b.current&&e.__self&&b.current.stateNode!==e.__self){var t=z(b.current.type);V[t]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',t,e.ref),V[t]=!0)}}(t)),H(t)&&(a=""+t.key),s=void 0===t.__self?null:t.__self,u=void 0===t.__source?null:t.__source,t)W.call(t,r)&&!B.hasOwnProperty(r)&&(o[r]=t[r]);var c=arguments.length-2;if(1===c)o.children=n;else if(c>1){for(var l=Array(c),f=0;f<c;f++)l[f]=arguments[f+2];Object.freeze&&Object.freeze(l),o.children=l}if(e&&e.defaultProps){var p=e.defaultProps;for(r in p)void 0===o[r]&&(o[r]=p[r])}if(a||i){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&function(e,t){var n=function(){U||(U=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(o,d),i&&function(e,t){var n=function(){q||(q=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(o,d)}return J(e,a,i,s,u,b.current,o)}function Z(e,n,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o,a,i=t({},e.props),s=e.key,u=e.ref,c=e._self,l=e._source,f=e._owner;if(null!=n)for(o in Y(n)&&(u=n.ref,f=b.current),H(n)&&(s=""+n.key),e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)W.call(n,o)&&!B.hasOwnProperty(o)&&(void 0===n[o]&&void 0!==a?i[o]=a[o]:i[o]=n[o]);var p=arguments.length-2;if(1===p)i.children=r;else if(p>1){for(var d=Array(p),y=0;y<p;y++)d[y]=arguments[y+2];i.children=d}return J(e.type,s,u,c,l,f,i)}function G(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var K=!1,Q=/\/+/g;function ee(e){return e.replace(Q,"$&/")}function te(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function ne(e,t,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u,c,l,f=!1;if(null===e)f=!0;else switch(s){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case n:case r:f=!0}}if(f){var p=e,d=i(p),y=""===a?"."+te(p,0):a;if(Array.isArray(d)){var m="";null!=y&&(m=ee(y)+"/"),ne(d,t,m,"",function(e){return e})}else null!=d&&(G(d)&&(u=d,c=o+(!d.key||p&&p.key===d.key?"":ee(""+d.key)+"/")+y,d=J(u.type,c,u.ref,u._self,u._source,u._owner,u.props)),t.push(d));return 1}var h=0,g=""===a?".":a+":";if(Array.isArray(e))for(var b=0;b<e.length;b++)h+=ne(l=e[b],t,o,g+te(l,b),i);else{var _=v(e);if("function"==typeof _){var w=e;_===w.entries&&(K||$("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),K=!0);for(var k,S=_.call(w),C=0;!(k=S.next()).done;)h+=ne(l=k.value,t,o,g+te(l,C++),i)}else if("object"===s){var x=""+e;throw Error("Objects are not valid as a React child (found: "+("[object Object]"===x?"object with keys {"+Object.keys(e).join(", ")+"}":x)+"). If you meant to render a collection of children, use an array instead.")}}return h}function re(e,t,n){if(null==e)return e;var r=[],o=0;return ne(e,r,"","",function(e){return t.call(n,e,o++)}),r}function oe(e){if(-1===e._status){var t=(0,e._result)(),n=e;n._status=0,n._result=t,t.then(function(t){if(0===e._status){var n=t.default;void 0===n&&x("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",t);var r=e;r._status=1,r._result=n}},function(t){if(0===e._status){var n=e;n._status=2,n._result=t}})}if(1===e._status)return e._result;throw e._result}function ae(t){return"string"==typeof t||"function"==typeof t||t===e.Fragment||t===e.Profiler||t===d||t===e.StrictMode||t===e.Suspense||t===s||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===c||t.$$typeof===u||t.$$typeof===o||t.$$typeof===a||t.$$typeof===i||t.$$typeof===p||t.$$typeof===l||t[0]===f)}function ie(){var e=g.current;if(null===e)throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");return e}var se,ue,ce,le,fe,pe,de,ye=0;function me(){}me.__reactDisabledLog=!0;var he,ve=C.ReactCurrentDispatcher;function ge(e,t,n){if(void 0===he)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);he=r&&r[1]||""}return"\n"+he+e}var be,_e=!1,we="function"==typeof WeakMap?WeakMap:Map;function ke(e,n){if(!e||_e)return"";var r,o=be.get(e);if(void 0!==o)return o;_e=!0;var a,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,a=ve.current,ve.current=null,function(){if(0===ye){se=console.log,ue=console.info,ce=console.warn,le=console.error,fe=console.group,pe=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:me,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ye++}();try{if(n){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(e){r=e}Reflect.construct(e,[],s)}else{try{s.call()}catch(e){r=e}e.call(s.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var u=t.stack.split("\n"),c=r.stack.split("\n"),l=u.length-1,f=c.length-1;l>=1&&f>=0&&u[l]!==c[f];)f--;for(;l>=1&&f>=0;l--,f--)if(u[l]!==c[f]){if(1!==l||1!==f)do{if(l--,--f<0||u[l]!==c[f]){var p="\n"+u[l].replace(" at new "," at ");return"function"==typeof e&&be.set(e,p),p}}while(l>=1&&f>=0);break}}}finally{_e=!1,ve.current=a,function(){if(0===--ye){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},e,{value:se}),info:t({},e,{value:ue}),warn:t({},e,{value:ce}),error:t({},e,{value:le}),group:t({},e,{value:fe}),groupCollapsed:t({},e,{value:pe}),groupEnd:t({},e,{value:de})})}ye<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"",y=d?ge(d):"";return"function"==typeof e&&be.set(e,y),y}function Se(e,t,n){return ke(e,!1)}function Ce(t,n,r){if(null==t)return"";if("function"==typeof t)return ke(t,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(t));if("string"==typeof t)return ge(t);switch(t){case e.Suspense:return ge("Suspense");case s:return ge("SuspenseList")}if("object"==typeof t)switch(t.$$typeof){case i:return Se(t.render);case u:return Ce(t.type,n,r);case l:return Se(t._render);case c:var o=t,a=o._payload,f=o._init;try{return Ce(f(a),n,r)}catch(e){}}return""}be=new we;var $e,xe={},Re=C.ReactDebugCurrentFrame;function je(e){if(e){var t=e._owner,n=Ce(e.type,e._source,t?t.type:null);Re.setExtraStackFrame(n)}else Re.setExtraStackFrame(null)}function Pe(e){if(e){var t=e._owner;S(Ce(e.type,e._source,t?t.type:null))}else S(null)}function Oe(){if(b.current){var e=z(b.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}$e=!1;var Ee={};function Te(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=Oe();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!Ee[n]){Ee[n]=!0;var r="";e&&e._owner&&e._owner!==b.current&&(r=" It was passed a child from "+z(e._owner.type)+"."),Pe(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),Pe(null)}}}function De(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];G(r)&&Te(r,t)}else if(G(e))e._store&&(e._store.validated=!0);else if(e){var o=v(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)G(a.value)&&Te(a.value,t)}}function Fe(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==i&&n.$$typeof!==u)return;t=n.propTypes}if(t){var r=z(n);!function(e,t,n,r,o){var a=Function.call.bind(Object.prototype.hasOwnProperty);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var u=Error((r||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[i](t,i,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(je(o),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,i,typeof s),je(null)),s instanceof Error&&!(s.message in xe)&&(xe[s.message]=!0,je(o),x("Failed %s type: %s",n,s.message),je(null))}}(t,e.props,"prop",r,e)}else void 0===n.PropTypes||$e||($e=!0,x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",z(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ne(t,r,o){var a,i,s=ae(t);if(!s){var u="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var c,l=null!=(a=r)&&void 0!==(i=a.__source)?"\n\nCheck your code at "+i.fileName.replace(/^.*[\\\/]/,"")+":"+i.lineNumber+".":"";u+=l||Oe(),null===t?c="null":Array.isArray(t)?c="array":void 0!==t&&t.$$typeof===n?(c="<"+(z(t.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):c=typeof t,x("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,u)}var f=X.apply(this,arguments);if(null==f)return f;if(s)for(var p=2;p<arguments.length;p++)De(arguments[p],t);return t===e.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){Pe(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),Pe(null);break}}null!==e.ref&&(Pe(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}(f):Fe(f),f}var Ae=!1;try{var Ie=Object.freeze({});new Map([[Ie,null]]),new Set([Ie])}catch(e){}var Me=Ne,Le=function(e,t,n){for(var r=Z.apply(this,arguments),o=2;o<arguments.length;o++)De(arguments[o],r.type);return Fe(r),r},ze=function(e){var t=Ne.bind(null,e);return t.type=e,Ae||(Ae=!0,$("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return $("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},Ue={map:re,forEach:function(e,t,n){re(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return re(e,function(){t++}),t},toArray:function(e){return re(e,function(e){return e})||[]},only:function(e){if(!G(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};e.Children=Ue,e.Component=T,e.PureComponent=I,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C,e.cloneElement=Le,e.createContext=function(e,t){void 0===t?t=null:null!==t&&"function"!=typeof t&&x("createContext: Expected the optional second argument to be a function. Instead received: %s",t);var n={$$typeof:a,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null};n.Provider={$$typeof:o,_context:n};var r=!1,i=!1,s=!1,u={$$typeof:a,_context:n,_calculateChangedBits:n._calculateChangedBits};return Object.defineProperties(u,{Provider:{get:function(){return i||(i=!0,x("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,x("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),n.Consumer}},displayName:{get:function(){return n.displayName},set:function(e){s||($("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),s=!0)}}}),n.Consumer=u,n._currentRenderer=null,n._currentRenderer2=null,n},e.createElement=Me,e.createFactory=ze,e.createRef=function(){var e={current:null};return Object.seal(e),e},e.forwardRef=function(e){null!=e&&e.$$typeof===u?x("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?x("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&x("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||x("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,n={$$typeof:i,render:e};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(n){t=n,null==e.displayName&&(e.displayName=n)}}),n},e.isValidElement=G,e.lazy=function(e){var t,n,r={$$typeof:c,_payload:{_status:-1,_result:e},_init:oe};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){x("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){x("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},e.memo=function(e,t){ae(e)||x("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var n,r={$$typeof:u,type:e,compare:void 0===t?null:t};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(t){n=t,null==e.displayName&&(e.displayName=t)}}),r},e.useCallback=function(e,t){return ie().useCallback(e,t)},e.useContext=function(e,t){var n=ie();if(void 0!==t&&x("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://reactjs.org/link/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?x("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&x("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},e.useDebugValue=function(e,t){return ie().useDebugValue(e,t)},e.useEffect=function(e,t){return ie().useEffect(e,t)},e.useImperativeHandle=function(e,t,n){return ie().useImperativeHandle(e,t,n)},e.useLayoutEffect=function(e,t){return ie().useLayoutEffect(e,t)},e.useMemo=function(e,t){return ie().useMemo(e,t)},e.useReducer=function(e,t,n){return ie().useReducer(e,t,n)},e.useRef=function(e){return ie().useRef(e)},e.useState=function(e){return ie().useState(e)},e.version="17.0.2"}()),C;var e}var x=(S||(S=1,"production"===process.env.NODE_ENV?g.exports=w():g.exports=$()),g.exports);function R(e){const t=e.match(/\/([^/]+)$/);if(!t)return null;const n=t[1].match(/^(.+?)-[a-zA-Z0-9]+\.(js|css)$/);return n?n[1]:null}function j(e){return async()=>{try{return await e()}catch(e){if(!(e instanceof Error&&function(e){return e.message?.includes("Failed to fetch dynamically imported module")||e.message?.includes("Loading chunk")||e.message?.includes("Loading CSS chunk")||"ChunkLoadError"===e.name}(e)))throw e;const t=function(e){const t=e.message?.match(/module:\s*(https?:\/\/[^\s]+)/);return t?t[1]:null}(e);if(!t)throw e;const n=R(t);if(!n)throw e;const r=function(e){const t=new URL(e),n=t.pathname.split("/");return n.pop(),"assets"===n[n.length-1]&&n.pop(),`${t.origin}${n.join("/")}`}(t),o=await async function(e){const t=`${e}/.vite/manifest.json?t=${Date.now()}`,n=await fetch(t);if(!n.ok)throw new Error(`获取 manifest 失败: ${n.status} - ${t}`);return n.json()}(r),a=function(e,t,n){for(const[,r]of Object.entries(e))if(r.name===t)return`${n}/${r.file}`;for(const[,r]of Object.entries(e))if(R("/"+r.file)===t)return`${n}/${r.file}`;return null}(o,n,r);if(!a)throw new Error(`[dynamic] 无法在 manifest 中找到 "${n}" 对应的新 chunk`);return console.log("newUrl",a),import(a)}}}function P(e){const t=x.lazy(j(e.loader)),n=e.loading;return function(e){return x.createElement(x.Suspense,{fallback:n?x.createElement(n):null},x.createElement(t,e))}}function O(r){const{appName:o,useDevMode:a="development"===process.env.NODE_ENV,federation:i,routes:s={pagesDir:"src/pages",outputPath:"src/routes.ts",watch:!0,ignoreDirs:["components","utils","hooks","typings"],routeTemplate:{defaultLoadingComponentPath:"@/components/loading",intlPath:"@/utils/intl",pageAliasPrefix:"@/pages"}},htmlTransform:u=!0,qiankun:c}=r,l=[];a&&u&&l.push({name:"micro-frontend:html-transform",transformIndexHtml:e=>e.replace(/<script[^>]*>.*?<\/script>/s,"")});const f="object"==typeof s?s:{};if(l.push(d({pagesDir:f.pagesDir?e.resolve(process.cwd(),f.pagesDir):void 0,outputPath:f.outputPath?e.resolve(process.cwd(),f.outputPath):void 0,watch:f.watch,ignoreDirs:f.ignoreDirs,routeTemplate:f.routeTemplate})),!1!==c?.enabled){const e=c?.name||o;l.push(n(e,{useDevMode:a}))}return i&&(l.push(t({name:i.name,filename:i.filename||"remote.js",exposes:i.exposes||{},shared:i.shared})),i.remotes&&l.push(y({remotes:i.remotes,outputPath:i.outputPath?e.resolve(process.cwd(),i.outputPath):"src/utils/mf.tsx"}))),l}function E(t){return{"@@/mf":t||e.resolve(process.cwd(),"./src/utils/mf.tsx")}}export{E as createMfAlias,P as dynamic,i as htmlRemoveFreshPlugin,y as mfGeneratorPlugin,O as microFrontendPlugins,d as pagesRoutesPlugin};
1
+ import*as e from"path";import t from"@originjs/vite-plugin-federation";import n from"vite-plugin-qiankun";import*as r from"fs";import*as o from"chokidar";import*as a from"prettier";function i(){return{name:"micro-frontend:html-transform",transformIndexHtml:e=>e.replace(/<script[^>]*>.*?<\/script>/s,"")}}const s=new Map;function u(e,t){if(!t||void 0===t.index)return!1;const n=t.index,r=e.substring(0,n),o=r.lastIndexOf("\n"),a=r.substring(o+1).indexOf("//");if(-1!==a){if(a<n-(o+1))return!0}let i=0;const s=/\/\*/g,u=/\*\//g;let c,l;s.lastIndex=0,u.lastIndex=0;const f=[];for(;null!==(c=s.exec(r));)f.push({index:c.index,type:"start"});for(;null!==(l=u.exec(r));)f.push({index:l.index,type:"end"});f.sort((e,t)=>e.index-t.index);for(const e of f)"start"===e.type?i++:i--;return i>0}function c(e){if(!e.endsWith(".tsx"))return!1;try{const t=r.readFileSync(e,"utf-8");return!!t.match(/export\s+default\s+(\w+)/)}catch{return!1}}function l(e){if(!c(e))return!1;const t=function(e){try{const t=r.readFileSync(e,"utf-8"),n=t.match(/export\s+default\s+(\w+)/);if(!n)return"";const o=n[1],a=t.match(new RegExp(`${o}\\.title\\s*=\\s*['"\`]([^'"\`]+)['"\`]`)),i=t.match(new RegExp(`${o}\\.keepAlive\\s*=\\s*(true|false)`)),s=t.match(new RegExp(`${o}\\.authority\\s*=\\s*\\[([^\\]]+)\\]`));return JSON.stringify({title:a&&!u(t,a)?a[1]:void 0,keepAlive:i&&!u(t,i)?i[1]:void 0,authority:s&&!u(t,s)?s[1]:void 0})}catch(t){return console.error("读取文件失败:",e,t),""}}(e),n=s.get(e);return(void 0===n||t!==n)&&(s.set(e,t),!0)}function f(t,n,o,a){const i=function(t,n){return e.relative(n,t).replace(/\\/g,"/")}(t,o),s=e.basename(t,e.extname(t)),c=r.readFileSync(t,"utf-8").match(/export\s+default\s+(\w+)/);if(s.startsWith("_")&&"_layout"!==s||!c)return null;let l=e.join(n,"index"===s||"_layout"===s?"":s);l=l.replace(/\\/g,"/"),l=l.startsWith("/")?l:`/${l}`,l=`${l}`,l=l.replace(/\[([^\]]+)\]/g,":$1");const f=`${a.pageAliasPrefix||"@/pages"}/${i.replace(/\\/g,"/")}`,{title:p,keepAlive:d,authority:y}=function(e){const t=r.readFileSync(e,"utf-8"),n=t.match(/export\s+default\s+(\w+)/);if(!n)return{};const o=n[1],a={},i=new RegExp(`${o}\\.title\\s*=\\s*['"\`]([^'"\`]+)['"\`]`),s=t.match(i);s&&!u(t,s)&&(a.title=s[1]);const c=new RegExp(`${o}\\.keepAlive\\s*=\\s*(true|false)`),l=t.match(c);l&&!u(t,l)&&(a.keepAlive="true"===l[1]);const f=new RegExp(`${o}\\.authority\\s*=\\s*\\[([^\\]]+)\\]`),p=t.match(f);return p&&!u(t,p)&&(a.authority=p[1].split(",").map(e=>e.trim().replace(/['"`]/g,"")).filter(Boolean)),a}(t),m={path:l,exact:!0,component:`dynamic({ loader: () => import('${f.replace(/.tsx$/g,"")}'), loading: LoadingComponent})`,title:p?`$t({ defaultMessage: "${p}" })`:void 0};return"_layout"===s&&(m.exact=!1),y&&(m.authority=y),"_layout"===s&&(m.routes=[]),d&&(m.keepAlive=!0),m}async function p(t,n){function o(e,t=2){const n=" ".repeat(t),r=" ".repeat(t+2);let a=`${n}{\n`;if(a+=`${r}path: '${e.path}',\n`,void 0!==e.exact&&null!==e.exact&&(a+=`${r}exact: ${e.exact},\n`),void 0!==e.component&&null!==e.component&&(a+=`${r}component: ${e.component},\n`),void 0!==e.title&&null!==e.title&&(a+=`${r}title: ${e.title},\n`),e.authority&&(a+=`${r}authority: ${JSON.stringify(e.authority)},\n`),e.keepAlive&&(a+=`${r}keepAlive: ${e.keepAlive},\n`),e.routes&&e.routes.length>0){a+=`${r}routes: [\n${e.routes.map(e=>o(e,t+2)).join(",\n")}\n${r}],\n`}return a=a.replace(/,\n$/,"\n"),a+=`${n}}`,a}const i=t.map(e=>o(e)).join(",\n"),s=`/**\n * 自动根据 pages 目录生成路由配置\n * 新增、删除、修改组件 title、keepAlive、authority 属性时,会自动更新路由配置\n * 路由组件只支持默认导出\n */\nimport { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime';\nimport LoadingComponent from '${n.defaultLoadingComponentPath||"@/components/loading"}';\nimport { $t } from '${n.intlPath||"@/utils/intl"}';\n\nexport const routers = [\n${i}\n];\n`;try{const t=e.resolve(process.cwd(),".prettierrc");let n={};if(r.existsSync(t))try{const e=r.readFileSync(t,"utf-8");n=JSON.parse(e)}catch(e){console.warn("⚠️ 读取 prettier 配置失败,使用默认配置:",e)}const o={parser:"typescript",...n};return await a.format(s,o)}catch(e){return console.error("格式化代码失败:",e),s}}function d(t={}){const{pagesDir:n,outputPath:a,watch:i=!0,ignoreDirs:u=["components","utils","hooks","typings"],routeTemplate:d={}}=t;let y=!1,m=null,h=!1;const v=n||e.resolve(process.cwd(),"src/pages"),g=a||e.resolve(process.cwd(),"src/routes.ts"),b=async()=>{if(!r.existsSync(v))return void console.warn("⚠️ pages 目录不存在:",v);const t=function(t,n){return function o(a,i=""){const s=r.readdirSync(a),u=[];let c=null;const l=s.find(e=>"_layout.tsx"===e);l&&(c=f(e.join(a,l),i,t,n),c&&(c.routes=[],u.push(c)));for(const l of s){const s=e.join(a,l),p=r.statSync(s);if("_layout.tsx"!==l)if(p.isDirectory()&&"components"!==l&&"utils"!==l&&"hooks"!==l){const t=o(s,e.join(i,l));t.length>0&&(c?c.routes.push(...t):u.push(...t))}else if(l.endsWith(".tsx")){const e=f(s,i,t,n);e&&(c?c.routes.push(e):u.push(e))}}return u}(t)}(v,d),n=await p(t,d);r.writeFileSync(g,n),console.log("✅ 路由已生成:",g)},_=()=>{m&&(m.close(),m=null,y=!1,s.clear())};return{name:"micro-frontend:routes",enforce:"pre",configureServer(e){h||(b(),h=!0),(()=>{if(y||!i)return;if(!r.existsSync(v))return;const e=["**/node_modules/**","**/*.d.ts","**/*.less","**/*.css","**/*.scss","**/*.sass",...u.map(e=>`**/${e}/**`)];m=o.watch(v,{ignored:e,persistent:!0,ignoreInitial:!0}),m.on("add",e=>{c(e)&&b()}).on("change",e=>{c(e)&&l(e)&&b()}).on("unlink",e=>{c(e)&&(s.delete(e),b())}).on("addDir",()=>{b()}).on("unlinkDir",()=>{b()}).on("error",e=>{console.error("❌ 文件监听错误:",e)}),y=!0})(),e.httpServer?.on("close",_)},buildStart(){h||(console.log("🚀 构建开始,生成路由文件..."),b(),h=!0)}}}function y(t){const{remotes:n,outputPath:o}=t,a=o||e.resolve(process.cwd(),"src/utils/mf.tsx"),i=()=>{const t=function(e){const t=JSON.stringify(e,null,2);return"/* eslint-disable */\nimport { lazy, Suspense, type ReactNode, type ComponentType } from 'react';\n\n// 远程模块配置\nconst remotes = __REMOTES_JSON__ as const;\n\ntype RemoteAlias = keyof typeof remotes;\ntype ModuleSpecifier = `${RemoteAlias}/${string}`;\n\n// 多个入口文件之间共享的变量\nconst entryShared = (window as any).__entry_shared__ || {};\n\n// 脚本加载状态: undefined=未加载, Promise=加载中, true=已完成\nconst scriptCache: Record<string, Promise<void> | true | undefined> = {};\n\n/**\n * 获取多入口共享变量(懒初始化单例)\n */\nexport function getEntryShared<T>(key: string, init: () => T): T {\n return (entryShared[key] ??= init()) as T;\n}\n\n/**\n * 安全加载远程组件\n */\nexport function safeRemoteComponent<T extends ComponentType<any>>(opts: {\n moduleSpecifier: ModuleSpecifier;\n fallbackComponent: T;\n loadingElement?: ReactNode;\n}): T {\n const LazyComponent = lazy<T>(() =>\n loadRemoteModule(opts.moduleSpecifier, { default: opts.fallbackComponent }),\n );\n\n return ((props: any) => (\n <Suspense fallback={opts.loadingElement ?? null}>\n <LazyComponent {...props} />\n </Suspense>\n )) as T;\n}\n\n// ============ 内部实现 ============\n\nasync function loadRemoteModule<T>(specifier: ModuleSpecifier, fallback: T): Promise<T> {\n try {\n const slashIndex = specifier.indexOf('/');\n const alias = specifier.slice(0, slashIndex) as RemoteAlias;\n const moduleName = specifier.slice(slashIndex + 1);\n const remote = remotes[alias];\n\n if (!remote) {\n console.error(`[MF] Unknown remote alias: \"${alias}\"`);\n return fallback;\n }\n\n await loadScriptOnce(remote.remoteName, remote.entry);\n\n const container = (window as any)[remote.remoteName];\n const factory = await container.get(`./${moduleName}`);\n return factory();\n } catch (e) {\n console.error(`[MF] Failed to load \"${specifier}\"`, e);\n return fallback;\n }\n}\n\nasync function loadScriptOnce(name: string, url: string): Promise<void> {\n const cached = scriptCache[name];\n\n if (cached === true) return;\n if (cached) return cached;\n\n const promise = new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = `${url}?t=${Date.now()}`;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = reject;\n document.head.appendChild(script);\n }).then(\n () => {\n scriptCache[name] = true;\n },\n e => {\n scriptCache[name] = undefined;\n throw e;\n },\n );\n\n scriptCache[name] = promise;\n return promise;\n}\n\n// ==== Vite Module Federation 动态加载 ===\n\ntype RemoteComponentOptions<P = any> = {\n /** 远程模块加载函数,如 () => import('remoteApp/Component') */\n loader: () => Promise<{ default: ComponentType<P> }>;\n /** 加载失败时的回退组件 */\n fallback?: ComponentType<P>;\n /** 加载中显示的元素 */\n loading?: ReactNode;\n};\n\n/**\n * 创建一个动态加载的远程联邦组件\n * @example\n * const RemoteButton = createRemoteComponent({\n * loader: () => import('remoteApp/Button'),\n * fallback: () => <div>加载失败</div>,\n * loading: <Spin />,\n * });\n */\nexport function createRemoteComponent<P extends object = {}>(\n options: RemoteComponentOptions<P>,\n): ComponentType<P> {\n const { loader, fallback: Fallback, loading = null } = options;\n\n const LazyComponent = lazy(() =>\n loader().catch(error => {\n console.error('Failed to load remote component:', error);\n if (Fallback) {\n return { default: Fallback };\n }\n throw error;\n }),\n );\n\n const RemoteWrapper: React.FC<P> = props => (\n <Suspense fallback={loading}>\n {/* @ts-expect-error: 类型不完全匹配,但实际可以正常渲染 */}\n <LazyComponent {...props} />\n </Suspense>\n );\n\n return RemoteWrapper as ComponentType<P>;\n}\n\n".replace("__REMOTES_JSON__",t)}(n),o=e.dirname(a);if(r.existsSync(o)||r.mkdirSync(o,{recursive:!0}),r.existsSync(a)){if(r.readFileSync(a,"utf-8")===t)return}r.writeFileSync(a,t),console.log("✅ mf.tsx 已生成:",a)};return{name:"micro-frontend:mf-generator",enforce:"pre",configResolved(){i()},buildStart(){i()}}}var m,h,v,g={exports:{}},b={};function _(){if(h)return m;h=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return m=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var a,i,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),u=1;u<arguments.length;u++){for(var c in a=Object(arguments[u]))t.call(a,c)&&(s[c]=a[c]);if(e){i=e(a);for(var l=0;l<i.length;l++)n.call(a,i[l])&&(s[i[l]]=a[i[l]])}}return s},m}function w(){if(v)return b;v=1;var e=_(),t=60103,n=60106;b.Fragment=60107,b.StrictMode=60108,b.Profiler=60114;var r=60109,o=60110,a=60112;b.Suspense=60113;var i=60115,s=60116;if("function"==typeof Symbol&&Symbol.for){var u=Symbol.for;t=u("react.element"),n=u("react.portal"),b.Fragment=u("react.fragment"),b.StrictMode=u("react.strict_mode"),b.Profiler=u("react.profiler"),r=u("react.provider"),o=u("react.context"),a=u("react.forward_ref"),b.Suspense=u("react.suspense"),i=u("react.memo"),s=u("react.lazy")}var c="function"==typeof Symbol&&Symbol.iterator;function l(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p={};function d(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||f}function y(){}function m(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||f}d.prototype.isReactComponent={},d.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(l(85));this.updater.enqueueSetState(this,e,t,"setState")},d.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=d.prototype;var h=m.prototype=new y;h.constructor=m,e(h,d.prototype),h.isPureReactComponent=!0;var g={current:null},w=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function S(e,n,r){var o,a={},i=null,s=null;if(null!=n)for(o in void 0!==n.ref&&(s=n.ref),void 0!==n.key&&(i=""+n.key),n)w.call(n,o)&&!k.hasOwnProperty(o)&&(a[o]=n[o]);var u=arguments.length-2;if(1===u)a.children=r;else if(1<u){for(var c=Array(u),l=0;l<u;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(o in u=e.defaultProps)void 0===a[o]&&(a[o]=u[o]);return{$$typeof:t,type:e,key:i,ref:s,props:a,_owner:g.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var R=/\/+/g;function $(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function x(e,r,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u=!1;if(null===e)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case t:case n:u=!0}}if(u)return i=i(u=e),e=""===a?"."+$(u,0):a,Array.isArray(i)?(o="",null!=e&&(o=e.replace(R,"$&/")+"/"),x(i,r,o,"",function(e){return e})):null!=i&&(C(i)&&(i=function(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}(i,o+(!i.key||u&&u.key===i.key?"":(""+i.key).replace(R,"$&/")+"/")+e)),r.push(i)),1;if(u=0,a=""===a?".":a+":",Array.isArray(e))for(var f=0;f<e.length;f++){var p=a+$(s=e[f],f);u+=x(s,r,o,p,i)}else if(p=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=c&&e[c]||e["@@iterator"])?e:null}(e),"function"==typeof p)for(e=p.call(e),f=0;!(s=e.next()).done;)u+=x(s=s.value,r,o,p=a+$(s,f++),i);else if("object"===s)throw r=""+e,Error(l(31,"[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r));return u}function j(e,t,n){if(null==e)return e;var r=[],o=0;return x(e,r,"","",function(e){return t.call(n,e,o++)}),r}function P(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then(function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)},function(t){0===e._status&&(e._status=2,e._result=t)})}if(1===e._status)return e._result;throw e._result}var O={current:null};function E(){var e=O.current;if(null===e)throw Error(l(321));return e}var T={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:e};return b.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error(l(143));return e}},b.Component=d,b.PureComponent=m,b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,b.cloneElement=function(n,r,o){if(null==n)throw Error(l(267,n));var a=e({},n.props),i=n.key,s=n.ref,u=n._owner;if(null!=r){if(void 0!==r.ref&&(s=r.ref,u=g.current),void 0!==r.key&&(i=""+r.key),n.type&&n.type.defaultProps)var c=n.type.defaultProps;for(f in r)w.call(r,f)&&!k.hasOwnProperty(f)&&(a[f]=void 0===r[f]&&void 0!==c?c[f]:r[f])}var f=arguments.length-2;if(1===f)a.children=o;else if(1<f){c=Array(f);for(var p=0;p<f;p++)c[p]=arguments[p+2];a.children=c}return{$$typeof:t,type:n.type,key:i,ref:s,props:a,_owner:u}},b.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:o,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:r,_context:e},e.Consumer=e},b.createElement=S,b.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},b.createRef=function(){return{current:null}},b.forwardRef=function(e){return{$$typeof:a,render:e}},b.isValidElement=C,b.lazy=function(e){return{$$typeof:s,_payload:{_status:-1,_result:e},_init:P}},b.memo=function(e,t){return{$$typeof:i,type:e,compare:void 0===t?null:t}},b.useCallback=function(e,t){return E().useCallback(e,t)},b.useContext=function(e,t){return E().useContext(e,t)},b.useDebugValue=function(){},b.useEffect=function(e,t){return E().useEffect(e,t)},b.useImperativeHandle=function(e,t,n){return E().useImperativeHandle(e,t,n)},b.useLayoutEffect=function(e,t){return E().useLayoutEffect(e,t)},b.useMemo=function(e,t){return E().useMemo(e,t)},b.useReducer=function(e,t,n){return E().useReducer(e,t,n)},b.useRef=function(e){return E().useRef(e)},b.useState=function(e){return E().useState(e)},b.version="17.0.2",b}var k,S,C={};function R(){return k||(k=1,e=C,"production"!==process.env.NODE_ENV&&function(){var t=_(),n=60103,r=60106;e.Fragment=60107,e.StrictMode=60108,e.Profiler=60114;var o=60109,a=60110,i=60112;e.Suspense=60113;var s=60120,u=60115,c=60116,l=60121,f=60122,p=60117,d=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var m=Symbol.for;n=m("react.element"),r=m("react.portal"),e.Fragment=m("react.fragment"),e.StrictMode=m("react.strict_mode"),e.Profiler=m("react.profiler"),o=m("react.provider"),a=m("react.context"),i=m("react.forward_ref"),e.Suspense=m("react.suspense"),s=m("react.suspense_list"),u=m("react.memo"),c=m("react.lazy"),l=m("react.block"),f=m("react.server.block"),p=m("react.fundamental"),m("react.scope"),m("react.opaque.id"),d=m("react.debug_trace_mode"),m("react.offscreen"),y=m("react.legacy_hidden")}var h="function"==typeof Symbol&&Symbol.iterator;function v(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}var g={current:null},b={current:null},w={},k=null;function S(e){k=e}w.setExtraStackFrame=function(e){k=e},w.getCurrentStack=null,w.getStackAddendum=function(){var e="";k&&(e+=k);var t=w.getCurrentStack;return t&&(e+=t()||""),e};var C={ReactCurrentDispatcher:g,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:b,IsSomeRendererActing:{current:!1},assign:t};function R(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];x("warn",e,n)}function $(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];x("error",e,n)}function x(e,t,n){var r=C.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map(function(e){return""+e});o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}C.ReactDebugCurrentFrame=w;var j={};function P(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",o=r+"."+t;j[o]||($("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,r),j[o]=!0)}var O={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){P(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){P(e,"replaceState")},enqueueSetState:function(e,t,n,r){P(e,"setState")}},E={};function T(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||O}Object.freeze(E),T.prototype.isReactComponent={},T.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},T.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var D={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},F=function(e,t){Object.defineProperty(T.prototype,e,{get:function(){R("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var N in D)D.hasOwnProperty(N)&&F(N,D[N]);function A(){}function I(e,t,n){this.props=e,this.context=t,this.refs=E,this.updater=n||O}A.prototype=T.prototype;var M=I.prototype=new A;function L(e){return e.displayName||"Context"}function z(t){if(null==t)return null;if("number"==typeof t.tag&&$("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case e.Fragment:return"Fragment";case r:return"Portal";case e.Profiler:return"Profiler";case e.StrictMode:return"StrictMode";case e.Suspense:return"Suspense";case s:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case a:return L(t)+".Consumer";case o:return L(t._context)+".Provider";case i:return d=t,y=t.render,m="ForwardRef",h=y.displayName||y.name||"",d.displayName||(""!==h?m+"("+h+")":m);case u:return z(t.type);case l:return z(t._render);case c:var n=t,f=n._payload,p=n._init;try{return z(p(f))}catch(e){return null}}var d,y,m,h;return null}M.constructor=I,t(M,T.prototype),M.isPureReactComponent=!0;var U,q,V,W=Object.prototype.hasOwnProperty,B={key:!0,ref:!0,__self:!0,__source:!0};function Y(e){if(W.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function H(e){if(W.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}V={};var J=function(e,t,r,o,a,i,s){var u={$$typeof:n,type:e,key:t,ref:r,props:s,_owner:i,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function X(e,t,n){var r,o={},a=null,i=null,s=null,u=null;if(null!=t)for(r in Y(t)&&(i=t.ref,function(e){if("string"==typeof e.ref&&b.current&&e.__self&&b.current.stateNode!==e.__self){var t=z(b.current.type);V[t]||($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',t,e.ref),V[t]=!0)}}(t)),H(t)&&(a=""+t.key),s=void 0===t.__self?null:t.__self,u=void 0===t.__source?null:t.__source,t)W.call(t,r)&&!B.hasOwnProperty(r)&&(o[r]=t[r]);var c=arguments.length-2;if(1===c)o.children=n;else if(c>1){for(var l=Array(c),f=0;f<c;f++)l[f]=arguments[f+2];Object.freeze&&Object.freeze(l),o.children=l}if(e&&e.defaultProps){var p=e.defaultProps;for(r in p)void 0===o[r]&&(o[r]=p[r])}if(a||i){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&function(e,t){var n=function(){U||(U=!0,$("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(o,d),i&&function(e,t){var n=function(){q||(q=!0,$("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(o,d)}return J(e,a,i,s,u,b.current,o)}function K(e,n,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o,a,i=t({},e.props),s=e.key,u=e.ref,c=e._self,l=e._source,f=e._owner;if(null!=n)for(o in Y(n)&&(u=n.ref,f=b.current),H(n)&&(s=""+n.key),e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)W.call(n,o)&&!B.hasOwnProperty(o)&&(void 0===n[o]&&void 0!==a?i[o]=a[o]:i[o]=n[o]);var p=arguments.length-2;if(1===p)i.children=r;else if(p>1){for(var d=Array(p),y=0;y<p;y++)d[y]=arguments[y+2];i.children=d}return J(e.type,s,u,c,l,f,i)}function G(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var Q=!1,Z=/\/+/g;function ee(e){return e.replace(Z,"$&/")}function te(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function ne(e,t,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u,c,l,f=!1;if(null===e)f=!0;else switch(s){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case n:case r:f=!0}}if(f){var p=e,d=i(p),y=""===a?"."+te(p,0):a;if(Array.isArray(d)){var m="";null!=y&&(m=ee(y)+"/"),ne(d,t,m,"",function(e){return e})}else null!=d&&(G(d)&&(u=d,c=o+(!d.key||p&&p.key===d.key?"":ee(""+d.key)+"/")+y,d=J(u.type,c,u.ref,u._self,u._source,u._owner,u.props)),t.push(d));return 1}var h=0,g=""===a?".":a+":";if(Array.isArray(e))for(var b=0;b<e.length;b++)h+=ne(l=e[b],t,o,g+te(l,b),i);else{var _=v(e);if("function"==typeof _){var w=e;_===w.entries&&(Q||R("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Q=!0);for(var k,S=_.call(w),C=0;!(k=S.next()).done;)h+=ne(l=k.value,t,o,g+te(l,C++),i)}else if("object"===s){var $=""+e;throw Error("Objects are not valid as a React child (found: "+("[object Object]"===$?"object with keys {"+Object.keys(e).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}}return h}function re(e,t,n){if(null==e)return e;var r=[],o=0;return ne(e,r,"","",function(e){return t.call(n,e,o++)}),r}function oe(e){if(-1===e._status){var t=(0,e._result)(),n=e;n._status=0,n._result=t,t.then(function(t){if(0===e._status){var n=t.default;void 0===n&&$("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",t);var r=e;r._status=1,r._result=n}},function(t){if(0===e._status){var n=e;n._status=2,n._result=t}})}if(1===e._status)return e._result;throw e._result}function ae(t){return"string"==typeof t||"function"==typeof t||t===e.Fragment||t===e.Profiler||t===d||t===e.StrictMode||t===e.Suspense||t===s||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===c||t.$$typeof===u||t.$$typeof===o||t.$$typeof===a||t.$$typeof===i||t.$$typeof===p||t.$$typeof===l||t[0]===f)}function ie(){var e=g.current;if(null===e)throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");return e}var se,ue,ce,le,fe,pe,de,ye=0;function me(){}me.__reactDisabledLog=!0;var he,ve=C.ReactCurrentDispatcher;function ge(e,t,n){if(void 0===he)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);he=r&&r[1]||""}return"\n"+he+e}var be,_e=!1,we="function"==typeof WeakMap?WeakMap:Map;function ke(e,n){if(!e||_e)return"";var r,o=be.get(e);if(void 0!==o)return o;_e=!0;var a,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,a=ve.current,ve.current=null,function(){if(0===ye){se=console.log,ue=console.info,ce=console.warn,le=console.error,fe=console.group,pe=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:me,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ye++}();try{if(n){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(e){r=e}Reflect.construct(e,[],s)}else{try{s.call()}catch(e){r=e}e.call(s.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var u=t.stack.split("\n"),c=r.stack.split("\n"),l=u.length-1,f=c.length-1;l>=1&&f>=0&&u[l]!==c[f];)f--;for(;l>=1&&f>=0;l--,f--)if(u[l]!==c[f]){if(1!==l||1!==f)do{if(l--,--f<0||u[l]!==c[f]){var p="\n"+u[l].replace(" at new "," at ");return"function"==typeof e&&be.set(e,p),p}}while(l>=1&&f>=0);break}}}finally{_e=!1,ve.current=a,function(){if(0===--ye){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},e,{value:se}),info:t({},e,{value:ue}),warn:t({},e,{value:ce}),error:t({},e,{value:le}),group:t({},e,{value:fe}),groupCollapsed:t({},e,{value:pe}),groupEnd:t({},e,{value:de})})}ye<0&&$("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"",y=d?ge(d):"";return"function"==typeof e&&be.set(e,y),y}function Se(e,t,n){return ke(e,!1)}function Ce(t,n,r){if(null==t)return"";if("function"==typeof t)return ke(t,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(t));if("string"==typeof t)return ge(t);switch(t){case e.Suspense:return ge("Suspense");case s:return ge("SuspenseList")}if("object"==typeof t)switch(t.$$typeof){case i:return Se(t.render);case u:return Ce(t.type,n,r);case l:return Se(t._render);case c:var o=t,a=o._payload,f=o._init;try{return Ce(f(a),n,r)}catch(e){}}return""}be=new we;var Re,$e={},xe=C.ReactDebugCurrentFrame;function je(e){if(e){var t=e._owner,n=Ce(e.type,e._source,t?t.type:null);xe.setExtraStackFrame(n)}else xe.setExtraStackFrame(null)}function Pe(e){if(e){var t=e._owner;S(Ce(e.type,e._source,t?t.type:null))}else S(null)}function Oe(){if(b.current){var e=z(b.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Re=!1;var Ee={};function Te(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=Oe();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!Ee[n]){Ee[n]=!0;var r="";e&&e._owner&&e._owner!==b.current&&(r=" It was passed a child from "+z(e._owner.type)+"."),Pe(e),$('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),Pe(null)}}}function De(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];G(r)&&Te(r,t)}else if(G(e))e._store&&(e._store.validated=!0);else if(e){var o=v(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)G(a.value)&&Te(a.value,t)}}function Fe(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==i&&n.$$typeof!==u)return;t=n.propTypes}if(t){var r=z(n);!function(e,t,n,r,o){var a=Function.call.bind(Object.prototype.hasOwnProperty);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var u=Error((r||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[i](t,i,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(je(o),$("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,i,typeof s),je(null)),s instanceof Error&&!(s.message in $e)&&($e[s.message]=!0,je(o),$("Failed %s type: %s",n,s.message),je(null))}}(t,e.props,"prop",r,e)}else void 0===n.PropTypes||Re||(Re=!0,$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",z(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||$("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ne(t,r,o){var a,i,s=ae(t);if(!s){var u="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var c,l=null!=(a=r)&&void 0!==(i=a.__source)?"\n\nCheck your code at "+i.fileName.replace(/^.*[\\\/]/,"")+":"+i.lineNumber+".":"";u+=l||Oe(),null===t?c="null":Array.isArray(t)?c="array":void 0!==t&&t.$$typeof===n?(c="<"+(z(t.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):c=typeof t,$("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,u)}var f=X.apply(this,arguments);if(null==f)return f;if(s)for(var p=2;p<arguments.length;p++)De(arguments[p],t);return t===e.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){Pe(e),$("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),Pe(null);break}}null!==e.ref&&(Pe(e),$("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}(f):Fe(f),f}var Ae=!1;try{var Ie=Object.freeze({});new Map([[Ie,null]]),new Set([Ie])}catch(e){}var Me=Ne,Le=function(e,t,n){for(var r=K.apply(this,arguments),o=2;o<arguments.length;o++)De(arguments[o],r.type);return Fe(r),r},ze=function(e){var t=Ne.bind(null,e);return t.type=e,Ae||(Ae=!0,R("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return R("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},Ue={map:re,forEach:function(e,t,n){re(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return re(e,function(){t++}),t},toArray:function(e){return re(e,function(e){return e})||[]},only:function(e){if(!G(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};e.Children=Ue,e.Component=T,e.PureComponent=I,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C,e.cloneElement=Le,e.createContext=function(e,t){void 0===t?t=null:null!==t&&"function"!=typeof t&&$("createContext: Expected the optional second argument to be a function. Instead received: %s",t);var n={$$typeof:a,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null};n.Provider={$$typeof:o,_context:n};var r=!1,i=!1,s=!1,u={$$typeof:a,_context:n,_calculateChangedBits:n._calculateChangedBits};return Object.defineProperties(u,{Provider:{get:function(){return i||(i=!0,$("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,$("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),n.Consumer}},displayName:{get:function(){return n.displayName},set:function(e){s||(R("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),s=!0)}}}),n.Consumer=u,n._currentRenderer=null,n._currentRenderer2=null,n},e.createElement=Me,e.createFactory=ze,e.createRef=function(){var e={current:null};return Object.seal(e),e},e.forwardRef=function(e){null!=e&&e.$$typeof===u?$("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?$("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&$("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||$("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,n={$$typeof:i,render:e};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(n){t=n,null==e.displayName&&(e.displayName=n)}}),n},e.isValidElement=G,e.lazy=function(e){var t,n,r={$$typeof:c,_payload:{_status:-1,_result:e},_init:oe};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){$("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){$("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},e.memo=function(e,t){ae(e)||$("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var n,r={$$typeof:u,type:e,compare:void 0===t?null:t};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(t){n=t,null==e.displayName&&(e.displayName=t)}}),r},e.useCallback=function(e,t){return ie().useCallback(e,t)},e.useContext=function(e,t){var n=ie();if(void 0!==t&&$("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://reactjs.org/link/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?$("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&$("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},e.useDebugValue=function(e,t){return ie().useDebugValue(e,t)},e.useEffect=function(e,t){return ie().useEffect(e,t)},e.useImperativeHandle=function(e,t,n){return ie().useImperativeHandle(e,t,n)},e.useLayoutEffect=function(e,t){return ie().useLayoutEffect(e,t)},e.useMemo=function(e,t){return ie().useMemo(e,t)},e.useReducer=function(e,t,n){return ie().useReducer(e,t,n)},e.useRef=function(e){return ie().useRef(e)},e.useState=function(e){return ie().useState(e)},e.version="17.0.2"}()),C;var e}var $=(S||(S=1,"production"===process.env.NODE_ENV?g.exports=w():g.exports=R()),g.exports);const x=new Map;function j(e){return async()=>{try{return await e()}catch(e){if(!(e instanceof Error&&function(e){return e.message?.includes("Failed to fetch dynamically imported module")||e.message?.includes("Loading chunk")||e.message?.includes("Loading CSS chunk")||"ChunkLoadError"===e.name}(e)))throw e;const t=function(e){const t=e.message?.match(/module:\s*(https?:\/\/[^\s]+)/);return t?t[1]:null}(e);if(!t)throw e;const n=function(e){const t=new URL(e),n=t.pathname.split("/");return n.pop(),"assets"===n[n.length-1]&&n.pop(),`${t.origin}${n.join("/")}`}(t),r=function(e,t){try{const n=new URL(e),r=new URL(t);return n.pathname.slice(r.pathname.length).replace(/^\//,"")}catch{return null}}(t,n);if(!r)throw e;const o=x.get(n);let a=null;o&&(a=function(e,t){for(const[n,r]of Object.entries(e))if(r.file===t||`assets/${r.file}`===t||r.file===`assets/${t}`)return n;return null}(o,r));const i=await async function(e,t=!1){if(!t&&x.has(e))return x.get(e);const n=`${e}/.vite/manifest.json?t=${Date.now()}`,r=await fetch(n);if(!r.ok)throw new Error(`获取 manifest 失败: ${r.status} - ${n}`);const o=await r.json();return t||x.set(e,o),o}(n,!0);if(!a)return console.warn("[dynamic] 无法映射 chunk,提示用户刷新页面:",r),alert("系统已更新,请刷新页面以获取最新版本。"),void window.location.reload();const s=function(e,t,n){const r=e[t];return r?`${n}/${r.file}`:null}(i,a,n);return s?import(s):(console.warn('[dynamic] 无法在新 manifest 中找到 "${manifestKey}" 对应的 chunk'),alert("系统已更新,请刷新页面以获取最新版本。"),void window.location.reload())}}}function P(e){const t=$.lazy(j(e.loader)),n=e.loading;return function(e){return $.createElement($.Suspense,{fallback:n?$.createElement(n):null},$.createElement(t,e))}}const O={pagesDir:"src/pages",outputPath:"src/routes.ts",watch:!0,ignoreDirs:["components","utils","hooks","typings"],routeTemplate:{defaultLoadingComponentPath:"@/components/loading",intlPath:"@/utils/intl"}};function E(r){const{appName:o,useDevMode:a="development"===process.env.NODE_ENV,federation:i,routes:s,htmlTransform:u=!0,qiankun:c}=r,l=[];a&&u&&l.push({name:"micro-frontend:html-transform",transformIndexHtml:e=>e.replace(/<script[^>]*>.*?<\/script>/s,"")});const f="object"==typeof s?Object.assign(O,s):O;if(l.push(d({pagesDir:f.pagesDir?e.resolve(process.cwd(),f.pagesDir):void 0,outputPath:f.outputPath?e.resolve(process.cwd(),f.outputPath):void 0,watch:f.watch,ignoreDirs:f.ignoreDirs,routeTemplate:f.routeTemplate})),!1!==c?.enabled){const e=c?.name||o;l.push(n(e,{useDevMode:a}))}return i&&(l.push(t({name:i.name,filename:i.filename||"remote.js",exposes:i.exposes||{},shared:i.shared})),i.remotes&&l.push(y({remotes:i.remotes,outputPath:i.outputPath?e.resolve(process.cwd(),i.outputPath):"src/utils/mf.tsx"}))),l}function T(t){return{"@@/mf":t||e.resolve(process.cwd(),"./src/utils/mf.tsx")}}export{T as createMfAlias,P as dynamic,i as htmlRemoveFreshPlugin,y as mfGeneratorPlugin,E as microFrontendPlugins,d as pagesRoutesPlugin};
2
2
  //# sourceMappingURL=index.js.map