@flatjs/evolve 1.2.64 → 1.2.71

Sign up to get free protection for your applications and to get access to all the features.
package/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! @flatjs/forge MIT https://github.com/flatjs */
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("@flatjs/common");var t=require("lodash");var n=require("@flatjs/mock");var r=require("babel-merge");var o=require("path");var s=require("@flatjs/forge-plugin-postcss-pixel");var a=require("cssnano");var l=require("webpack");var i=require("terser-webpack-plugin");var c=require("mini-css-extract-plugin");var u=require("case-sensitive-paths-webpack-plugin");var p=require("webpack-bundle-analyzer");var d=require("webpack-sources");var f=require("webpack/lib/util/extractUrlAndGlobal");var h=require("html-webpack-plugin");var m=require("os");var g=require("tty");var b=require("webpack-dev-server");var v=require("better-opn");var y=require("fs");function w(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var j=w(r);var k=w(a);var C=w(l);var O=w(i);var x=w(c);var M=w(u);var P=w(f);var S=w(h);var A=w(m);var E=w(g);var B=w(b);var R=w(v);function $(e){let t;const n=process.env.NODE_ENV==="FLATJS_CORE";switch(e){case"@flatjs/evolve-preset-babel":t=require.resolve(n?"../../../evolve-preset-babel/src/index":e);break}return t}const T=(e,t=false)=>{if(!t){return require(e)}else{return n.loadModule(e)}};const q=({usePreset:t,...n}={usePreset:"react"},r=[])=>{const o=r.map((e=>[require.resolve("babel-plugin-import"),{transformToDefaultImport:false,libraryDirectory:"esm",style:()=>false,...e},e.libraryName]));const{reactBabelPreset:s,vueBabelPreset:a}=T($("@flatjs/evolve-preset-babel"));const l=t==="react"?s():a();let i={};try{i=j["default"](l,n);if(i.plugins){i.plugins.unshift(...o)}else{i.plugins=o}}catch(t){e.printError(t)}return Object.assign({babelrc:false},i)};const I=[`https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`];const _={reactDev:[`https://unpkg.com/react@17.0.2/umd/react.development.js`,`https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js`,`https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.js`],reactProd:[`https://unpkg.com/react@17.0.2/umd/react.production.min.js`,`https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js`,`https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.min.js`]};const F={reactDev:[`https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.development.js`,`https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.development.js`,`https://cdn.jsdelivr.net/npm/react-router-dom@5.2.0/umd/react-router-dom.js`],reactProd:[`https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.production.min.js`,`https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.production.min.js`,`https://cdn.jsdelivr.net/npm/react-router-dom@5.2.0/umd/react-router-dom.min.js`]};const N={reactDev:[`//cdn.bootcss.com/react/17.0.2/umd/react.development.js`,`//cdn.bootcss.com/react-dom/17.0.2/umd/react-dom.development.js`,`//cdn.bootcss.com/react-router-dom/5.2.0/react-router-dom.js`],reactProd:[`//cdn.bootcss.com/react/17.0.2/umd/react.production.min.js`,`//cdn.bootcss.com/react-dom/17.0.2/umd/react-dom.production.min.js`,`//cdn.bootcss.com/react-router-dom/5.2.0/react-router-dom.min.js`]};const D={flatjsEvolve:{projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",forBuild:{rejectWarnings:false},forServe:{pageMiddlewares:[],defaultServeGlobalData:()=>({})},target:["web","es5"],minimizeTerserOptions:{},multiHtmlCdn:{},watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},pluginLoaderOptions:{babelOptions:{usePreset:"react"},lessOptions:{},pixelOptions:{enabled:true,rootValue:{px:100,rpx:1},outputUnit:"rem"},enableBundleHashName:true,modularImports:[]}}};const W=(e={},t)=>{var n;const r=t[1];const o={vue:"Vue",react:"React","react-dom":"ReactDOM","react-router":"ReactRouter","react-router-dom":"ReactRouterDOM"};return Object.assign({},o,e,((n=r.options)==null?void 0:n.externals)||{})};const L=`(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector('meta[name="viewport"]');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);`;const z={title:"",favicon:"",headBeforeStyles:()=>[],headBeforeScripts:e=>[...I,...e==="development"?N.reactDev:N.reactProd],bodyAfterScripts:()=>[],viewport:L,excludeCdnEnvs:["me","dev","ntv"],minify:true,template:o.join(e.getPackageDirSync(__dirname,""),"templates/html-plugin/index-{0}.html")};const G=(e,n,r)=>{let o;if(r){o=typeof r==="function"?r(n):r}if(t.isUndefined(o)){const t=z[e];return typeof t==="function"?t(n):t}return o};const H=(e,t)=>Object.assign({sourceMap:e,javascriptEnabled:true},t);const U=(e,t={})=>{const n=[k["default"]({preset:["default",{discardComments:{removeAll:!e},reduceInitial:false,normalizeWhitespace:!e}]})];if(t.enabled!==false){n.push(s.forgePluginPostcssPixel(t))}return{plugins:n}};const J=(e,t={})=>{const n={hints:e?false:"warning"};return Object.assign(n,t)};const V=(e={})=>({parallel:true,
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("@flatjs/common");var t=require("lodash");var n=require("@flatjs/mock");var r=require("babel-merge");var o=require("path");var s=require("@flatjs/forge-plugin-postcss-pixel");var l=require("cssnano");var a=require("webpack");var i=require("terser-webpack-plugin");var c=require("mini-css-extract-plugin");var u=require("case-sensitive-paths-webpack-plugin");var p=require("webpack-bundle-analyzer");var d=require("webpack-sources");var f=require("webpack/lib/util/extractUrlAndGlobal");var h=require("html-webpack-plugin");var m=require("os");var g=require("tty");var b=require("webpack-dev-server");var v=require("express");var y=require("https");var w=require("fs");var j=require("better-opn");function k(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var C=k(r);var O=k(l);var x=k(a);var M=k(i);var P=k(c);var S=k(u);var A=k(f);var E=k(h);var B=k(m);var R=k(g);var $=k(b);var T=k(v);var q=k(y);var I=k(j);function F(e){let t;const n=process.env.NODE_ENV==="FLATJS_CORE";switch(e){case"@flatjs/evolve-preset-babel":t=require.resolve(n?"../../../evolve-preset-babel/src/index":e);break}return t}const _=(e,t=false)=>{if(!t){return require(e)}else{return n.loadModule(e)}};const D=({usePreset:t,...n}={usePreset:"react"},r=[])=>{const o=r.map((e=>[require.resolve("babel-plugin-import"),{transformToDefaultImport:false,libraryDirectory:"esm",style:()=>false,...e},e.libraryName]));const{reactBabelPreset:s,vueBabelPreset:l}=_(F("@flatjs/evolve-preset-babel"));const a=t==="react"?s():l();let i={};try{i=C["default"](a,n);if(i.plugins){i.plugins.unshift(...o)}else{i.plugins=o}}catch(t){e.printError(t)}return Object.assign({babelrc:false},i)};const N=[`https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`];const W={reactDev:[`https://unpkg.com/react@17.0.2/umd/react.development.js`,`https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js`,`https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.js`],reactProd:[`https://unpkg.com/react@17.0.2/umd/react.production.min.js`,`https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js`,`https://unpkg.com/react-router-dom@5.2.0/umd/react-router-dom.min.js`]};const L={reactDev:[`https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.development.js`,`https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.development.js`,`https://cdn.jsdelivr.net/npm/react-router-dom@5.2.0/umd/react-router-dom.js`],reactProd:[`https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.production.min.js`,`https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.production.min.js`,`https://cdn.jsdelivr.net/npm/react-router-dom@5.2.0/umd/react-router-dom.min.js`]};const z={reactDev:[`//cdn.bootcss.com/react/17.0.2/umd/react.development.js`,`//cdn.bootcss.com/react-dom/17.0.2/umd/react-dom.development.js`,`//cdn.bootcss.com/react-router-dom/5.2.0/react-router-dom.js`],reactProd:[`//cdn.bootcss.com/react/17.0.2/umd/react.production.min.js`,`//cdn.bootcss.com/react-dom/17.0.2/umd/react-dom.production.min.js`,`//cdn.bootcss.com/react-router-dom/5.2.0/react-router-dom.min.js`]};const U={flatjsEvolve:{projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",forBuild:{rejectWarnings:false},forServe:{pageMiddlewares:[],defaultServeGlobalData:()=>({})},target:["web","es5"],liveReload:true,minimizeTerserOptions:{},multiHtmlCdn:{},watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},pluginLoaderOptions:{babelOptions:{usePreset:"react"},lessOptions:{},pixelOptions:{enabled:true,rootValue:{px:100,rpx:1},outputUnit:"rem"},enableBundleHashName:true,modularImports:[]}}};const H=(e={},t)=>{var n;const r=t[1];const o={vue:"Vue",react:"React","react-dom":"ReactDOM","react-router":"ReactRouter","react-router-dom":"ReactRouterDOM"};return Object.assign({},o,e,((n=r.options)==null?void 0:n.externals)||{})};const G=`(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector('meta[name="viewport"]');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);`;const J={title:"",favicon:"",headBeforeStyles:()=>[],headBeforeScripts:e=>[...N,...e==="development"?z.reactDev:z.reactProd],bodyAfterScripts:()=>[],viewport:G,excludeCdnEnvs:["me","dev","ntv"],minify:true,template:o.join(e.getPackageDirSync(__dirname,""),"templates/html-plugin/index-{0}.html")};const V=(e,n,r)=>{let o;if(r){o=typeof r==="function"?r(n):r}if(t.isUndefined(o)){const t=J[e];return typeof t==="function"?t(n):t}return o};const Y=(e,t)=>Object.assign({sourceMap:e,javascriptEnabled:true},t);const K=(e,t={})=>{const n=[O["default"]({preset:["default",{discardComments:{removeAll:!e},reduceInitial:false,normalizeWhitespace:!e}]})];if(t.enabled!==false){n.push(s.forgePluginPostcssPixel(t))}return{plugins:n}};const X=(e,t={})=>{const n={hints:e?false:"warning"};return Object.assign(n,t)};const Q=(e={})=>({parallel:true,
3
3
  // Disable Extract all or some (use /^\**!|@preserve|@license|@cc_on/i RegExp) comments.
4
- extractComments:false,terserOptions:t.merge({ecma:undefined,parse:{},compress:{},mangle:true,module:false,output:null,toplevel:false,nameCache:null,ie8:false,keep_classnames:undefined,keep_fnames:false,safari10:false},e)});const Y=(n=process.cwd(),r)=>{const o=e.loadFlatjsConfig(n,"flatjsEvolve","flatjs.evolve.js");return t.merge({},D.flatjsEvolve,o.flatjsEvolve,r,{projectCwd:n})};const K=e=>{try{R["default"](e)}catch(e){console.warn(`Unable to open browser. If you are running in a headless environment\n`)}};function X(e="",t=""){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function Q(e){const t=new RegExp("[?&]env(=([^&#]*)|&|#|$)");const n=t.exec(window.location.href);const r=n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"prod";const o=e[r]||e["prod"]||[];const s=o[Math.floor(Math.random()*o.length)];return s.replace(/\/$/,"")+"/"}function Z(e={},t="prod"){const n=e[t]||e["prod"]||[];return n[Math.floor(Math.random()*n.length)]}function ee(e){return`window.evolveFetchMicroWidgets = function () {\n var cdnConfig = ${JSON.stringify(e)};\n var cdnFinder = ${Q.toString()};\n return (cdnFinder(cdnConfig) || '').replace(/\\/$/, '');\n }`}function te(e,n){const r=[];for(const[t,n]of Object.entries(e)){r.push({[t]:n.entry})}return r.map((e=>t.merge({},n,{name:Object.keys(e)[0],entry:e})))}const ne=(e,n)=>{var r,o;const s=t.merge({},n.pluginLoaderOptions);if((r=e.options)!=null&&r.allowPx2rem){t.set(s,"pixelOptions.enabled",e.options.allowPx2rem)}if((o=e.options)!=null&&o.enableBundleHashName){t.set(s,"enableBundleHashName",e.options.enableBundleHashName)}const a={...n,pluginLoaderOptions:s};return a};const re=(e,t)=>{var n,r,o;const s=(n=e.pluginLoaderOptions)==null?void 0:(r=n.pixelOptions)==null?void 0:r.enabled;const a=(o=t==null?void 0:t.allowPx2rem)!=null?o:s;return!!a};const oe=e=>{const t={};for(const[n,r]of Object.entries(e)){t[n]=r.entry}return t};const se=e=>{if(Object.keys(e).length>1){throw new Error(`Only single one entry map support now while "serve", "build" process!`)}let t=undefined;for(const[n,r]of Object.entries(e)){t=[n,r];break}if(!t){throw new Error(`No entry map found while "serve", "build" process!`)}return t};const ae=()=>Date.now().toString();const le=(e,t,n=true)=>{const r=e==="js"?".js":".css";if(t){return`bundle${r}`}if(n){return`bundle[contenthash]${r}`}return`bundle${r}?${ae()}`};const ie=/icons\//;const ce=/\.(jpe?g|png|gif|svg)$/;const ue=/\.(ttf|eot|woff|woff2)(\?.+)?$/;const pe=({projectCwd:e,projectVirtualPath:t},n,[r,s])=>{let a=o.dirname(o.join(t,n.replace(/^src/,"")));const l=s.entry.map((t=>o.dirname(o.join(e,t))));const i=o.resolve(e,n);const c=l.find((e=>i.startsWith(e)));if(c){a=o.dirname(o.join(r,o.relative(c,i)))}return`${a}/[name]-[contenthash:8][ext]`};const de=(e,t)=>{const n={test(e){return ue.test(e)||ce.test(e)&&!ie.test(e)},type:"asset",generator:{filename({filename:n}){return pe(e,n,t)}},parser:{dataUrlCondition:{maxSize:4*1024}}};return n};const fe=()=>{const e={test(e){return ie.test(e)&&e.endsWith(".svg")},use:[{loader:require.resolve("./loader-icon"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]};return e};const he=(e={},t=[])=>{const n={test:/\.(tsx|ts|js|jsx)$/,use:[{loader:"babel-loader",options:q(e,t)}]};return n};const me=(e,t={})=>{const n={test:/\.css$/i,use:[{loader:x["default"].loader,options:{esModule:true}},{loader:"css-loader",options:{sourceMap:e}}]};if(Array.isArray(n.use)){n.use.push({loader:"postcss-loader",options:{postcssOptions:U(e,t),sourceMap:e}})}return n};const ge=(e,t={},n={})=>{const r=me(e,n);r.test=/\.less$/i;if(Array.isArray(r.use)){r.use.push({loader:"less-loader",options:{sourceMap:e,lessOptions:H(e,t)}})}return r};const be=(e,t,n,r={})=>{const o=[fe(),de(t,n),me(e,r.pixelOptions),ge(e,r.lessOptions,r.pixelOptions),he(r.babelOptions,r.modularImports)];return o};class ve{constructor(e={}){this.verbose=void 0;this.cleanStaleWebpackAssets=void 0;this.protectWebpackAssets=void 0;this.cleanAfterEveryBuildPatterns=void 0;this.cleanOnceBeforeBuildPatterns=void 0;this.currentAssets=void 0;this.initialClean=void 0;this.outputPath=void 0;this.verbose=e.verbose===true||false;this.cleanStaleWebpackAssets=e.cleanStaleWebpackAssets===true||e.cleanStaleWebpackAssets===false?e.cleanStaleWebpackAssets:true;this.protectWebpackAssets=e.protectWebpackAssets===true||e.protectWebpackAssets===false?e.protectWebpackAssets:true;this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[];this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"];this.currentAssets=[];this.initialClean=false;this.outputPath="";this.apply=this.apply.bind(this);this.handleInitial=this.handleInitial.bind(this);this.handleDone=this.handleDone.bind(this);this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path){console.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...");return}this.outputPath=e.options.output.path;const t=e.hooks;if(this.cleanOnceBeforeBuildPatterns.length!==0){t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)}))}t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean){return}const t=e.getStats();if(t.hasErrors()){return}this.initialClean=true;this.removeFiles(this.cleanOnceBeforeBuildPatterns)}handleDone(e){if(e.hasErrors()){if(this.verbose){console.warn("clean-webpack-plugin: pausing due to webpack errors")}return}const t=e.toJson({assets:true}).assets||[];const n=t.map((e=>e.name));const r=this.currentAssets.filter((e=>{const t=n.includes(e)===false;return t}));this.currentAssets=n.sort();const o=[];if(this.cleanStaleWebpackAssets===true&&r.length!==0){o.push(...r)}if(this.cleanAfterEveryBuildPatterns.length!==0){o.push(...this.cleanAfterEveryBuildPatterns)}if(o.length!==0){this.removeFiles(o)}}removeFiles(t){try{const n=e.delFilesSync(t,{cwd:this.outputPath,dot:true,ignore:this.protectWebpackAssets?this.currentAssets:[]});if(this.verbose){n.forEach((e=>{const t=o.relative(process.cwd(),e);const n="removed";console.warn(`clean-webpack-plugin: ${n} ${t}`)}))}}catch(e){const t=/Cannot delete files\/folders outside the current working directory\./.test(e.message);if(t){const e="clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.";throw new Error(e)}throw e}}}const ye=t=>new ve({verbose:true,cleanOnceBeforeBuildPatterns:[`${o.join(e.ensureSlash(t[0],true),"**/*")}`]});const we=(e,t)=>new x["default"]({filename:`[name]/${le("css",e,t==null?void 0:t.enableBundleHashName)}`,chunkFilename:"[id].[contenthash].css"});const je="ExternalTemplateRemotesPlugin";const ke=e=>e.constructor.name==="ExternalModule";class Ce{apply(e){e.hooks.make.tap(je,(e=>{const t=[];e.hooks.buildModule.tap(je,(e=>{if(ke(e)&&e.externalType==="script"){t.push(e)}}));e.hooks.afterCodeGeneration.tap(je,(()=>{t.map((t=>{const n=P["default"](t.request)[0];const r=Oe(n);const o=e.codeGenerationResults.get(t,undefined).sources;const s=o.get("javascript");if(s){o.set("javascript",new d.RawSource(s.source().toString().replace(`"${n}"`,r)))}}))}))}))}}function Oe(e){const t=[];const n=[];let r=false;let o=false;for(const s of e){if(s==="["){if(r){o=true;break}r=true;if(n.length){t.push(`"${n.join("")}"`);n.length=0}}else if(s==="]"){if(!r){o=true;break}r=false;if(n.length){t.push(`${n.join("")}`);n.length=0}n.length=0}else{n.push(s)}}if(r||o){throw new Error(`Invalid template URL "${e}"`)}if(n.length){t.push(`"${n.join("")}"`)}return t.join(" + ")}const xe=`HtmlInjectScriptPlugin`;class Me{constructor(e){this.scripts=void 0;this.scripts=e||[]}processScripts(){return this.scripts.filter(Boolean).map((e=>({tagName:"script",innerHTML:e,voidTag:false,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(e){e.hooks.compilation.tap(`${xe}_compilation`,(e=>{const t=S["default"].getHooks(e);t.alterAssetTags.tap(`${xe}_alterAssetTags`,(e=>{e.assetTags.scripts.unshift(...this.processScripts());return e}))}))}}const Pe=(e="")=>e.replace(/[\/-]/gi,"_").toLowerCase();const Se=e=>o.join(e,`micro-remote-module.js`);const Ae=(t,[n,r],o)=>{var s;const a=(s=r.options)==null?void 0:s.moduleFederation;const i=[];if(a){const{remotes:r,...s}=a;const c=Se(n);const u=Pe(n);const p=(r||[]).map((({name:t,endpoint:n})=>{const r=Pe(t);const o=Se(t);const s=n?e.ensureSlash(n(t),false):`[window.evolveFetchMicroWidgets()]`;return{[r]:`${r}@${s}/${o}`}}));i.push(new l.container.ModuleFederationPlugin({name:u,filename:c,remotes:p,...s}),new Ce);if(!t){i.unshift(new Me([ee(o)]))}}return i};const Ee={minifyJS:true,removeComments:true,collapseWhitespace:true,collapseBooleanAttributes:false};const Be=(e,t,[n,r],o)=>{const s=[];const{options:a}=r;const l=e?"development":"production";for(const e of o){s.push(new S["default"]({inject:"body",title:G("title",l,a==null?void 0:a.title),chunks:[n],minify:(a==null?void 0:a.minify)===false?false:["me","dev"].includes(e)?false:Ee,filename:`${n}/index${e==="prod"?"":`-${e}`}.html`,template:G("template",l,a==null?void 0:a.template).replace(`{0}`,e),templateParameters:{title:G("title",l,a==null?void 0:a.title),favicon:G("favicon",l,a==null?void 0:a.favicon),headBeforeStyles:G("headBeforeStyles",l,a==null?void 0:a.headBeforeStyles),headBeforeScripts:G("headBeforeScripts",l,a==null?void 0:a.headBeforeScripts),bodyAfterScripts:G("bodyAfterScripts",l,a==null?void 0:a.bodyAfterScripts),viewport:re(t,a)?G("viewport",l,a==null?void 0:a.viewport):""},multiCdn:{env:e,disabled:((a==null?void 0:a.excludeCdnEnvs)||["me","dev","ntv"]).includes(e)}}))}return s};class Re{constructor(e){var t;this.config=e;this.pluginName="FlatEvolveMultiCdnPlugin";this.requireFn=l.RuntimeGlobals.publicPath;if(!((t=this.config)!=null&&t.prod)){throw new Error("We must setup `prod` for each CDN config node!")}}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{var r;const o=[];o.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=(r=e.chunkGraph)==null?void 0:r.getTreeRuntimeRequirements(n);if(s&&s.has(l.RuntimeGlobals.requireScope)){o.push("(function () {");o.push(l.Template.indent(`var flatjsMultiCdn = {`));o.push(l.Template.indent(l.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`])));o.push(l.Template.indent(l.Template.indent([`cdnFinder: ${Q.toString()}`])));o.push(l.Template.indent(`};`));o.push(l.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig) || ${this.requireFn};`));o.push("})();")}return l.Template.asString(o)}))}));e.hooks.compilation.tap(this.pluginName,(e=>{S["default"].getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t}=e;const{userOptions:n}=e.plugin;const r=n.multiCdn;const s=t.publicPath;const a=t.js.map((e=>{if(r.disabled){return o.basename(e)}const t=Z(this.config,r.env);return X(t,e.replace(s,""))}));const l=t.css.map((e=>{if(r.disabled){return o.basename(e)}const t=Z(this.config,r.env);return X(t,e.replace(s,""))}));e.assets.js=a;e.assets.css=l;return e}))}))}}const $e=(e,t,n)=>{const r=[new M["default"]];if(n.analyzer){r.push(new p.BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}))}r.push(we(e,n.pluginLoaderOptions));r.push(...Ae(e,t,n.multiHtmlCdn));if(!e){r.push(ye(t));const o=Object.keys(n.multiHtmlCdn);r.push(...Be(e,n,t,o));r.push(new Re(n.multiHtmlCdn))}return r};const Te=(e,t,n,r)=>{const s=e==="development";const a=r.projectCwd;const l=r.pluginLoaderOptions;const i=se(n);const c=[...be(s,r,i,l),...r.extraLoaders||[]];const u=[...$e(s,i,r),...r.extraPlugins||[]];const p={mode:e,target:r.target,stats:"minimal",devtool:s?"eval-source-map":false,plugins:u,context:a,cache:{type:"memory"},resolve:{mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json",".vue"],alias:r.resolveAlias||{}},module:{rules:c},externals:W(r.externals,i),performance:J(s,r.performance),output:{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:t})=>`webpack:///${o.join(e,t)}`,environment:{},pathinfo:false,path:o.join(a,"public"),publicPath:t,filename:`[name]/${le("js",s,l==null?void 0:l.enableBundleHashName)}`,chunkFilename:`[id].[contenthash].js`},optimization:{nodeEnv:s?"development":"production",chunkIds:s?"named":"named",moduleIds:s?"named":"named",minimize:r.minimize===false?false:s?false:true,minimizer:[new O["default"](V(r.minimizeTerserOptions))],splitChunks:{name:false,chunks:"all",minSize:25e5,cacheGroups:{default:false,defaultVendors:false}}}};return p};const qe=(e,t,n)=>{const r=Te("production",t,e,n);const o=te(e,r);if(o.length>1){throw new Error("startSingleEntryBuild() only support `compiler` at a time")}const s=o[0];return new Promise(((e,t)=>{C["default"](s,((r,o)=>{var a,l;if(r){return t(r)}const i=o==null?void 0:o.toJson();if(i!=null&&(a=i.errors)!=null&&a.length){return t(i.errors)}if(n.forBuild.rejectWarnings&&i!=null&&(l=i.warnings)!=null&&l.length){return t(i.warnings)}e({name:s.name,warningStats:i==null?void 0:i.warnings})}))}))};const Ie=(t,n)=>{var r;const o=((r=n.multiHtmlCdn)==null?void 0:r.prod)||[];const s=[];const a=e.ensureSlash(o[Math.floor(Math.random()*o.length)],true);for(const[e,r]of Object.entries(t)){const t=ne(r,n);const o={[e]:r};s.push(qe(o,a,t))}return Promise.all(s)};var _e={exports:{}};var Fe={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Ne=Fe;const De={};for(const e of Object.keys(Ne)){De[Ne[e]]=e}const We={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Le=We;for(const e of Object.keys(We)){if(!("channels"in We[e])){throw new Error("missing channels property: "+e)}if(!("labels"in We[e])){throw new Error("missing channel labels property: "+e)}if(We[e].labels.length!==We[e].channels){throw new Error("channel and label counts mismatch: "+e)}const{channels:t,labels:n}=We[e];delete We[e].channels;delete We[e].labels;Object.defineProperty(We[e],"channels",{value:t});Object.defineProperty(We[e],"labels",{value:n})}We.rgb.hsl=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(t,n,r);const s=Math.max(t,n,r);const a=s-o;let l;let i;if(s===o){l=0}else if(t===s){l=(n-r)/a}else if(n===s){l=2+(r-t)/a}else if(r===s){l=4+(t-n)/a}l=Math.min(l*60,360);if(l<0){l+=360}const c=(o+s)/2;if(s===o){i=0}else if(c<=.5){i=a/(s+o)}else{i=a/(2-s-o)}return[l,i*100,c*100]};We.rgb.hsv=function(e){let t;let n;let r;let o;let s;const a=e[0]/255;const l=e[1]/255;const i=e[2]/255;const c=Math.max(a,l,i);const u=c-Math.min(a,l,i);const p=function(e){return(c-e)/6/u+1/2};if(u===0){o=0;s=0}else{s=u/c;t=p(a);n=p(l);r=p(i);if(a===c){o=r-n}else if(l===c){o=1/3+t-r}else if(i===c){o=2/3+n-t}if(o<0){o+=1}else if(o>1){o-=1}}return[o*360,s*100,c*100]};We.rgb.hwb=function(e){const t=e[0];const n=e[1];let r=e[2];const o=We.rgb.hsl(e)[0];const s=1/255*Math.min(t,Math.min(n,r));r=1-1/255*Math.max(t,Math.max(n,r));return[o,s*100,r*100]};We.rgb.cmyk=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(1-t,1-n,1-r);const s=(1-t-o)/(1-o)||0;const a=(1-n-o)/(1-o)||0;const l=(1-r-o)/(1-o)||0;return[s*100,a*100,l*100,o*100]};function ze(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}We.rgb.keyword=function(e){const t=De[e];if(t){return t}let n=Infinity;let r;for(const t of Object.keys(Ne)){const o=Ne[t];const s=ze(e,o);if(s<n){n=s;r=t}}return r};We.keyword.rgb=function(e){return Ne[e]};We.rgb.xyz=function(e){let t=e[0]/255;let n=e[1]/255;let r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124+n*.3576+r*.1805;const s=t*.2126+n*.7152+r*.0722;const a=t*.0193+n*.1192+r*.9505;return[o*100,s*100,a*100]};We.rgb.lab=function(e){const t=We.rgb.xyz(e);let n=t[0];let r=t[1];let o=t[2];n/=95.047;r/=100;o/=108.883;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;o=o>.008856?o**(1/3):7.787*o+16/116;const s=116*r-16;const a=500*(n-r);const l=200*(r-o);return[s,a,l]};We.hsl.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;let o;let s;let a;if(n===0){a=r*255;return[a,a,a]}if(r<.5){o=r*(1+n)}else{o=r+n-r*n}const l=2*r-o;const i=[0,0,0];for(let e=0;e<3;e++){s=t+1/3*-(e-1);if(s<0){s++}if(s>1){s--}if(6*s<1){a=l+(o-l)*6*s}else if(2*s<1){a=o}else if(3*s<2){a=l+(o-l)*(2/3-s)*6}else{a=l}i[e]=a*255}return i};We.hsl.hsv=function(e){const t=e[0];let n=e[1]/100;let r=e[2]/100;let o=n;const s=Math.max(r,.01);r*=2;n*=r<=1?r:2-r;o*=s<=1?s:2-s;const a=(r+n)/2;const l=r===0?2*o/(s+o):2*n/(r+n);return[t,l*100,a*100]};We.hsv.rgb=function(e){const t=e[0]/60;const n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6;const s=t-Math.floor(t);const a=255*r*(1-n);const l=255*r*(1-n*s);const i=255*r*(1-n*(1-s));r*=255;switch(o){case 0:return[r,i,a];case 1:return[l,r,a];case 2:return[a,r,i];case 3:return[a,l,r];case 4:return[i,a,r];case 5:return[r,a,l]}};We.hsv.hsl=function(e){const t=e[0];const n=e[1]/100;const r=e[2]/100;const o=Math.max(r,.01);let s;let a;a=(2-n)*r;const l=(2-n)*o;s=n*o;s/=l<=1?l:2-l;s=s||0;a/=2;return[t,s*100,a*100]};We.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100;let r=e[2]/100;const o=n+r;let s;if(o>1){n/=o;r/=o}const a=Math.floor(6*t);const l=1-r;s=6*t-a;if((a&1)!==0){s=1-s}const i=n+s*(l-n);let c;let u;let p;switch(a){default:case 6:case 0:c=l;u=i;p=n;break;case 1:c=i;u=l;p=n;break;case 2:c=n;u=l;p=i;break;case 3:c=n;u=i;p=l;break;case 4:c=i;u=n;p=l;break;case 5:c=l;u=n;p=i;break}return[c*255,u*255,p*255]};We.cmyk.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;const o=e[3]/100;const s=1-Math.min(1,t*(1-o)+o);const a=1-Math.min(1,n*(1-o)+o);const l=1-Math.min(1,r*(1-o)+o);return[s*255,a*255,l*255]};We.xyz.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;let o;let s;let a;o=t*3.2406+n*-1.5372+r*-.4986;s=t*-.9689+n*1.8758+r*.0415;a=t*.0557+n*-.204+r*1.057;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92;o=Math.min(Math.max(0,o),1);s=Math.min(Math.max(0,s),1);a=Math.min(Math.max(0,a),1);return[o*255,s*255,a*255]};We.xyz.lab=function(e){let t=e[0];let n=e[1];let r=e[2];t/=95.047;n/=100;r/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;const o=116*n-16;const s=500*(t-n);const a=200*(n-r);return[o,s,a]};We.lab.xyz=function(e){const t=e[0];const n=e[1];const r=e[2];let o;let s;let a;s=(t+16)/116;o=n/500+s;a=s-r/200;const l=s**3;const i=o**3;const c=a**3;s=l>.008856?l:(s-16/116)/7.787;o=i>.008856?i:(o-16/116)/7.787;a=c>.008856?c:(a-16/116)/7.787;o*=95.047;s*=100;a*=108.883;return[o,s,a]};We.lab.lch=function(e){const t=e[0];const n=e[1];const r=e[2];let o;const s=Math.atan2(r,n);o=s*360/2/Math.PI;if(o<0){o+=360}const a=Math.sqrt(n*n+r*r);return[t,a,o]};We.lch.lab=function(e){const t=e[0];const n=e[1];const r=e[2];const o=r/360*2*Math.PI;const s=n*Math.cos(o);const a=n*Math.sin(o);return[t,s,a]};We.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let s=t===null?We.rgb.hsv(e)[2]:t;s=Math.round(s/50);if(s===0){return 30}let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));if(s===2){a+=60}return a};We.hsv.ansi16=function(e){return We.rgb.ansi16(We.hsv.rgb(e),e[2])};We.rgb.ansi256=function(e){const t=e[0];const n=e[1];const r=e[2];if(t===n&&n===r){if(t<8){return 16}if(t>248){return 231}return Math.round((t-8)/247*24)+232}const o=16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5);return o};We.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50){t+=3.5}t=t/10.5*255;return[t,t,t]}const n=(~~(e>50)+1)*.5;const r=(t&1)*n*255;const o=(t>>1&1)*n*255;const s=(t>>2&1)*n*255;return[r,o,s]};We.ansi256.rgb=function(e){if(e>=232){const t=(e-232)*10+8;return[t,t,t]}e-=16;let t;const n=Math.floor(e/36)/5*255;const r=Math.floor((t=e%36)/6)/5*255;const o=t%6/5*255;return[n,r,o]};We.rgb.hex=function(e){const t=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255);const n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};We.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t){return[0,0,0]}let n=t[0];if(t[0].length===3){n=n.split("").map((e=>e+e)).join("")}const r=parseInt(n,16);const o=r>>16&255;const s=r>>8&255;const a=r&255;return[o,s,a]};We.rgb.hcg=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.max(Math.max(t,n),r);const s=Math.min(Math.min(t,n),r);const a=o-s;let l;let i;if(a<1){l=s/(1-a)}else{l=0}if(a<=0){i=0}else if(o===t){i=(n-r)/a%6}else if(o===n){i=2+(r-t)/a}else{i=4+(t-n)/a}i/=6;i%=1;return[i*360,a*100,l*100]};We.hsl.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=n<.5?2*t*n:2*t*(1-n);let o=0;if(r<1){o=(n-.5*r)/(1-r)}return[e[0],r*100,o*100]};We.hsv.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=t*n;let o=0;if(r<1){o=(n-r)/(1-r)}return[e[0],r*100,o*100]};We.hcg.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;if(n===0){return[r*255,r*255,r*255]}const o=[0,0,0];const s=t%1*6;const a=s%1;const l=1-a;let i=0;switch(Math.floor(s)){case 0:o[0]=1;o[1]=a;o[2]=0;break;case 1:o[0]=l;o[1]=1;o[2]=0;break;case 2:o[0]=0;o[1]=1;o[2]=a;break;case 3:o[0]=0;o[1]=l;o[2]=1;break;case 4:o[0]=a;o[1]=0;o[2]=1;break;default:o[0]=1;o[1]=0;o[2]=l}i=(1-n)*r;return[(n*o[0]+i)*255,(n*o[1]+i)*255,(n*o[2]+i)*255]};We.hcg.hsv=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);let o=0;if(r>0){o=t/r}return[e[0],o*100,r*100]};We.hcg.hsl=function(e){const t=e[1]/100;const n=e[2]/100;const r=n*(1-t)+.5*t;let o=0;if(r>0&&r<.5){o=t/(2*r)}else if(r>=.5&&r<1){o=t/(2*(1-r))}return[e[0],o*100,r*100]};We.hcg.hwb=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};We.hwb.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=1-n;const o=r-t;let s=0;if(o<1){s=(r-o)/(1-o)}return[e[0],o*100,s*100]};We.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};We.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};We.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};We.gray.hsl=function(e){return[0,0,e[0]]};We.gray.hsv=We.gray.hsl;We.gray.hwb=function(e){return[0,100,e[0]]};We.gray.cmyk=function(e){return[0,0,0,e[0]]};We.gray.lab=function(e){return[e[0],0,0]};We.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255;const n=(t<<16)+(t<<8)+t;const r=n.toString(16).toUpperCase();return"000000".substring(r.length)+r};We.rgb.gray=function(e){const t=(e[0]+e[1]+e[2])/3;return[t/255*100]};const Ge=Le;function He(){const e={};const t=Object.keys(Ge);for(let n=t.length,r=0;r<n;r++){e[t[r]]={distance:-1,parent:null}}return e}function Ue(e){const t=He();const n=[e];t[e].distance=0;while(n.length){const e=n.pop();const r=Object.keys(Ge[e]);for(let o=r.length,s=0;s<o;s++){const o=r[s];const a=t[o];if(a.distance===-1){a.distance=t[e].distance+1;a.parent=e;n.unshift(o)}}}return t}function Je(e,t){return function(n){return t(e(n))}}function Ve(e,t){const n=[t[e].parent,e];let r=Ge[t[e].parent][e];let o=t[e].parent;while(t[o].parent){n.unshift(t[o].parent);r=Je(Ge[t[o].parent][o],r);o=t[o].parent}r.conversion=n;return r}var Ye=function(e){const t=Ue(e);const n={};const r=Object.keys(t);for(let e=r.length,o=0;o<e;o++){const e=r[o];const s=t[e];if(s.parent===null){continue}n[e]=Ve(e,t)}return n};const Ke=Le;const Xe=Ye;const Qe={};const Ze=Object.keys(Ke);function et(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}return e(t)};if("conversion"in e){t.conversion=e.conversion}return t}function tt(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}const r=e(t);if(typeof r==="object"){for(let e=r.length,t=0;t<e;t++){r[t]=Math.round(r[t])}}return r};if("conversion"in e){t.conversion=e.conversion}return t}Ze.forEach((e=>{Qe[e]={};Object.defineProperty(Qe[e],"channels",{value:Ke[e].channels});Object.defineProperty(Qe[e],"labels",{value:Ke[e].labels});const t=Xe(e);const n=Object.keys(t);n.forEach((n=>{const r=t[n];Qe[e][n]=tt(r);Qe[e][n].raw=et(r)}))}));var nt=Qe;(function(e){const t=(e,t)=>(...n)=>{const r=e(...n);return`[${r+t}m`};const n=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};5;${r}m`};const r=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};2;${r[0]};${r[1]};${r[2]}m`};const o=e=>e;const s=(e,t,n)=>[e,t,n];const a=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{const r=n();Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true});return r},enumerable:true,configurable:true})};let l;const i=(e,t,n,r)=>{if(l===undefined){l=nt}const o=r?10:0;const s={};for(const[r,a]of Object.entries(l)){const l=r==="ansi16"?"ansi":r;if(r===t){s[l]=e(n,o)}else if(typeof a==="object"){s[l]=e(a[t],o)}}return s};function c(){const e=new Map;const l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};l.color.gray=l.color.blackBright;l.bgColor.bgGray=l.bgColor.bgBlackBright;l.color.grey=l.color.blackBright;l.bgColor.bgGrey=l.bgColor.bgBlackBright;for(const[t,n]of Object.entries(l)){for(const[t,r]of Object.entries(n)){l[t]={open:`[${r[0]}m`,close:`[${r[1]}m`};n[t]=l[t];e.set(r[0],r[1])}Object.defineProperty(l,t,{value:n,enumerable:false})}Object.defineProperty(l,"codes",{value:e,enumerable:false});l.color.close="";l.bgColor.close="";a(l.color,"ansi",(()=>i(t,"ansi16",o,false)));a(l.color,"ansi256",(()=>i(n,"ansi256",o,false)));a(l.color,"ansi16m",(()=>i(r,"rgb",s,false)));a(l.bgColor,"ansi",(()=>i(t,"ansi16",o,true)));a(l.bgColor,"ansi256",(()=>i(n,"ansi256",o,true)));a(l.bgColor,"ansi16m",(()=>i(r,"rgb",s,true)));return l}Object.defineProperty(e,"exports",{enumerable:true,get:c})})(_e);var rt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--";const r=t.indexOf(n+e);const o=t.indexOf("--");return r!==-1&&(o===-1||r<o)};const ot=A["default"];const st=E["default"];const at=rt;const{env:lt}=process;let it;if(at("no-color")||at("no-colors")||at("color=false")||at("color=never")){it=0}else if(at("color")||at("colors")||at("color=true")||at("color=always")){it=1}if("FORCE_COLOR"in lt){if(lt.FORCE_COLOR==="true"){it=1}else if(lt.FORCE_COLOR==="false"){it=0}else{it=lt.FORCE_COLOR.length===0?1:Math.min(parseInt(lt.FORCE_COLOR,10),3)}}function ct(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function ut(e,t){if(it===0){return 0}if(at("color=16m")||at("color=full")||at("color=truecolor")){return 3}if(at("color=256")){return 2}if(e&&!t&&it===undefined){return 0}const n=it||0;if(lt.TERM==="dumb"){return n}if(process.platform==="win32"){const e=ot.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in lt){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in lt))||lt.CI_NAME==="codeship"){return 1}return n}if("TEAMCITY_VERSION"in lt){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(lt.TEAMCITY_VERSION)?1:0}if(lt.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in lt){const e=parseInt((lt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(lt.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(lt.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(lt.TERM)){return 1}if("COLORTERM"in lt){return 1}return n}function pt(e){const t=ut(e,e&&e.isTTY);return ct(t)}var dt={supportsColor:pt,stdout:ct(ut(true,st.isatty(1))),stderr:ct(ut(true,st.isatty(2)))};const ft=(e,t,n)=>{let r=e.indexOf(t);if(r===-1){return e}const o=t.length;let s=0;let a="";do{a+=e.substr(s,r-s)+t+n;s=r+o;r=e.indexOf(t,s)}while(r!==-1);a+=e.substr(s);return a};const ht=(e,t,n,r)=>{let o=0;let s="";do{const a=e[r-1]==="\r";s+=e.substr(o,(a?r-1:r)-o)+t+(a?"\r\n":"\n")+n;o=r+1;r=e.indexOf("\n",o)}while(r!==-1);s+=e.substr(o);return s};var mt={stringReplaceAll:ft,stringEncaseCRLFWithFirstIndex:ht};const gt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const bt=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const vt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const yt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;const wt=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function jt(e){const t=e[0]==="u";const n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3){return String.fromCharCode(parseInt(e.slice(1),16))}if(t&&n){return String.fromCodePoint(parseInt(e.slice(2,-1),16))}return wt.get(e)||e}function kt(e,t){const n=[];const r=t.trim().split(/\s*,\s*/g);let o;for(const t of r){const r=Number(t);if(!Number.isNaN(r)){n.push(r)}else if(o=t.match(vt)){n.push(o[2].replace(yt,((e,t,n)=>t?jt(t):n)))}else{throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`)}}return n}function Ct(e){bt.lastIndex=0;const t=[];let n;while((n=bt.exec(e))!==null){const e=n[1];if(n[2]){const r=kt(e,n[2]);t.push([e].concat(r))}else{t.push([e])}}return t}function Ot(e,t){const n={};for(const e of t){for(const t of e.styles){n[t[0]]=e.inverse?null:t.slice(1)}}let r=e;for(const[e,t]of Object.entries(n)){if(!Array.isArray(t)){continue}if(!(e in r)){throw new Error(`Unknown Chalk style: ${e}`)}r=t.length>0?r[e](...t):r[e]}return r}var xt=(e,t)=>{const n=[];const r=[];let o=[];t.replace(gt,((t,s,a,l,i,c)=>{if(s){o.push(jt(s))}else if(l){const t=o.join("");o=[];r.push(n.length===0?t:Ot(e,n)(t));n.push({inverse:a,styles:Ct(l)})}else if(i){if(n.length===0){throw new Error("Found extraneous } in Chalk template literal")}r.push(Ot(e,n)(o.join("")));o=[];n.pop()}else{o.push(c)}}));r.push(o.join(""));if(n.length>0){const e=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw new Error(e)}return r.join("")};const Mt=_e.exports;const{stdout:Pt,stderr:St}=dt;const{stringReplaceAll:At,stringEncaseCRLFWithFirstIndex:Et}=mt;const{isArray:Bt}=Array;const Rt=["ansi","ansi","ansi256","ansi16m"];const $t=Object.create(null);const Tt=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const n=Pt?Pt.level:0;e.level=t.level===undefined?n:t.level};class qt{constructor(e){return It(e)}}const It=e=>{const t={};Tt(t,e);t.template=(...e)=>Gt(t.template,...e);Object.setPrototypeOf(t,_t.prototype);Object.setPrototypeOf(t.template,t);t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};t.template.Instance=qt;return t.template};function _t(e){return It(e)}for(const[e,t]of Object.entries(Mt)){$t[e]={get(){const n=Wt(this,Dt(t.open,t.close,this._styler),this._isEmpty);Object.defineProperty(this,e,{value:n});return n}}}$t.visible={get(){const e=Wt(this,this._styler,true);Object.defineProperty(this,"visible",{value:e});return e}};const Ft=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of Ft){$t[e]={get(){const{level:t}=this;return function(...n){const r=Dt(Mt.color[Rt[t]][e](...n),Mt.color.close,this._styler);return Wt(this,r,this._isEmpty)}}}}for(const e of Ft){const t="bg"+e[0].toUpperCase()+e.slice(1);$t[t]={get(){const{level:t}=this;return function(...n){const r=Dt(Mt.bgColor[Rt[t]][e](...n),Mt.bgColor.close,this._styler);return Wt(this,r,this._isEmpty)}}}}const Nt=Object.defineProperties((()=>{}),{...$t,level:{enumerable:true,get(){return this._generator.level},set(e){this._generator.level=e}}});const Dt=(e,t,n)=>{let r;let o;if(n===undefined){r=e;o=t}else{r=n.openAll+e;o=t+n.closeAll}return{open:e,close:t,openAll:r,closeAll:o,parent:n}};const Wt=(e,t,n)=>{const r=(...e)=>{if(Bt(e[0])&&Bt(e[0].raw)){return Lt(r,Gt(r,...e))}return Lt(r,e.length===1?""+e[0]:e.join(" "))};Object.setPrototypeOf(r,Nt);r._generator=e;r._styler=t;r._isEmpty=n;return r};const Lt=(e,t)=>{if(e.level<=0||!t){return e._isEmpty?"":t}let n=e._styler;if(n===undefined){return t}const{openAll:r,closeAll:o}=n;if(t.indexOf("")!==-1){while(n!==undefined){t=At(t,n.close,n.open);n=n.parent}}const s=t.indexOf("\n");if(s!==-1){t=Et(t,o,r,s)}return r+t+o};let zt;const Gt=(e,...t)=>{const[n]=t;if(!Bt(n)||!Bt(n.raw)){return t.join(" ")}const r=t.slice(1);const o=[n.raw[0]];for(let e=1;e<n.length;e++){o.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[e]))}if(zt===undefined){zt=xt}return zt(e,o.join(""))};Object.defineProperties(_t.prototype,$t);const Ht=_t();Ht.supportsColor=Pt;Ht.stderr=_t({level:St?St.level:0});Ht.stderr.supportsColor=St;var Ut=Ht;const Jt=async(n,r,s)=>{const a=await e.getPackageDir(__dirname,process.cwd());const l=y.readFileSync(o.join(a,"./templates/main.html"),"utf-8");const i=[];for(const[t]of Object.entries(s.entryMap)){const o=Object.keys(n).includes(t);i.push({name:t,link:e.urlJoin(r,["pages",t],{env:"me"}),flagText:o?"serve":"static",isServed:o?1:0})}const c={title:"@flatjs/evolve",modules:i.sort(((e,t)=>t.isServed-e.isServed))};return t.template(l)(c)};const Vt=async(n,r,s,a)=>{const l=a.entryMap;const i=Object.keys(l).sort(((e,t)=>t.length-e.length));const c=await e.getPackageDir(__dirname,process.cwd());const u=i.find((t=>e.ensureSlash(r.path.replace(/^\//,""),true).startsWith(e.ensureSlash(t,true))));if(!u){const e=y.readFileSync(o.join(c,`./templates/module-404.html`),"utf-8");return t.template(e)({title:"404 Not Found",errorMeta:[{name:`@flatjs/evolve workspace`,value:c},{name:`served entry names`,value:JSON.stringify(i)},{name:`module path`,value:`${r.path}`}]})}const p=l[u];const d=p.options;const f=(d==null?void 0:d.serveModuleTemplate)||"./templates/module.html";const h=o.join(a.projectCwd,"./templates/module.html");const m=y.readFileSync(o.isAbsolute(f)?f:e.existsSync(h)?h:o.join(c,"./templates/module.html"),"utf-8");const g=a.forServe;const b=g.defaultServeGlobalData?g.defaultServeGlobalData(p,s):{};const v={title:G("title",n,d==null?void 0:d.title),favicon:G("favicon",n,d==null?void 0:d.favicon),viewport:re(a,d)?G("viewport",n,d==null?void 0:d.viewport):"",headBeforeStyles:G("headBeforeStyles",n,d==null?void 0:d.headBeforeStyles),headBeforeScripts:G("headBeforeScripts",n,d==null?void 0:d.headBeforeScripts),bodyAfterScripts:G("bodyAfterScripts",n,d==null?void 0:d.bodyAfterScripts),moduleFederationScripts:ee({me:[e.urlJoin(s,["public"])]}),global:{hostUrl:s,apiBase:e.urlJoin(s,["api"]),routeBaseName:o.join(`/pages`,u),...b,...(d==null?void 0:d.serveGlobalData)||{}},styles:[e.urlJoin(s,[o.join("public",u,"bundle.css")])],scripts:[e.urlJoin(s,[o.join("public",u,"bundle.js")])]};return t.template(m)(v)};const Yt=(e,t,n,r)=>{const o=async(o,s)=>{let a;if(o.path==="/"){a=await Jt(n,t,r)}else{a=await Vt(e,o,t,r)}s.send(a)};return(r.forServe.pageMiddlewares||[]).concat(o)};const Kt=t=>async(n,r)=>{const s=n.baseUrl;if(!s.startsWith("/public")){r.redirect("/pages")}else{const n=await e.fileWalk(o.join("public/","**/*.{js,css}"),{cwd:t});const a=n.find((e=>o.extname(e)===o.extname(s)&&e.indexOf(s.replace(/\.(js|css)$/,""))!==-1));if(a){r.sendFile(a)}else{r.status(404).send()}}};const Xt=(e,t,r,s,a,l,i,c,u,p="development")=>{const d=new B["default"](e,{hot:true,compress:true,open:false,port:i,static:{directory:`${o.join(r,"/public")}`,watch:Object.assign({poll:1e3,ignored:/node_modules/,aggregateTimeout:500},l.watchOptions)},https:l.https,allowedHosts:"all",client:{overlay:{errors:true,warnings:false}},onBeforeSetupMiddleware(e){n.attachMockMiddlewares(e.app,s);e.app.set("hostUri",t);e.app.use("/pages",...Yt(p,t,a,l))},onAfterSetupMiddleware(e){e.app.use("*",Kt(r))},proxy:{...s.proxyMap}});return new Promise(((e,t)=>{d.listen(i,c,(n=>{if(n){return t(n)}K(u);e(true)}))}))};const Qt=async(t,r,s,a)=>{if(s.https){a.https=s.https}const{mockPort:i,hostUri:c,listenHostName:u}=await n.prepareMockDomain(a);const p=e.urlJoin(c,["public"])+"/";const d=e.urlJoin(c,["/pages"]);const f=[];for(const[e,t]of Object.entries(r)){const n=ne(t,s);const r={[e]:t};const o=Te("development",p,r,n);f.push(...te(r,o))}const h=l.webpack(f);h.compilers.forEach((e=>{const n=Ut.bgBlack(`[${Ut.magenta("@flatjs")}:${Ut.bold(e.name||"")}]`);e.hooks.invalid.tap("fileChange",(e=>{console.log(n,`${"file change".padEnd(12," ")} ➩ ${Ut.cyan(o.relative(t,e||""))}`)}));e.hooks.done.tap("compileDone",(()=>{console.log(n,`${"serve page".padEnd(12," ")} ➩ ${Ut.cyan(d)}`)}))}));return Xt(h,c,t,a,r,s,i,u,d,"development")};const Zt=async(t,r,s)=>{if(r.https){s.https=r.https}const{mockPort:a,hostUri:i,listenHostName:c}=await n.prepareMockDomain(s);const u=e.urlJoin(i,["/pages"]);const p={"@evolve-empty-entry":{entry:[o.join(__dirname,"./evolve-empty-entry.js")]}};const d=l.webpack({name:"static",mode:"development",stats:"none",entry:oe(p)});const f=Ut.bgBlack(`[${Ut.magenta("@flatjs")}:${Ut.bold(d.name||"")}]`);d.hooks.done.tap("compileDone",(()=>{console.log(f,`${"serve page".padEnd(12," ")} ➩ ${Ut.cyan(u)}`)}));return Xt(d,i,t,s,p,r,a,c,u,"production")};const en=(e={},n={})=>{const r={};for(const[o,s]of Object.entries(n)){const n={options:{}};if(e[o]){r[o]=t.merge({},n,s,e[o])}t.merge(s,n)}return r};const tn=(e,t,n={})=>{const r=Y(e,n);const o=en(t,r.entryMap);return Ie(o,r)};const nn=(e,t,r={},o={})=>{const s=Y(e,r);const a=n.loadMockConfiguration(e,o);const l=en(t,s.entryMap);return Qt(e,l,s,a)};const rn=(e,t={},r={})=>{const o=Y(e,t);const s=n.loadMockConfiguration(e,r);return Zt(e,o,s)};exports.cdnBoot=N;exports.cdnJsDelivr=F;exports.cdnUnpkg=_;exports.createPageMiddleware=Yt;exports.createPublicAssetsMiddleware=Kt;exports.defaultFlatjsConfig=D;exports.evolveBuild=tn;exports.evolveServe=nn;exports.evolveStatic=rn;exports.flatBabelOptions=q;exports.flatExternalOptions=W;exports.flatLessLoaderOptions=H;exports.flatPerformanceOptions=J;exports.flatPostcssLoaderOptions=U;exports.getHtmlPluginConfig=G;exports.loadEvolveConfiguration=Y;exports.loadModule=T;exports.normalizeEntries=en;exports.polyfill=I;exports.terserOptions=V;exports.viewportScripts=L;
4
+ extractComments:false,terserOptions:t.merge({ecma:undefined,parse:{},compress:{},mangle:true,module:false,output:null,toplevel:false,nameCache:null,ie8:false,keep_classnames:undefined,keep_fnames:false,safari10:false},e)});const Z=(n=process.cwd(),r)=>{const o=e.loadFlatjsConfig(n,"flatjsEvolve","flatjs.evolve.js");return t.merge({},U.flatjsEvolve,o.flatjsEvolve,r,{projectCwd:n})};const ee=e=>{try{I["default"](e)}catch(e){console.warn(`Unable to open browser. If you are running in a headless environment\n`)}};function te(e="",t=""){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function ne(e){const t=new RegExp("[?&]env(=([^&#]*)|&|#|$)");const n=t.exec(window.location.href);const r=n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"prod";const o=e[r]||e["prod"]||[];const s=o[Math.floor(Math.random()*o.length)];return s.replace(/\/$/,"")+"/"}function re(e={},t="prod"){const n=e[t]||e["prod"]||[];return n[Math.floor(Math.random()*n.length)]}function oe(e){return`window.evolveFetchMicroWidgets = function () {\n var cdnConfig = ${JSON.stringify(e)};\n var cdnFinder = ${ne.toString()};\n return (cdnFinder(cdnConfig) || '').replace(/\\/$/, '');\n }`}function se(e,n){const r=[];for(const[t,n]of Object.entries(e)){r.push({[t]:n.entry})}return r.map((e=>t.merge({},n,{name:Object.keys(e)[0],entry:e})))}const le=(e,n)=>{var r,o;const s=t.merge({},n.pluginLoaderOptions);if((r=e.options)!=null&&r.allowPx2rem){t.set(s,"pixelOptions.enabled",e.options.allowPx2rem)}if((o=e.options)!=null&&o.enableBundleHashName){t.set(s,"enableBundleHashName",e.options.enableBundleHashName)}const l={...n,pluginLoaderOptions:s};return l};const ae=(e,t)=>{var n,r,o;const s=(n=e.pluginLoaderOptions)==null?void 0:(r=n.pixelOptions)==null?void 0:r.enabled;const l=(o=t==null?void 0:t.allowPx2rem)!=null?o:s;return!!l};const ie=e=>{if(Object.keys(e).length>1){throw new Error(`Only single one entry map support now while "serve", "build" process!`)}let t=undefined;for(const[n,r]of Object.entries(e)){t=[n,r];break}if(!t){throw new Error(`No entry map found while "serve", "build" process!`)}return t};const ce=()=>Date.now().toString();const ue=(e,t,n=true)=>{const r=e==="js"?".js":".css";if(t){return`bundle${r}`}if(n){return`bundle[contenthash]${r}`}return`bundle${r}?${ce()}`};const pe=/icons\//;const de=/\.(jpe?g|png|gif|svg)$/;const fe=/\.(ttf|eot|woff|woff2)(\?.+)?$/;const he=({projectCwd:e,projectVirtualPath:t},n,[r,s])=>{let l=o.dirname(o.join(t,n.replace(/^src/,"")));const a=s.entry.map((t=>o.dirname(o.join(e,t))));const i=o.resolve(e,n);const c=a.find((e=>i.startsWith(e)));if(c){l=o.dirname(o.join(r,o.relative(c,i)))}return`${l}/[name]-[contenthash:8][ext]`};const me=(e,t)=>{const n={test(e){return fe.test(e)||de.test(e)&&!pe.test(e)},type:"asset",generator:{filename({filename:n}){return he(e,n,t)}},parser:{dataUrlCondition:{maxSize:4*1024}}};return n};const ge=()=>{const e={test(e){return pe.test(e)&&e.endsWith(".svg")},use:[{loader:require.resolve("./loader-icon"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]};return e};const be=(e={},t=[])=>{const n={test:/\.(tsx|ts|js|jsx)$/,use:[{loader:"babel-loader",options:D(e,t)}]};return n};const ve=(e,t={})=>{const n={test:/\.css$/i,use:[{loader:P["default"].loader,options:{esModule:true}},{loader:"css-loader",options:{sourceMap:e}}]};if(Array.isArray(n.use)){n.use.push({loader:"postcss-loader",options:{postcssOptions:K(e,t),sourceMap:e}})}return n};const ye=(e,t={},n={})=>{const r=ve(e,n);r.test=/\.less$/i;if(Array.isArray(r.use)){r.use.push({loader:"less-loader",options:{sourceMap:e,lessOptions:Y(e,t)}})}return r};const we=(e,t,n,r={})=>{const o=[ge(),me(t,n),ve(e,r.pixelOptions),ye(e,r.lessOptions,r.pixelOptions),be(r.babelOptions,r.modularImports)];return o};class je{constructor(e={}){this.verbose=void 0;this.cleanStaleWebpackAssets=void 0;this.protectWebpackAssets=void 0;this.cleanAfterEveryBuildPatterns=void 0;this.cleanOnceBeforeBuildPatterns=void 0;this.currentAssets=void 0;this.initialClean=void 0;this.outputPath=void 0;this.verbose=e.verbose===true||false;this.cleanStaleWebpackAssets=e.cleanStaleWebpackAssets===true||e.cleanStaleWebpackAssets===false?e.cleanStaleWebpackAssets:true;this.protectWebpackAssets=e.protectWebpackAssets===true||e.protectWebpackAssets===false?e.protectWebpackAssets:true;this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[];this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"];this.currentAssets=[];this.initialClean=false;this.outputPath="";this.apply=this.apply.bind(this);this.handleInitial=this.handleInitial.bind(this);this.handleDone=this.handleDone.bind(this);this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path){console.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...");return}this.outputPath=e.options.output.path;const t=e.hooks;if(this.cleanOnceBeforeBuildPatterns.length!==0){t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)}))}t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean){return}const t=e.getStats();if(t.hasErrors()){return}this.initialClean=true;this.removeFiles(this.cleanOnceBeforeBuildPatterns)}handleDone(e){if(e.hasErrors()){if(this.verbose){console.warn("clean-webpack-plugin: pausing due to webpack errors")}return}const t=e.toJson({assets:true}).assets||[];const n=t.map((e=>e.name));const r=this.currentAssets.filter((e=>{const t=n.includes(e)===false;return t}));this.currentAssets=n.sort();const o=[];if(this.cleanStaleWebpackAssets===true&&r.length!==0){o.push(...r)}if(this.cleanAfterEveryBuildPatterns.length!==0){o.push(...this.cleanAfterEveryBuildPatterns)}if(o.length!==0){this.removeFiles(o)}}removeFiles(t){try{const n=e.delFilesSync(t,{cwd:this.outputPath,dot:true,ignore:this.protectWebpackAssets?this.currentAssets:[]});if(this.verbose){n.forEach((e=>{const t=o.relative(process.cwd(),e);const n="removed";console.warn(`clean-webpack-plugin: ${n} ${t}`)}))}}catch(e){const t=/Cannot delete files\/folders outside the current working directory\./.test(e.message);if(t){const e="clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.";throw new Error(e)}throw e}}}const ke=t=>new je({verbose:true,cleanOnceBeforeBuildPatterns:[`${o.join(e.ensureSlash(t[0],true),"**/*")}`]});const Ce=(e,t)=>new P["default"]({filename:`[name]/${ue("css",e,t==null?void 0:t.enableBundleHashName)}`,chunkFilename:"[id].[contenthash].css"});const Oe="ExternalTemplateRemotesPlugin";const xe=e=>e.constructor.name==="ExternalModule";class Me{apply(e){e.hooks.make.tap(Oe,(e=>{const t=[];e.hooks.buildModule.tap(Oe,(e=>{if(xe(e)&&e.externalType==="script"){t.push(e)}}));e.hooks.afterCodeGeneration.tap(Oe,(()=>{t.map((t=>{const n=A["default"](t.request)[0];const r=Pe(n);const o=e.codeGenerationResults.get(t,undefined).sources;const s=o.get("javascript");if(s){o.set("javascript",new d.RawSource(s.source().toString().replace(`"${n}"`,r)))}}))}))}))}}function Pe(e){const t=[];const n=[];let r=false;let o=false;for(const s of e){if(s==="["){if(r){o=true;break}r=true;if(n.length){t.push(`"${n.join("")}"`);n.length=0}}else if(s==="]"){if(!r){o=true;break}r=false;if(n.length){t.push(`${n.join("")}`);n.length=0}n.length=0}else{n.push(s)}}if(r||o){throw new Error(`Invalid template URL "${e}"`)}if(n.length){t.push(`"${n.join("")}"`)}return t.join(" + ")}const Se=`HtmlInjectScriptPlugin`;class Ae{constructor(e){this.scripts=void 0;this.scripts=e||[]}processScripts(){return this.scripts.filter(Boolean).map((e=>({tagName:"script",innerHTML:e,voidTag:false,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(e){e.hooks.compilation.tap(`${Se}_compilation`,(e=>{const t=E["default"].getHooks(e);t.alterAssetTags.tap(`${Se}_alterAssetTags`,(e=>{e.assetTags.scripts.unshift(...this.processScripts());return e}))}))}}const Ee=(e="")=>e.replace(/[\/-]/gi,"_").toLowerCase();const Be=e=>o.join(e,`micro-remote-module.js`);const Re=(t,[n,r],o)=>{var s;const l=(s=r.options)==null?void 0:s.moduleFederation;const i=[];if(l){const{remotes:r,...s}=l;const c=Be(n);const u=Ee(n);const p=(r||[]).map((({name:t,endpoint:n})=>{const r=Ee(t);const o=Be(t);const s=n?e.ensureSlash(n(t),false):`[window.evolveFetchMicroWidgets()]`;return{[r]:`${r}@${s}/${o}`}}));i.push(new a.container.ModuleFederationPlugin({name:u,filename:c,remotes:p,...s}),new Me);if(!t){i.unshift(new Ae([oe(o)]))}}return i};const $e={minifyJS:true,removeComments:true,collapseWhitespace:true,collapseBooleanAttributes:false};const Te=(e,t,[n,r],o)=>{const s=[];const{options:l}=r;const a=e?"development":"production";for(const e of o){s.push(new E["default"]({inject:"body",title:V("title",a,l==null?void 0:l.title),chunks:[n],minify:(l==null?void 0:l.minify)===false?false:["me","dev"].includes(e)?false:$e,filename:`${n}/index${e==="prod"?"":`-${e}`}.html`,template:V("template",a,l==null?void 0:l.template).replace(`{0}`,e),templateParameters:{title:V("title",a,l==null?void 0:l.title),favicon:V("favicon",a,l==null?void 0:l.favicon),headBeforeStyles:V("headBeforeStyles",a,l==null?void 0:l.headBeforeStyles),headBeforeScripts:V("headBeforeScripts",a,l==null?void 0:l.headBeforeScripts),bodyAfterScripts:V("bodyAfterScripts",a,l==null?void 0:l.bodyAfterScripts),viewport:ae(t,l)?V("viewport",a,l==null?void 0:l.viewport):""},multiCdn:{env:e,disabled:((l==null?void 0:l.excludeCdnEnvs)||["me","dev","ntv"]).includes(e)}}))}return s};class qe{constructor(e){var t;this.config=e;this.pluginName="FlatEvolveMultiCdnPlugin";this.requireFn=a.RuntimeGlobals.publicPath;if(!((t=this.config)!=null&&t.prod)){throw new Error("We must setup `prod` for each CDN config node!")}}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{var r;const o=[];o.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const s=(r=e.chunkGraph)==null?void 0:r.getTreeRuntimeRequirements(n);if(s&&s.has(a.RuntimeGlobals.requireScope)){o.push("(function () {");o.push(a.Template.indent(`var flatjsMultiCdn = {`));o.push(a.Template.indent(a.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`])));o.push(a.Template.indent(a.Template.indent([`cdnFinder: ${ne.toString()}`])));o.push(a.Template.indent(`};`));o.push(a.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig) || ${this.requireFn};`));o.push("})();")}return a.Template.asString(o)}))}));e.hooks.compilation.tap(this.pluginName,(e=>{E["default"].getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t}=e;const{userOptions:n}=e.plugin;const r=n.multiCdn;const s=t.publicPath;const l=t.js.map((e=>{if(r.disabled){return o.basename(e)}const t=re(this.config,r.env);return te(t,e.replace(s,""))}));const a=t.css.map((e=>{if(r.disabled){return o.basename(e)}const t=re(this.config,r.env);return te(t,e.replace(s,""))}));e.assets.js=l;e.assets.css=a;return e}))}))}}const Ie=(e,t,n)=>{const r=[new S["default"]];if(n.analyzer){r.push(new p.BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}))}r.push(Ce(e,n.pluginLoaderOptions));r.push(...Re(e,t,n.multiHtmlCdn));if(!e){r.push(ke(t));const o=Object.keys(n.multiHtmlCdn);r.push(...Te(e,n,t,o));r.push(new qe(n.multiHtmlCdn))}return r};const Fe=(e,t,n,r)=>{const s=e==="development";const l=r.projectCwd;const a=r.pluginLoaderOptions;const i=r.watchOptions;const c=ie(n);const u=[...we(s,r,c,a),...r.extraLoaders||[]];const p=[...Ie(s,c,r),...r.extraPlugins||[]];const d={mode:e,target:r.target,stats:{preset:"minimal"},infrastructureLogging:{level:"warn"},devtool:s?"eval-source-map":false,plugins:p,watchOptions:i,context:l,cache:{type:"memory"},resolve:{mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json",".vue"],alias:r.resolveAlias||{}},module:{rules:u},externals:H(r.externals,c),performance:X(s,r.performance),output:{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:t})=>`webpack:///${o.join(e,t)}`,environment:{},pathinfo:false,path:o.join(l,"public"),publicPath:t,filename:`[name]/${ue("js",s,a==null?void 0:a.enableBundleHashName)}`,chunkFilename:`[id].[contenthash].js`},optimization:{nodeEnv:s?"development":"production",chunkIds:s?"named":"named",moduleIds:s?"named":"named",minimize:r.minimize===false?false:s?false:true,minimizer:[new M["default"](Q(r.minimizeTerserOptions))],splitChunks:{name:false,chunks:"all",minSize:25e5,cacheGroups:{default:false,defaultVendors:false}}}};return d};const _e=(e,t,n)=>{const r=Fe("production",t,e,n);const o=se(e,r);if(o.length>1){throw new Error("startSingleEntryBuild() only support `compiler` at a time")}const s=o[0];return new Promise(((e,t)=>{x["default"](s,((r,o)=>{var l,a;if(r){return t(r)}const i=o==null?void 0:o.toJson();if(i!=null&&(l=i.errors)!=null&&l.length){return t(i.errors)}if(n.forBuild.rejectWarnings&&i!=null&&(a=i.warnings)!=null&&a.length){return t(i.warnings)}e({name:s.name,warningStats:i==null?void 0:i.warnings})}))}))};const De=(t,n)=>{var r;const o=((r=n.multiHtmlCdn)==null?void 0:r.prod)||[];const s=[];const l=e.ensureSlash(o[Math.floor(Math.random()*o.length)],true);for(const[e,r]of Object.entries(t)){const t=le(r,n);const o={[e]:r};s.push(_e(o,l,t))}return Promise.all(s)};var Ne={exports:{}};var We={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Le=We;const ze={};for(const e of Object.keys(Le)){ze[Le[e]]=e}const Ue={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var He=Ue;for(const e of Object.keys(Ue)){if(!("channels"in Ue[e])){throw new Error("missing channels property: "+e)}if(!("labels"in Ue[e])){throw new Error("missing channel labels property: "+e)}if(Ue[e].labels.length!==Ue[e].channels){throw new Error("channel and label counts mismatch: "+e)}const{channels:t,labels:n}=Ue[e];delete Ue[e].channels;delete Ue[e].labels;Object.defineProperty(Ue[e],"channels",{value:t});Object.defineProperty(Ue[e],"labels",{value:n})}Ue.rgb.hsl=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(t,n,r);const s=Math.max(t,n,r);const l=s-o;let a;let i;if(s===o){a=0}else if(t===s){a=(n-r)/l}else if(n===s){a=2+(r-t)/l}else if(r===s){a=4+(t-n)/l}a=Math.min(a*60,360);if(a<0){a+=360}const c=(o+s)/2;if(s===o){i=0}else if(c<=.5){i=l/(s+o)}else{i=l/(2-s-o)}return[a,i*100,c*100]};Ue.rgb.hsv=function(e){let t;let n;let r;let o;let s;const l=e[0]/255;const a=e[1]/255;const i=e[2]/255;const c=Math.max(l,a,i);const u=c-Math.min(l,a,i);const p=function(e){return(c-e)/6/u+1/2};if(u===0){o=0;s=0}else{s=u/c;t=p(l);n=p(a);r=p(i);if(l===c){o=r-n}else if(a===c){o=1/3+t-r}else if(i===c){o=2/3+n-t}if(o<0){o+=1}else if(o>1){o-=1}}return[o*360,s*100,c*100]};Ue.rgb.hwb=function(e){const t=e[0];const n=e[1];let r=e[2];const o=Ue.rgb.hsl(e)[0];const s=1/255*Math.min(t,Math.min(n,r));r=1-1/255*Math.max(t,Math.max(n,r));return[o,s*100,r*100]};Ue.rgb.cmyk=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(1-t,1-n,1-r);const s=(1-t-o)/(1-o)||0;const l=(1-n-o)/(1-o)||0;const a=(1-r-o)/(1-o)||0;return[s*100,l*100,a*100,o*100]};function Ge(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Ue.rgb.keyword=function(e){const t=ze[e];if(t){return t}let n=Infinity;let r;for(const t of Object.keys(Le)){const o=Le[t];const s=Ge(e,o);if(s<n){n=s;r=t}}return r};Ue.keyword.rgb=function(e){return Le[e]};Ue.rgb.xyz=function(e){let t=e[0]/255;let n=e[1]/255;let r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124+n*.3576+r*.1805;const s=t*.2126+n*.7152+r*.0722;const l=t*.0193+n*.1192+r*.9505;return[o*100,s*100,l*100]};Ue.rgb.lab=function(e){const t=Ue.rgb.xyz(e);let n=t[0];let r=t[1];let o=t[2];n/=95.047;r/=100;o/=108.883;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;o=o>.008856?o**(1/3):7.787*o+16/116;const s=116*r-16;const l=500*(n-r);const a=200*(r-o);return[s,l,a]};Ue.hsl.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;let o;let s;let l;if(n===0){l=r*255;return[l,l,l]}if(r<.5){o=r*(1+n)}else{o=r+n-r*n}const a=2*r-o;const i=[0,0,0];for(let e=0;e<3;e++){s=t+1/3*-(e-1);if(s<0){s++}if(s>1){s--}if(6*s<1){l=a+(o-a)*6*s}else if(2*s<1){l=o}else if(3*s<2){l=a+(o-a)*(2/3-s)*6}else{l=a}i[e]=l*255}return i};Ue.hsl.hsv=function(e){const t=e[0];let n=e[1]/100;let r=e[2]/100;let o=n;const s=Math.max(r,.01);r*=2;n*=r<=1?r:2-r;o*=s<=1?s:2-s;const l=(r+n)/2;const a=r===0?2*o/(s+o):2*n/(r+n);return[t,a*100,l*100]};Ue.hsv.rgb=function(e){const t=e[0]/60;const n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6;const s=t-Math.floor(t);const l=255*r*(1-n);const a=255*r*(1-n*s);const i=255*r*(1-n*(1-s));r*=255;switch(o){case 0:return[r,i,l];case 1:return[a,r,l];case 2:return[l,r,i];case 3:return[l,a,r];case 4:return[i,l,r];case 5:return[r,l,a]}};Ue.hsv.hsl=function(e){const t=e[0];const n=e[1]/100;const r=e[2]/100;const o=Math.max(r,.01);let s;let l;l=(2-n)*r;const a=(2-n)*o;s=n*o;s/=a<=1?a:2-a;s=s||0;l/=2;return[t,s*100,l*100]};Ue.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100;let r=e[2]/100;const o=n+r;let s;if(o>1){n/=o;r/=o}const l=Math.floor(6*t);const a=1-r;s=6*t-l;if((l&1)!==0){s=1-s}const i=n+s*(a-n);let c;let u;let p;switch(l){default:case 6:case 0:c=a;u=i;p=n;break;case 1:c=i;u=a;p=n;break;case 2:c=n;u=a;p=i;break;case 3:c=n;u=i;p=a;break;case 4:c=i;u=n;p=a;break;case 5:c=a;u=n;p=i;break}return[c*255,u*255,p*255]};Ue.cmyk.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;const o=e[3]/100;const s=1-Math.min(1,t*(1-o)+o);const l=1-Math.min(1,n*(1-o)+o);const a=1-Math.min(1,r*(1-o)+o);return[s*255,l*255,a*255]};Ue.xyz.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;let o;let s;let l;o=t*3.2406+n*-1.5372+r*-.4986;s=t*-.9689+n*1.8758+r*.0415;l=t*.0557+n*-.204+r*1.057;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92;o=Math.min(Math.max(0,o),1);s=Math.min(Math.max(0,s),1);l=Math.min(Math.max(0,l),1);return[o*255,s*255,l*255]};Ue.xyz.lab=function(e){let t=e[0];let n=e[1];let r=e[2];t/=95.047;n/=100;r/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;const o=116*n-16;const s=500*(t-n);const l=200*(n-r);return[o,s,l]};Ue.lab.xyz=function(e){const t=e[0];const n=e[1];const r=e[2];let o;let s;let l;s=(t+16)/116;o=n/500+s;l=s-r/200;const a=s**3;const i=o**3;const c=l**3;s=a>.008856?a:(s-16/116)/7.787;o=i>.008856?i:(o-16/116)/7.787;l=c>.008856?c:(l-16/116)/7.787;o*=95.047;s*=100;l*=108.883;return[o,s,l]};Ue.lab.lch=function(e){const t=e[0];const n=e[1];const r=e[2];let o;const s=Math.atan2(r,n);o=s*360/2/Math.PI;if(o<0){o+=360}const l=Math.sqrt(n*n+r*r);return[t,l,o]};Ue.lch.lab=function(e){const t=e[0];const n=e[1];const r=e[2];const o=r/360*2*Math.PI;const s=n*Math.cos(o);const l=n*Math.sin(o);return[t,s,l]};Ue.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let s=t===null?Ue.rgb.hsv(e)[2]:t;s=Math.round(s/50);if(s===0){return 30}let l=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));if(s===2){l+=60}return l};Ue.hsv.ansi16=function(e){return Ue.rgb.ansi16(Ue.hsv.rgb(e),e[2])};Ue.rgb.ansi256=function(e){const t=e[0];const n=e[1];const r=e[2];if(t===n&&n===r){if(t<8){return 16}if(t>248){return 231}return Math.round((t-8)/247*24)+232}const o=16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5);return o};Ue.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50){t+=3.5}t=t/10.5*255;return[t,t,t]}const n=(~~(e>50)+1)*.5;const r=(t&1)*n*255;const o=(t>>1&1)*n*255;const s=(t>>2&1)*n*255;return[r,o,s]};Ue.ansi256.rgb=function(e){if(e>=232){const t=(e-232)*10+8;return[t,t,t]}e-=16;let t;const n=Math.floor(e/36)/5*255;const r=Math.floor((t=e%36)/6)/5*255;const o=t%6/5*255;return[n,r,o]};Ue.rgb.hex=function(e){const t=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255);const n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};Ue.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t){return[0,0,0]}let n=t[0];if(t[0].length===3){n=n.split("").map((e=>e+e)).join("")}const r=parseInt(n,16);const o=r>>16&255;const s=r>>8&255;const l=r&255;return[o,s,l]};Ue.rgb.hcg=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.max(Math.max(t,n),r);const s=Math.min(Math.min(t,n),r);const l=o-s;let a;let i;if(l<1){a=s/(1-l)}else{a=0}if(l<=0){i=0}else if(o===t){i=(n-r)/l%6}else if(o===n){i=2+(r-t)/l}else{i=4+(t-n)/l}i/=6;i%=1;return[i*360,l*100,a*100]};Ue.hsl.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=n<.5?2*t*n:2*t*(1-n);let o=0;if(r<1){o=(n-.5*r)/(1-r)}return[e[0],r*100,o*100]};Ue.hsv.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=t*n;let o=0;if(r<1){o=(n-r)/(1-r)}return[e[0],r*100,o*100]};Ue.hcg.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;if(n===0){return[r*255,r*255,r*255]}const o=[0,0,0];const s=t%1*6;const l=s%1;const a=1-l;let i=0;switch(Math.floor(s)){case 0:o[0]=1;o[1]=l;o[2]=0;break;case 1:o[0]=a;o[1]=1;o[2]=0;break;case 2:o[0]=0;o[1]=1;o[2]=l;break;case 3:o[0]=0;o[1]=a;o[2]=1;break;case 4:o[0]=l;o[1]=0;o[2]=1;break;default:o[0]=1;o[1]=0;o[2]=a}i=(1-n)*r;return[(n*o[0]+i)*255,(n*o[1]+i)*255,(n*o[2]+i)*255]};Ue.hcg.hsv=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);let o=0;if(r>0){o=t/r}return[e[0],o*100,r*100]};Ue.hcg.hsl=function(e){const t=e[1]/100;const n=e[2]/100;const r=n*(1-t)+.5*t;let o=0;if(r>0&&r<.5){o=t/(2*r)}else if(r>=.5&&r<1){o=t/(2*(1-r))}return[e[0],o*100,r*100]};Ue.hcg.hwb=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};Ue.hwb.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=1-n;const o=r-t;let s=0;if(o<1){s=(r-o)/(1-o)}return[e[0],o*100,s*100]};Ue.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Ue.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Ue.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Ue.gray.hsl=function(e){return[0,0,e[0]]};Ue.gray.hsv=Ue.gray.hsl;Ue.gray.hwb=function(e){return[0,100,e[0]]};Ue.gray.cmyk=function(e){return[0,0,0,e[0]]};Ue.gray.lab=function(e){return[e[0],0,0]};Ue.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255;const n=(t<<16)+(t<<8)+t;const r=n.toString(16).toUpperCase();return"000000".substring(r.length)+r};Ue.rgb.gray=function(e){const t=(e[0]+e[1]+e[2])/3;return[t/255*100]};const Je=He;function Ve(){const e={};const t=Object.keys(Je);for(let n=t.length,r=0;r<n;r++){e[t[r]]={distance:-1,parent:null}}return e}function Ye(e){const t=Ve();const n=[e];t[e].distance=0;while(n.length){const e=n.pop();const r=Object.keys(Je[e]);for(let o=r.length,s=0;s<o;s++){const o=r[s];const l=t[o];if(l.distance===-1){l.distance=t[e].distance+1;l.parent=e;n.unshift(o)}}}return t}function Ke(e,t){return function(n){return t(e(n))}}function Xe(e,t){const n=[t[e].parent,e];let r=Je[t[e].parent][e];let o=t[e].parent;while(t[o].parent){n.unshift(t[o].parent);r=Ke(Je[t[o].parent][o],r);o=t[o].parent}r.conversion=n;return r}var Qe=function(e){const t=Ye(e);const n={};const r=Object.keys(t);for(let e=r.length,o=0;o<e;o++){const e=r[o];const s=t[e];if(s.parent===null){continue}n[e]=Xe(e,t)}return n};const Ze=He;const et=Qe;const tt={};const nt=Object.keys(Ze);function rt(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}return e(t)};if("conversion"in e){t.conversion=e.conversion}return t}function ot(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}const r=e(t);if(typeof r==="object"){for(let e=r.length,t=0;t<e;t++){r[t]=Math.round(r[t])}}return r};if("conversion"in e){t.conversion=e.conversion}return t}nt.forEach((e=>{tt[e]={};Object.defineProperty(tt[e],"channels",{value:Ze[e].channels});Object.defineProperty(tt[e],"labels",{value:Ze[e].labels});const t=et(e);const n=Object.keys(t);n.forEach((n=>{const r=t[n];tt[e][n]=ot(r);tt[e][n].raw=rt(r)}))}));var st=tt;(function(e){const t=(e,t)=>(...n)=>{const r=e(...n);return`[${r+t}m`};const n=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};5;${r}m`};const r=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};2;${r[0]};${r[1]};${r[2]}m`};const o=e=>e;const s=(e,t,n)=>[e,t,n];const l=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{const r=n();Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true});return r},enumerable:true,configurable:true})};let a;const i=(e,t,n,r)=>{if(a===undefined){a=st}const o=r?10:0;const s={};for(const[r,l]of Object.entries(a)){const a=r==="ansi16"?"ansi":r;if(r===t){s[a]=e(n,o)}else if(typeof l==="object"){s[a]=e(l[t],o)}}return s};function c(){const e=new Map;const a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};a.color.gray=a.color.blackBright;a.bgColor.bgGray=a.bgColor.bgBlackBright;a.color.grey=a.color.blackBright;a.bgColor.bgGrey=a.bgColor.bgBlackBright;for(const[t,n]of Object.entries(a)){for(const[t,r]of Object.entries(n)){a[t]={open:`[${r[0]}m`,close:`[${r[1]}m`};n[t]=a[t];e.set(r[0],r[1])}Object.defineProperty(a,t,{value:n,enumerable:false})}Object.defineProperty(a,"codes",{value:e,enumerable:false});a.color.close="";a.bgColor.close="";l(a.color,"ansi",(()=>i(t,"ansi16",o,false)));l(a.color,"ansi256",(()=>i(n,"ansi256",o,false)));l(a.color,"ansi16m",(()=>i(r,"rgb",s,false)));l(a.bgColor,"ansi",(()=>i(t,"ansi16",o,true)));l(a.bgColor,"ansi256",(()=>i(n,"ansi256",o,true)));l(a.bgColor,"ansi16m",(()=>i(r,"rgb",s,true)));return a}Object.defineProperty(e,"exports",{enumerable:true,get:c})})(Ne);var lt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--";const r=t.indexOf(n+e);const o=t.indexOf("--");return r!==-1&&(o===-1||r<o)};const at=B["default"];const it=R["default"];const ct=lt;const{env:ut}=process;let pt;if(ct("no-color")||ct("no-colors")||ct("color=false")||ct("color=never")){pt=0}else if(ct("color")||ct("colors")||ct("color=true")||ct("color=always")){pt=1}if("FORCE_COLOR"in ut){if(ut.FORCE_COLOR==="true"){pt=1}else if(ut.FORCE_COLOR==="false"){pt=0}else{pt=ut.FORCE_COLOR.length===0?1:Math.min(parseInt(ut.FORCE_COLOR,10),3)}}function dt(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function ft(e,t){if(pt===0){return 0}if(ct("color=16m")||ct("color=full")||ct("color=truecolor")){return 3}if(ct("color=256")){return 2}if(e&&!t&&pt===undefined){return 0}const n=pt||0;if(ut.TERM==="dumb"){return n}if(process.platform==="win32"){const e=at.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in ut){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in ut))||ut.CI_NAME==="codeship"){return 1}return n}if("TEAMCITY_VERSION"in ut){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ut.TEAMCITY_VERSION)?1:0}if(ut.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in ut){const e=parseInt((ut.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ut.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(ut.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ut.TERM)){return 1}if("COLORTERM"in ut){return 1}return n}function ht(e){const t=ft(e,e&&e.isTTY);return dt(t)}var mt={supportsColor:ht,stdout:dt(ft(true,it.isatty(1))),stderr:dt(ft(true,it.isatty(2)))};const gt=(e,t,n)=>{let r=e.indexOf(t);if(r===-1){return e}const o=t.length;let s=0;let l="";do{l+=e.substr(s,r-s)+t+n;s=r+o;r=e.indexOf(t,s)}while(r!==-1);l+=e.substr(s);return l};const bt=(e,t,n,r)=>{let o=0;let s="";do{const l=e[r-1]==="\r";s+=e.substr(o,(l?r-1:r)-o)+t+(l?"\r\n":"\n")+n;o=r+1;r=e.indexOf("\n",o)}while(r!==-1);s+=e.substr(o);return s};var vt={stringReplaceAll:gt,stringEncaseCRLFWithFirstIndex:bt};const yt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const wt=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const jt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const kt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;const Ct=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function Ot(e){const t=e[0]==="u";const n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3){return String.fromCharCode(parseInt(e.slice(1),16))}if(t&&n){return String.fromCodePoint(parseInt(e.slice(2,-1),16))}return Ct.get(e)||e}function xt(e,t){const n=[];const r=t.trim().split(/\s*,\s*/g);let o;for(const t of r){const r=Number(t);if(!Number.isNaN(r)){n.push(r)}else if(o=t.match(jt)){n.push(o[2].replace(kt,((e,t,n)=>t?Ot(t):n)))}else{throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`)}}return n}function Mt(e){wt.lastIndex=0;const t=[];let n;while((n=wt.exec(e))!==null){const e=n[1];if(n[2]){const r=xt(e,n[2]);t.push([e].concat(r))}else{t.push([e])}}return t}function Pt(e,t){const n={};for(const e of t){for(const t of e.styles){n[t[0]]=e.inverse?null:t.slice(1)}}let r=e;for(const[e,t]of Object.entries(n)){if(!Array.isArray(t)){continue}if(!(e in r)){throw new Error(`Unknown Chalk style: ${e}`)}r=t.length>0?r[e](...t):r[e]}return r}var St=(e,t)=>{const n=[];const r=[];let o=[];t.replace(yt,((t,s,l,a,i,c)=>{if(s){o.push(Ot(s))}else if(a){const t=o.join("");o=[];r.push(n.length===0?t:Pt(e,n)(t));n.push({inverse:l,styles:Mt(a)})}else if(i){if(n.length===0){throw new Error("Found extraneous } in Chalk template literal")}r.push(Pt(e,n)(o.join("")));o=[];n.pop()}else{o.push(c)}}));r.push(o.join(""));if(n.length>0){const e=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw new Error(e)}return r.join("")};const At=Ne.exports;const{stdout:Et,stderr:Bt}=mt;const{stringReplaceAll:Rt,stringEncaseCRLFWithFirstIndex:$t}=vt;const{isArray:Tt}=Array;const qt=["ansi","ansi","ansi256","ansi16m"];const It=Object.create(null);const Ft=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const n=Et?Et.level:0;e.level=t.level===undefined?n:t.level};class _t{constructor(e){return Dt(e)}}const Dt=e=>{const t={};Ft(t,e);t.template=(...e)=>Jt(t.template,...e);Object.setPrototypeOf(t,Nt.prototype);Object.setPrototypeOf(t.template,t);t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};t.template.Instance=_t;return t.template};function Nt(e){return Dt(e)}for(const[e,t]of Object.entries(At)){It[e]={get(){const n=Ut(this,zt(t.open,t.close,this._styler),this._isEmpty);Object.defineProperty(this,e,{value:n});return n}}}It.visible={get(){const e=Ut(this,this._styler,true);Object.defineProperty(this,"visible",{value:e});return e}};const Wt=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of Wt){It[e]={get(){const{level:t}=this;return function(...n){const r=zt(At.color[qt[t]][e](...n),At.color.close,this._styler);return Ut(this,r,this._isEmpty)}}}}for(const e of Wt){const t="bg"+e[0].toUpperCase()+e.slice(1);It[t]={get(){const{level:t}=this;return function(...n){const r=zt(At.bgColor[qt[t]][e](...n),At.bgColor.close,this._styler);return Ut(this,r,this._isEmpty)}}}}const Lt=Object.defineProperties((()=>{}),{...It,level:{enumerable:true,get(){return this._generator.level},set(e){this._generator.level=e}}});const zt=(e,t,n)=>{let r;let o;if(n===undefined){r=e;o=t}else{r=n.openAll+e;o=t+n.closeAll}return{open:e,close:t,openAll:r,closeAll:o,parent:n}};const Ut=(e,t,n)=>{const r=(...e)=>{if(Tt(e[0])&&Tt(e[0].raw)){return Ht(r,Jt(r,...e))}return Ht(r,e.length===1?""+e[0]:e.join(" "))};Object.setPrototypeOf(r,Lt);r._generator=e;r._styler=t;r._isEmpty=n;return r};const Ht=(e,t)=>{if(e.level<=0||!t){return e._isEmpty?"":t}let n=e._styler;if(n===undefined){return t}const{openAll:r,closeAll:o}=n;if(t.indexOf("")!==-1){while(n!==undefined){t=Rt(t,n.close,n.open);n=n.parent}}const s=t.indexOf("\n");if(s!==-1){t=$t(t,o,r,s)}return r+t+o};let Gt;const Jt=(e,...t)=>{const[n]=t;if(!Tt(n)||!Tt(n.raw)){return t.join(" ")}const r=t.slice(1);const o=[n.raw[0]];for(let e=1;e<n.length;e++){o.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[e]))}if(Gt===undefined){Gt=St}return Gt(e,o.join(""))};Object.defineProperties(Nt.prototype,It);const Vt=Nt();Vt.supportsColor=Et;Vt.stderr=Nt({level:Bt?Bt.level:0});Vt.stderr.supportsColor=Bt;var Yt=Vt;const Kt=async(n,r,s)=>{const l=await e.getPackageDir(__dirname,process.cwd());const a=w.readFileSync(o.join(l,"./templates/main.html"),"utf-8");const i=[];for(const[t]of Object.entries(s.entryMap)){const o=Object.keys(n).includes(t);i.push({name:t,link:e.urlJoin(r,["pages",t],{env:"me"}),flagText:o?"serve":"static",isServed:o?1:0})}const c={title:"@flatjs/evolve",modules:i.sort(((e,t)=>t.isServed-e.isServed))};return t.template(a)(c)};const Xt=async(n,r,s,l,a)=>{const i=a.entryMap;const c=Object.keys(i).sort(((e,t)=>t.length-e.length));const u=await e.getPackageDir(__dirname,process.cwd());const p=c.find((t=>e.ensureSlash(s.path.replace(/^\//,""),true).startsWith(e.ensureSlash(t,true))));if(!p){const e=w.readFileSync(o.join(u,`./templates/module-404.html`),"utf-8");return t.template(e)({title:"404 Not Found",errorMeta:[{name:`@flatjs/evolve workspace`,value:u},{name:`served entry names`,value:JSON.stringify(c)},{name:`module path`,value:`${s.path}`}]})}const d=i[p];const f=d.options;const h=n[p];const m=(h==null?void 0:h.devServerHostUri)||l;const g=(f==null?void 0:f.serveModuleTemplate)||"./templates/module.html";const b=o.join(a.projectCwd,"./templates/module.html");const v=w.readFileSync(o.isAbsolute(g)?g:e.existsSync(b)?b:o.join(u,"./templates/module.html"),"utf-8");const y=a.forServe;const j=y.defaultServeGlobalData?y.defaultServeGlobalData(d,l):{};const k={title:V("title",r,f==null?void 0:f.title),favicon:V("favicon",r,f==null?void 0:f.favicon),viewport:ae(a,f)?V("viewport",r,f==null?void 0:f.viewport):"",headBeforeStyles:V("headBeforeStyles",r,f==null?void 0:f.headBeforeStyles),headBeforeScripts:V("headBeforeScripts",r,f==null?void 0:f.headBeforeScripts),bodyAfterScripts:V("bodyAfterScripts",r,f==null?void 0:f.bodyAfterScripts),moduleFederationScripts:oe({me:[e.urlJoin(l,["public"])]}),global:{hostUrl:l,apiBase:e.urlJoin(l,["api"]),routeBaseName:o.join(`/pages`,p),...j,...(f==null?void 0:f.serveGlobalData)||{}},styles:[e.urlJoin(m,[o.join("public",p,"bundle.css")])],scripts:[e.urlJoin(m,[o.join("public",p,"bundle.js")])]};return t.template(v)(k)};const Qt=(e,t,n,r)=>{const o=async(o,s)=>{let l;if(o.path==="/"){l=await Kt(n,t,r)}else{l=await Xt(n,e,o,t,r)}s.send(l)};return(r.forServe.pageMiddlewares||[]).concat(o)};const Zt=t=>async(n,r)=>{const s=n.baseUrl;if(!s.startsWith("/public")){r.redirect("/pages")}else{const n=await e.fileWalk(o.join("public/","**/*.{js,css}"),{cwd:t});const l=o.extname(s);const a=n.find((e=>o.extname(e)===l&&e.indexOf(s.replace(/\.(js|css)$/,""))!==-1));if(a){r.sendFile(a)}else{r.sendFile(o.join(t,s))}}};const en=(e,t="development",r,o,s,l,a)=>{const i=T["default"]();n.attachMockMiddlewares(i,a);i.set("hostUri",o);i.use("/pages",...Qt(t,o,s,l));i.use("*",Zt(e));return new Promise((e=>{const t=l.https?q["default"].createServer(l.https,i):i;t.listen(r,(()=>{e(true)}))}))};const tn=(e,t,n)=>{const{projectCwd:r,https:s,liveReload:l}=n;const a=new $["default"]({https:s,open:false,compress:true,port:t,hot:!l,liveReload:l,allowedHosts:"all",static:{directory:`${o.join(r,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{overlay:{errors:true,warnings:false}}},e);return new Promise(((e,t)=>{a.startCallback((n=>{if(n){return t(n)}e(true)}))}))};const nn=async(r,s,l,i)=>{if(l.https){i.https=l.https}const{mockPort:c,hostUri:u}=await n.prepareMockDomain(i);const p=e.urlJoin(u,["/pages"]);let d=c;const f=[];const h={};for(const[e]of Object.entries(s)){d=d+1;const{mockPort:r,hostUri:o}=await n.prepareMockDomain(t.merge({},i,{port:d}));h[e]={devServerPort:r,devServerHostUri:o}}for(const[t,n]of Object.entries(s)){var m,g;const s=((m=n.options)==null?void 0:(g=m.moduleFederation)==null?void 0:g.remotes)||[];s.forEach((t=>{t.endpoint=t=>{var n;return e.urlJoin(((n=h[t])==null?void 0:n.devServerHostUri)||u,["/public"])}}));const{devServerPort:i,devServerHostUri:c}=h[t];const d=e.urlJoin(c,["public"]);const b={[t]:n};const v=le(n,l);const y=Fe("development",d,b,v);const w=a.webpack(se(b,y)[0]);f.push(tn(w,i,l));const j=Yt.bgBlack(`[${Yt.magenta("@flatjs")}:${Yt.bold(w.name||"")}]`);w.hooks.invalid.tap("fileChange",(e=>{console.log(j,`${"file change".padEnd(12," ")} ➩ ${Yt.cyan(o.relative(r,e||""))}`)}));w.hooks.done.tap("compileDone",(()=>{console.log(j,`${"serve page".padEnd(12," ")} ➩ ${Yt.cyan(p)}`)}))}await en(r,"development",c,u,h,l,i);ee(p);return Promise.all(f).then((()=>true)).catch((e=>{console.log("evolve serve err: ",e);return false}))};const rn=async(t,r,o)=>{if(r.https){o.https=r.https}const{mockPort:s,hostUri:l}=await n.prepareMockDomain(o);const a=e.urlJoin(l,["/pages"]);return en(t,"development",s,l,{},r,o).then((e=>{const t=Yt.bgBlack(`[${Yt.magenta("@flatjs")}:`);console.log(t,`${"serve page".padEnd(12," ")} ➩ ${Yt.cyan(a)}`);return e}))};const on=(e={},n={})=>{const r={};for(const[o,s]of Object.entries(n)){const n={options:{}};if(e[o]){r[o]=t.merge({},n,s,e[o])}t.merge(s,n)}return r};const sn=(e,t,n={})=>{const r=Z(e,n);const o=on(t,r.entryMap);return De(o,r)};const ln=(e,t,r={},o={})=>{const s=Z(e,r);const l=n.loadMockConfiguration(e,o);const a=on(t,s.entryMap);return nn(e,a,s,l)};const an=(e,t={},r={})=>{const o=Z(e,t);const s=n.loadMockConfiguration(e,r);return rn(e,o,s)};exports.cdnBoot=z;exports.cdnJsDelivr=L;exports.cdnUnpkg=W;exports.createPageMiddleware=Qt;exports.createPublicAssetsMiddleware=Zt;exports.defaultFlatjsConfig=U;exports.evolveBuild=sn;exports.evolveServe=ln;exports.evolveStatic=an;exports.flatBabelOptions=D;exports.flatExternalOptions=H;exports.flatLessLoaderOptions=Y;exports.flatPerformanceOptions=X;exports.flatPostcssLoaderOptions=K;exports.getHtmlPluginConfig=V;exports.loadEvolveConfiguration=Z;exports.loadModule=_;exports.normalizeEntries=on;exports.polyfill=N;exports.terserOptions=Q;exports.viewportScripts=G;
package/index.d.ts CHANGED
@@ -349,6 +349,12 @@ export interface FlatEvolveOptions extends Partial<Pick<Configuration, "performa
349
349
  * ```
350
350
  */
351
351
  externals?: Record<string, string>;
352
+ /**
353
+ * Indicates current we use `hot` or `liveReload` mode for `webpack-dev-server`
354
+ * Note: for module `ModuleFederation` it seems that `webpack-dev-server` has issue here.
355
+ * @default true
356
+ */
357
+ liveReload?: boolean;
352
358
  /**
353
359
  * Environment to build for. An array of environments to build for all of them when possible.
354
360
  */
@@ -567,16 +573,28 @@ export declare const loadEvolveConfiguration: (projectCwd: string | undefined, o
567
573
  * @param refresh
568
574
  */
569
575
  export declare const loadModule: <T>(moduleId: string, refresh?: boolean) => T;
576
+ export declare type EvolveDevServerEntryMap = {
577
+ [entryName: string]: {
578
+ /**
579
+ * dev server port number
580
+ */
581
+ devServerPort: number;
582
+ /**
583
+ * dev server host uri.
584
+ */
585
+ devServerHostUri: string;
586
+ };
587
+ };
570
588
  /**
571
589
  * A middleware to proxy the page modules template.
572
590
  * @example `http://dev.flatjs.com:3001/pages`
573
591
  * @param mode The mode of this dev server instance.
574
592
  * @param hostUri The main host base url.
575
- * @param servedEntries The served webpack entries
593
+ * @param servedDevServerEntries The served webpack entries
576
594
  * @param forPageMiddlewares Allow us provider customized middlewares for `page`, `modules`
577
595
  * @param options The evolve config options
578
596
  */
579
- export declare const createPageMiddleware: (mode: "development" | "production", hostUri: string, servedEntries: EvolveEntryMap, options: FlatEvolveOptions) => MockRequestHandler[];
597
+ export declare const createPageMiddleware: (mode: "development" | "production", hostUri: string, servedDevServerEntries: EvolveDevServerEntryMap, options: FlatEvolveOptions) => MockRequestHandler[];
580
598
  export declare const createPublicAssetsMiddleware: (projectCwd: string) => MockRequestHandler;
581
599
 
582
600
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.2.64",
3
+ "version": "1.2.71",
4
4
  "description": "the webpack based tools `evolve` of @flatjs",
5
5
  "sideEffects": false,
6
6
  "main": "index.js",
@@ -25,39 +25,40 @@
25
25
  "node": ">=13.8.0"
26
26
  },
27
27
  "dependencies": {
28
- "@babel/core": "^7.15.0",
29
- "@flatjs/common": "^1.2.60",
30
- "@flatjs/evolve-preset-babel": "^1.2.60",
31
- "@flatjs/forge-plugin-postcss-pixel": "^1.2.81",
32
- "@flatjs/mock": "^1.2.64",
28
+ "@babel/core": "^7.15.5",
29
+ "@flatjs/common": "^1.2.71",
30
+ "@flatjs/evolve-preset-babel": "^1.2.71",
31
+ "@flatjs/forge-plugin-postcss-pixel": "^1.2.93",
32
+ "@flatjs/mock": "^1.2.71",
33
33
  "babel-loader": "^8.2.2",
34
34
  "babel-merge": "^3.0.0",
35
35
  "babel-plugin-import": "^1.13.3",
36
36
  "better-opn": "^3.0.0",
37
37
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
38
- "css-loader": "^6.2.0",
38
+ "css-loader": "^6.3.0",
39
39
  "cssnano": "^5.0.8",
40
40
  "cssnano-preset-default": "^5.1.4",
41
41
  "html-webpack-plugin": "^5.3.2",
42
42
  "less": "^4.1.1",
43
43
  "less-loader": "^10.0.1",
44
44
  "lodash": "^4.17.21",
45
- "mini-css-extract-plugin": "^2.2.0",
46
- "postcss": "^8.3.6",
45
+ "mini-css-extract-plugin": "^2.3.0",
46
+ "postcss": "^8.3.8",
47
47
  "postcss-loader": "^6.1.1",
48
- "svgo": "^2.4.0",
49
- "terser-webpack-plugin": "^5.1.4",
50
- "webpack": "^5.50.0",
48
+ "svgo": "^2.7.0",
49
+ "terser-webpack-plugin": "^5.2.4",
50
+ "webpack": "^5.54.0",
51
51
  "webpack-bundle-analyzer": "^4.4.2",
52
- "webpack-dev-server": "^4.0.0",
53
- "webpack-sources": "^3.2.0"
52
+ "webpack-dev-server": "4.3.0",
53
+ "webpack-sources": "^3.2.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/cssnano": "^4.0.1",
57
- "@types/lodash": "^4.14.172"
57
+ "@types/lodash": "^4.14.174",
58
+ "express": "^4.17.1"
58
59
  },
59
60
  "publishConfig": {
60
61
  "access": "public"
61
62
  },
62
- "gitHead": "1ae8d9bd01bbcbaf77f0ab4a90fed5fe902e0be0"
63
+ "gitHead": "5e027a7716c6c63db0c86967805cafdb27ef3983"
63
64
  }
@@ -1,2 +0,0 @@
1
- /*! @flatjs/forge MIT https://github.com/flatjs */
2
- "use strict";console.log("evolve-empty-entry");